
function isAjaxable() {
  if (window.XMLHttpRequest) {
		return new XMLHttpRequest() != null
    } else if (window.ActiveXObject) {
		return new ActiveXObject('Msxml2.XMLHTTP') != null || new ActiveXObject('Microsoft.XMLHTTP') != null ;
    }
  }

  
 /*
	all DOM elements on the page that have a name or ID starting with $object_name. will be updated
	for example, if using for a class EMSUser, you would name your elements EMSUser.xxx
*/
	/* loop thru all available properties ob the object we want to update */
	function handleDwrDomAutoUpdate(theObject){	
		if(theObject!=null){
			window[theObject.className]= theObject;
			for (var i in window[theObject.className])
			{				
				updateElements(theObject.className+'.'+i,window[theObject.className][i]);
				
			}
		}
	}
	function handleDwrSpanDomAutoUpdate(theObject){	
		if(theObject!=null){
			window[theObject.className]= theObject;
			for (var i in window[theObject.className])
			{				
				updateElements(theObject.className+'.'+i,window[theObject.className][i], "span");
				
			}
		}
	}
	
	/* find and update DOM elements that match the object we want to update */
	function updateElements(elementName,value, tagName)
	  {	 
	  if(tagName ==null || tagName == ""){
	  	  var x=document.getElementsByName(elementName);		  
		  if(x.length > 0){
				for(var i=0;i<x.length;i++){			
					dwr.util.setValue(x[i], value);
				}
		  }	  
	   }else {
	   	var x=document.getElementsByTagName(tagName);		  
		  if(x.length > 0){
				for(var i=0;i<x.length;i++){	
					if(x[i].getAttribute("name") == elementName) {		
						dwr.util.setValue(x[i], value);
					}
				}
		  }	
	   
	   }
	}
	function updateDisplayComponent(name, value, tagName) {	
		if(tagName ==null || tagName == ""){
			var x = document.getElementsByName(name);
			for(var i=0; i<x.length; i++){			
				x[i].style.display = value;			
			}
		}else{
			var x = document.getElementsByTagName(tagName);
			for(var i=0; i<x.length; i++){			
				if(x[i].getAttribute("name") == name) {
					x[i].style.display = value;			
				}
			}
		}
			
	}

	function showAjaxComponent(){	
		updateDisplayComponent("ajaxComponent", "block", "div")
	}
	function hideAjaxComponent(){
		 updateDisplayComponent("ajaxComponent", "none", "div");
 	}
