﻿// 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 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 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 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 clockTimeoutID;



/* Ajax Function */

function LeftHomeTab(Opt)
{
    if(Opt == "Eq")
    {
        document.getElementById("Eq").className = "HomeSelTab";
        document.getElementById("Com").className = "HomeUnSelTab";
        document.getElementById("Mut").className = "HomeUnSelTab";
        document.getElementById("TrFirst").style.display = "inline";
        document.getElementById("TrSecond").style.display = "none";
        document.getElementById("TrThird").style.display = "none";
        ShowTab("FirstTab");
    }
    
    if(Opt == "Com")
    {
        document.getElementById("Eq").className = "HomeUnSelTab";
        document.getElementById("Com").className = "HomeSelTab";
        document.getElementById("Mut").className = "HomeUnSelTab";
        document.getElementById("TrFirst").style.display = "none";
        document.getElementById("TrSecond").style.display = "inline";
        document.getElementById("TrThird").style.display = "none";
        ShowTab("FirstCommTab");
    }
    
    if(Opt == "Mut")
    {
        document.getElementById("Eq").className = "HomeUnSelTab";
        document.getElementById("Com").className = "HomeUnSelTab";
        document.getElementById("Mut").className = "HomeSelTab";
        document.getElementById("TrFirst").style.display = "none";
        document.getElementById("TrSecond").style.display = "none";
        document.getElementById("TrThird").style.display = "inline";
    }
}

function ShowTab(Opt1)
{
    if(Opt1 == "FirstTab")
    {
        document.getElementById("FirstTab").style.display = "inline";
        document.getElementById("SecondTab").style.display = "none";
        document.getElementById("PlusMinus1").className = "MinusTab";
        document.getElementById("PlusMinus2").className = "PlusTab";
        ChangeControl("GAIN","BSE");
    }
    
    if(Opt1 == "SecondTab")
    {
        document.getElementById("FirstTab").style.display = "none";
        document.getElementById("SecondTab").style.display = "inline";
        document.getElementById("PlusMinus1").className = "PlusTab";
        document.getElementById("PlusMinus2").className = "MinusTab";
        ChangeControl("GAIN","NSE");
    }
    
    if(Opt1 == "FirstCommTab")
    {
        document.getElementById("FirstCommTab").style.display = "inline";
        document.getElementById("SecondCommTab").style.display = "none";
        document.getElementById("PlusMinusComm1").className = "MinusTab";
        document.getElementById("PlusMinusComm2").className = "PlusTab";
    }
    
    if(Opt1 == "SecondCommTab")
    {
        document.getElementById("FirstCommTab").style.display = "none";
        document.getElementById("SecondCommTab").style.display = "inline";
        document.getElementById("PlusMinusComm1").className = "PlusTab";
        document.getElementById("PlusMinusComm2").className = "MinusTab";
    }
}

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 ChangeControl(Opt,Exch)
{
    CreateXmlHttpGLVolVal();
    var currentDivObj = document.getElementById("Td_Data");
	//document.body.style.cursor = "progress";
	var requestUrl = "AjaxDataGLVV.aspx?Option="+ Opt +"&Exchange="+ Exch;
   
	if(XmlHttpGLVolVal!=null)	
	{
	    XmlHttpGLVolVal.onreadystatechange = function(){ChangeControlResponse(Opt,Exch)}
		XmlHttpGLVolVal.open('GET', requestUrl,  true);
		XmlHttpGLVolVal.send(null);
	}
	
	return false; 
}	
	
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");
     var bb =document.getElementById("aa");
	
	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;
	}
	
	switch (Exch)
	{
	    case "BSE":
		    bb.innerHTML="(BSE)";
		    break;
		
	    case "NSE":
		    bb.innerHTML="(NSE)";
	        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";
		}
	}
}

function HomeCommChart(ex,symbol)
{
    var requestUrl="Chart.aspx?sid=" + Math.random() + "&Exchange=MCX&Symbol=GOLD";
	document.getElementById("ChartComm").src=requestUrl;
}
function HomeCommChart1(ex,symbol)
{
    var requestUrl="Chart1.aspx?sid=" + Math.random() + "&Exchange=MCX&Symbol=SILVER";
	document.getElementById("ChartComm1").src=requestUrl;
}

