﻿// JScript File
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;
  }

  // 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();
var clockTimeoutID;
//Global Variables


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)
 	{
 	    tempX = event.clientX + document.body.scrollLeft;
 		tempY = event.clientY + document.body.scrollTop;
 	}
 	else
 	{
 		tempX = e.pageX;
 	    tempY = e.pageY;
 	}
 	return true;
 }

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.visibility = "visible";
 	m_show = 1;
 }

var XmlHttpGL;
var XmlHttpForex;
var XmlHttp;
function CreateXmlHttp()
{
	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();
	}
}



///Archana
function ChangeControl(Opt,Exch)
{
	CreateXmlHttp();
       var currentDivObj = document.getElementById("Td_Data");
        
		//currentDivObj.innerHTML ="<img src=App_Themes/Images/ajax-loader.gif>";
	document.body.style.cursor = "progress";
	
	
	var requestUrl = "AjaxDataGLVV.aspx?Option="+ Opt +"&Exchange="+ Exch;
   // window.open(requestUrl) 
	if(XmlHttp!=null)	
	        {
				XmlHttp.onreadystatechange = function(){ChangeControlResponseHome(Opt,Exch)}
				XmlHttp.open('GET', requestUrl,  true);
				XmlHttp.send(null);
			}
			 return false; 
			 
			 
}	
	
function ChangeControlResponseHome(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";
	    if(Exch=='BSE')
	    {
		More.innerHTML="<a class='HomeMore' href='Equity/TopGainersAndLosers.aspx?Option=GAIN&EXCHG=BSE&id=1&index=0'>More</a>";
		}
		else
		{
		More.innerHTML="<a class='HomeMore' href='Equity/TopGainersAndLosers.aspx?Option=GAIN&EXCHG=NSE&id=1&index=0'>More</a>";
		}
		
		break;
		
	case "LOSE":
		Head_td.innerHTML="Losers";
		 if(Exch=='BSE')
	    {
		More.innerHTML="<a class='HomeMore' href='Equity/TopGainersAndLosers.aspx?Option=LOSE&EXCHG=BSE&id=1&index=0'>More</a>";
		}
		else
		{
		More.innerHTML="<a class='HomeMore' href='Equity/TopGainersAndLosers.aspx?Option=LOSE&EXCHG=NSE&id=1&index=0'>More</a>";
		}
	break;
	
	case "Vol":
		Head_td.innerHTML="Volume";
		 if(Exch=='BSE')
	    {
		More.innerHTML="<a class='HomeMore' href='Equity/MostActive.aspx?id=2&Option=Volume&EXCHG=BSE&index=0'>More</a>";
		}
		else
		{
		    More.innerHTML="<a class='HomeMore' href='Equity/MostActive.aspx?id=2&Option=Volume&EXCHG=NSE&index=0'>More</a>";
		}
	break;
	
	case "Val":
	    Head_td.innerHTML="Value";
	     if(Exch=='BSE')
	    {
		More.innerHTML="<a class='HomeMore' href='Equity/MostActive.aspx?id=2&Option=Value&EXCHG=BSE&index=0'>More</a>";
		}
		else
		{
		    More.innerHTML="<a class='HomeMore' href='Equity/MostActive.aspx?id=2&Option=Value&EXCHG=NSE&index=0'>More</a>";
		}
	break;
	
	}

	// To make sure receiving response data from server is completed
	
	if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		var td_Id = document.getElementById("Td_Data");
	    //alert(XmlHttp.status)
		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";
		}
	}
}	
function sensexvalue(val)
{
	
    if(val=='BSE')
    {
      
       ChangeControl("GAIN","BSE");
        document.getElementById('sec_1').style.backgroundColor="#25b9ff";
        document.getElementById('sec_2').style.backgroundColor="#009bde";
        document.getElementById('imgOnOff').src="App_Themes/images/SensexOn.GIF";
     
        document.getElementById("chart").src="http://content.acesphere.com/Charts/SteelCityBse.png?time=" + new Date().getTime() + "";
        GlVoLVal('BSE');
        
    }
    else
    {
   
         ChangeControl('GAIN','NSE');
        document.getElementById('sec_2').style.backgroundColor="#25b9ff";
        document.getElementById('sec_1').style.backgroundColor="#009bde";
        document.getElementById('imgOnOff').src= "App_Themes/images/NiftyOn.GIF";
     
       document.getElementById("chart").src="http://content.acesphere.com/Charts/SteelCityNse.png?time=" + new Date().getTime() + "";
        GlVoLVal('NSE');
    return true;
    }

   
}
var XmlHttphomemid;
function CreateXmlHttpHomemid()
{
	try
	{
		XmlHttphomemid = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttphomemid = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttphomemid = null;				
		}
	}
	if(!XmlHttphomemid && typeof XMLHttpRequest != "undefined")
	{
		XmlHttphomemid = new XMLHttpRequest();
	}
}
function GetHomeMidSenNifty()
{
   CreateXmlHttpHomemid();
   document.body.style.cursor = "progress";
    var requestUrl = "AjaxHomeMid.aspx";
    
	 if(XmlHttphomemid!=null)	
	        {
				XmlHttphomemid.onreadystatechange = function(){ChangeControlMidHome()}
				XmlHttphomemid.open('GET', requestUrl,  true);
				XmlHttphomemid.send(null);
			}
			 return false; 

}

