﻿// JScript File

function CreateXmlHttpNewsGlobal()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpNewsGlobal = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{  
				XmlHttpNewsGlobal = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpNewsGlobal = false;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if (!XmlHttpNewsGlobal && typeof XMLHttpRequest!='undefined') 
		{
	        try 
	        {
		        XmlHttpNewsGlobal = new XMLHttpRequest();
	        } 
	        catch (e) 
	        {
		        XmlHttpNewsGlobal=false;
	        }
        }
        if (!XmlHttpNewsGlobal && window.createRequest) 
        {
	        try 
	        {
		        XmlHttpNewsGlobal = window.createRequest();
	        } 
	        catch (e)
	        {
		        XmlHttpNewsGlobal=false;
	        }
        }
	}
	
    function OpenNewsGlobal(NewsID)
    {

        CreateXmlHttpNewsGlobal();
       
        document.getElementById("divNews").style.display = "inline";
  
		var requestUrl = "../Insurance/GetNews.aspx?timeStamp="+ new Date().getTime() +"&NewsID="+NewsID ;
		
	
		if(XmlHttpNewsGlobal)	{
					XmlHttpNewsGlobal.onreadystatechange = function(){getNewsRespGlobal()};
					XmlHttpNewsGlobal.open("GET", requestUrl,  true);
					XmlHttpNewsGlobal.send(null);
				}
    }
    
    function getNewsRespGlobal()
{



	if(XmlHttpNewsGlobal.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpNewsGlobal.status == 200)//
		{
		document.getElementById("TdNews").innerHTML=XmlHttpNewsGlobal.responseText;
		document.body.style.cursor = "auto";		
		}
		else
		{
			document.getElementById("TdNews").innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}