/* 
iReports v1.0
Developed by    : Tekbroker Ventures LLC
Code Ownership  : Tekbroker Ventures LLC 
 * Created Mar 28, 2009 by Derrick Roach
 * Last modified: 03.28.2009
*/

function sendData(url,sScript) {
	var ohttpObj;
	if (window.XMLHttpRequest) {
		ohttpObj=new XMLHttpRequest()
	} else if (window.ActiveXObject) {
	 	//IE code
	 	ohttpObj=new ActiveXObject("Microsoft.XMLHTTP")
	}
	ohttpObj.onreadystatechange=function() { state_Change(ohttpObj,sScript); }
   	ohttpObj.open("GET",url+"&"+Math.random(),true)
   	ohttpObj.send(null)
}

function state_Change(oHttp,sScript) {
    if (oHttp.readyState == 4) {
		result=oHttp.responseText
		if (result.indexOf("ERROR")>0) {
			alert(result);
		} else {
			if (sScript!=null) {
	            eval(sScript+"(\""+escape(result)+"\")");
			}
		}
	}
	oHttp=false;
}

//used for pinging only
function sendPingData(url) {
	var ohttpObj;
	if (window.XMLHttpRequest) {
		ohttpObj=new XMLHttpRequest()
	} else if (window.ActiveXObject) {
	 	//IE code
	 	ohttpObj=new ActiveXObject("Microsoft.XMLHTTP")
	}
	ohttpObj.onreadystatechange=function() { pingstate_Change(ohttpObj); }
   	ohttpObj.open("GET",url+"&"+Math.random(),true)
   	ohttpObj.send(null)
}

function pingstate_Change(oHttp) {
    if (oHttp.readyState == 4) {
		result=oHttp.responseText
		if (result.indexOf("ERROR")>0) {
			alert(result);
		} else {
			document.getElementById('progress').style.display="none";
			document.getElementById('ping_result').innerHTML=result;
			document.getElementById('ping_result').style.display="";
			document.getElementById('bPro').style.display="";
		}
	}
	oHttp=false;
}

