function loading(elem) {
	$('Loading').style.display='';
	if(elem != null) {
		elem.style.cursor='wait';
	}
	$('wide').style.cursor='wait';	
}

function stopLoading(elem) {
	$('Loading').style.display='none';
	if(elem != null) {
		elem.style.cursor='';
	}
	$('wide').style.cursor='';	
}

function checkUncheckAll(theElement) {
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  theForm[z].checked = theElement.checked;
	  }
     }
    }

function toggleElements(name) {
   	loading(null);
   	var c=Ext.DomQuery.select('.'+name);
	for (var j = 0; j < c.length; j++) {
		c[j].style.display = (c[j].style.display != 'none' ? 'none' : '' );
	}
   	stopLoading(null);
}

function showElements(name) {
    loading(null);
 	Ext.each(Ext.DomQuery.select('.'+name),
		function(el) {
			Ext.DomHelper.applyStyles(el, 'display:');
		}
	);
    stopLoading(null);
}

function hideElements(name) {
    loading(null);
 	Ext.each(Ext.DomQuery.select('.'+name),
		function(el) {
			Ext.DomHelper.applyStyles(el, 'display:none');
		}
	);
    stopLoading(null);
}