var xmlHttp
var obj

// written by Perry
// ajaxFunction Version 2   09/12/2006
// Version 2 of ajaxFunction can take more than 1 argument as queryString with separater "&".
// str is the value passed to the destination page as a querystring variable
// dest is the page which takes str as an argument or querystring
// queryString is the name of the queryString will be used in the dest page
// objName is the div object located in the caller

var ajaxPageFolder = "/includes/ajaxPages/"

function ajaxFunction(queryStringKey, queryStringValue,dest,objName){ 

	obj=objName
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	} 
	
	var KeyArray = queryStringKey.split("&");
	var ValueArray = queryStringValue.split("&");

	var queryString = ""
	
	for (var i=0; i < KeyArray.length ; i++){
		queryString = queryString + KeyArray[i] + "=" + ValueArray[i] + "&"
	}
	
	dest = ajaxPageFolder+dest+"?"+queryString
	
	xmlHttp.onreadystatechange=stateChanged
	xmlHttp.open("GET",dest,true)
	xmlHttp.send(null)
}

function stateChanged() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		document.getElementById(obj).innerHTML=xmlHttp.responseText 
	} 
} 

function GetXmlHttpObject() { 
	var objXMLHttp=null
	if (window.XMLHttpRequest){
		objXMLHttp=new XMLHttpRequest()
	}else if (window.ActiveXObject){
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}