﻿// JScript File
//Common Function
var xmlHttp;
function GethttpObject()
{

//    var objxmlHttp=new ActiveXObject('Microsoft.XMLHttp');
//    return objxmlHttp;
var objxmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  objxmlHttp=new XMLHttpRequest();
  return objxmlHttp
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    objxmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    return objxmlHttp
    }
  catch (e)
    {
    try
      {
      objxmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      return objxmlHttp
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }

    
}
//end

//Retrive data through AJAX
function getResponse(url,fname)
{
    xmlHttp=GethttpObject();    
    xmlHttp.open("GET",url,true);
    xmlHttp.onreadystatechange=fname;
    xmlHttp.send(null);

}
//End

//Post Data through AJAX
function PostData(sBody,ObjForm,fName)
{
    xmlHttp=GethttpObject();
    xmlHttp.open("post",ObjForm.action,true);
    xmlHttp.setRequestHeader("Content-Type")
    xmlHttp.onreadystatechange=fName;
    xmlHttp.send(sBody);
}

//Retrive data through API
function getResponsefromAPI(url,fname)
{
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");    
    xmlHttp.open("GET",url,true);
    xmlHttp.onreadystatechange=fname;
    xmlHttp.send(null);
}
//End