function ChangeControlMidHome()
	{
	
		
		if(XmlHttphomemid.readyState == 4)
		{
			// To make sure valid response is received from the server, 200 means response received is OK
			if(XmlHttphomemid.status == 200)
			{	
			var SPrice,ChangeClass,SChange,NPrice,ChangeClassN,NChange;
			
				var SenNifty = XmlHttphomemid.responseText;
					
			if(SenNifty != "")
			 var arrRow = SenNifty.split("|");
			
						SPrice = arrRow[0];
						ChangeClass  = arrRow[1];
						 SChange  = arrRow[2];
						NPrice  = arrRow[3];	
						ChangeClassN  = arrRow[4];
						NChange  = arrRow[5];
					
				document.getElementById("SPricetxt").innerHTML = SPrice;
				document.getElementById("ChangeClasstxt").innerHTML = ChangeClass;
				document.getElementById("SChangetxt").innerHTML = SChange;
				document.getElementById("NPricetxt").innerHTML = NPrice;
				document.getElementById("ChangeClassNtxt").innerHTML = ChangeClassN;
				document.getElementById("NChangetxt").innerHTML = NChange;
				
				document.body.style.cursor = "auto";
			}
			else
			{
				
					document.getElementById("homemid").innerHTML = "<img src=../App_Themes/images/ajax-loader.gif>";
				
			}
		}
	}
	
var XmlHttphomeNews;
function CreateXmlHttpHomeNews()
{
	try
	{
		XmlHttphomeNews = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttphomeNews = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttphomeNews = null;				
		}
	}
	if(!XmlHttphomeNews && typeof XMLHttpRequest != "undefined")
	{
		XmlHttphomeNews = new XMLHttpRequest();
	}
}

function ShowHomeNewsTxt()
{
 CreateXmlHttpHomeNews();
  document.body.style.cursor = "progress";
    var requestUrl = "AjaxHomeNews.aspx";
     if(XmlHttphomeNews!=null)	
	        {
				XmlHttphomeNews.onreadystatechange = function(){ChangeControlHomeNews()}
				XmlHttphomeNews.open('GET', requestUrl,  true);
				XmlHttphomeNews.send(null);
			}
		 return false; 
}	
	
function ChangeControlHomeNews()
	{
	
		
		if(XmlHttphomeNews.readyState == 4)
		{
			// To make sure valid response is received from the server, 200 means response received is OK
			if(XmlHttphomeNews.status == 200)
			{	
						
				document.getElementById("HomeNews").innerHTML = XmlHttphomeNews.responseText;
				
				document.body.style.cursor = "auto";
			}
			else
			{
				
			document.getElementById("HomeNews").innerHTML = "<img src=../App_Themes/images/ajax-loader.gif>";
				
			}
		}
	}	
	
	var XmlHttGlVolVal;
function CreateXmlHttpGlVolVal()
{
	try
	{
		XmlHttGlVolVal = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttGlVolVal = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttGlVolVal = null;				
		}
	}
	if(!XmlHttGlVolVal && typeof XMLHttpRequest != "undefined")
	{
		XmlHttGlVolVal = new XMLHttpRequest();
	}
}

