﻿// JScript File

// JScript File

function LeftHomeTab(Opt)
{
    if(Opt == "Eq")
    {
        document.getElementById("Eq").className = "HomeSelTab";
        document.getElementById("Com").className = "HomeUnSelTab";
        document.getElementById("Mut").className = "HomeUnSelTab";
        document.getElementById("dr").className = "HomeUnSelTab";
        document.getElementById("imgeqlef").src="App_Themes/Common/images/SelLef.gif";
        document.getElementById("imgeqri").src="App_Themes/Common/images/SelRig.gif";
        
        document.getElementById("imgcomlef").src="App_Themes/Common/images/DeSelLef.gif";
        document.getElementById("imgcomri").src="App_Themes/Common/images/DeSelRig.gif";
        
         document.getElementById("imgmutlef").src="App_Themes/Common/images/DeSelLef.gif";
        document.getElementById("imgmutri").src="App_Themes/Common/images/DeSelRig.gif";
        
             document.getElementById("imgdrlef").src="App_Themes/Common/images/DeSelLef.gif";
        document.getElementById("imgdrri").src="App_Themes/Common/images/DeSelRig.gif";
     
        document.getElementById("TrFirst").style.display = "inline";
        document.getElementById("TrSecond").style.display = "none";
        document.getElementById("TrThird").style.display = "none";
          document.getElementById("TrFourth").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("dr").className = "HomeUnSelTab";
        
        document.getElementById("imgcomlef").src="App_Themes/Common/images/SelLef.gif";
        document.getElementById("imgcomri").src="App_Themes/Common/images/SelRig.gif";
        
        document.getElementById("imgeqlef").src="App_Themes/Common/images/DeSelLef.gif";
        document.getElementById("imgeqri").src="App_Themes/Common/images/DeSelRig.gif";
        
      
        
         document.getElementById("imgmutlef").src="App_Themes/Common/images/DeSelLef.gif";
        document.getElementById("imgmutri").src="App_Themes/Common/images/DeSelRig.gif";
        
             document.getElementById("imgdrlef").src="App_Themes/Common/images/DeSelLef.gif";
        document.getElementById("imgdrri").src="App_Themes/Common/images/DeSelRig.gif";
        
        document.getElementById("TrFirst").style.display = "none";
        document.getElementById("TrSecond").style.display = "inline";
        document.getElementById("TrThird").style.display = "none";
          document.getElementById("TrFourth").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("dr").className = "HomeUnSelTab";
        
        document.getElementById("imgmutlef").src="App_Themes/Common/images/SelLef.gif";
        document.getElementById("imgmutri").src="App_Themes/Common/images/SelRig.gif";
        
          document.getElementById("imgcomlef").src="App_Themes/Common/images/DeSelLef.gif";
        document.getElementById("imgcomri").src="App_Themes/Common/images/DeSelRig.gif";
        
        document.getElementById("imgeqlef").src="App_Themes/Common/images/DeSelLef.gif";
        document.getElementById("imgeqri").src="App_Themes/Common/images/DeSelRig.gif";
          document.getElementById("imgdrlef").src="App_Themes/Common/images/DeSelLef.gif";
        document.getElementById("imgdrri").src="App_Themes/Common/images/DeSelRig.gif";
        
      
        
        
        
        document.getElementById("TrFirst").style.display = "none";
        document.getElementById("TrSecond").style.display = "none";
        document.getElementById("TrThird").style.display = "inline";
         document.getElementById("TrFourth").style.display = "none";
    }
    
     if(Opt == "dr")
      {
        
         document.getElementById("Eq").className = "HomeUnSelTab";
        document.getElementById("Com").className = "HomeUnSelTab";
        document.getElementById("Mut").className = "HomeUnSelTab";
        document.getElementById("dr").className = "HomeSelTab";
        
        document.getElementById("imgdrlef").src="App_Themes/Common/images/SelLef.gif";
        document.getElementById("imgdrri").src="App_Themes/Common/images/SelRig.gif";
        
         document.getElementById("imgmutlef").src="App_Themes/Common/images/DeSelLef.gif";
        document.getElementById("imgmutri").src="App_Themes/Common/images/DeSelRig.gif";
        
          document.getElementById("imgcomlef").src="App_Themes/Common/images/DeSelLef.gif";
        document.getElementById("imgcomri").src="App_Themes/Common/images/DeSelRig.gif";
        
        document.getElementById("imgeqlef").src="App_Themes/Common/images/DeSelLef.gif";
        document.getElementById("imgeqri").src="App_Themes/Common/images/DeSelRig.gif";
       
        
        
        
        document.getElementById("TrFirst").style.display = "none";
        document.getElementById("TrSecond").style.display = "none";
        document.getElementById("TrThird").style.display = "none";
        document.getElementById("TrFourth").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");
    
       if(Opt=='GAIN')
	                {
	               // More.href="#";
    	              
	                    document.getElementById("tdGain").className="HomeHeadSelPink";
	                    document.getElementById("tdLose").className="HomeHeadPink";
	                    document.getElementById("tdValue").className="HomeHeadPink";
	                    document.getElementById("tdVolume").className="HomeHeadPink";
	                    
	                    
	                       if (document.getElementById("hdnsensex").value=="NSE")
	                    {
	                    document.getElementById("more1NSE").style.display = "inline";
	                    document.getElementById("more2NSE").style.display = "none";
	                    document.getElementById("more3NSE").style.display = "none";
	                    document.getElementById("more4NSE").style.display = "none";
	                    document.getElementById("more1BSE").style.display = "none";
	                    document.getElementById("more2BSE").style.display = "none";
	                    document.getElementById("more3BSE").style.display = "none";
	                    document.getElementById("more4BSE").style.display = "none";
	                    }
	                    else
	                    {
	                    document.getElementById("more1NSE").style.display = "none";
	                    document.getElementById("more2NSE").style.display = "none";
	                    document.getElementById("more3NSE").style.display = "none";
	                    document.getElementById("more4NSE").style.display = "none";
	                    document.getElementById("more1BSE").style.display = "inline";
	                    document.getElementById("more2BSE").style.display = "none";
	                    document.getElementById("more3BSE").style.display = "none";
	                    document.getElementById("more4BSE").style.display = "none";
	                    }
	                    
	                    
	                }
                if(Opt=='LOSE')
                    {   
                    //More.href="#";
                     
                        document.getElementById("tdGain").className="HomeHeadPink";
                        document.getElementById("tdLose").className="HomeHeadSelPink";
                        document.getElementById("tdValue").className="HomeHeadPink";
                        document.getElementById("tdVolume").className="HomeHeadPink";
                        
                              if (document.getElementById("hdnsensex").value=="NSE")
	                    {
	                    document.getElementById("more1NSE").style.display = "none";
	                    document.getElementById("more2NSE").style.display = "inline";
	                    document.getElementById("more3NSE").style.display = "none";
	                    document.getElementById("more4NSE").style.display = "none";
	                    document.getElementById("more1BSE").style.display = "none";
	                    document.getElementById("more2BSE").style.display = "none";
	                    document.getElementById("more3BSE").style.display = "none";
	                    document.getElementById("more4BSE").style.display = "none";
	                    }
	                    else
	                    {
	                    document.getElementById("more1NSE").style.display = "none";
	                    document.getElementById("more2NSE").style.display = "none";
	                    document.getElementById("more3NSE").style.display = "none";
	                    document.getElementById("more4NSE").style.display = "none";
	                    document.getElementById("more1BSE").style.display = "none";
	                    document.getElementById("more2BSE").style.display = "inline";
	                    document.getElementById("more3BSE").style.display = "none";
	                    document.getElementById("more4BSE").style.display = "none";
	                    }
                        
                    }
	            if(Opt=='Val')
	                {
	               // More.href="#";
	                   
	                    document.getElementById("tdGain").className="HomeHeadPink";
	                    document.getElementById("tdLose").className="HomeHeadPink";
	                    document.getElementById("tdValue").className="HomeHeadSelPink";
	                    document.getElementById("tdVolume").className="HomeHeadPink";
	                    
	                    
	                            if (document.getElementById("hdnsensex").value=="NSE")
	                    {
	                    document.getElementById("more1NSE").style.display = "none";
	                    document.getElementById("more2NSE").style.display = "none";
	                    document.getElementById("more3NSE").style.display = "inline";
	                    document.getElementById("more4NSE").style.display = "none";
	                    document.getElementById("more1BSE").style.display = "none";
	                    document.getElementById("more2BSE").style.display = "none";
	                    document.getElementById("more3BSE").style.display = "none";
	                    document.getElementById("more4BSE").style.display = "none";
	                    }
	                    else
	                    {
	                    document.getElementById("more1NSE").style.display = "none";
	                    document.getElementById("more2NSE").style.display = "none";
	                    document.getElementById("more3NSE").style.display = "none";
	                    document.getElementById("more4NSE").style.display = "none";
	                    document.getElementById("more1BSE").style.display = "none";
	                    document.getElementById("more2BSE").style.display = "none";
	                    document.getElementById("more3BSE").style.display = "inline";
	                    document.getElementById("more4BSE").style.display = "none";
	                    }
	                }
	            if(Opt=='Vol')
	                {
	                     //More.href="#";
	                  
	                    document.getElementById("tdGain").className="HomeHeadPink";
	                    document.getElementById("tdLose").className="HomeHeadPink";
	                    document.getElementById("tdValue").className="HomeHeadPink";
	                    document.getElementById("tdVolume").className="HomeHeadSelPink";
	                    
	                                if (document.getElementById("hdnsensex").value=="NSE")
	                    {
	                    document.getElementById("more1NSE").style.display = "none";
	                    document.getElementById("more2NSE").style.display = "none";
	                    document.getElementById("more3NSE").style.display = "none";
	                    document.getElementById("more4NSE").style.display = "inline";
	                    document.getElementById("more1BSE").style.display = "none";
	                    document.getElementById("more2BSE").style.display = "none";
	                    document.getElementById("more3BSE").style.display = "none";
	                    document.getElementById("more4BSE").style.display = "none";
	                    }
	                    else
	                    {
	                    document.getElementById("more1NSE").style.display = "none";
	                    document.getElementById("more2NSE").style.display = "none";
	                    document.getElementById("more3NSE").style.display = "none";
	                    document.getElementById("more4NSE").style.display = "none";
	                    document.getElementById("more1BSE").style.display = "none";
	                    document.getElementById("more2BSE").style.display = "none";
	                    document.getElementById("more3BSE").style.display = "none";
	                    document.getElementById("more4BSE").style.display = "inline";
	                    }
	                    
	                }
    
    
    
	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");
	
	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";
		}
	}
}

