﻿var XmlHttp_LN;
 function show_popup(m_im_id, m_im_shortdesc, m_im_desc, m_ff_desc, m_ff_id, m_fundclass)
 {
 
 	f_im_id = m_im_id;
 	f_im_shortdesc = m_im_shortdesc;
 	f_im_desc = m_im_desc;
 	f_ff_desc = m_ff_desc;
 	f_ff_id = m_ff_id;
 	f_fundclass = m_fundclass;

 	//document.getElementById("head1").innerHTML = " Company Profile " ;
 //	document.getElementById("popup").style.left = tempX + "px";
 //	document.getElementById("popup").style.top = tempY + "px";
 
 	document.getElementById("popup").style.left = event.clientX + document.body.scrollLeft + "px";
 	
 	
 	
 	document.getElementById("popup").style.top = event.clientY + document.body.scrollTop + "px";
 
 	document.getElementById("popup").style.visibility = "visible";
 	m_show = 1;
 }
 
 function hide_popup()
 {
 	if(m_show == 0)
 	{
 		document.getElementById("popup").style.visibility = "hidden";
 	}
 }

var m_urls = Array('http://www.rathionline.com/equity/equitymain.aspx?Url=CompanyProfile/QuoteFinder.aspx?id=37','http://www.rathionline.com/equity/equitymain.aspx?Url=CompanyProfile/MF_Holdings.aspx?id=67','http://www.rathionline.com/equity/equitymain.aspx?Url=CompanyProfile/FinanceRatios.aspx?id=63|Mode=S','http://www.rathionline.com/equity/equitymain.aspx?Url=CompanyProfile/ChartDisplay.aspx?id=39');


// Functions for showing and hiding divs

 var tempX = 0;
 var tempY = 0;
 var m_show = 0;
 var f_sc_id = "";
 var f_sc_dispid = "";
 var f_sc_comp = "";
 var f_topic_id = 0;
 var f_buy_id =0;

 //setInterval("hide_popup1()",1000);
 
 var IE = document.all?true:false
 
 if (!IE) document.captureEvents(Event.MOUSEMOVE)
 document.onmousemove = getMouseXY;
 
 function getMouseXY(e) 
 {
 	if(IE)
 	{
 	     tempY = document.body.scrollTop+50;
 	}
 	else
 	{
 		 tempY = document.body.scrollTop+50;
 	}
 	return true;
 }


function _trim(ig_)
{
    return ig_.replace(/^\s*|\s*$/g,"")
}	



function id_click(m_id)
 {
 f_im_id=_trim(f_im_id);
 	if(m_id == 1)
 		window.top.location = m_urls[m_id-1] +"|FinCode="+f_im_id;
 	else if(m_id == 2) 	    
 	    window.top.location = m_urls[m_id-1] +"|FinCode="+f_im_id;
 	else if(m_id == 3)
 		window.top.location = m_urls[m_id-1] +"|FinCode="+f_im_id;
 	else if(m_id == 4)
 		window.top.location = m_urls[m_id-1] +"|FinCode="+f_im_id;
 
 	else
 		window.top.location = m_urls[m_id-1] + f_im_id;
  	
 }

function ItemMouseOver(currentRow)
    {
        oRow = document.getElementById(currentRow);
//        oCheckBox = document.getElementById(chkBxMail);
//        oImage = document.getElementById(imgMail);
//        if(!oCheckBox.checked)
//        {
//            oCheckBox.style.display = '';
//            oImage.style.display = 'none';
            oRow.originalBackgroundColor = oRow.style.backgroundColor
            oRow.style.backgroundColor = 'red';
//        }
    }

    function ItemMouseOut(currentRow)
    {
        oRow = document.getElementById(currentRow);
//        oCheckBox = document.getElementById(chkBxMail);
//        oImage = document.getElementById(imgMail);
//        if(!oCheckBox.checked)
//        {
//            oCheckBox.style.display = 'none';
//            oImage.style.display = '';
            oRow.style.backgroundColor = oRow.originalBackgroundColor;
//        }
    }
    
//Creating object of XMLHTTP For AJAX Method
function CreateXmlHttpLN()
{
    //Creating object of XMLHTTP in IE
	try
	{
	    XmlHttp_LN = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try
		{
			XmlHttp_LN = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp_LN = null;	
		}
	} 
	
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp_LN && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp_LN = new XMLHttpRequest();
	}
}