function GlVoLVal(Exchange)
{

 CreateXmlHttpGlVolVal();
  document.body.style.cursor = "progress";
    var requestUrl = "AjaxGLVolVal.aspx?Exchange="+Exchange;
     if(XmlHttGlVolVal!=null)	
	        {
				XmlHttGlVolVal.onreadystatechange = function(){ChangeControlGlVolVal()}
				XmlHttGlVolVal.open('GET', requestUrl,  true);
				XmlHttGlVolVal.send(null);
			}
		 return false; 
}	
	
function ChangeControlGlVolVal()
	{

		
		if(XmlHttGlVolVal.readyState == 4)
		{
			// To make sure valid response is received from the server, 200 means response received is OK
			if(XmlHttGlVolVal.status == 200)
			{	
				
				document.getElementById("GlVoLVal1").innerHTML = XmlHttGlVolVal.responseText;
			  
				document.body.style.cursor = "auto";
			}
			else
			{
				
			document.getElementById("GlVoLVal").innerHTML = "<img src=../App_Themes/images/ajax-loader.gif>";
				
			}
		}
	}	
	
	
	
	
	
	
	
	
	
	

var m_urls = Array('../CompanyProfile/QuoteFinder.aspx?id=1','../CompanyProfile/MF_Holdings.aspx?id=14','../CompanyProfile/FinanceRatios.aspx?id=7','../CompanyProfile/ChartDisplay.aspx?id=9');
var url;
var containerid="contentarea";
var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""
/*var browser = new Browser();*/
var dragObj = new Object();
dragObj.zIndex = 0;

function GetDataAdvDec()
{
    var requestUrl = "AjaxMktSum.aspx?time="+new Date().getTime();
    ajaxpage('1',requestUrl,'AdvDecTd');
}	
function GetDataSN()
{
    var requestUrl = "AjaxSensexNifty.aspx?time="+new Date().getTime();
    ajaxpage('1',requestUrl,'SensexDataTd');
}	