var XmlHttpGLVolValComm;

function CreateXmlHttpGLVolValComm()
{
	try
	{
		XmlHttpGLVolValComm = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpGLVolValComm = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpGLVolValComm = null;				
		}
	}
	
	if(!XmlHttpGLVolValComm && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpGLVolValComm = new XMLHttpRequest();
	}
}

function ChangeControlComm(Opt,Exch)
{
    CreateXmlHttpGLVolValComm();
    var currentDivObj = document.getElementById("Td_DataComm");
	
	
	if(Exch == "MCX")
	{
	    document.getElementById("tdMCX").className = "SelOrange";
	    document.getElementById("tdNCDEX").className = "UnSelGray";
	}
	else
	{
	    document.getElementById("tdMCX").className = "UnSelGray";
	    document.getElementById("tdNCDEX").className = "SelOrange";
	}
	
	var requestUrl = "AjaxDataGLVVComm.aspx?Option="+ Opt +"&Exchange="+ Exch;
	
	if(XmlHttpGLVolValComm!=null)	
	{
	    XmlHttpGLVolValComm.onreadystatechange = function(){ChangeControlResponseComm(Opt,Exch)}
		XmlHttpGLVolValComm.open('GET', requestUrl,  true);
		XmlHttpGLVolValComm.send(null);
	}
	
	return false; 
}	
	
function ChangeControlResponseComm(Opt,Exch)
{
    var Head_tdComm =document.getElementById("HeadingComm");
	
	switch (Opt)
	{
	    case "G":
		    Head_tdComm.innerHTML="Gainers";
		    break;
		
	    case "L":
		    Head_tdComm.innerHTML="Losers";
	        break;
	    
	    case "Volume":
		    Head_tdComm.innerHTML="Volume";
	        break;
	    
	    case "Value":
	        Head_tdComm.innerHTML="Value";
	        break;
	}
	
	if(XmlHttpGLVolValComm.readyState == 4)
	{
		var td_IdComm = document.getElementById("Td_DataComm");
		
		if(XmlHttpGLVolValComm.status == 200)//
		{
			td_IdComm.innerHTML =  XmlHttpGLVolValComm.responseText;
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_IdComm.innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}

var XmlHttpTicker;

function CreateXmlHttpTicker()
{
	try
	{
		XmlHttpTicker = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpTicker = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpTicker = null;				
		}
	}
	
	if(!XmlHttpTicker && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpTicker = new XMLHttpRequest();
	}
}

function getTickerData(Exchg)
{	
    CreateXmlHttpTicker();
	//document.body.style.cursor = "progress";
	document.getElementById("MarqueeId").innerHTML = " <img src='App_Themes/Seeta/Images/loading.gif'>";
	
	if(Exchg == "BSE")
	{
	    document.getElementById("imgBSE").src = "App_Themes/Seeta/Images/BSEOn.gif";
	    document.getElementById("imgBSE").style.cursor = "default";
	    document.getElementById("imgNSE").style.cursor = "pointer";
	    document.getElementById("imgNSE").src = "App_Themes/Seeta/Images/NSEOff.gif";
	}
	else
	{
	    document.getElementById("imgBSE").src = "App_Themes/Seeta/Images/BSEOff.gif";
	    document.getElementById("imgBSE").style.cursor = "pointer";
	    document.getElementById("imgNSE").style.cursor = "default";
	    document.getElementById("imgNSE").src = "App_Themes/Seeta/Images/NSEOn.gif";
	}
	
	var requestUrl = "AjaxTickerData.aspx?Exchange="+ Exchg +"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
		
	if(XmlHttpTicker)
	{
	    XmlHttpTicker.onreadystatechange = function(){getDataResponse(Exchg);};
		XmlHttpTicker.open("GET", requestUrl,  true);
		XmlHttpTicker.send(null);
	}
}

function getDataResponse(Exchg)
{
    if(XmlHttpTicker.readyState == 4)
	{	
	    if(XmlHttpTicker.status == 200)
		{	
			var arrCol,Time,Code,CompName,ClPrice,DiffVal,DiffImg;
			var ExchgDet="",stkDet="";
			var MarqueeId = document.getElementById("MarqueeId");
			var TickerData = XmlHttpTicker.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];
				DiffVal  = arrCol[3];
				
				if(DiffVal>0) 
				{
				    DiffImg= "<img src='App_Themes/Seeta/Images/up.gif'>";
					clss = "<span class='GreenNormal'>" ;
				}
				else if(DiffVal<0) 
				{							
				    DiffImg="<img src='App_Themes/Seeta/Images/Down.gif'>";
					clss = "<span class='RedNormal'>" ;
				}
				else 
				{
				    DiffImg= "<img src='App_Themes/Seeta/Images/Equl.gif'>";
					clss = "<span class='GreenNormal'>"	;				
				}
				
				if(i==0)ExchgDet = "<span class='BlackNormal'>" + arrCol[0] +" &nbsp; "+ CompName +": "+"<span  class=BlackNormal>" + ClPrice+"&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>"+ DiffVal+ "</b>"+"]</span>  &nbsp;</span>&nbsp;";						
			}
			
			if(Exchg == "BSE")
			{
			    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>";
			}    
							
			document.body.style.cursor = "auto";
		}
	}
}