function HomeCommChart(ex,symbol)
{
    var requestUrl="Chart.aspx?sid=" + Math.random() + "&Exchange=MCX&Symbol=GOLD";
	var requestUrl1="../Chart.aspx?sid=" + Math.random() + "&Exchange=MCX&Symbol=SILVER";
	//document.getElementById("ChartComm").src=requestUrl;
}
function HomeCommChart1(ex,symbol)
{
    var requestUrl="Chart.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");
	document.body.style.cursor = "progress";
	
	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/Common/Images/loading.gif'>";
	
	if(Exchg == "BSE")
	{
	    document.getElementById("imgBSE").src = "App_Themes/Common/Images/BSEOn.gif";
	    document.getElementById("imgBSE").style.cursor = "default";
	    document.getElementById("imgNSE").style.cursor = "pointer";
	    document.getElementById("imgNSE").src = "App_Themes/Common/Images/NSEOff.gif";
	}
	else
	{
	    document.getElementById("imgBSE").src = "App_Themes/Common/Images/BSEOff.gif";
	    document.getElementById("imgBSE").style.cursor = "pointer";
	    document.getElementById("imgNSE").style.cursor = "default";
	    document.getElementById("imgNSE").src = "App_Themes/Common/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/Common/Images/up.gif'>";
					clss = "<span class='GreenNormal'>" ;
				}
				else if(DiffVal<0) 
				{							
				    DiffImg="<img src='App_Themes/Common/Images/Down.gif'>";
					clss = "<span class='RedNormal'>" ;
				}
				else 
				{
				    DiffImg= "<img src='App_Themes/Common/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();
	}
}


