function ajaxRequest(){
 var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
 if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
  for (var i=0; i<activexmodes.length; i++){
   try{
    return new ActiveXObject(activexmodes[i])
   }
   catch(e){
    //suppress error
   }
  }
 }
 else if (window.XMLHttpRequest) // if Mozilla, Safari etc
  return new XMLHttpRequest()
 else
  return false
}


var ezAjax=new ajaxRequest();


////////////////////////////////////////////////
///					GET
////////////////////////////////////////////////
function ajaxGET(actionFile,params,actionElement,waitMsg){
	if(waitMsg!=''){
	document.getElementById(actionElement).innerHTML=waitMsg;	
	}

ezAjax.open("GET", actionFile+"?"+params+'&sid='+parseInt(Math.random()*99999999999999999999), true);
ezAjax.onreadystatechange=function(){
 if (ezAjax.readyState==4){
  if (ezAjax.status==200 || window.location.href.indexOf("http")==-1){
  	if(actionElement!=''){
   document.getElementById(actionElement).innerHTML=ezAjax.responseText
   }
  }
  else{
   alert("An error has occured making the request")
  }
 }
}
ezAjax.send(null)
}




////////////////////////////////////////////////
///					POST
////////////////////////////////////////////////
function ajaxPOST(actionFile,params,actionElement,waitMsg){
	
	if(waitMsg!=''){
	document.getElementById(actionElement).innerHTML=waitMsg;	
	}
	

var parameters=params
ezAjax.open("POST", actionFile, true)
ezAjax.onreadystatechange=function(){
 if (ezAjax.readyState==4){
  if (ezAjax.status==200 || window.location.href.indexOf("http")==-1){
   document.getElementById(actionElement).innerHTML=ezAjax.responseText
  }
  else{
   alert("An error has occured making the request")
  }
 }
}
ezAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
ezAjax.send(parameters)
}