function ajaxpage(id,url,containerid)
{
document.getElementById(containerid).innerHTML = "<table cellspacing=0 cellpadding=0 width=100%><tr><td height=60></td></tr><tr><td align=center><img src='../App_Themes/images/loading.gif'></td></tr></table>";
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject)
{ // if IE
        try {
            page_request = new ActiveXObject("Msxml2.XMLHTTP")
            } 
        catch (e){
                try{
                    page_request = new ActiveXObject("Microsoft.XMLHTTP")
                }
                catch (e){}
                }
}
else
return false
page_request.onreadystatechange=function()
{
    loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function dragStart(event, id) {

  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 loadpage(page_request, containerid)
{
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
  //alert(page_request.responseText)
    document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}

function GetTalkingStockHot(SecID,SubSec)
	{

		var requestUrl = "TalkingStockAjax.aspx?Sec="+ SecID +"&SubSec="+SubSec+"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
		ajaxpage('1',requestUrl,'TalkingStockTD');
		LoadMarketGlanceData();
	}
	
	function LoadMarketGlanceData() 
	{
			
		    clockTimeoutCorpAnn = setTimeout("GetTalkingStockHot('4,7','38,40,41,42,15')",60000);
		
	}
	
	var XmlHttpTalkingStock;
	function CreateXmlHttpTalkingStock()
{
	try
	{
		XmlHttpTalkingStock = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpTalkingStock = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpTalkingStock = null;				
		}
	}
	if(!XmlHttpTalkingStock && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpTalkingStock = new XMLHttpRequest();
	}
}
  function GetNewsDetail(secId,SubSecId,NewsID,opt)
	{
		var NewsWin = document.getElementById("divNews").style.display='inline';
		var currentDivObj;	
		
			currentDivObj = document.getElementById("TdHomeNews");
			//alert(currentDivObj);
			currentDivObj.innerHTML ="<img src=../App_Themes/images/ajax-loader.gif>"; 
		
		CreateXmlHttpTalkingStock();
		document.body.style.cursor = "progress";
		var requestUrl = "../PopupNewsData.aspx?SecId="+ secId +"&SubSecId="+ SubSecId+"&NewsID="+NewsID+"&timeStamp="+new Date().getTime()+"opt="+opt;
		//alert(requestUrl);
		if(XmlHttpTalkingStock)	{
					XmlHttpTalkingStock.onreadystatechange = function(){getDetailsResp();};
					XmlHttpTalkingStock.open("GET", requestUrl,  true);
					XmlHttpTalkingStock.send(null);					
				}
	}
  function GetNewsDetailHome(secId,SubSecId,NewsID,opt)
    {
        var NewsWin = document.getElementById("divNews").style.display='inline';
        var currentDivObj;	
		
	        currentDivObj = document.getElementById("TdHomeNews");
	        //alert(currentDivObj);
	        currentDivObj.innerHTML ="<img src=../App_Themes/images/ajax-loader.gif>"; 
		
        CreateXmlHttpTalkingStock();
        document.body.style.cursor = "progress";
        var requestUrl = "PopupNewsData.aspx?SecId="+ secId +"&SubSecId="+ SubSecId+"&NewsID="+NewsID+"&timeStamp="+new Date().getTime()+"opt="+opt;
        //alert(requestUrl);
        if(XmlHttpTalkingStock)	{
			        XmlHttpTalkingStock.onreadystatechange = function(){getDetailsResp();};
			        XmlHttpTalkingStock.open("GET", requestUrl,  true);
			        XmlHttpTalkingStock.send(null);					
		        }
    }
	function getDetailsResp()
	{
	
		// To make sure receiving response data from server is completed
		if(XmlHttpTalkingStock.readyState == 4)
		{
			// To make sure valid response is received from the server, 200 means response received is OK
			if(XmlHttpTalkingStock.status == 200)
			{				
				
					document.getElementById("TdHomeNews").innerHTML = XmlHttpTalkingStock.responseText;
				
				document.body.style.cursor = "auto";
			}
			else
			{
				
					document.getElementById("TdHomeNews").innerHTML = "<img src=../App_Themes/images/ajax-loader.gif>";
				
			}
		}
	}
	function Redirect(newid)
{

window.open("News/AllNewsDetails.aspx?Newsid="+newid+"&id=21",'ITI','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=580,height=500,screenX=0,screenY=0,left=210,top=200');

}

function getTickerData(Exchg)
	{	
	//alert(Exchg);	
		CreateXmlHttp();
		document.body.style.cursor = "progress";
		//document.getElementById("MarqueeId").innerHTML = " <img src='App_Themes/images/ajax-loader.gif'>";
		//if(Exchg=="NSE"){document.NseTickImg.src="../images/NSEon.gif";document.BseTickImg.src="../images/BSEoff.gif";}else{document.NseTickImg.src="../images/NSEoff.gif";document.BseTickImg.src="../images/BSEon.gif";}
		var requestUrl = "../CommonControls/AjaxTickerData.aspx?Exchange="+ Exchg +"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
		
		if(XmlHttp){
			XmlHttp.onreadystatechange = function(){getDataResponse(Exchg);};
			XmlHttp.open("GET", requestUrl,  true);
			XmlHttp.send(null);
		}
}
function getDataResponse(Exchg)
{
//alert(XmlHttp.status);	
	if(XmlHttp.readyState == 4)
	{	
	
		if(XmlHttp.status == 200)
		{	
				
		
			var arrCol,Time,Code,CompName,ClPrice,DiffVal,DiffImg,Change;
			var ExchgDet="",stkDet="";
			var MarqueeId = document.getElementById("MarqueeId");
			var TickerData = XmlHttp.responseText;
						
			if(TickerData != "")
			var arrRow = TickerData.split("|");
				for(i=0; i<arrRow.length-1; i++)
				 {
					arrCol = arrRow[i].split("~");
						CompName = arrCol[1];
						ClPrice  = arrCol[2];
						 Change  = arrCol[3];
						DiffVal  = arrCol[4];
						if(DiffVal>0) 
						{
							DiffImg= "<img src='../images/up.gif'>";
							clss = "<span class='Green'>" ;
						}
						else if(DiffVal<0) 
						{							
							DiffImg="<img src='../images/down.gif'>";
							clss = "<span class='Red'>" ;
						}
						else 
						{
							DiffImg= "<img src='../images/eq.gif'>";
							clss = "<span class='Green'>"	;				
						}
						
						//if(i==0)ExchgDet = arrCol[0] +" &nbsp; "+ CompName +": "+ ClPrice +" ["+ DiffVal +"] "+ DiffImg +" &nbsp; ";else stkDet += "<a href='getQuotes.aspx?code="+ arrCol[0] +"' class=TickerLink>" + CompName +"</a>: "+ ClPrice +" ["+ DiffVal +"] "+ DiffImg +" &nbsp; ";    href='../profile/CorpInfo.aspx?id=1&code="+ arrCol[0] +"'
						if(i==0)ExchgDet = "<span class='BlackNormal'>" + arrCol[0] +" &nbsp; "+ CompName +": "+"<span  class=BlackNormal>" + ClPrice+"&nbsp;"+ clss +" ["  +"<b>"+ Change+ "</b>"+"]</span> </span>&nbsp;"+ clss +" ["  +"<b>"+ DiffVal+ "</b>"+"]</span> </span>&nbsp;&nbsp;&nbsp;";else stkDet += "<span class='TickerLink'>" + "<a href='../companyprofile/QuoteFinder.aspx?id=1&Fincode="+arrCol[0]+"'><span  class=BlackNormal>" + CompName +"</span></a>: " + "<span  class=BlackNormal>" + ClPrice +"&nbsp;"+ clss +" [" +"<b>"+ Change+ "</b>"+"]</span></span>&nbsp;"+ clss +" [" +"<b>"+ DiffVal+ "</b>"+"]</span>  &nbsp;</span>&nbsp;";						
						
				}
				
				if(browser.isIE)
					MarqueeId.innerHTML = "<marquee id='maqid' onmouseover='this.stop();' onmouseout='this.start();' trueSpeed scrollAmount='1' scrollDelay='50' direction='left' loop='repeat' width='100%'>" + ExchgDet + stkDet + "</marquee>";
					
				else
				MarqueeId.innerHTML = "<marquee id='maqid' onmouseover='this.stop();' onmouseout='this.start();' trueSpeed scrollAmount='1' scrollDelay='50' direction='left' loop='repeat' width='100%'>" + ExchgDet + stkDet + "</marquee>";
					//MarqueeId.innerHTML = ExchgDet + stkDet;				
				document.body.style.cursor = "auto";
				ExchngTimeClock(Exchg);
		}
		
		//else
			//MarqueeId.innerHTML = "<img src='../CommonImgs/loading1.gif'>";
	}
}

function ExchngTimeClock(Exchg) {
	 var time = new Date()
	 var hour = time.getHours()
	 if (hour >= 10 && hour <= 20)
			  clockTimeoutID = setTimeout("getTickerData('"+ Exchg +"')",600000);
	}
	
	
	function ChangeSpeed(Option)
	{
	
	 var Marq = document.getElementById("maqid");
	 
	 
	 
	 if(Option=="+")
	 {
	 if(Marq.scrollDelay == "10")
	 return;
	 else
	 Marq.scrollDelay = eval(Marq.scrollDelay)-10;
	 
	 }
	 
	 else
	 {
	 if(Marq.scrollDelay == "90")
	 return;
	 else
	 Marq.scrollDelay = eval(Marq.scrollDelay)+10;
	 
	 }
	 
	 if(Marq.scrollDelay == "10")
	 {
	 document.getElementById("ImgUp").style.cursor = "text";
	 document.getElementById("ImgUp").src = "App_Themes/images/plus_disable.gif";
	 }
	 else
	 {
	 document.getElementById("ImgUp").style.cursor = "hand";
	 document.getElementById("ImgUp").src = "App_Themes/images/plus_act.gif";
	 }
	 
	 if(Marq.scrollDelay == "90")
	 {
	 document.getElementById("ImgDown").style.cursor = "text";
	  document.getElementById("ImgDown").src = "App_Themes/images/minus_disable.gif";
	 }
	 else
	 {
	 document.getElementById("ImgDown").style.cursor = "hand";
	 document.getElementById("ImgDown").src = "App_Themes/images/minus_act.gif";
	 }
	 
	 
	}
	var XmlHttpFO;

//Creating object of XMLHTTP For AJAX Method
function CreateXmlHttpNew()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpFO = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpFO = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpFO = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpFO && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpFO = new XMLHttpRequest();
		}
	}
	
	function openNews(NewsID)
    {
    
        //document.getElementById('newsid').value=NewsID;
       	CreateXmlHttpNew();
		document.body.style.cursor = "progress";
		var requestUrl = "../News/GetNews.aspx?timeStamp="+ new Date().getTime() +"&NewsID="+NewsID;
		//alert(requestUrl)
		if(XmlHttpFO)	
		{
		    XmlHttpFO.onreadystatechange = function(){getNewsResp()};
			XmlHttpFO.open("GET", requestUrl,  true);
			XmlHttpFO.send(null);
		}
    }
     function getNewsResp()
    {

	if(XmlHttpFO.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		var td_Id = document.getElementById("divNews").style.display="inline";
		if(XmlHttpFO.status == 200)//
		{
		//alert(XmlHttpFO.responseText);
		
		var mydiv=document.getElementById("TdHomeNews")
//            var filterscheck=mydiv.filters && mydiv.filters.length>0 //check if element supports filter/ has at least 1 filter defined

//            if (filterscheck) //if browser supports filters
//            mydiv.filters[0].apply() //capture initial state of content
//            //mydiv.style.backgroundColor="blue" //change content background to blue (not visible yet)
//            if (filterscheck) //if browser supports filters
//            mydiv.filters[0].play() //play transition to reveal new background

			document.getElementById("TdHomeNews").innerHTML =  XmlHttpFO.responseText;
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}

//Creating object of XMLHTTP For AJAX Method
function CreateXmlHttpForex()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpForex = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpForex = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpForex = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpForex && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpForex = new XMLHttpRequest();
		}
	}

