﻿// JScript File

//Global XMLHTTP Request object
var XmlHttp;
//***************************Comman Function****************************************

//Creating and setting the instance of appropriate XMLHTTP Request object to a “XmlHttp” variable  
function CreateXmlHttp()
{
	
	//Creating object of XMLHTTP in IE
	try
	{
		XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp = null;
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp = new XMLHttpRequest();
	}
}
//Returns the node text value 
function GetInnerText (node)
{
	if(node==null)	
	{
		return "";
	}
	else
	{
		return (node.textContent || node.innerText || node.text) ;
	}
}

function xmlToHtml (ex)
{
                  var newstr;    
                  newstr="<";
                  ex = ex.replace(/&lt;/g, newstr);                  
                  newstr=">";
                  ex =ex.replace(/&gt;/g, newstr);
                  newstr=" ";
                  ex =ex.replace(/&amp;nbsp;/g, newstr);
                  newstr="&";
                  ex =ex.replace(/&amp;/g, newstr);
                  return ex;
}



function loadXMLDoc(fname)
      {
      var xmlDoc;
      // code for IE
      if (window.ActiveXObject)
      {
      xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
      }
      // code for Mozilla, Firefox, Opera, etc.
      else if (document.implementation  && document.implementation.createDocument)
      {
      xmlDoc=document.implementation.createDocument("","",null);
      }
      else
      {
      alert('Your browser cannot handle this script');
      }
      xmlDoc.async=false;
      xmlDoc.load(fname);
      return(xmlDoc);
      }
      
      
      var lblObj;
//var load;
//var OtherObj;
//Gets called when country combo box selection changes
function sendmail(para) 
{
    
    
	
		// URL to get states for a given country
		var requestUrl = "ajaxmail.aspx?" + para ;
		
		CreateXmlHttp();
		
		
		// If browser supports XMLHTTPRequest object
		if(XmlHttp)
		{
			//Setting the event handler for the response
			XmlHttp.onreadystatechange = sendmailResponse;
			
			//Initializes the request object with GET (METHOD of posting), 
			//Request URL and sets the request as asynchronous.
			
			XmlHttp.open("GET", requestUrl,  true);
			
			//Sends the request to server
			XmlHttp.send(null);		
		}
	
}

function sendmailResponse()
{
	   var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
        var ie = ( typeof window.ActiveXObject != 'undefined');
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{	
		    var result = XmlHttp.responseText;
		}
		else
		{

		}
	}
}