var oSrcObj, xmlHttp;

function doAJAXRequestPOST(sUrl, sParams, stateChanged)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) return;

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("POST", sUrl, true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(sParams);
	return;
}

function doAJAXRequestGET(sUrl, stateChanged)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) return;

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",sUrl+"&sid="+Math.random(),true);
	xmlHttp.send(null);
	return;
}

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 urlencode (str) {
    str = (str+'').toString();
    return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
}

function stateChangedSTD() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		oSrcObj.innerHTML=xmlHttp.responseText;
}