var SelectedTabsensex = "BSE";
function sensexvalue(val)
{  

    if(val=='BSE')
    {
    
    SelectedTabsensex = "BSE";
  
        document.getElementById('sec_1').style.backgroundColor="#e2e2e2";
        document.getElementById('sec_2').style.backgroundColor="#f0f0f0";
        document.getElementById('imgOnOff1').src="../App_Themes/Common/images/IndexArr.gif";
        document.getElementById('BSEArr').style.display = "inline";
        document.getElementById('NSEArr').style.display = "none";
        //document.getElementById("chart").src="http://content.acesphere.com/Charts/MagnumBse.png";
        document.getElementById("chart").src="http://content.acesphere.com/charts/Magnum1Bse.png?time=" + new Date().getTime() + "";
        document.getElementById("hdnsensex").value ='BSE';
        
        //document.getElementById("Indicator").innerHTML ="Sensex";
        
        
            if(document.getElementById("hdnbyerseller").value=="B")
             {
                document.getElementById("trseller").style.display="none";
                document.getElementById("trbuyer").style.display="inline"; 
                document.getElementById("trsellerNse").style.display="none";
                document.getElementById("trbuyerNse").style.display="none";
                document.getElementById("tdGainBS").className="HomeHeadSelPink";
                document.getElementById("tdLoseBS").className="HomeHeadPink";
                
                 
             }
             else
             {
                document.getElementById("trseller").style.display="inline";
                document.getElementById("trbuyer").style.display="none"; 
                document.getElementById("trsellerNse").style.display="none";
                document.getElementById("trbuyerNse").style.display="none";
                document.getElementById("tdGainBS").className="HomeHeadPink";
                document.getElementById("tdLoseBS").className="HomeHeadSelPink";
                
             }
             
             
              if(document.getElementById("hdnweak").value=="H")
             {
                document.getElementById("trhigh").style.display="inline";
                document.getElementById("trlow").style.display="none"; 
                 document.getElementById("trhighNse").style.display="none";
                document.getElementById("trlowNse").style.display="none"; 
                document.getElementById("tdGainHL").className="HomeHeadSelPink";
                document.getElementById("tdLoseHL").className="HomeHeadPink";
                
                 
             }
             else
             {
                document.getElementById("trhigh").style.display="none";
                document.getElementById("trlow").style.display="inline"; 
                  document.getElementById("trhighNse").style.display="none";
                document.getElementById("trlowNse").style.display="none"; 
                document.getElementById("tdGainHL").className="HomeHeadPink";
                document.getElementById("tdLoseHL").className="HomeHeadSelPink";
                
             }
              ChangeControl(document.getElementById("hdnglv").value, document.getElementById("hdnsensex").value)
        
    }
    else
    {
    
   SelectedTabsensex = "NSE";

    
        document.getElementById('sec_2').style.backgroundColor="#e2e2e2";
        document.getElementById('sec_1').style.backgroundColor="#f0f0f0";
        document.getElementById('imgOnOff2').src= "../App_Themes/Common/images/IndexArr.gif";
        document.getElementById('NSEArr').style.display = "inline";
        document.getElementById('BSEArr').style.display = "none";
        //document.getElementById("chart").src="http://content.acesphere.com/Charts/MagnumNse.png";
        document.getElementById("chart").src="http://content.acesphere.com/charts/Magnum1Nse.png?time=" + new Date().getTime() + "";
        document.getElementById("hdnsensex").value='NSE';
       // document.getElementById("HomeLeftCrtl_OnlyBuyerSeller_hdnbyerseller").value ='NSE';
       
      // document.getElementById("Indicator").innerHTML ="Nifty";
       
           ChangeControl(document.getElementById("hdnglv").value, document.getElementById("hdnsensex").value)
         if(document.getElementById("hdnbyerseller").value=="B")
             {
                document.getElementById("trseller").style.display="none";
                document.getElementById("trbuyer").style.display="none"; 
                document.getElementById("trsellerNse").style.display="none";
                document.getElementById("trbuyerNse").style.display="inline";
                document.getElementById("tdGainBS").className="HomeHeadSelPink";
                document.getElementById("tdLoseBS").className="HomeHeadPink";
                
                 
             }
             else
             {
                document.getElementById("trseller").style.display="none";
                document.getElementById("trbuyer").style.display="none"; 
                document.getElementById("trsellerNse").style.display="inline";
                document.getElementById("trbuyerNse").style.display="none";
                document.getElementById("tdGainBS").className="HomeHeadPink";
                document.getElementById("tdLoseBS").className="HomeHeadSelPink";
                
             }
             
             
                if(document.getElementById("hdnweak").value=="H")
             {
                document.getElementById("trhigh").style.display="none";
                document.getElementById("trlow").style.display="none"; 
                document.getElementById("trhighNse").style.display="inline";
                document.getElementById("trlowNse").style.display="none"; 
                document.getElementById("tdGainHL").className="HomeHeadSelPink";
                document.getElementById("tdLoseHL").className="HomeHeadPink";
                
                 
             }
             else
             {
                document.getElementById("trhigh").style.display="none";
                document.getElementById("trlow").style.display="none"; 
                  document.getElementById("trhighNse").style.display="none";
                document.getElementById("trlowNse").style.display="inline"; 
                document.getElementById("tdGainHL").className="HomeHeadPink";
                document.getElementById("tdLoseHL").className="HomeHeadSelPink";
                
             }
       
    }
    return true;
}


