
//----------------------------------AJAX CODE BASIC----------------------------
var xmlHttp;

//Create XmlHttp object that will get a response from a server
//Gets the URL to handle and the response handler function
function getServerResponse(strAspxPageUrl, responseHandlerFunction)
{
	xmlHttp=GetXmlHttpObject(responseHandlerFunction);
	xmlHttp.open("GET", strAspxPageUrl , true);
	xmlHttp.send(null);
}

//Create XmlHttp object
function GetXmlHttpObject(responseHandlerFunction)
{ 
	var objXmlHttp=null;
    try 
    {
      // For Internet Explorer.
      var strName="Msxml2.XMLHTTP";
	  if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
	  {
		strName="Microsoft.XMLHTTP";
	  } 
      objXmlHttp = new ActiveXObject(strName);
      objXmlHttp.onreadystatechange=responseHandlerFunction;
    }
    catch(e) 
    {
      try 
      {
        // Gecko-based browsers, Safari, and Opera.
        objXmlHttp = new XMLHttpRequest();
        objXmlHttp.onload=responseHandlerFunction;
		objXmlHttp.onerror=responseHandlerFunction;         
      }
      catch (e) 
      {
        // Browser supports Javascript but not XMLHttpRequest.
        objXmlHttp = false;
      }
    }
    return objXmlHttp;
}
//----------------------------------END AJAX CODE BASIC----------------------------
//------------------------------------- CODE BASIC---------------------------------


var m_strElementId;
//---------------------------------CODE FOR LOADING ASCX'S HTML--------------------
function loadHtml(strElementId, strAspxUrl)
{
	//alert(strAspxUrl);
	m_strElementId = strElementId;
	getServerResponse(strAspxUrl, response_LoadHtml);
}
function response_LoadHtml()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		if (xmlHttp.status==200)
		{
			//alert(xmlHttp.responseText);
			var objElement = document.getElementById(m_strElementId);
			objElement.innerHTML = xmlHttp.responseText;
		}		
	} 
}
//------------------------------END CODE FOR LOADING ASCX'S HTML--------------------