/* Get Quotes */

function Searchempty()
{
    if (document.getElementById("txtCompany").value=="Company Name")
    {
        document.getElementById("txtCompany").value="";
    }
}

function Searchfill()
{
    var getquote=document.getElementById("txtCompany").value;
    
    if (getquote=="")
    {
        document.getElementById("txtCompany").value="Company Name";
    }
}	
        
function QuoteEnterScript(e,id)
{
    if(e.keyCode==13)	
    {
        var Scripid = document.getElementById(id);
        Scripid.click();
    }
}
        
function SearchCompany()
{
    var SearchTxt = document.getElementById("txtCompany").value;
    
    var Id = document.getElementById("ddlQuote").value;	
    		
    if(SearchTxt =="" || SearchTxt=="Company Name")
    {
        alert("Please enter company name ..!!!");
        document.getElementById("txtCompany").value="";
        document.getElementById("txtCompany").focus();
        return false;
    }
    else
    {
        var ddlQuote = document.getElementById("ddlQuote").value
        
        if(ddlQuote=="1")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=1";
        } 
        
        if(ddlQuote=="2")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=2";
        }  
        
        if(ddlQuote=="3")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=3";
        }
        
        if(ddlQuote=="4")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=4";
        } 
        
        if(ddlQuote=="5")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=5";
        }  
        
        if(ddlQuote=="6")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=6";
        }  
        
        if(ddlQuote=="7")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=7";
        } 
        
        if(ddlQuote=="8")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=8";
        } 
        
        if(ddlQuote=="9")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=9";
        } 
        
        if(ddlQuote=="10")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=10";
        } 
        
        if(ddlQuote=="11")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=11";
        } 
        
        if(ddlQuote=="12")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=12";
        } 
        
        if(ddlQuote=="13")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=13";
        } 
        
        if(ddlQuote=="14")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=14";
        } 
        
        if(ddlQuote=="15")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=15";
        } 
    }
}

function Searchempty()
{
	if (document.getElementById("txtCompany").value=="Company Name")
	{
		document.getElementById("txtCompany").value="";
	}
}

function CreateXmlHttpNews()
{
	try
	{
		XmlHttpNews = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpNews = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpNews = null;				
		}
	}
	
	if(!XmlHttpNews && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpNews = new XMLHttpRequest();
	}
}

/* News Ctrl */

function NewsFunction(Opt)
{
    if(Opt == "1")
    {
        GetNewsHot('4','38');
    }
    
    if(Opt == "2")
    {
        GetNewsHot('4','40');
    }
    
    if(Opt == "3")
    {
        GetNewsHot('4','41');
    }
    
    if(Opt == "4")
    {
        GetNewsHot('4','42');
    }
    
    if(Opt == "5")
    {
        GetNewsHot('6','12,13,14,45');
    }
    
    if(Opt == "6")
    {
        GetNewsHot('7','15');
    }
    
    if(Opt == "7")
    {
        GetNewsHot('5','23');
    }
  
    if(Opt == "8")
    {
        GetNewsHot('5','36');
        
    }
    
    if(Opt == "9")
    {
        GetNewsHot('9','22');
    }
}