function GetDataForex()
{
	CreateXmlHttpForex();
	
     
      var currentDivObj = document.getElementById("Forexdata");
   
       
        
		currentDivObj.innerHTML ="<img src=App_Themes/images/ajax-loader.gif>";
	document.body.style.cursor = "progress";
	
	var requestUrl = "AjaxForex.aspx?Exchange="+ Math.random();
	
	 //alert(requestUrl) 
	if(XmlHttpForex!=null)	
	        {
				XmlHttpForex.onreadystatechange = function(){ChangeResponseForex()}
				XmlHttpForex.open('GET', requestUrl,  true);
				XmlHttpForex.send(null);
			}
			 return false; 
}	
	
function ChangeResponseForex()
{
   
	// To make sure receiving response data from server is completed
	
	if(XmlHttpForex.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		
		    var td_Id = document.getElementById("Forexdata");
		
	    //alert(XmlHttp.status)
		if(XmlHttpForex.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpForex.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 XmlHttpComResult;

//Creating object of XMLHTTP For AJAX Method
function CreateXmlHttpComResult()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpComResult = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpComResult = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpComResult = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpComResult && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpComResult = new XMLHttpRequest();
		}
	}

function OpenPopUp(FinCode)
{	
    CreateXmlHttpComResult();
	document.body.style.cursor = "progress";
	
	document.getElementById("divNews").style.display = "inline";
	//document.getElementById("TdNews").innerHTML = " <img src='App_Themes/images/ajax-loader.gif'>";
    var requestUrl="../News/CompResMirrDetails.aspx?id=26&FromDate=&FinCode="+FinCode;
	if(XmlHttpComResult)
	{
	    XmlHttpComResult.onreadystatechange = function(){getCompResult();};
		XmlHttpComResult.open("GET", requestUrl,  true);
		XmlHttpComResult.send(null);
	}
}

function getCompResult()
{

	if(XmlHttpComResult.readyState == 4)
	{	

		if(XmlHttpComResult.status == 200)
		{				
			var NewTd = document.getElementById("TdHomeNews");
			var NewData = XmlHttpComResult.responseText;
//			alert(NewTd);
						
			if(NewData != "")
		
				NewTd.innerHTML = NewData;				
				document.body.style.cursor = "auto";
				
		}
		
	}
}

//Company Profile

 function CustomNavigation()
{
    var SearchText = document.getElementById("SmartQuoteCtrl1_txtcomp");
    var ID = document.getElementById("QuoteFinder");
    if(SearchText.value == "" || SearchText.value == "Enter Company Name")
    {
    alert("Please Enter Company Name");
    SearchText.focus;
    }
    else
    {
         if(SearchText.length > 2)
         {
          alert('At Least Enter 3 Char');
          SearchText.focus;
          return false;  
         }
         else
         {
          window.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchText.value+"&id="+ID.value;
          return false;  
         }
    }
}

function rdoEmpty()
{

	if (document.getElementById("SmartQuoteCtrl1_txtcomp").value=="Enter Company Name")
	{
		document.getElementById("SmartQuoteCtrl1_txtcomp").value="";
	}
}

function rdofill()
{
	var TxtSearch=document.getElementById("SmartQuoteCtrl1_txtcomp").value;
	if (TxtSearch=="")
	{
		document.getElementById("SmartQuoteCtrl1_txtcomp").value="Enter Company Name";
	}
}
var XmlHttpGL;
function CreateXmlHttpGL()
{
	try
	{
		XmlHttpGL = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpGL = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpGL = null;				
		}
	}
	if(!XmlHttpGL && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpGL = new XMLHttpRequest();
	}
}

