﻿// JScript File
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 DoAjax_SendToFriend(url,obj)
{

    var xmlHttp;
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    
    xmlHttp.onreadystatechange=function stateChanged(){ 
          
            switch(xmlHttp.readyState)
            {
                
               case 0: //  0 The request is not initialized 
                alert("No Connection...");
                 break;
                 
              case 1: // 1 The request has been set up 
                  //document.getElementById(divLoadingID).innerHTML =  strLodingTemp; //"start Connecting...";
                 break;
            
              case 2: // 2 The request has been sent
                  //document.getElementById(divLoadingID).innerHTML = strLodingTemp; //"Connecting...";
                 break;
                 
              case 3: // 3 The request is in process 
                 //document.getElementById(divLoadingID).innerHTML = strLodingTemp; //"Loading...";
                 break;
                 
              case 4: // 4 The request is complete 
                  //document.getElementById(divLoadingID).innerHTML=xmlHttp.responseText;
                 
                    obj.complete(xmlHttp.responseText);
                 
              }
        }
        
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