function GetNewsHot(SecID,SubSec)
{	
    
    CreateXmlHttpNews();
	//document.body.style.cursor = "progress";
	document.getElementById("NewTd").innerHTML = " <img src='App_Themes/Seeta/Images/loading.gif'>";
	
	var requestUrl = "HotnewsAjax.aspx?Sec="+ SecID +"&SubSec="+SubSec+"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
	
	if(XmlHttpNews)
	{
	    XmlHttpNews.onreadystatechange = function(){getDataResponseHot();};
		XmlHttpNews.open("GET", requestUrl,  true);
		XmlHttpNews.send(null);
	}
}

function getDataResponseHot()
{
    if(XmlHttpNews.readyState == 4)
	{	
	    if(XmlHttpNews.status == 200)
		{				
		    var NewTd = document.getElementById("NewTd");
			var NewData = XmlHttpNews.responseText;
						
			if(NewData != "")
				NewTd.innerHTML = NewData;				
			document.body.style.cursor = "auto";
		}
	}
}

function CreateXmlHttpPop()
{
    //Creating object of XMLHTTP in IE
	try
	{
		XmlHttpPop= new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try
		{
			XmlHttpPop = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttpPop = null;	
		}
	}
	
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttpPop && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttpPop = new XMLHttpRequest();
	}
}
	
function GetNewsDetail(secId,SubSecId,NewsID,opt)
{
    var NewsWin = document.getElementById("divNews").style.display='inline';
	var currentDivObj;	
		
	currentDivObj = document.getElementById("TdNews");
	currentDivObj.innerHTML ="<img src=App_Themes/Seeta/Images/loading.gif>"; 
	CreateXmlHttpPop();
	//document.body.style.cursor = "progress";
	
	var requestUrl = "PopupNewsData.aspx?SecId="+ secId +"&SubSecId="+ SubSecId+"&NewsID="+NewsID+"&timeStamp="+new Date().getTime()+"opt="+opt;

	if(XmlHttpPop)	
	{
	    XmlHttpPop.onreadystatechange = function(){getDetailsResp();};
		XmlHttpPop.open("GET", requestUrl,  true);
		XmlHttpPop.send(null);					
	}
}
	
function getDetailsResp()
{
    // To make sure receiving response data from server is completed
	if(XmlHttpPop.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpPop.status == 200)
		{				
		    document.getElementById("TdNews").innerHTML = XmlHttpPop.responseText;
			document.body.style.cursor = "auto";
		}
		else
		{
		    document.getElementById("NewsId").innerHTML = "<img src=App_Themes/Seeta/Images/loading.gif>";
		}
	}
}

/* Fund Performance */

var XmlHttpCat;
var XmlHttpCat1;

function CreateXmlHttpCat()
{
    //Creating object of XMLHTTP in IE
	try
	{
		XmlHttpCat= new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try
		{
			XmlHttpCat = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttpCat = null;	
		}
	}
	
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttpCat && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttpCat = new XMLHttpRequest();
	}
}

function CreateXmlHttpCat1()
{
    //Creating object of XMLHTTP in IE
	try
	{
		XmlHttpCat1= new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try
		{
			XmlHttpCat1 = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttpCat1 = null;	
		}
	}
	
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttpCat1 && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttpCat1 = new XMLHttpRequest();
	}
}


function Category()
{
    CreateXmlHttpCat();
    CreateXmlHttpCat1();
    
    var Category = document.getElementById("LeftHomeCtrl1_TopBottomPerformance1_ddlCategoryHome");
    var TxtCat = document.getElementById("LeftHomeCtrl1_TopBottomPerformance1_txtCat");
    
    TxtCat.value= Category.value;
    CategoryTop(TxtCat.value);
    CategoryBottom(TxtCat.value);
}