/* 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/Common/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 tempY_New = document.body.scrollTop + 50;
    var NewsWin = document.getElementById("divNews").style.display='inline';
    document.getElementById("divNews").style.top = tempY_New + "px";
	var currentDivObj;	
		
	currentDivObj = document.getElementById("TdNews");
	currentDivObj.innerHTML ="<img src=../App_Themes/Common/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/Common/images/ajax-loader.gif>";
		}
	}
}

function opentdHL(id)
{
      if(id=='1')
      {
      
          
            document.getElementById("trgainerloser").style.display="none";
            document.getElementById("tdminus").style.display="none";
            document.getElementById("tdplus").style.display="inline";
            
            document.getElementById("trhigh").style.display="none";
            document.getElementById("trlow").style.display="none";
            document.getElementById("tdminusHL").style.display="none";
            document.getElementById("tdplusHL").style.display="inline";
      }
     if(id=='2')
      {
              document.getElementById("tdminusBS").style.display="none";
              document.getElementById("tdplusBS").style.display="inline";
              document.getElementById("trbuyer").style.display="none";
              document.getElementById("trgainerloser").style.display="none";
              document.getElementById("tdminus").style.display="none";
              document.getElementById("tdplus").style.display="inline";
              document.getElementById("trhigh").style.display="inline";
              document.getElementById("tdminusHL").style.display="inline";
               document.getElementById("tdplusHL").style.display="none";
              
              document.getElementById("hdnvalue").value="P";
              document.getElementById("hdnvalueHL").value="M";
              document.getElementById("tdGainHL").className="HomeHeadSelPink";
              document.getElementById("tdLoseHL").className="HomeHeadPink";
      }
}




var XmlHttpHighLow;
function CreateXmlHttpHighLow()
	{
		//Creating object of XmlHttp in IE
		try
		{
			XmlHttpHighLow = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{  
				XmlHttpHighLow = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpHighLow = false;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if (!XmlHttpHighLow && typeof XMLHttpRequest!='undefined') 
		{
	        try 
	        {
		        XmlHttpHighLow = new XMLHttpRequest();
	        } 
	        catch (e) 
	        {
		        XmlHttpHighLow=false;
	        }
        }
        if (!XmlHttpHighLow && window.createRequest) 
        {
	        try 
	        {
		        XmlHttpHighLow = window.createRequest();
	        } 
	        catch (e)
	        {
		        XmlHttpHighLow=false;
	        }
        }
	
	}




function ChangeDataHL(id)
  {
        
     var flag =  document.getElementById("hdnvalueHL");
      var Exchange = document.getElementById("hdnsensex").value; 
     var Option = id;
       
         if(flag.value == "p")
         {
             if(id=="H")
             {
//                document.getElementById("trhigh").style.display="inline";
//                document.getElementById("trlow").style.display="none"; 
                document.getElementById("tdGainHL").className="HomeHeadSelPink";
                document.getElementById("tdLoseHL").className="HomeHeadPink";
                
                 
             }
             else
             {
//                document.getElementById("trhigh").style.display="none";
//                document.getElementById("trlow").style.display="inline"; 
                document.getElementById("tdGainHL").className="HomeHeadPink";
                document.getElementById("tdLoseHL").className="HomeHeadSelPink";
                
             }
         }
         else
         {
//                document.getElementById("trhigh").style.display="none";
//                document.getElementById("trlow").style.display="none"; 
            
         }
         
         CreateXmlHttpHighLow();
		document.body.style.cursor = "progress";
		
		var requestUrl = "../AjaxHighLowData.aspx?Exchange="+Exchange+"&Option="+Option+"&flag="+flag.value+"&timeStamp="+new Date().getTime();
	
		if(XmlHttpHighLow){
			XmlHttpHighLow.onreadystatechange = function(){getDataResponseXmlHttpHighLow();};
			XmlHttpHighLow.open("GET", requestUrl,  true);
			XmlHttpHighLow.send(null);
         
         }
         
   
  }


  function getDataResponseXmlHttpHighLow()
{
   
	if(XmlHttpHighLow.readyState == 4)
	{	
	
		if(XmlHttpHighLow.status == 200)
		{				
		
			
			var tdHighLowData = document.getElementById("Td_HighLowData");
			var HighLowData = XmlHttpHighLow.responseText;
			
						
			if(HighLowData != "")
		
				tdHighLowData.innerHTML = HighLowData;				
				document.body.style.cursor = "auto";
				
		}
		
		//else
			//MarqueeId.innerHTML = "<img src='../CommonImgs/loading1.gif'>";
	}
}



function opentd(id)
{
      if(id=='1')
      {
            document.getElementById("trgainerloser").style.display="none";
            document.getElementById("tdminus").style.display="none";
            document.getElementById("tdplus").style.display="inline";
           
      }
      else
      {
            document.getElementById("trgainerloser").style.display="inline";
            document.getElementById("tdminus").style.display="inline";
            document.getElementById("tdplus").style.display="none";
            document.getElementById("tdminusBS").style.display="none";
            document.getElementById("tdplusBS").style.display="inline";
            document.getElementById("trbuyer").style.display="none";
            document.getElementById("trseller").style.display="none";
            document.getElementById("hdnvalue").value="P";
        
            document.getElementById("trhigh").style.display="none";
            document.getElementById("trlow").style.display="none";
            document.getElementById("tdminusHL").style.display="none";
            document.getElementById("tdplusHL").style.display="inline";
              
            document.getElementById("hdnvalue").value="P";
            document.getElementById("hdnvalueHL").value="P";
             
            
            
      }
     
}

 function opentdbuyer(id)
      {
         if (id=='1')
         {
            document.getElementById("tdminusBS").style.display="none";
            document.getElementById("tdplusBS").style.display="inline";
            document.getElementById("trbuyer").style.display="none";
            document.getElementById("trseller").style.display="none";
            
          
         }
         
         if(id=='2')
         {
              
              document.getElementById("tdminusBS").style.display="inline";
              document.getElementById("tdplusBS").style.display="none";
              document.getElementById("trbuyer").style.display="inline";
              document.getElementById("trgainerloser").style.display="none";
              document.getElementById("tdminus").style.display="none";
              document.getElementById("tdplus").style.display="inline";
              document.getElementById("hdnvalue").value="M";
              document.getElementById("tdGainBS").className="HomeHeadSelPink";
              document.getElementById("tdLoseBS").className="HomeHeadPink";
              
              
              document.getElementById("trhigh").style.display="none";
              document.getElementById("trlow").style.display="none";
              document.getElementById("tdminusHL").style.display="none";
              document.getElementById("tdplusHL").style.display="inline";
              document.getElementById("hdnvalueHL").value="P";
              
         }
      }
      
      function ChangeData(id)
      {
        var flag =  document.getElementById("hdnvalue");
       
         if(flag.value=="P")
         {
             if(id=="B")
             {
                document.getElementById("trseller").style.display="none";
                document.getElementById("trbuyer").style.display="inline"; 
                document.getElementById("tdGainBS").className="HomeHeadSelPink";
                document.getElementById("tdLoseBS").className="HomeHeadPink";
                
                 
             }
             else
             {
                document.getElementById("trseller").style.display="inline";
                document.getElementById("trbuyer").style.display="none"; 
                document.getElementById("tdGainBS").className="HomeHeadPink";
                document.getElementById("tdLoseBS").className="HomeHeadSelPink";
                
             }
         }
         else
         {
                document.getElementById("trseller").style.display="none";
                document.getElementById("trbuyer").style.display="none"; 
            
         }
      }
    


function MovePrev()
	{
 	 document.getElementById("GridView1").style.display="inline" ;
     document.getElementById("GridView2").style.display='none';
    }
    
    function MoveNext()
	{
 		
     document.getElementById("GridView1").style.display='none';
     document.getElementById("GridView2").style.display="inline" ;
    }
    
    
    function AddEditProfitMatrix()
{ 
      document.getElementById("ProfitMatrixVieW").style.display="none" ;
      document.getElementById("AddEditView").style.display='inline';
} 
function OpenClose(Str)
	{
	
	if (Str==1)
	{
 	 document.getElementById("ShowGr").style.display="inline" ;
        document.getElementById("Plus").style.display="none" ;
        document.getElementById("Minus").style.display="inline" ;
    }
    
	if (Str==2)
	{
 	 document.getElementById("ShowGr").style.display="none" ;
        document.getElementById("Plus").style.display="inline" ;
        document.getElementById("Minus").style.display="none" ;
    }
    }
    function AddClose()
	{
	 document.getElementById("ProfitMatrixVieW").style.display="inline" ;
     document.getElementById("AddEditView").style.display='none';
   
    }
    
    
    
	function CreateXmlHttpIPO()
{
	try
	{
		XmlHttpIPO = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpIPO = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpIPO = null;				
		}
	}
	if(!XmlHttpIPO && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpIPO = new XMLHttpRequest();
	}
}


function GetIPO()
	{	
	//alert(Exchg);	
		CreateXmlHttpIPO();
		document.body.style.cursor = "progress";
		
		var requestUrl = "IpoAjaxData.aspx?IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
//		alert(requestUrl);
		if(XmlHttpIPO){
			XmlHttpIPO.onreadystatechange = function(){getDataResponseIPO();};
			XmlHttpIPO.open("GET", requestUrl,  true);
			XmlHttpIPO.send(null);
		}
}
function getDataResponseIPO()
{
	if(XmlHttpIPO.readyState == 4)
	{	
	
		if(XmlHttpIPO.status == 200)
		{				
		
			
			var tdIpoData = document.getElementById("IPOdata");
			var IPOData = XmlHttpIPO.responseText;
			//alert(IPOData);
						
			if(IPOData != "")
		
				tdIpoData.innerHTML = IPOData;				
				document.body.style.cursor = "auto";
				
		}
		
		//else
			//MarqueeId.innerHTML = "<img src='../CommonImgs/loading1.gif'>";
	}
}


function CommodityPriceCreateXmlHttp()
	{
	
		//Creating object of XmlHttp in IE
		try
		{
			CommodityPriceXmlHttp = new ActiveXObject("Msxml2.XmlHttp");
		}
		catch(e)
		{
			try
			{
				CommodityPriceXmlHttp = new ActiveXObject("Microsoft.XmlHttp");
			} 
			catch(oc)
			{
				CommodityPriceXmlHttp = null;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if(!CommodityPriceXmlHttp && typeof XmlHttpRequest != "undefined") 
		{
			CommodityPriceXmlHttp = new XmlHttpRequest();
		}
		
	}
	
	
	function CommodityPriceAjaxCall(Commodity)
	{		
		CommodityPriceCreateXmlHttp();
		document.body.style.cursor = "progress";
		/*Setting Symbol value*/
		//document.getElementById("HdnMarket").value = Commodity;
		
		/*Getting Exchange value*/
		//var Market = document.getElementById("HdnMarket");
		
		var requestUrl = "AjaxCommodityPrice.aspx?Symbol="+Commodity+"&Exchange=MCX";
		
		if(CommodityPriceXmlHttp)	
			{
					//alert("hi");
					CommodityPriceXmlHttp.onreadystatechange = function(){CommodityPriceHandleResponse();}; 
					CommodityPriceXmlHttp.open("GET", requestUrl,  true);
					CommodityPriceXmlHttp.send(null);
			}
			
	}	
	
	
	function CommodityPriceHandleResponse()
{

	// To make sure receiving response data from server is completed
	if(CommodityPriceXmlHttp.readyState == 4)
	{
	    	
		// To make sure valid response is received from the server, 200 means response received is OK
		if(CommodityPriceXmlHttp.status == 200)
		{	
		
		  var ArrResponse = CommodityPriceXmlHttp.responseText.split("|");
		  
		   document.getElementById("TdCommodityName").innerHTML = ArrResponse[0];
		  document.getElementById("TdCommoditPrice").innerHTML = ArrResponse[1];
		  document.getElementById("TdCommodityChg").innerHTML = ArrResponse[2];
		  document.getElementById("TdCommodityPerChg").innerHTML = ArrResponse[3];
		  
			document.body.style.cursor = "auto";	
		}
		else
		{
			//ContentTD.innerHTML = "There was a problem retrieving data from the server.";
			
		}
	}
	
}	


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();
	}
}