function EquityHome_Change(Opt)
{

	
   // var currentDivObj = document.getElementById("EquHome_Td_Data");
     var More = document.getElementById("More");
      
	document.body.style.cursor = "progress";
	if(Opt=='GAIN')
	{
	    More.href="../Equity/TopGainersAndLosers.aspx?Option=GAIN&EXCHG=BSE&ddlOption=Daily&IndexCtrl=2&id=1&index=0";
    	document.getElementById("lblBSE").innerHTML = "BSE Gainers";
    	document.getElementById("lblNSE").innerHTML = "NSE Gainers";
	    document.getElementById("tdGain").className="SelectTD";
	    document.getElementById("tdLose").className="UnSelectTD";
	    document.getElementById("tdValue").className="UnSelectTD";
	    document.getElementById("tdVolume").className="UnSelectTD";
	}
	if(Opt=='LOSE')
	{   
	 More.href="../Equity/TopGainersAndLosers.aspx?Option=LOSE&EXCHG=BSE&ddlOption=Daily&IndexCtrl=2&id=1&index=0";
	    document.getElementById("lblBSE").innerHTML = "BSE Losers";
    	document.getElementById("lblNSE").innerHTML = "NSE Losers";
	    document.getElementById("tdGain").className="UnSelectTD";
	    document.getElementById("tdLose").className="SelectTD";
	    document.getElementById("tdValue").className="UnSelectTD";
	    document.getElementById("tdVolume").className="UnSelectTD";
	}
	if(Opt=='Val')
	{
	 More.href="../Equity/MostActive.aspx?Option=Value&EXCHG=BSE&ddlOption=Daily&IndexCtrl=2&id=8&index=0";
	    document.getElementById("lblBSE").innerHTML = "BSE Value";
    	document.getElementById("lblNSE").innerHTML = "NSE Value";
	    document.getElementById("tdGain").className="UnSelectTD";
	    document.getElementById("tdLose").className="UnSelectTD";
	    document.getElementById("tdValue").className="SelectTD";
	    document.getElementById("tdVolume").className="UnSelectTD";
	}
	if(Opt=='Vol')
	{
	 More.href="../Equity/MostActive.aspx?Option=Volume&EXCHG=BSE&ddlOption=Daily&IndexCtrl=2&id=8&index=0";
	    document.getElementById("lblBSE").innerHTML = "BSE Volume";
    	document.getElementById("lblNSE").innerHTML = "NSE Volume";
	    document.getElementById("tdGain").className="UnSelectTD";
	    document.getElementById("tdLose").className="UnSelectTD";
	    document.getElementById("tdValue").className="UnSelectTD";
	    document.getElementById("tdVolume").className="SelectTD";
	}
	
	
	var requestUrl = "../Equity/AjaxDataGLVV.aspx?Option="+ Opt ;
	CreateXmlHttpGL();
   // alert(requestUrl)
	if(XmlHttpGL!=null)	
	        {
				XmlHttpGL.onreadystatechange = function(){ChangeControlResponse(Opt,'BSE')}
				XmlHttpGL.open('GET', requestUrl,  true);
				XmlHttpGL.send(null);
			}
			 return false; 
}	
	