function CategoryTop(TxtCatTop)
{
    CreateXmlHttpCat();
    //document.body.style.cursor = "progress";
    
    var requestUrl = "AjaxDataPerform.aspx?TxtCat="+ TxtCatTop;
    
    if(XmlHttpCat!=null)	
	{
	    XmlHttpCat.onreadystatechange = function(){ChangeControlResponseCat()}
		XmlHttpCat.open('GET', requestUrl,  true);
		XmlHttpCat.send(null);
	}
	
	return false; 
}

function ChangeControlResponseCat()
{
	if(XmlHttpCat.readyState == 4)
	{
		var TopPerform = document.getElementById("LeftHomeCtrl1_TopBottomPerformance1_TopPerform");
		
		if(XmlHttpCat.status == 200)//
		{
			TopPerform.innerHTML =  XmlHttpCat.responseText;
			document.body.style.cursor = "auto";		
		}
		else
		{
			TopPerform.innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}

function CategoryBottom(TxtCatBottom)
{
    CreateXmlHttpCat1();
  //  document.body.style.cursor = "progress";
    var requestUrl = "AjaxDataPerformBottom.aspx?TxtCat="+ TxtCatBottom;
    
    if(XmlHttpCat1!=null)	
	{
	    XmlHttpCat1.onreadystatechange = function(){ChangeControlResponseCat1()}
		XmlHttpCat1.open('GET', requestUrl,  true);
		XmlHttpCat1.send(null);
	}
	
	return false; 
}

function ChangeControlResponseCat1()
{
	if(XmlHttpCat1.readyState == 4)
	{
        var BottomPerform = document.getElementById("LeftHomeCtrl1_TopBottomPerformance1_BottomPerform");
		
		if(XmlHttpCat1.status == 200)//
		{
			BottomPerform.innerHTML =  XmlHttpCat1.responseText;
			document.body.style.cursor = "auto";		
		}
		else
		{
			BottomPerform.innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}

/* IPO Snap Shot */ 

var XmlHttpSnap;

function CreateXmlHttpSnap()
{
    try
	{
	    XmlHttpSnap= new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try
		{
		    XmlHttpSnap = new ActiveXObject("Microsoft.XMLHTTP");
		}    
		catch(oc)
		{
		    XmlHttpSnap = null;	
		}
	}
	
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttpSnap && typeof XMLHttpRequest != "undefined") 
	{
	    XmlHttpSnap = new XMLHttpRequest();
	}
}
    
function desc_popup(FinCd)
{
    var NewsWin = document.getElementById("divNews").style.display='inline';
	var currentDivObj;	
		
	currentDivObj = document.getElementById("TdNews");
	currentDivObj.innerHTML ="<img src=../App_Themes/Seeta/Images/loading.gif>"; 
	CreateXmlHttpSnap();
//	document.body.style.cursor = "progress";
	
	var requestUrl = "PopUpDescription.aspx?FinCode="+ FinCd;
	
	if(XmlHttpSnap)	
	{
	    XmlHttpSnap.onreadystatechange = function(){getDetailsSnap();};
		XmlHttpSnap.open("GET", requestUrl,  true);
		XmlHttpSnap.send(null);					
	}
}
    
function getDetailsSnap()
{
    // To make sure receiving response data from server is completed
	if(XmlHttpSnap.readyState == 4)
	{
	    // To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpSnap.status == 200)
		{				
		    document.getElementById("TdNews").innerHTML = XmlHttpSnap.responseText;
			document.body.style.cursor = "auto";
		}
		else
		{
		    document.getElementById("NewsId").innerHTML = "<img src=../App_Themes/Seeta/Images/loading.gif>";
		}
	}
}
function showmenu_mover6()

{ 
document.getElementById("ADR").className = "ControlBackwhite";
}
function showmenu_mover5()

{ 
document.getElementById("Advance").className = "ControlBackwhite";
}
function showmenu_mover4()

{ 
document.getElementById("ValVol").className = "ControlBackwhite";
}

function showmenu_mover3()

{ 
document.getElementById("Board").className = "ControlBackwhite";
}
function showmenu_mover2()

{ 
document.getElementById("Bulk").className = "ControlBackwhite";
}

function showmenu_mover1()

{
document.getElementById("Buyer").className = "ControlBackwhite";
}

function showmenu_mout6()
{
   document.getElementById("ADR").className = "ControlBackText";
}
function showmenu_mout5()
{
 document.getElementById("Advance").className = "ControlBackText";
}
function showmenu_mout4()
{
   document.getElementById("ValVol").className = "ControlBackText";
}
function showmenu_mout3()
{
   document.getElementById("Board").className = "ControlBackText";
}
function showmenu_mout2()
{ 
   document.getElementById("Bulk").className = "ControlBackText";
}

function showmenu_mout1()
{
document.getElementById("Buyer").className = "ControlBackText";
}


/* Flash Fix*/ 

function FlashPosition()
{
    var x=screen.width;
    var rightout=x-1120;
    var rightpos=rightout/2;
    document.getElementById("fixmetoo").style.right=rightpos;
}

//GainerLoser//
//function LookUpData(str,typ)
//{ 
////alert(str);

//        if (str=="FUT")
//        {
//        	
//            
//        document.getElementById("tdfuture").className="FOselect" 
//        document.getElementById("tdoption").className="FOUnselect"
//	        
//	        ShowVolumeValue('FUT',document.getElementById("VV").value);
//	        ShowBseGL('FUT', document.getElementById("GL").value)
//        }
//        else
//        {
//        //	alert('F');

//         document.getElementById("tdfuture").className="FOUnselect" 
//         document.getElementById("tdoption").className="FOselect"
//	       
//	        ShowVolumeValue('OPT',document.getElementById("VV").value);
//	        ShowBseGL('OPT',document.getElementById("GL").value)
//        }
//	
//} 



 /*Home News Control Start*/
 /* Home News  */ 

var XmlHttpHomeNews;

function CreateXmlHttpHomeNews()
{
    try
	{
	    XmlHttpHomeNews= new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try
		{
		    XmlHttpHomeNews = new ActiveXObject("Microsoft.XMLHTTP");
		}    
		catch(oc)
		{
		    XmlHttpHomeNews = null;	
		}
	}
	
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttpHomeNews && typeof XMLHttpRequest != "undefined") 
	{
	    XmlHttpHomeNews = new XMLHttpRequest();
	}
}
    
function NewsData(SecID,SubSec,id)
{
	ChangeTopNewsTab(id);
	
	currentDivObj = document.getElementById("HomeNewsData");
	currentDivObj.innerHTML ="<img style='padding-top:50px;' src=App_Themes/CommonTheme/images/loader.gif>"; 
	CreateXmlHttpHomeNews();
	//document.body.style.cursor = "progress";
	
	//var requestUrl = "HotnewsAjax.aspx?id="+ id;
	var requestUrl = "HotnewsAjax.aspx?Sec="+ SecID +"&SubSec="+SubSec+"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
	
	if(XmlHttpHomeNews)	
	{
	
	    XmlHttpHomeNews.onreadystatechange = function(){GetNewsData();};
		XmlHttpHomeNews.open("GET", requestUrl,  true);
		XmlHttpHomeNews.send(null);		
			
	}
}
    
function GetNewsData()
{
    // To make sure receiving response data from server is completed
	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("HomeNewsData").innerHTML = XmlHttpHomeNews.responseText;
			document.body.style.cursor = "auto";
		}
		else
		{
		    document.getElementById("HomeNewsData").innerHTML = "<img src=../App_Themes/CommonTheme/images/loader.gif>"; 
		}
	}
}