function getNews(opt,secid,subsecid)
{
    
    
    CreateXmlHttpLN();
    
    var MktCom=document.getElementById("LiveNewsTab2_NewsTd");
    
    
    var requestUrl="GetNewsTab.aspx?secid="+secid+"&subsecid="+subsecid+"&opt="+opt+"&timeStamp="+new Date().getTime();
    //alert(requestUrl);
	if(XmlHttp_LN)
	{
		//alert(requestUrl);
		XmlHttp_LN.onreadystatechange=function(){getNewsData(MktCom,opt);};
		XmlHttp_LN.open("GET",requestUrl,true);
		XmlHttp_LN.send(null);
	}
}

function getNewsData(id,opt)
{
    if(XmlHttp_LN.readyState==4)
	{
	    if(XmlHttp_LN.status == 200)
		{
		    id.innerHTML=XmlHttp_LN.responseText;
	
		  
		}
	}
}


function ChangeControl(Opt,Exch)
{  
            SetOptionGLVV = Opt;
            SetExchGLVV = Exch;

            CreateXmlHttpGLVolVal();
            var currentDivObj = document.getElementById("Td_Data"); 
            var More = document.getElementById("More") ;
            
            var GNLef=document.getElementById("GNLef");
            var GNRef=document.getElementById("GNRef");
            var GNRig=document.getElementById("GNRig");
          
            var LOLef=document.getElementById("LOLef");
            var LORef=document.getElementById("LORef");
            var LORig=document.getElementById("LORig");
          
            var VOLef=document.getElementById("VOLef");
            var VORef=document.getElementById("VORef");
            var VORig=document.getElementById("VORig");
          
            var ADVLef=document.getElementById("ADVLef");
            var ADVBck=document.getElementById("ADVBck");
            var ADVRig=document.getElementById("ADVRig");  
       
            var MoreGLVV=document.getElementById("MoreGLVV"); 
            
       if(Opt=='GAIN')
        {  
          MoreGLVV.innerHTML="<a target=_parent href='http://www.rathionline.com/Equity/EquityMain.aspx?Url=Equity/TopGainersAndLosers_All.aspx?id=68|Option=dailygain' class=HomeMore>more...</a>";
          GNLef.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabLef1.gif align=absbottom />";
          GNRef.className="TabTextSel";
          GNRig.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabRig1.gif align=absbottom />"; 
          
          GNRef.style.cursor = "text";
          LORef.style.cursor = "Pointer";
          VORef.style.cursor = "Pointer";
          ADVBck.style.cursor = "Pointer";
          LOLef.innerHTML="";
          LORef.className="TabTextUnSel";
          LORig.innerHTML="";
          
          VOLef.innerHTML="";
          VORef.className="TabTextUnSel";
          VORig.innerHTML="";
          
          ADVLef.innerHTML="";
          ADVBck.className="TabTextUnSel";
          ADVRig.innerHTML="";
          
        } 
        if(Opt=='LOSE')
        {  
          MoreGLVV.innerHTML="<a target=_parent href='http://www.rathionline.com/Equity/EquityMain.aspx?Url=Equity/TopGainersAndLosers_All.aspx?id=68|Option=dailylose' class=HomeMore>more...</a>";
          LOLef.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabLef1.gif align=absbottom />";
          LORef.className="TabTextSel";
          LORig.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabRig1.gif align=absbottom />";  
          
          GNRef.style.cursor = "Pointer";
          LORef.style.cursor = "text";
          VORef.style.cursor = "Pointer";
          ADVBck.style.cursor = "Pointer";
          
          GNLef.innerHTML="";
          GNRef.className="TabTextUnSel";
          GNRig.innerHTML="";
          
          VOLef.innerHTML="";
          VORef.className="TabTextUnSel";
          VORig.innerHTML="";
          
          ADVLef.innerHTML="";
          ADVBck.className="TabTextUnSel";
          ADVRig.innerHTML="";
        }  
         if(Opt=='Vol')
        {        
          MoreGLVV.innerHTML="<a target=_parent href='http://www.rathionline.com/Equity/EquityMain.aspx?Url=Equity/MostActive.aspx?id=9|EXCHG=BSE|Option=Volume' class=HomeMore>more...</a>";
          VOLef.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabLef1.gif align=absbottom />";
          VORef.className="TabTextSel";
          VORig.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabRig1.gif align=absbottom />"; 
          
          GNRef.style.cursor = "Pointer";
          LORef.style.cursor = "Pointer";
          VORef.style.cursor = "text";
          ADVBck.style.cursor = "Pointer";
          
          
          GNLef.innerHTML="";
          GNRef.className="TabTextUnSel";
          GNRig.innerHTML="";
          
          LOLef.innerHTML="";
          LORef.className="TabTextUnSel";
          LORig.innerHTML="";
          
          ADVLef.innerHTML="";
          ADVBck.className="TabTextUnSel";
          ADVRig.innerHTML=""; 
        } 
         if(Opt=='AdvDec')
        {        
          MoreGLVV.innerHTML="<a target=_parent href='http://www.rathionline.com/Equity/EquityMain.aspx?Url=Equity/AdvanceAndDeclines.aspx?Option=|EXCHG=BSE|id=5' class=HomeMore>more...</a>";
          VOLef.innerHTML="";
          VORef.className="TabTextUnSel";
          VORig.innerHTML=""; 
          
          GNRef.style.cursor = "Pointer";
          LORef.style.cursor = "Pointer";
          VORef.style.cursor = "Pointer";
          ADVBck.style.cursor = "text";
          
          GNLef.innerHTML="";
          GNRef.className="TabTextUnSel";
          GNRig.innerHTML="";
          
          LOLef.innerHTML="";
          LORef.className="TabTextUnSel";
          LORig.innerHTML="";
          
          ADVLef.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabLef1.gif align=absbottom />";
          ADVBck.className="TabTextSel";
          ADVRig.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabRig1.gif align=absbottom />"; 
        } 
     document.getElementById("Td_Data").innerHTML = "<table align=center><tr><td ><img src =../App_Themes/HomeCommon/Homeimages/loader.gif /></td></tr></table>";
	document.body.style.cursor = "progress";
	var requestUrl;  
	if(Opt=='AdvDec')
	 {
	  requestUrl = "../Equity/DisplayBarChartAD.aspx?timeStamp="+new Date().getTime();  
	 }
	else
	{
	 requestUrl = "../Equity/AjaxDataGLVV.aspx?Option="+ Opt +"&Exchange="+Exch+"&timeStamp="+new Date().getTime();
	} 
	if(XmlHttpGLVolVal!=null)	
	{
	    XmlHttpGLVolVal.onreadystatechange = function(){ChangeControlResponse(Opt,Exch)}
		XmlHttpGLVolVal.open('GET', requestUrl,  true);
		XmlHttpGLVolVal.send(null);
	}
	return false; 
}	

