﻿function ChooseNewsHome(NewsTxt)
{

NewsTxt = NewsTxt.toUpperCase();

   
  
 if(NewsTxt =="COMPANY RESULTS")
    {

        GetNewsHotGlobalHome('7','16');
    }
  
    if(NewsTxt =="HOT STOCKS")
    {

        GetNewsHotGlobalHome('4','38');
    }
    if(NewsTxt =="OTHER MARKET")
    {
        GetNewsHotGlobalHome('6','12,13,14,45');
    }
    if(NewsTxt =="MARKET PULSE")
    {
        GetNewsHotGlobalHome('5','56');
    }
    if(NewsTxt =="ECONOMY")
    { 
        GetNewsHotGlobalHome('5','23,24,25,26,36,43,44,49');
    }

   
    if(NewsTxt=="CORPORATE NEWS")
    {
        GetNewsHotGlobalHome('7','15');
    }
   
    if(NewsTxt =="FII POSITION")
    {
        GetNewsHotGlobalHome('9','22');
    }
    
    if(NewsTxt =="OPENING BELL")
    {
        GetNewsHotGlobalHome('4','40');
    }

    if(NewsTxt=="CLOSING BELL")
    {
        GetNewsHotGlobalHome('4','42');
    }
   
  
    if(NewsTxt =="MIDDAY REVIEW")
    {
        GetNewsHotGlobalHome('4','41');
    }
    

    if(NewsTxt =="CURRENT AFFAIRS AND POLITICS")
    {
        GetNewsHotGlobalHome('5','11');
    }

     if(NewsTxt =="GLOBAL MARKETS")
    {
        GetNewsHotGlobalHome('4','27');
    }
  
         if(NewsTxt =="MUTUAL FUNDS NEWS")
    {
        GetNewsHotGlobalHome('2','3,58');
    }

}

function CreateXmlHttpNewsHome()
{
	try
	{
		XmlHttpNewsHome = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpNewsHome = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpNewsHome = null;				
		}
	}
	if(!XmlHttpNewsHome && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpNewsHome = new XMLHttpRequest();
	}
}


function GetNewsHotGlobalHome(SecID,SubSec)
{	


    CreateXmlHttpNewsHome();
   
	document.body.style.cursor = "progress";
	//document.getElementById("NewsTdGlobal").innerHTML="<table align=center><tr><td><img src =../App_Themes/Common/images/ajax-loader.gif/></td></tr></table>";
	
	var requestUrl = "HomeControls/AjaxHomeNews.aspx?Sec="+ SecID +"&SubSec="+SubSec+"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();

	if(XmlHttpNewsHome)
	{
	    XmlHttpNewsHome.onreadystatechange = function(){getDataResponseHotHome();};
		XmlHttpNewsHome.open("GET", requestUrl,  true);			
		XmlHttpNewsHome.send(null);
	
	}
	
}

function getDataResponseHotHome()
{
 
    if(XmlHttpNewsHome.readyState == 4)
	{	
	
	    if(XmlHttpNewsHome.status == 200)
		{
				
		    var NewTd = document.getElementById("NewsTdGlobal");
			var NewData = XmlHttpNewsHome.responseText;
			if(NewData != "")
				NewTd.innerHTML = NewData;				
			document.body.style.cursor = "auto";
			
		}
	}
}






// Function For Back Up //



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,SecID,SubSecID,FinCode,Opt)
    {
        CreateXmlHttpNewsGlobal();
        document.getElementById("divNews").style.display = "inline";
		document.body.style.cursor = "progress";
//		alert('1');
		var requestUrl = "HomeControls/AjaxNewsPopGlobal.aspx?timeStamp="+ new Date().getTime() +"&NewsID="+NewsID +"&SecID="+SecID +"&SubSecID="+SubSecID +"&FinCode="+FinCode;
//	alert(requestUrl);
		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";
		}
	}
}

//Recognia

function CreateXmlHttprecognia()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttprecognia = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{  
				XmlHttprecognia = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttprecognia = false;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if (!XmlHttprecognia && typeof XMLHttpRequest!='undefined') 
		{
	        try 
	        {
		        XmlHttprecognia = new XMLHttpRequest();
	        } 
	        catch (e) 
	        {
		        XmlHttprecognia=false;
	        }
        }
        if (!XmlHttprecognia && window.createRequest) 
        {
	        try 
	        {
		        XmlHttprecognia = window.createRequest();
	        } 
	        catch (e)
	        {
		        XmlHttprecognia=false;
	        }
        }
	}
	
    function open_recognia(id)
    {
        CreateXmlHttprecognia();
        document.getElementById("div_Recognia").style.display = "";
		document.body.style.cursor = "progress";
		//alert(id);
		var requestUrl = "ajaxrecognia.aspx?timeStamp="+ new Date().getTime() +"&id="+id ;
		if(XmlHttprecognia)	{
					XmlHttprecognia.onreadystatechange = function(){getNewsRespGlobal()};
					XmlHttprecognia.open("GET", requestUrl,  true);
					XmlHttprecognia.send(null);
				}
    }
     function getNewsRespGlobal()
   {

	if(XmlHttprecognia.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttprecognia.status == 200)//
		{ 
		document.getElementById("tdRecognia").innerHTML=XmlHttprecognia.responseText;
		
		document.body.style.cursor = "auto";		
		}
		else
		{
			document.getElementById("tdRecognia").innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}
 