function ChangeTopNewsTab(id)
    {
     if(id == "CompanyNews")
    {
    document.getElementById("CompanyNews").className = "HomeNewsSubSelTab";
    document.getElementById("Derivatives").className = "HomeNewsSubUnSelTab";
    document.getElementById("Commodities").className= "HomeNewsSubUnSelTab";
    document.getElementById("MutualFund").className= "HomeNewsSubUnSelTab";
    document.getElementById("IPO").className= "HomeNewsSubUnSelTab";
    
    
    }
    else if(id == "Derivatives")
    {
    
     document.getElementById("CompanyNews").className = "HomeNewsSubUnSelTab";
    document.getElementById("Derivatives").className = "HomeNewsSubSelTab";
    document.getElementById("Commodities").className= "HomeNewsSubUnSelTab";
    document.getElementById("MutualFund").className= "HomeNewsSubUnSelTab";
    document.getElementById("IPO").className= "HomeNewsSubUnSelTab";
    }
    else if(id == "Commodities")
    {
    document.getElementById("CompanyNews").className = "HomeNewsSubUnSelTab";
    document.getElementById("Derivatives").className = "HomeNewsSubUnSelTab";
    document.getElementById("Commodities").className= "HomeNewsSubSelTab";
    document.getElementById("MutualFund").className= "HomeNewsSubUnSelTab";
    document.getElementById("IPO").className= "HomeNewsSubUnSelTab";
    }
    else if(id == "MutualFund")
    {
   document.getElementById("CompanyNews").className = "HomeNewsSubUnSelTab";
    document.getElementById("Derivatives").className = "HomeNewsSubUnSelTab";
    document.getElementById("Commodities").className= "HomeNewsSubUnSelTab";
    document.getElementById("MutualFund").className= "HomeNewsSubSelTab";
    document.getElementById("IPO").className= "HomeNewsSubUnSelTab";
    }
     else if(id == "IPO")
    {
      document.getElementById("CompanyNews").className = "HomeNewsSubUnSelTab";
    document.getElementById("Derivatives").className = "HomeNewsSubUnSelTab";
    document.getElementById("Commodities").className= "HomeNewsSubUnSelTab";
    document.getElementById("MutualFund").className= "HomeNewsSubUnSelTab";
    document.getElementById("IPO").className= "HomeNewsSubSelTab";
    }
     else if(id == "PreSession")
    {
    document.getElementById("PreSession").className = "HomeNewsSubSelTab";
    document.getElementById("MidSession").className = "HomeNewsSubUnSelTab";
    document.getElementById("EndSession").className= "HomeNewsSubUnSelTab";
    }
     else if(id == "MidSession")
    {
    document.getElementById("PreSession").className = "HomeNewsSubUnSelTab";
    document.getElementById("MidSession").className = "HomeNewsSubSelTab";
    document.getElementById("EndSession").className= "HomeNewsSubUnSelTab";
    
    }
      else if(id == "EndSession")
    {
    document.getElementById("PreSession").className = "HomeNewsSubUnSelTab";
    document.getElementById("MidSession").className = "HomeNewsSubUnSelTab";
    document.getElementById("EndSession").className= "HomeNewsSubSelTab";
    
    }
    
    
    
    }
  /*Home News Control End*/
  
  
  function AttachTicker()
{	
	 window.opener.document.getElementById("DetachTD").style.display="";	 
	 self.close();
}

