﻿// JavaScript For Getting The BroadCastMessage
var XmlReqGet;
var AjaxServerPageGet = "../AjaxGetMsg.aspx";

function GetMessage(obj1,obj2,obj3)
//function chkAvailability(Table,obj,objvalue,Label)
{
    
    
    //To Fetch the Paaram send the QueryString with certain param t
    if(obj1!="" && obj2!="")
    {
        var requestUrlGet = AjaxServerPageGet + "?Choice1=" + obj1 +"&Choice2=" + obj2 +"&Choice3=" +obj3;
        
	    CreateXmlReqGet();
	}
	
    if(XmlReqGet)
	{
	
		XmlReqGet.onreadystatechange = HandleResponseGet;
		XmlReqGet.open("GET", requestUrlGet,  true);
		XmlReqGet.send();	
			
	}
   
	return false;
}

function HandleResponseGet()
{
//4 means connection has been established successfully and ready to use
   
	if(XmlReqGet.readyState == 4)
	{
	 
	//200 means successful reterive the data
		if(XmlReqGet.status == 200)
		{			
		
			// Before filling new contents into the DataGrid, clear the cotents by calling this function
			//ClearTable();
			// Fill the cleared Datagrid with new XML Reponse
			GetandCheckResultGet(XmlReqGet.responseXML.documentElement);  //
			
		}
		else
		{
			//alert("There was a problem retrieving data from the server.");
		}
	}
}

function CreateXmlReqGet()
{
	try
	{
		XmlReqGet = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlReqGet = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlReqGet = null;			
		}
	}
	if(!XmlReqGet && typeof XMLHttpRequest != "undefined") 
	{
	    
		XmlReqGet = new XMLHttpRequest();
	}
}


function GetandCheckResultGet(ResultNodeGet)
{  
   if(ResultNodeGet !=null)
    {
        var mess = ResultNodeGet.getElementsByTagName('Message')[0].text;
    
        if(mess != "")
        {
            alert(mess);
        }
    }
 }