function ChangeControlResponse(Opt,Exch)
{
   

	// To make sure receiving response data from server is completed
	
	if(XmlHttpGL.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		var td_Id = document.getElementById("strData");
	//  alert(XmlHttp.status)
		if(XmlHttpGL.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpGL.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 XmlHttpGLE;

	function CreateXmlHttpGLE()
	{
		try
		{
			XmlHttpGLE = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpGLE = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpGLE = null;
					
			}
		}
		if(!XmlHttpGLE && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpGLE = new XMLHttpRequest();
		}
	}


function GetInternationalData()
{
	CreateXmlHttpGLE();
       var currentDivObj = document.getElementById("tdInterIndices");
       
        
		currentDivObj.innerHTML ="<img src=../App_Themes/images/loading.gif>";
	document.body.style.cursor = "progress";
	
	
	var requestUrl = "AjaxInternationalIndices.aspx?timeStamp="+new Date().getTime();
   //alert(requestUrl) 
	if(XmlHttpGLE!=null)	
	        {
				XmlHttpGLE.onreadystatechange = function(){ChangeResponseInternational()}
				XmlHttpGLE.open('GET', requestUrl,  true);
				XmlHttpGLE.send(null);
			}
			 return false; 
}	
	
function ChangeResponseInternational()
{
 
	// To make sure receiving response data from server is completed
	
	if(XmlHttpGLE.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		var td_Id = document.getElementById("tdInterIndices");
	   // alert(XmlHttpGLE.status)
		if(XmlHttpGLE.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpGLE.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 GetBSEAnn(opt)
	{	
	//alert(Exchg);	
		CreateXmlHttpBA();
		document.body.style.cursor = "progress";
		document.getElementById("tdBseAnn").innerHTML = " <img src='../App_Themes/images/loading.gif'>";
		//if(Exchg=="NSE"){document.NseTickImg.src="../images/NSEon.gif";document.BseTickImg.src="../images/BSEoff.gif";}else{document.NseTickImg.src="../images/NSEoff.gif";document.BseTickImg.src="../images/BSEon.gif";}
		var requestUrl = "../Equity/BseAnnAjax.aspx?IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime()+"&Opt="+opt;
		//alert(requestUrl);
		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("tdBseAnn");
			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];
			    }
			}
				
		}
		
		//else
			//MarqueeId.innerHTML = "<img src='../CommonImgs/loading1.gif'>";
	}
}
function id_click(m_id)
 {
 	
 	if(m_id == 1)
 		window.location = m_urls[m_id-1] +"&FinCode="+ f_im_id;
 	else if(m_id == 2) 	    
 	    window.location = m_urls[m_id-1] +"&FinCode="+ f_im_id;
 	else if(m_id == 3)
 		window.location = m_urls[m_id-1] +"&FinCode="+ f_im_id;
 	else if(m_id == 4)
 		window.location = m_urls[m_id-1] +"&FinCode="+ f_im_id;
 
 	else
 		window.location = m_urls[m_id-1] + f_im_id;
  	
 }
 
  function hide_popup()
 {
 	if(m_show == 0)
 	{
 		document.getElementById("popup").style.visibility = "hidden";
 	}
 }


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;
//        }
    }
    
    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 GetBSEAnnInn(srno)
	{	
	
	    document.getElementById("divNews").style.display = "inline";
		CreateXmlHttpBAI();
		document.body.style.cursor = "progress";
		document.getElementById("TdHomeNews").innerHTML = " <img src='../App_Themes/images/loading.gif'>";
		//if(Exchg=="NSE"){document.NseTickImg.src="../images/NSEon.gif";document.BseTickImg.src="../images/BSEoff.gif";}else{document.NseTickImg.src="../images/NSEoff.gif";document.BseTickImg.src="../images/BSEon.gif";}
		var requestUrl = "../Equity/BSEAnnDetailsAjax.aspx?IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime()+"&srno="+srno;
		//alert(requestUrl);
		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("TdHomeNews");
			//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'>";
	}
}

function rdoEmptyeq()
{
 	if (document.getElementById("ctl00_ContentPlaceHolder1_SmartQuoteEq1_txtcomp").value=="Enter Company Name")
	{
		document.getElementById("ctl00_ContentPlaceHolder1_SmartQuoteEq1_txtcomp").value="";
	}
}

function rdofilleq()
{
  	var TxtSearch=document.getElementById("ctl00_ContentPlaceHolder1_SmartQuoteEq1_txtcomp").value;
	if (TxtSearch=="")
	{
		document.getElementById("ctl00_ContentPlaceHolder1_SmartQuoteEq1_txtcomp").value="Enter Company Name";
	}
}

function CustomNavigationeq()
{
    var SearchText = document.getElementById("ctl00_ContentPlaceHolder1_SmartQuoteEq1_txtcomp");
    var ID = document.getElementById("QuoteFinder");
    if(SearchText.value == "" || SearchText.value == "Enter Company Name")
    {
    alert("Please Enter Company Name");
    SearchText.focus;
    }
    else
    {
         if(SearchText.length > 2)
         {
          alert('At Least Enter 3 Char');
          SearchText.focus;
          return false;  
         }
         else
         {
          window.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchText.value+"&id="+ID.value;
          return false;  
         }
    }
}