function SQLQuery(strSQL,strReturnFunc) {
	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}

	var url="../_ajax/runquery.php";  //will ../ work here?
	url=url+"?q="+strSQL + "&seq=" + Math.random();
	xmlHttp.onreadystatechange= function() {
		var results="";
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
			if (xmlHttp.responseText != "") {
				results = json_parse(xmlHttp.responseText);
			}
			//then call return tag
			eval(strReturnFunc + "(results,'')");
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
 
}

function SQLQuery2(strSQL,strReturnFunc) {
	xmlHttp2=GetXmlHttpObject();

	if (xmlHttp2==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}

	var url="../_ajax/runquery.php";  //will ../ work here?
	url=url+"?q="+strSQL + "&seq=" + Math.random();
	xmlHttp2.onreadystatechange= function() {
		var results="";
		if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete") { 
			if (xmlHttp2.responseText != "") {
				results = json_parse(xmlHttp2.responseText);
			}
			//then call return tag
			eval(strReturnFunc + "(results,'')");
		}
	}
	xmlHttp2.open("GET",url,true);
	xmlHttp2.send(null);
 
}
function SQLQuery3(strSQL,strReturnFunc) {
	xmlHttp3=GetXmlHttpObject();

	if (xmlHttp3==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}

	var url="../../_ajax/runquery.php";  //will ../ work here?
	url=url+"?q="+strSQL + "&seq=" + Math.random();
	xmlHttp3.onreadystatechange= function() {
		var results="";
		if (xmlHttp3.readyState==4 || xmlHttp3.readyState=="complete") { 
			if (xmlHttp3.responseText != "") {
				results = json_parse(xmlHttp3.responseText);
			}
			//then call return tag
			eval(strReturnFunc + "(results,'')");
		}
	}
	xmlHttp3.open("GET",url,true);
	xmlHttp3.send(null);
 
}

//SQLQuerySync -- synchronous query -sbc 4/20/2010
function SQLQuerySync(strSQL) {
alert('Hello, world!');
	xmlHttpSync=GetXmlHttpObject();

	if (xmlHttpSync==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}

	var url="../_ajax/runquery.php";  //will ../ work here?
	url=url+"?q="+strSQL + "&seq=" + Math.random();
	xmlHttpSync.open("GET",url,false);
	xmlHttpSync.send(null);
	return json_parse(xmlHttpSync.responseText);
}

// PHPExec -- call a PHP file from within JS - sbc 1/30/10
function PHPExec(strPHPFile,strReturnFunc) {
	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}

	xmlHttp.onreadystatechange= function() {
		var results="";
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
			//then call return tag
			eval(strReturnFunc + "(xmlHttp.responseText)");
		}
	}
	xmlHttp.open("GET",strPHPFile,true);
	xmlHttp.send(null);
}

function SQLQuery_Debug(strSQL,strReturnFunc) {
	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}

	var url="../_ajax/runquery_debug.php";  //will ../ work here?
	url=url+"?q="+strSQL + "&seq=" + Math.random();
	xmlHttp.onreadystatechange= function() {
		var results="";
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
			if (xmlHttp.responseText != "") {
				results = json_parse(xmlHttp.responseText);
			}
			//then call return tag
			eval(strReturnFunc + "(results,'')");
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

//sbc new for making MSSQL requests 10/9/08
function MSSQLQuery(strSQL,strReturnFunc) {
	
	xmlHttp_ms=GetXmlHttpObject();

	if (xmlHttp_ms==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="../_ajax/runqueryMSSQL.php";  //will ../ work here?
	url=url+"?q="+strSQL + "&seq=" + Math.random();

	xmlHttp_ms.open("GET",url,true);

	xmlHttp_ms.onreadystatechange=function() {
		var results_ms="";
		if (xmlHttp_ms.readyState==4 || xmlHttp_ms.readyState=="complete") { 
			if (xmlHttp_ms.responseText != "") {
				//alert(xmlHttp_ms.responseText);
				results_ms = json_parse(xmlHttp_ms.responseText);
			}
			eval(strReturnFunc + "(results_ms,'')");
		}
	}
	xmlHttp_ms.send(null);
	//xmlHttp_ms = null;
}

function MSSQLQuery2(strSQL,strReturnFunc) {
	
	xmlHttp_ms2=GetXmlHttpObject();

	if (xmlHttp_ms2==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="../_ajax/runqueryMSSQL.php";  //will ../ work here?
	url=url+"?q="+strSQL + "&seq=" + Math.random();

	xmlHttp_ms2.open("GET",url,true);

	xmlHttp_ms2.onreadystatechange=function() {
		var results_ms2="";
		if (xmlHttp_ms2.readyState==4 || xmlHttp_ms2.readyState=="complete") { 
			if (xmlHttp_ms2.responseText != "") {
				//alert(xmlHttp_ms2.responseText);
				results_ms2 = json_parse(xmlHttp_ms2.responseText);
			}
			eval(strReturnFunc + "(results_ms2,'')");
		}
	}
	xmlHttp_ms2.send(null);
	//xmlHttp_ms2 = null;
}



function MakeHTTPCall(strHttp,strReturnFunc) {
	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	strHttp = "token.php?seq=" + Math.random() + "&event_id=" + strHttp;
	xmlHttp.onreadystatechange=stateChangedHttp;
	xmlHttp.tag=strReturnFunc + "(xmlHttp.responseText)"; //save the return function name into the .tag property of the xmlHttp object - stateChanged() will then extract and call this!
	xmlHttp.open("GET",strHttp,true);
	xmlHttp.send(null);
 
}

function stateChangedHttp() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		//then call return tag
		eval(String(xmlHttp.tag));
	}
}


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 sendEmail(emailInfo) {
	xmlHttp_em=GetXmlHttpObject();

	if (xmlHttp_em==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}

	//var url="../_ajax/sendemail.php";  //will ../ work here?
	var url=encodeURI("../_ajax/sendemail.php?subject=" + emailInfo[0] + "&to=" + emailInfo[1] + "&from=" + emailInfo[2] + "&msg=" + emailInfo[3]);
	//alert(url);
	xmlHttp_em.onreadystatechange=stateChangedEmail;
	xmlHttp_em.open("GET",url,true);
	xmlHttp_em.send(null);

}
function stateChangedEmail() { 
}