function CallworldTricker()
	{	
		CreateXmlHttp();
		document.body.style.cursor = "progress";
//		document.getElementById("MarqueeId").innerHTML = " <img src='../App_Themes/Common/images/loading.gif'>";
		
		var requestUrl = "AjaxWorldtricker.aspx";
		if(XmlHttp)
		{
			XmlHttp.onreadystatechange = function(){getDataResponse();};
			XmlHttp.open("GET", requestUrl,  true);
			XmlHttp.send(null);
		}
    }
function getDataResponse()
{
   	var MarqueeId = document.getElementById("tdtricker");
	if(XmlHttp.readyState == 4)
	{	
	
		if(XmlHttp.status == 200)
		{	
				var TickerData = XmlHttp.responseText;
		
		
//				if(browser.isIE)
					MarqueeId.innerHTML = "<marquee id='maqid' onmouseover='this.stop();' onmouseout='this.start();' trueSpeed scrollAmount='1' scrollDelay='30' direction='left' loop='repeat' width='100%'>" + TickerData + "</marquee>";
					
//				else
//					MarqueeId.innerHTML = ExchgDet + stkDet;				
				document.body.style.cursor = "auto";
//				ExchngTimeClock(Exchg);
		}
		
		//else
			//MarqueeId.innerHTML = "<img src='../CommonImgs/loading1.gif'>";
	}
}



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)
        }
	
} 





 function ShowBseGL(ex,glctrl,id)
{
if(id!=1)
{
 if (ex == "")
    {
      //  ex=="NCDEX";
         if (glctrl=="G")
	    {
	         document.getElementById("tdgain").className="GLSelect";
	         document.getElementById("tdlos").className="GLUnselect";
	         ex= document.getElementById("MCXNCD").value
	  
	        document.getElementById("GL").value = "G"
	    }
	    else
	    {
     	      document.getElementById("tdgain").className="GLUnselect";
	          document.getElementById("tdlos").className="GLSelect";
	          document.getElementById("GL").value = "L"
	          ex= document.getElementById("MCXNCD").value
	    }
	 }
	 else
        {
	        if(ex=="FUT")
	        {
                
		        document.getElementById("MCXNCD").value = "FUT"
	        }
	        else
	        {
        	
		        document.getElementById("MCXNCD").value = "OPT"
	        }
        	
        }
    }
   
        CreateXmlHttp();
        //alert(document.getElementById("GL").value);

	var requestUrl="AjaxGainLose.aspx?sid=" + Math.random() + "&Exchg="+ex+"&typeGL="+glctrl;
       	//alert(requestUrl);

	if(XmlHttp)	
			{
					//alert("hi");
					XmlHttp.onreadystatechange = function(){ShowShowGLData(ex,glctrl);}; 
					XmlHttp.open("GET", requestUrl,  true);
					XmlHttp.send(null);
			}
	
}