//DetachTicker
function DetachTicker()
{	
	 
	 document.getElementById("DetachTD").style.display="none";
//alert("dip");
	 var newWin=window.open("AttachTicker.aspx",'Daga','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=710px,height=3px,screenX=0,screenY=0,left=50,top=50');	
	 newWin.focus();	 
}



/***************************************************/

function CreateXmlHttpFII()
{
	try
	{
		XmlHttpFII = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpFII = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpFII = null;				
		}
	}
	if(!XmlHttpFII && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpFII = new XMLHttpRequest();
	}
}


function GetFIIMF(Type)
	{	
	
		CreateXmlHttpFII();
	//	document.body.style.cursor = "progress";
		//alert(Type);
		var requestUrl = "FIIMFAjax.aspx?Type="+ Type +"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
		//alert(requestUrl);
		if(XmlHttpFII){
			XmlHttpFII.onreadystatechange = function(){getDataResponseFIIMF(Type);};
			XmlHttpFII.open("GET", requestUrl,  true);
			XmlHttpFII.send(null);
		}
}
function getDataResponseFIIMF(Type)
{
	if(XmlHttpFII.readyState == 4)
	{	
	
		if(XmlHttpFII.status == 200)
		{				
		
		if(Type == "MF")
			{
				var FIIMF = document.getElementById("FIIMF");
			}
			else
			{
			var FIIMF = document.getElementById("FII_Activites");
			}
			
			var FIIMFData = XmlHttpFII.responseText;
			//alert(NewData);
		
				FIIMF.innerHTML = FIIMFData;				
				document.body.style.cursor = "auto";
				
		}

	}
}
