
 

function Ajax()
{
	var myUrl,xmlHttp,strObj;
	this.ajaxRequest = ajaxRequest;

	function ajaxRequest(strParam, strMethod, strUrl, objResponse)
	{
		strObj = objResponse;
		//alert(strParam.length);
		if(strParam.length>0)
		{
			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
				{
					alert("Browser does not support HTTP Request");
					return;
				} 
			else
				{
					xmlHttp.onreadystatechange=stateChanged;
					myUrl = strUrl + strParam;
					if (xmlHttp.readyState == 4) 
					{
						if (xmlHttp.status == 200) 
							{
								alert(httpRequest.responseText);
							} 
						else 
							{
								alert('There was a problem with the request.');
							}
					}
	
						xmlHttp.open(strMethod,myUrl,true);
						xmlHttp.send(null);
						//xmlHttp = null;
				}
				
		
			}else 
				{if(strObj!=""){document.getElementById(strObj).innerHTML="";
				 document.getElementById(strObj).style.border="0px";}}
	}
	
	function stateChanged() 
		{ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
				{ 
					document.getElementById(strObj).innerHTML="";
					document.getElementById(strObj).innerHTML=xmlHttp.responseText;
					//document.getElementById(strObj).style.border="1px solid #A5ACB2";
				} 
			else
				{
				document.getElementById(strObj).innerHTML="<img src='http://www.dalecarnegieindia.com/intranet/index_files/icons/mozilla_blu.gif'>";
				}	 
		}
		
	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;
		}
}	