function ShowShowGLData(ex,glctrl) 
{ 
var ShowGLData ;
if(XmlHttp.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{			
		  if(document.getElementById("ShowGLData")==null)
		  { 
		    
		       ShowBseGL(ex,glctrl);
		  }
		  else
		  {
			 ShowGLData   = document.getElementById("ShowGLData");
		  }
		   //   ShowBseGL(ex,glctrl);
		  
		    var strData = XmlHttp.responseText;
			//alert(strData);
			if(strData != "")
			{
				ShowGLData.innerHTML   =  strData;
			}
			document.body.style.cursor = "auto";	
		}
		else
		{
			ShowGLData.innerHTML = "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}

	
} 


 function ShowVolumeValue(ex,glctrl,id)
{
if(id!='1')
{ 
  if (ex == "")
    {
         if (glctrl=="Val")
	    {
	         document.getElementById("tdval").className="VVSelect";
	         document.getElementById("tdvol").className="VVUnselect";
	         document.getElementById("VV").value = "Val"
	        // document.getElementById("MCXNCD").value=glctrl;
	         ex=document.getElementById("MCXNCD").value;
	    }
	    else
	    {
	         document.getElementById("tdval").className="VVUnselect";
	         document.getElementById("tdvol").className="VVSelect";
	  	     document.getElementById("VV").value = "Vol"
	  	    //  document.getElementById("MCXNCD").value=glctrl;
	  	     ex=document.getElementById("MCXNCD").value;
	    }
	 }
	 else
        {
	        if(ex=="FUT")
	        {
	        
		        document.getElementById("MCXNCD").value = "FUT"
	        }
	        else
	        {
        	
		        document.getElementById("MCXNCD").value = "OPT"
	        }
        	
        }
        
   }

        CreateXmlHttpVV();
	var requestUrl="AjaxValueVol.aspx?sid=" + Math.random() + "&Exchg="+ex+"&typeGL="+glctrl;

	
	
	if(XmlHttpVV)	
			{
					//alert("hi");
					XmlHttpVV.onreadystatechange = function(){ShowVolumeValueData(ex,glctrl);}; 
					XmlHttpVV.open("GET", requestUrl,  true);
					XmlHttpVV.send(null);
			}
	
}

function ShowVolumeValueData(ex,glctrl) 
{ 
var ShowVolumeValueData ;
var strData;
if(XmlHttpVV.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpVV.status == 200)
		{			
			if(document.getElementById("ShowVVData")==null)
			{
			
			  ShowVolumeValue(ex,glctrl);
			}
			else
			{
		       strData = XmlHttpVV.responseText;
		      
		    }
			//alert(strData);
			if(strData != "")
			{
				document.getElementById("ShowVVData").innerHTML   =  strData;
			}
			document.body.style.cursor = "auto";	
		}
		else
		{
			document.getElementById("ShowVVData").innerHTML = "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}

	
}


 
		
function CreateXmlHttpVV()
	{
		//Creating object of XmlHttp in IE
		try
		{
			XmlHttpVV = new ActiveXObject("Msxml2.XmlHttp");
		}
		catch(e)
		{
			try
			{
				XmlHttpVV = new ActiveXObject("Microsoft.XmlHttp");
			} 
			catch(oc)
			{
				XmlHttpVV = null;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if(!XmlHttpVV && typeof XmlHttpRequest != "undefined") 
		{
			XmlHttpVV = new XmlHttpRequest();
		}
	}
	
	function CreateXmlHttpMF()
	{
	  	try
		{
			XmlHttpMF = new ActiveXObject("Msxml2.XmlHttp");
		}
		catch(e)
		{
			try
			{
				XmlHttpMF = new ActiveXObject("Microsoft.XmlHttp");
			} 
			catch(oc)
			{
				XmlHttpMF = null;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if(!XmlHttpMF && typeof XmlHttpRequest != "undefined") 
		{
			XmlHttpMF = new XmlHttpRequest();
		}
	}
	
	
	function loadGLData(Category)
{

	CreateXmlHttpMF()
	document.body.style.cursor = "progress";
	var TopGl;
	var Period;
	if(Period=='')
		Period = "1YEAR";
	if(Category=='')	
		Category="ALL";
	
	var requestUrl = "AjaxFundData.aspx?Period="+ Period +"&Category="+ Category +"&TopGl="+ TopGl;
//alert(Category);
	
	if(XmlHttpMF)	{
				XmlHttpMF.onreadystatechange = function(){GLResponse(TopGl)}
				XmlHttpMF.open("GET", requestUrl,  true);
				XmlHttpMF.send(null);
			}
}	
	
	function GLResponse(TopGl)
{
            var FundPerformance = document.getElementById("TopPerform");
			//alert(FundPerformance);
	// To make sure receiving response data from server is completed
	if(XmlHttpMF.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK

		if(XmlHttpMF.status == 200)
		{	
			var strGlData = XmlHttpMF.responseText
			
				FundPerformance.innerHTML = strGlData;
			 
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			
				FundPerformance.innerHTML = "There was a problem retrieving data from the server.";
			
			
			document.body.style.cursor = "auto";
		}
	}
}	


var tempX_Div = 0;
 var tempY_Div = 0;

 var IE = document.all?true:false
 
 if (!IE) document.captureEvents(Event.MOUSEMOVE)
 document.onmousemove = getMouseXY_Div;
 
 function getMouseXY_Div (e) 
 {
 	if(IE)
 	{
 	 tempY_Div = document.body.scrollTop+50;

 	}
 	else
 	{
 		tempX_Div = e.pageX;
 	    tempY_Div = e.pageY;
 	}
 	return true;
 }
 
 
