function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){
		// Internet Explorer
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
return xmlHttp;
}
function ajaxPostback(objToCall, showAlert, objToWrite){
	var datatosend="";
	var xmlHttp = GetXmlHttpObject();
	if (xmlHttp==null){
		alert ("Your browser does not support some of the functionality of this website!");
		return false;
	} 
	var theform = document.forms[0];
	xmlHttp.open("POST", theform.action, false);//"http://localhost/test.asp", false); //
	var cnt;
	for (cnt=0;cnt<theform.elements.length;cnt++){
		if (theform.elements.item(cnt).getAttribute("type") == "submit" &&
			theform.elements.item(cnt).getAttribute("name") != objToCall.name){
			//do nothing
		}else{
			datatosend = datatosend + escape(theform.elements.item(cnt).getAttribute("name"));
			datatosend = datatosend + "=";
			if (theform.elements.item(cnt).getAttribute("name") == "__EVENTTARGET"){
				datatosend = datatosend + objToCall.name.split("$").join(":");
			}else if (theform.elements.item(cnt).getAttribute("name") == "__VIEWSTATE"){
				datatosend = datatosend + escape(theform.elements.item(cnt).getAttribute("value")).replace(new 
							RegExp('\\+', 'g'), "%2B");// + "&IsCallBack=true";			
			}else if (theform.elements.item(cnt).getAttribute("name") == "__EVENTVALIDATION"){
				datatosend = datatosend + escape(theform.elements.item(cnt).getAttribute("value")).replace(new 
							RegExp('\\+', 'g'), "%2B");// + "&IsCallBack=true";						    
			}else{
				datatosend = datatosend + escape(theform.elements.item(cnt).value);
			}
			datatosend = datatosend + "&";
		}
	}
	//strip the last ampsand	
	datatosend = datatosend.substr(0,datatosend.length-1);
	//set headers
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", datatosend.length);		
	//xmlhttp.setRequestHeader("Connection", "close");
	xmlHttp.send(datatosend);
	if (showAlert){
		alert(xmlHttp.responseText);
		//document.write(xmlHttp.responseText);
	}
	if (objToWrite!=null){
		objToWrite.contentWindow.document.write(xmlHttp.responseText);
	}
	return false;
}