var XmlHttpGLVolVal;
function CreateXmlHttpGLVolVal()
{
	try
	{
		XmlHttpGLVolVal = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpGLVolVal = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpGLVolVal = null;				
		}
	}
	if(!XmlHttpGLVolVal && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpGLVolVal = new XMLHttpRequest();
	}
}

function ChangeControlResponse(Opt,Exch)
{
    var Head_td =document.getElementById("Heading");
    var More=document.getElementById("More");
    var BSE_td =document.getElementById("Td_BSE");
    var NSE_td =document.getElementById("Td_NSE");	
	switch (Opt)
	{
	    case "GAIN":
		    //Head_td.innerHTML="Gainers";
		    break;
		
	    case "LOSE":
		   // Head_td.innerHTML="Losers";
	        break;
	    
	    case "Vol":
		  //  Head_td.innerHTML="Volume";
	        break;
	    
	    case "Val":
	        //Head_td.innerHTML="Value";
	        break;
	}
	
	if(XmlHttpGLVolVal.readyState == 4)
	{
		var td_Id = document.getElementById("Td_Data");
		
		if(XmlHttpGLVolVal.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpGLVolVal.responseText;
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}

var XmlHttp;
function CreateXmlGLHL()
{
	try
	{
		XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttp = null;				
		}
	}
	if(!XmlHttp && typeof XMLHttpRequest != "undefined")
	{
		XmlHttp = new XMLHttpRequest();
	}
}

function GetData(type)
{

  var Bse=document.getElementById("Bsed");
  var Nse=document.getElementById("nsed");
  
  var GLef=document.getElementById("GLef");
  var GBck=document.getElementById("GBck");
  var GRig=document.getElementById("GRig");
  
  var LLef=document.getElementById("LLef");
  var LBck=document.getElementById("LBck");
  var LRig=document.getElementById("LRig");
  
  var HLef=document.getElementById("HLef");
  var HBck=document.getElementById("HBck");
  var HRig=document.getElementById("HRig");
  
  var LwLef=document.getElementById("LwLef");
  var LwBck=document.getElementById("LwBck");
  var LwRig=document.getElementById("LwRig");

 var More=document.getElementById("MoreGLHL");
 
 switch(type)
 {
  case "Buyers":
  {
      More.innerHTML="<a target=_parent href='http://www.rathionline.com/Equity/EquityMain.aspx?Url=Equity/OnlyBuyersAndSellers.aspx?Option=UP|EXCHG=BSE|index=1|id=73' class=HomeMore>more...</a>";
      Bse.innerHTML="Only Buyers";
      Nse.innerHTML="Only Buyers";
      GLef.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabLef1.gif align=absbottom />";
      GBck.className="TabTextSel";
      GRig.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabRig1.gif align=absbottom />";
      GBck.style.cursor = "text";
      LBck.style.cursor = "Pointer";
      HBck.style.cursor = "Pointer";
      LwBck.style.cursor = "Pointer";
      LLef.innerHTML="";

      LBck.className="TabTextUnSel";
      LRig.innerHTML="";
      
      HLef.innerHTML="";

      HBck.className="TabTextUnSel";
      HRig.innerHTML="";
      
      LwLef.innerHTML="";

      LwBck.className="TabTextUnSel";
      LwRig.innerHTML="";
      break;
  }
 case "Sellers": 
  {
      More.innerHTML="<a target=_parent href='http://www.rathionline.com/Equity/EquityMain.aspx?Url=Equity/OnlyBuyersAndSellers.aspx?Option=DOWN|EXCHG=BSE|index=1|id=74' class=HomeMore>more...</a>";
       Bse.innerHTML="Only Sellers";
      Nse.innerHTML="Only Sellers";
      GLef.innerHTML="";

      GBck.className="TabTextUnSel";
      GRig.innerHTML="";
      
      GBck.style.cursor = "Pointer";
      LBck.style.cursor = "text";
      HBck.style.cursor = "Pointer";
      LwBck.style.cursor = "Pointer";
      
      LLef.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabLef1.gif align=absbottom />";
      LBck.className="TabTextSel";
      LRig.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabRig1.gif align=absbottom />";
      
      HLef.innerHTML="";

      HBck.className="TabTextUnSel";
      HRig.innerHTML="";
      
      LwLef.innerHTML="";

      LwBck.className="TabTextUnSel";
      LwRig.innerHTML="";
      break;
  }
  case "High": 
  {
      More.innerHTML="<a target=_parent href='http://www.rathionline.com/Equity/EquityMain.aspx?Url=Equity/AllHighsLows.aspx?id=75|Option=HIGH' class=HomeMore>more...</a>";
      Bse.innerHTML="52 Weeks High";
      Nse.innerHTML="52 Weeks High";
      GLef.innerHTML="";

      GBck.className="TabTextUnSel";
      GRig.innerHTML="";
      
      LLef.innerHTML="";

      LBck.className="TabTextUnSel";
      LRig.innerHTML="";
      
      GBck.style.cursor = "Pointer";
      LBck.style.cursor = "Pointer";
      HBck.style.cursor = "text";
      LwBck.style.cursor = "Pointer";
      
      HLef.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabLef1.gif align=absbottom />";
      HBck.className="TabTextSel";
      HRig.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabRig1.gif align=absbottom />";
      
      LwLef.innerHTML="";

      LwBck.className="TabTextUnSel";
      LwRig.innerHTML="";
       break;
  }
  case "Low": 
  {
      More.innerHTML="<a target=_parent href='http://www.rathionline.com/Equity/EquityMain.aspx?Url=Equity/AllHighsLows.aspx?id=76|Option=LOW' class=HomeMore>more...</a>";
       Bse.innerHTML="52 Weeks Low";
      Nse.innerHTML="52 Weeks Low";
      GLef.innerHTML="";

      GBck.className="TabTextUnSel";
      GRig.innerHTML="";
      
      LLef.innerHTML="";

      LBck.className="TabTextUnSel";
      LRig.innerHTML="";
      
      HLef.innerHTML="";

      HBck.className="TabTextUnSel";
      HRig.innerHTML="";
      GBck.style.cursor = "Pointer";
      LBck.style.cursor = "Pointer";
      HBck.style.cursor = "Pointer";
      LwBck.style.cursor = "text";
      LwLef.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabLef1.gif align=absbottom />";
      LwBck.className="TabTextSel";
      LwRig.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/OrTabRig1.gif align=absbottom />";
       break;
  }
 }
    document.getElementById("display").innerHTML = "<table align=center><tr><td ><img src =../App_Themes/HomeCommon/Homeimages/loader.gif /></td></tr></table>";
    document.body.style.cursor = "progress";
    CreateXmlGLHL();
	var requestUrl = "../Equity/AjaxGLHghLow.aspx?Option="+ type+"&timeStamp="+new Date().getTime();  
	
	if(XmlHttp!=null)	
	{
	    XmlHttp.onreadystatechange = function(){ResponseFunct()}
		XmlHttp.open('GET', requestUrl,  true);
		XmlHttp.send(null);
	}
	return false; 
 
}

function ResponseFunct()
{
if(XmlHttp.readyState == 4)
	{
		var td_Id = document.getElementById("display");
		
		if(XmlHttp.status == 200)//
		{
			td_Id.innerHTML =  XmlHttp.responseText;
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
 }
	
var XmlHttpBA;

function CreateXmlHttpBA()
	{
		try
		{
			XmlHttpBA = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpBA = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpBA = null;
					
			}
		}
		if(!XmlHttpBA && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpBA = new XMLHttpRequest();
		}
	}


	function GetAnnconcmts(excg)
	{	
	
  var bsel=document.getElementById("bsel");
  var bsem=document.getElementById("bsem");
  var bser=document.getElementById("bser");
  
  var nsel=document.getElementById("nsel");
  var nsem=document.getElementById("nsem");
  var nser=document.getElementById("nser");
  var MoreAnnc=document.getElementById("MoreAnnc");
  
  switch(excg)
   {
    case "BSE": 
     {
      MoreAnnc.innerHTML="<a target=_parent href='http://www.rathionline.com/Equity/EquityMain.aspx?Url=CorporateAction/BSEAnnouncement.aspx?id=26' class=HomeMore>more...</a>";
      bsel.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/ChTabLef.gif  />";
      bsem.style.background="url(../App_Themes/HomeCommon/Homeimages/ChTabBk.gif)";
      bser.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/ChTabRig.gif  />";
      bsem.style.cursor = "text";
      nsem.style.cursor = "Pointer";
      nsel.innerHTML="";
    //  nsem.innerHTML="NSE";
      nsem.style.background="";
      nser.innerHTML="";
      break;
     }
     case "NSE":
      {
      MoreAnnc.innerHTML="<a target=_parent href='http://www.rathionline.com/Equity/EquityMain.aspx?Url=CorporateAction/NSEAnnouncement.aspx?id=25' class=HomeMore>more...</a>";
      nsel.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/ChTabLef.gif />";
      nsem.style.background="url(../App_Themes/HomeCommon/Homeimages/ChTabBk.gif)";
      nser.innerHTML="<img src=../App_Themes/HomeCommon/Homeimages/ChTabRig.gif  />";
      bsem.style.cursor = "Pointer";
      nsem.style.cursor = "text";
      bsel.innerHTML="";
      //bsem.innerHTML="BSE";
      bsem.style.background="";
      bser.innerHTML="";
       break;
      }
   }
		CreateXmlHttpBA();
//	    document.getElementById("anncdetails").innerHTML = "<table align=center><tr><td ><img src =../App_Themes/HomeCommon/Homeimages/Ctrl-Loader.gif /></td></tr></table>";
		document.body.style.cursor = "progress";
		var requestUrl = "AjaxAnnouncements.aspx?Exchange="+excg+"&timeStamp="+new Date().getTime();
	
		if(XmlHttpBA){
			XmlHttpBA.onreadystatechange = function(){getDataResponseBSEAnn();};
			XmlHttpBA.open("GET", requestUrl,  true);
			XmlHttpBA.send(null);
		}
    }
    
function getDataResponseBSEAnn()
{
	if(XmlHttpBA.readyState == 4)
	{	
	
		if(XmlHttpBA.status == 200)
		{				
		
			var BSEAnn = document.getElementById("anncdetails");
			var AnnDate = document.getElementById("AnnDate");
			var strData = XmlHttpBA.responseText;
			if(strData != "")
			 {	
			    var arrSchm = strData.split("|");
			   
			    for(i=0; i<arrSchm.length-1; i++) 
			    {	
				    var strSchm = arrSchm[i];
				   
				    var arrSchmCode = strSchm.split("~");
				     AnnDate.innerHTML = arrSchmCode[0];
				    
				    BSEAnn.innerHTML = arrSchmCode[1];
			    }
			}
				
		}
		
		
	}
	document.body.style.cursor = "auto";
}
var XmlHttpON;
function CreateXmlOpennews()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpON = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{  
				XmlHttpON = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpON = false;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if (!XmlHttpON && typeof XMLHttpRequest!='undefined') 
		{
	        try 
	        {
		        XmlHttpON = new XMLHttpRequest();
	        } 
	        catch (e) 
	        {
		        XmlHttpON=false;
	        }
        }
        if (!XmlHttpON && window.createRequest) 
        {
	        try 
	        {
		        XmlHttpON = window.createRequest();
	        } 
	        catch (e)
	        {
		        XmlHttpON=false;
	        }
        }
	}
function OpenNews(sec,subsec,NewsID)
    {
        	CreateXmlOpennews();
        	document.getElementById("divNews").style.display = "inline";
		document.body.style.cursor = "progress";
		document.getElementById("TdNews").innerHTML = "<img src =../App_Themes/HomeCommon/Homeimages/loader.gif />";
		var requestUrl = "../News/GetNews.aspx?timeStamp="+ new Date().getTime() +"&SecId=&SubSecID=&NewsID="+NewsID;
		if(XmlHttpON)	{
					XmlHttpON.onreadystatechange = function(){getNewsResp()};
					XmlHttpON.open("GET", requestUrl,  true);
					XmlHttpON.send(null);
				}
    }
    
    function getNewsResp()
{

	if(XmlHttpON.readyState == 4)
	{
		
		if(XmlHttpON.status == 200)
		{
		
		document.getElementById("TdNews").innerHTML=XmlHttpON.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";
		}
	}
}

//*****************************************************************************
// Do not remove this notice.
//
// Copyright 2001 by Mike Hall.
// See http://www.brainjar.com for terms of use.
//*****************************************************************************

// Determine browser and version.

function Browser() {

  var ua, s, i;
  this.isIE    = false;
  this.isNS    = false;  
  this.version = null;
  ua = navigator.userAgent;
	s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }  
  
  s="Opera";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

// Global object to hold drag information.

var dragObj = new Object();
dragObj.zIndex = 0;

function dragStart(event, id) {
    //alert("sdf");
  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}



var XmlHttpBAI;

function CreateXmlHttpBAI()
	{
		try
		{
			XmlHttpBAI = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpBAI = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpBAI = null;
					
			}
		}
		if(!XmlHttpBAI && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpBAI = new XMLHttpRequest();
		}
	}
	

function GetAnnInn(srno,Exchange)
	{	
	
	    document.getElementById("divNews").style.display = "inline";
		CreateXmlHttpBAI();
		document.body.style.cursor = "progress";
		var requestUrl = "AnnDetailsAjax.aspx?IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime()+"&srno="+srno+"&Exchange="+Exchange;
	
		if(XmlHttpBAI){
			XmlHttpBAI.onreadystatechange = function(){getDataResponseBSEAnnIN();};
			XmlHttpBAI.open("GET", requestUrl,  true);
			XmlHttpBAI.send(null);
		}
    }
function getDataResponseBSEAnnIN()
{
	if(XmlHttpBAI.readyState == 4)
	{	
	
		if(XmlHttpBAI.status == 200)
		{				
		
			
			var BSEAnn = document.getElementById("TdNews");
			//var AnnDate = document.getElementById("AnnDate");
			var strData = XmlHttpBAI.responseText;
			if(strData != "")
			 {	
			    var arrSchm = strData.split("|");
			   
			    for(i=0; i<arrSchm.length-1; i++) 
			    {	
				    var strSchm = arrSchm[i];
				   
				    var arrSchmCode = strSchm.split("~");
				  //   AnnDate.innerHTML = arrSchmCode[0];
				    BSEAnn.innerHTML = arrSchmCode[1];
				    document.body.style.cursor = "auto";
			    }
			   
			} 
				
		}
		
		else
		document.body.style.cursor = "auto";
			//MarqueeId.innerHTML = "<img src='../CommonImgs/loading1.gif'>";
	}
}
