var xmlHttp;
var working="<img src='images/working.gif' align='center'>";

function GetXmlHttpObject()
{
	var obj=null;
	try
	{
		 // Firefox, Opera 8.0+, Safari
		 obj=new XMLHttpRequest();
	}
	catch (e)
	{
		//Internet Explorer
		try
		{
			obj=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			obj=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return obj;
}

function executerequest(url,param)
{ 
	//alert(param);
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", param.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(param);
}

function stateChanged()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		//alert(xmlHttp.status);
		if(xmlHttp.status==200)
		{
			//alert(xmlHttp.responseText);
			document.getElementById("ajax").innerHTML=xmlHttp.responseText;
		}
		else
		{
			document.getElementById("ajax").innerHTML="Response Satus = " +xmlHttp.status;
		}
	} 
}


function emailexecuterequest(url,param)
{ 
	//alert(param);
	document.getElementById("emailajax").innerHTML=working;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=emailstateChanged;
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", param.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(param);
}

function emailstateChanged()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		//alert(xmlHttp.status);
		if(xmlHttp.status==200)
		{
			//alert(xmlHttp.responseText);
			document.getElementById("emailajax").innerHTML=xmlHttp.responseText;
		}
		else
		{
			document.getElementById("emailajax").innerHTML="Response Satus = " +xmlHttp.status;
		}
	} 
}
