﻿// JScript File

// JScript File

function chart_onclick()
{

window.open("static/popup.aspx",'image','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=600,height=425,=screenX=0,screenY=0,left=210,top=200');
}

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");
    var More = document.getElementById("More") ;
       if(Opt=='GAIN')
	                {
	              
	             
    	                document.getElementById("hdnglv").value="GAIN";
    	              //  More.href="Equity/TopGainersAndLosers.aspx?Option=GAIN&EXCHG="+Exch+"&id=1&index=0";
	                        document.getElementById("tdGain1").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')
                    {   
                 
                 
                        document.getElementById("hdnglv").value="LOSE";
                        //More.href="Equity/TopGainersAndLosers.aspx?id=1&Option=LOSE&EXCHG="+Exch+"&Period=Daily&Group=&Indices=2&IsAll=";
                        document.getElementById("tdGain1").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')
	                {
	             
	                    document.getElementById("hdnglv").value="Val";
	             //More.href="Equity/MostActive.aspx?id=8&Option=Value&EXCHG="+Exch+"&Group=&Indices=&IsAll=";
	                    document.getElementById("tdGain1").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')
	                {
	             
	                    document.getElementById("hdnglv").value="Vol";
	               //More.href="Equity/MostActive.aspx?id=8&Option=Volume&EXCHG="+Exch+"&Group=&Indices=&IsAll=";
	                    document.getElementById("tdGain1").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="+ document.getElementById("hdnsensex").value;
  
	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";
		}
	}
}




/* 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();
	}
}



function sensexvalue(val)
{
    if(val=='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/Airhant1Bse.png?time=" + new Date().getTime() + "";
        document.getElementById("hdnsensex").value ='BSE';
        
        
            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
    {
        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/Airhant1Nse.png?time=" + new Date().getTime() + "";
        document.getElementById("hdnsensex").value='NSE';
       // document.getElementById("HomeLeftCrtl_OnlyBuyerSeller_hdnbyerseller").value ='NSE';
       
         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 == "21")
    {
        GetNewsHot('4','38');
    }
    if(Opt == "22")
    {
        GetNewsHot('4','40');
    }
    if(Opt == "23")
    {
        GetNewsHot('4','41');
    }
    if(Opt == "24")
    {
        GetNewsHot('4','42');
    }
    if(Opt == "25")
    {
        GetNewsHot('6','12,13,14,45');
    }
    if(Opt == "26")
    {
        GetNewsHot('7','15');
    }
    if(Opt == "27")
    {
        GetNewsHot('5','23');
    }
    if(Opt == "28")
    {
        GetNewsHot('5','36');
    }
    if(Opt == "30")
    {
        GetNewsHot('9','22');
    }
}

function GetNewsHot(SecID,SubSec)
{	
//alert(SecID,SubSec);
    CreateXmlHttpNews();
	document.body.style.cursor = "progress";
	document.getElementById("NewTd").innerHTML = " <img src='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=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";
      }
}

function ChangeDataHL(id)
  {
        
     var flag =  document.getElementById("hdnvalueHL");
     document.getElementById("hdnweak").value=id;
     
   
         if(flag.value == "p")
         {
          if(  document.getElementById("hdnsensex").value =='BSE')
           {
                  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";
                    
                 }
           }
           else
           {
                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";
                
                }
           }
         }
         else
         {
                document.getElementById("trhigh").style.display="none";
                document.getElementById("trlow").style.display="none"; 
                document.getElementById("trhighNse").style.display="none";
                document.getElementById("trlowNse").style.display="none"; 
         }
   
  }

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");
        
        document.getElementById("hdnbyerseller").value=id;
         if(flag.value=="P")
         {
           if(  document.getElementById("hdnsensex").value =='BSE')
           {
                 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";
                    
                 }
             }
            else
            {
                 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";
                    
                 }
            } 
             
         }
         else
         {
                document.getElementById("trseller").style.display="none";
                document.getElementById("trbuyer").style.display="none"; 
                document.getElementById("trsellerNse").style.display="none";
                document.getElementById("trbuyerNse").style.display="none"; 
            
         }
      }
    


function MovePrev()
	{
 //	 document.getElementById("GridView1").style.display="inline" ;
  //   document.getElementById("GridView2").style.display='none';
  
    document.getElementById("ShowPrev").style.display="none";
    document.getElementById("ShowNext").style.display="inline";
      MatrixGridData(1);
  
    }
    
    function MoveNext()
	{
 		
  //   document.getElementById("GridView1").style.display='none';
  //   document.getElementById("GridView2").style.display="inline" ;
  
      document.getElementById("ShowPrev").style.display="inline";
      document.getElementById("ShowNext").style.display="none";
      MatrixGridData(2);
  
    }
    
    
    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 CreateXmlHttpVolVal()
	{
		//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";
		}
	}
}	

/* Forex Ctrl */

var XmlHttpForex;

function CreateXmlHttpForex()
{
    try
	{
		XmlHttpForex = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpForex = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttpForex = null;
		}
	}
	if(!XmlHttpForex && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttpForex = new XMLHttpRequest();
	}
}
function GetDataForex()
{
    CreateXmlHttpForex();
    var currentDivObj = document.getElementById("Forexdata");
	currentDivObj.innerHTML ="<img src=loading.gif>";
	document.body.style.cursor = "progress";
	var requestUrl = "AjaxForex.aspx?Exchange="+ Math.random();
	if(XmlHttpForex!=null)	
	{
	    XmlHttpForex.onreadystatechange = function(){ChangeResponseForex()}
		XmlHttpForex.open('GET', requestUrl,  true);
		XmlHttpForex.send(null);
	}
	return false; 
}	
	
function ChangeResponseForex()
{
	if(XmlHttpForex.readyState == 4)
	{
	    var td_Id = document.getElementById("Forexdata");
		if(XmlHttpForex.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpForex.responseText;
			document.body.style.cursor = "auto";		
		}
		else
		{
		    td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}	

/* International Indices */

var XmlHttpWI;

function CreateXmlHttpWI()
{
    try
	{
		XmlHttpWI = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpWI = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttpWI = null;
		}
	}
	if(!XmlHttpWI && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttpWI = new XMLHttpRequest();
	}
}

function WorldIndicesWindow()
{
    CreateXmlHttpWI();
    var currentDivObj = document.getElementById("InterMarketData");
    currentDivObj.innerHTML ="<img src=loading.gif>";
    document.body.style.cursor = "progress";
    var id = document.getElementById("InterMarket").value;
    
    var requestUrl = "AjaxWorldIndices.aspx?id="+id;
    
    if(XmlHttpWI!=null)	
	{
	    XmlHttpWI.onreadystatechange = function(){ChangeResponseWI()}
		XmlHttpWI.open('GET', requestUrl,  true);
		XmlHttpWI.send(null);
	}

    return false;
}

function ChangeResponseWI()
{
	if(XmlHttpWI.readyState == 4)
	{
	    var td_Id = document.getElementById("InterMarketData");
		if(XmlHttpWI.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpWI.responseText;
			document.body.style.cursor = "auto";		
		}
		else
		{
		    td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}	




/* To show the details of the Profit matrix Grid on the home page  */



var XmlHttpGridDetails;

function CreateXmlHttpGridDetails()
{
    try
	{
		XmlHttpGridDetails = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpGridDetails = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttpGridDetails = null;
		}
	}
	if(!XmlHttpGridDetails && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttpGridDetails = new XMLHttpRequest();
	}
}

function GridDetailsWindow(TdDetails,FinCode,Exchg,rowid)
{
    CreateXmlHttpGridDetails();
    var currentDivObj = document.getElementById(TdDetails);
    currentDivObj.innerHTML ="<img src=loading.gif>";
    document.body.style.cursor = "progress";
  
    
    var requestUrl = "ProfitMatrixGridDetails.aspx?FinCode="+FinCode+"&Exchg="+Exchg+"&rowid="+rowid;
    
    if(XmlHttpGridDetails!=null)	
	{
	    XmlHttpGridDetails.onreadystatechange = function(){ChangeResponseGridDetails(TdDetails)}
		XmlHttpGridDetails.open('GET', requestUrl,  true);
		XmlHttpGridDetails.send(null);
	}

    return false;
}

function ChangeResponseGridDetails(TdDetails)
{
	if(XmlHttpGridDetails.readyState == 4)
	{
	    var td_Id = document.getElementById(TdDetails);
		if(XmlHttpGridDetails.status == 200)//
		{
		td_Id.innerHTML =  XmlHttpGridDetails.responseText;
			document.body.style.cursor = "auto";		
		}
		else
		{
		    td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}	


  
    
    var XmlHttpFO;

//Creating object of XMLHTTP For AJAX Method
function CreateXmlHttpNew()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpFO = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpFO = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpFO = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpFO && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpFO = new XMLHttpRequest();
		}
	}
    function NewPopup(NewsID,NewsDate,SecId,SubSecId,NewsType,FinCode)
    {
        
		document.body.style.cursor = "progress";
		var requestUrl = "NewsDetails.aspx?FinCode="+FinCode +"&timeStamp="+ new Date().getTime() +"&SecId="+SecId+"&SubSecID="+SubSecId+"&NewsID="+NewsID+"&NewsDate="+NewsDate+"&NewsType="+NewsType;	
	 CreateXmlHttpNew();
	     if(XmlHttpFO)	
		{
		    XmlHttpFO.onreadystatechange = function(){getNewsResp()};
			XmlHttpFO.open("GET", requestUrl,  true);
			XmlHttpFO.send(null);
		}
    }
    
    function getNewsResp()
    {

	if(XmlHttpFO.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		var td_Id = document.getElementById("divNews").style.display="inline";
		if(XmlHttpFO.status == 200)//
		{
		//alert(XmlHttpFO.responseText);
			document.getElementById("TDNews").innerHTML =  XmlHttpFO.responseText;
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}


function ShowdetailsFull(rowid,FinCode,Exchg,Cnt)
    {
        var GridId,GridPlusID,GridMinusID;
        
        for(i=10; i<=Cnt; i++)
			{
			  GridId="Griddetails" + i;
			  GridPlusID="Grid1Plus"+ i;
			  GridMinusID="Grid1Minus"+ i;
			//  	   DivID="#sdiv"+i;
			  	   
			if (i==rowid)
			{
			document.getElementById(GridId).style.display = "inline";   
			document.getElementById(GridPlusID).style.display = "none";  
           document.getElementById(GridMinusID).style.display = "inline";  
             //$("#sdiv10").slideDown(500);

			}
			else
			{
		   document.getElementById(GridId).style.display = "none";   
		   document.getElementById(GridPlusID).style.display = "inline";  
           document.getElementById(GridMinusID).style.display = "none";  
			}
		
		}
		  var tdet="Griddetails"+rowid;
    GridDetailsWindow(tdet,FinCode,Exchg,rowid);
		
		}

function Showdetails1(rowid,FinCode,Exchg,Cnt)
    {
        var GridId,GridPlusID,GridMinusID;
        
        for(i=10; i<=Cnt-1; i++)
			{
			  GridId="Griddetails" + i;
			  GridPlusID="Grid1Plus"+ i;
			  GridMinusID="Grid1Minus"+ i;
			//  	   DivID="#sdiv"+i;
			  	   
			if (i==rowid)
			{
			document.getElementById(GridId).style.display = "inline";   
			document.getElementById(GridPlusID).style.display = "none";  
           document.getElementById(GridMinusID).style.display = "inline";  
             //$("#sdiv10").slideDown(500);

			}
			else
			{
		   document.getElementById(GridId).style.display = "none";   
		   document.getElementById(GridPlusID).style.display = "inline";  
           document.getElementById(GridMinusID).style.display = "none";  
			}
		
		}
		  var tdet="Griddetails"+rowid;
    GridDetailsWindow(tdet,FinCode,Exchg,rowid);
		
		}
		
function Showdetails2(rowid,FinCode,Exchg,Cnt)
    {
        var GridId,GridPlusID,GridMinusID;
		for(i=20; i<=Cnt-1; i++)
			{
			  GridId="Griddetails" + i;
			  GridPlusID="Grid2Plus"+ i;
			  GridMinusID="Grid2Minus"+ i;
			   //DivID="#sdiv"+i;
			  
			if (i==rowid)
			{
			document.getElementById(GridId).style.display = "inline";   
			document.getElementById(GridPlusID).style.display = "none";  
           document.getElementById(GridMinusID).style.display = "inline";  
         //  $(DivID).slideDown(1000);

			}
			
			else
			{
		   document.getElementById(GridId).style.display = "none";   
		   document.getElementById(GridPlusID).style.display = "inline";  
           document.getElementById(GridMinusID).style.display = "none";  
			}
		}
        
        
    var tdet="Griddetails"+rowid;
    GridDetailsWindow(tdet,FinCode,Exchg,rowid);
    
    
    
    }
    



 function Hidedetails(Str)
{
	var GridId,GridPlusID,GridMinusID,DivID;
	
	
	 GridId="Griddetails" + Str;
	 GridPlusID="Grid1Plus"+ Str;
	 GridMinusID="Grid1Minus"+ Str;
	
	 document.getElementById(GridId).style.display="none";
 	 document.getElementById(GridPlusID).style.display="inline";
     document.getElementById(GridMinusID).style.display="none";
    //$("#sdiv10").slideUp(1000);
  
    }
    
         
     function RedirectPM(search)
{
   
            var requestUrl;
            requestUrl = "CompanyProfile/QuoteFinder.aspx?timeStamp="+ new Date().getTime() +"&FinCode="+search +"&Mode=S&id=1";        
            window.location = requestUrl;
      

}
   
     
     
     
     
     function RemoveC2P()
{
        if(document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_txtSchName").value=="Enter Company Name")
        {
            document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_txtSchName").value="";
        }
}





function CreateXmlHttpNewC2P()
{
   //Creating object of XMLHTTP in IE
	try
	{
	 
		XmlHttpNewC2P = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try
		{
			XmlHttpNewC2P = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			
			XmlHttpNewC2P = null;	
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttpNewC2P && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttpNewC2P = new XMLHttpRequest();
	}
}

function SchResult()
 {
 	 var txtSchName = document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_txtSchName");
	 if(txtSchName.value=="Enter Company Name")
	{ 
	alert("Please Enter some text");
	} 
	else
		{
 		var SearchResult = document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_lbSchResult");	
 		
		CreateXmlHttpNewC2P();
		document.body.style.cursor = "progress";
		var requestUrl = "GetSchDataAjax.aspx?timeStamp="+ new Date().getTime() +"&txtSchName="+txtSchName.value;
	
		if(XmlHttpNewC2P)	{
					XmlHttpNewC2P.onreadystatechange = function(){fillSymbolResp(SearchResult)};
					XmlHttpNewC2P.open("GET", requestUrl,  true);
					XmlHttpNewC2P.send(null);
				}
				}
		
 }
 
 //Called when response comes back from server Only For Symbol
function fillSymbolResp(ig_)
{

	// To make sure receiving response data from server is completed
	if(XmlHttpNewC2P.readyState == 4)
	{
		
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpNewC2P.status == 200)
		{		
			//alert(ig_)
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpNewC2P.responseText
			//alert(strData)
			if(strData != "") {	
			    
				var arrSchm = strData.split("|");
				ig_.length = 0; 	
				
				for(i=0; i<arrSchm.length-1; i++) {	
								
					var strSchm = arrSchm[i];
					var arrSchmCode = strSchm.split("~");
					
					ig_.options[i] = new Option();
					
					ig_.options[i].value = arrSchmCode[0];
					ig_.options[i].text = arrSchmCode[1];
				}
				
			}
			else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "No Data Found";			
			}
			document.body.style.cursor = "auto";	
		}
		else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "server is not ready";
					document.body.style.cursor = "auto";		
		}
	}
}




	function DeleteSch()
	{
	
    var SchMine=document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_lbSchMine");
 
    if (SchMine.selectedIndex<0)
	 {
	 alert("Please select a name from list");
	 return false;
	 }
	 
    if (SchMine.selectedIndex==0)
    {
    if (SchMine.options[1] == null)
    {
    alert('The only remaining Name cannot be deleted');
    return false;
    }
    }
    
    
      SchMine.options[SchMine.selectedIndex] = null;


	
	return false;
	
	}
	
	
	function MoveUpSch()
	{

    var SchMine=document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_lbSchMine");
	var TempVal1 ,TempTxt1;
	var TempVal2 ,TempTxt2;
	 
	 if (SchMine.selectedIndex<0)
	 {
	 alert("Please select a name from list");
	 return false;
	 }
	
	 
	 if (SchMine.selectedIndex<=0)
	 {
	 return false;
	 }
	 
	 TempVal1=SchMine.options[SchMine.selectedIndex].value;
	 TempTxt1=SchMine.options[SchMine.selectedIndex].outerText; 
	 
     TempVal2=SchMine.options[SchMine.selectedIndex-1].value;
	 TempTxt2=SchMine.options[SchMine.selectedIndex-1].outerText; 
	 
	
	SchMine.options[SchMine.selectedIndex].value = TempVal2;
	SchMine.options[SchMine.selectedIndex].text = TempTxt2; 
	
	SchMine.options[SchMine.selectedIndex-1].value = TempVal1;
	SchMine.options[SchMine.selectedIndex-1].text = TempTxt1; 
	
	
	SchMine.selectedIndex = SchMine.selectedIndex-1;
	}
	
	
		function MoveDownSch()
	{

	 var SchMine=document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_lbSchMine");
	var TempVal1 ,TempTxt1;
	var TempVal2 ,TempTxt2;
	 var len = SchMine.length;
	 
	 if (SchMine.selectedIndex<0)
	 {
	 alert("Please select a name from list");
	 return false;
	 }
	
	 
	  if (SchMine.selectedIndex>=len-1)
	 {
	 return false;
	 }
	 
	 TempVal1=SchMine.options[SchMine.selectedIndex].value;
	 TempTxt1=SchMine.options[SchMine.selectedIndex].outerText; 
	 
     TempVal2=SchMine.options[SchMine.selectedIndex+1].value;
	 TempTxt2=SchMine.options[SchMine.selectedIndex+1].outerText; 
	 
	
	SchMine.options[SchMine.selectedIndex].value = TempVal2;
	SchMine.options[SchMine.selectedIndex].text = TempTxt2; 
	
	SchMine.options[SchMine.selectedIndex+1].value = TempVal1;
	SchMine.options[SchMine.selectedIndex+1].text = TempTxt1; 
	SchMine.selectedIndex = SchMine.selectedIndex+1;
	
	}


function StoreSch()
{
    var search=document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_lbSchResult");
    var SchMine=document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_lbSchMine");
   
    var len = SchMine.length;
        if(len>=10)
        {
            alert('You already have the maximum limit of Ten');
              return false;
        }
       
       for(i=0; i<len; i++)
        {
		 if (SchMine.options[i].text == search.options[search.selectedIndex].outerText)
		 {
		 alert("You already have this Name in your list");
		 return false;
		 }
	
		}
     
    
    
    
    SchMine.options[len] = new Option();
    SchMine.options[len].value = search.value;
	SchMine.options[len].text = search.options[search.selectedIndex].outerText; 

    
        if(search=="")
        {
            alert('select Company Name');
        }
       
       return false;
       
        }
        
function SaveSch()
   {   
   
     var SchMine=document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_lbSchMine");
     
      var len = SchMine.length;
      
      if (len>=1)
      
      {
     
        if (SchMine.options[0].value!="" && SchMine.options[0].text!="")
	{
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchValue0").value=SchMine.options[0].value;
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchText0").value=SchMine.options[0].text;
   	}
   	
   	}
	  if (len>=2)
    {
    
	if (SchMine.options[1].value!="" && SchMine.options[1].text!="")
	{
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchValue1").value=SchMine.options[1].value;
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchText1").value=SchMine.options[1].text;
   	}
 	}
	  if (len>=3)
    {
  	
	if (SchMine.options[2].value!="" && SchMine.options[2].text!="")
	{
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchValue2").value=SchMine.options[2].value;
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchText2").value=SchMine.options[2].text;
   	}
 	}
	  if (len>=4)
    {
  	
	if (SchMine.options[3].value!="" && SchMine.options[3].text!="")
	{
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchValue3").value=SchMine.options[3].value;
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchText3").value=SchMine.options[3].text;
   	}
 	}
	  if (len>=5)
    {
  	
	if (SchMine.options[4].value!="" && SchMine.options[4].text!="")
	{
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchValue4").value=SchMine.options[4].value;
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchText4").value=SchMine.options[4].text;
   	}
 	}
	  if (len>=6)
    {
  	
	if (SchMine.options[5].value!="" && SchMine.options[5].text!="")
	{
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchValue5").value=SchMine.options[5].value;
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchText5").value=SchMine.options[5].text;
   	}
 	}
	  if (len>=7)
    {
  	
	if (SchMine.options[6].value!="" && SchMine.options[6].text!="")
	{
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchValue6").value=SchMine.options[6].value;
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchText6").value=SchMine.options[6].text;
   	}
 	}
	  if (len>=8)
    {
  	
	
	if (SchMine.options[7].value!="" && SchMine.options[7].text!="")
	{
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchValue7").value=SchMine.options[7].value;
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchText7").value=SchMine.options[7].text;
   	}
 	}
	  if (len>=9)
    {
  	
	
	if (SchMine.options[8].value!="" && SchMine.options[8].text!="")
	{
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchValue8").value=SchMine.options[8].value;
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchText8").value=SchMine.options[8].text;
   	}
 	}
	  if (len>=10)
    {
  	
	if (SchMine.options[9].value!="" && SchMine.options[9].text!="")
	{
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchValue9").value=SchMine.options[9].value;
    document.getElementById("ProfitMatrix1_AddEditProfitMatrix1_hidSchText9").value=SchMine.options[9].text;
   	}
 	}
 	

 	 document.getElementById("ProfitMatrixVieW").style.display="inline" ;
     document.getElementById("AddEditView").style.display='none';
}





var XmlHttpMatrixGridData;
function CreateXmlHttpMatrixGridData()
{
	try
	{
		XmlHttpMatrixGridData = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpMatrixGridData = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpMatrixGridData = null;				
		}
	}
	if(!XmlHttpMatrixGridData && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpMatrixGridData = new XMLHttpRequest();
	}
}

function MatrixGridData(PageNo)
{
    CreateXmlHttpMatrixGridData();
   //alert(PageNo);
	document.body.style.cursor = "progress";
	
	
	var requestUrl = "AjaxProfitMatrixGrid.aspx?PageNo="+ PageNo ;
   document.getElementById("ProfitMatrix1_ProfitMatrixGrid1_GridBind1").innerHTML ="<img src=loading.gif>"; 
	if(XmlHttpMatrixGridData!=null)	
	{
	    XmlHttpMatrixGridData.onreadystatechange = function(){ChangeMatrixGridData()}
		XmlHttpMatrixGridData.open('GET', requestUrl,  true);
		XmlHttpMatrixGridData.send(null);
	}
	return false; 
}	
	
function ChangeMatrixGridData()
{
  
	
	if(XmlHttpMatrixGridData.readyState == 4)
	{
		var td_IdComm = document.getElementById("ProfitMatrix1_ProfitMatrixGrid1_GridBind1");
		
		if(XmlHttpMatrixGridData.status == 200)//
		{
		//alert(XmlHttpMatrixGridData.responseText);
			td_IdComm.innerHTML =  XmlHttpMatrixGridData.responseText;
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_IdComm.innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}
	
	
	
function MatrixRefresh()
	{
	
	if (document.getElementById("ShowNext").style.display=="none")
	{
	
	 MatrixGridData(2);
	}
    else
    {
     MatrixGridData(1);
    }
    
    }
    
    
    function WinPopOA(url,ht,wt)
    {
    
    window.open(url, 'Accord','height='+ ht + ',width='+ wt+ ',scrollbars=yes,status=1,top=100,left=420, ,alwaysRaised=0,channelmode=0,fullscreen=0,hotkeys=1,menubar=0,resizable=1,titlebar=0,toolbar=0,z-lock=0');
    }
    
    
/*Gainer Loser Volume Value */

function CreateXmlHttpGLVV()
{
	try
	{
		XmlHttpGLVV = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpGLVV = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpGLVV = null;				
		}
	}
	if(!XmlHttpGLVV && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpGLVV = new XMLHttpRequest();
	}
}


function ChangeBseNSeVal(val)
{

       
        if(val=='BSE')
        {
           
         
            document.getElementById('imgBSE').src="../../App_Themes/Common/images/BSEOn.gif";
            document.getElementById('imgNSE').src="../../App_Themes/Common/images/NseOff.gif";
            
           
             ChangeControl("GAIN","BSE");
          
            
        }
        else
        { 
         
            document.getElementById('imgBSE').src="../../App_Themes/Common/images/BSEOff.gif";
            document.getElementById('imgNSE').src="../../App_Themes/Common/images/NseOn.gif";
           
             
           ChangeControl('GAIN','NSE');
            
    }
}


function ChangeControl(Opt,Exch)
{
	CreateXmlHttpGLVV();
       var currentDivObj = document.getElementById("Td_Data");
        
		//currentDivObj.innerHTML ="<img src=../App_Themes/CommonTheme/Images/ajax-loader.gif>";
	document.body.style.cursor = "progress";
	
	
	var requestUrl = "AjaxDataGLVV.aspx?Option="+ Opt +"&Exchange="+ Exch;
   // alert(requestUrl) 
	if(XmlHttpGLVV!=null)	
	        {
				XmlHttpGLVV.onreadystatechange = function(){ChangeControlResponse(Opt,Exch)}
				XmlHttpGLVV.open('GET', requestUrl,  true);
				XmlHttpGLVV.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");
	
	if(XmlHttpGLVV.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		var td_Id = document.getElementById("Td_Data");
	    //alert(XmlHttp.status)
		if(XmlHttpGLVV.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpGLVV.responseText;
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}

/* Market Movers */

function MarketMovers(Exchange)
{
    if(Exchange == "BSE")
    {
        document.getElementById("trBSE").style.display = "inline";
        document.getElementById("trNSE").style.display = "none";
        
        GainLossHome('GAIN','BSE');
        VolValHome('Volume','BSE');
    }
    else if(Exchange == "NSE")
    {
        document.getElementById("trBSE").style.display = "none";
        document.getElementById("trNSE").style.display = "inline";
        
        GainLossHome('GAIN','NSE');
        VolValHome('Volume','NSE');
    }
}

function GainLoss(Option)
{
    if(Option == "GAIN")
    {
        document.getElementById("trGain").style.display = "inline";
        document.getElementById("trLoss").style.display = "none";
    }
    else if(Option == "LOSE")
    {
        document.getElementById("trGain").style.display = "none";
        document.getElementById("trLoss").style.display = "inline";
    }
    
    GainLossHome(Option,'BSE');
}

function VolVal(Option)
{
    if(Option == "Volume")
    {
        document.getElementById("trVolume").style.display = "inline";
        document.getElementById("trValue").style.display = "none";
        
        VolValHome('Volume','BSE')
    }
    else if(Option == "Value")
    {
        document.getElementById("trVolume").style.display = "none";
        document.getElementById("trValue").style.display = "inline";
       
        VolValHome('Value','BSE')
    }
}


/* Gainer Loser Ctrl */

function CreateXmlHttpGL()
{
	try
	{
		XmlHttpGL = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpGL = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpGL = null;				
		}
	}
	if(!XmlHttpGL && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpGL = new XMLHttpRequest();
	}
}

function GainLossHome(Opt,Exch)
{
    CreateXmlHttpGL();
    var currentDivObj = document.getElementById("tdGainLoss");
	document.body.style.cursor = "progress";
	
	var requestUrl = "AjaxGainLoss.aspx?Option="+ Opt +"&Exchange="+ Exch;
	//var requestUrl = "AjaxGainLoss.aspx?";
	
	if(XmlHttpGL!=null)	
	{
	    //XmlHttpGL.onreadystatechange = function(){GainLossHomeResponse(Opt,Exch)}
	    XmlHttpGL.onreadystatechange = function(){GainLossHomeResponse()}
		XmlHttpGL.open('GET', requestUrl,  true);
		XmlHttpGL.send(null);
	}
	
	return false; 
}

//function GainLossHomeResponse(Opt,Exch)
function GainLossHomeResponse()
{
	if(XmlHttpGL.readyState == 4)
	{
		var td_Id = document.getElementById("tdGainLoss");
		
		if(XmlHttpGL.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpGL.responseText;
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}

/* Volume Value Ctrl */

function CreateXmlHttpVolumeValue()
{
	try
	{
		XmlHttpVolumeValue = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpVolumeValue = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpVolumeValue = null;				
		}
	}
	if(!XmlHttpVolumeValue && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpVolumeValue = new XMLHttpRequest();
	}
}

function VolValHome(Opt,Exch)
{
    CreateXmlHttpVolumeValue();
    var currentDivObj = document.getElementById("tdVolVal");
	document.body.style.cursor = "progress";
	var requestUrl = "AjaxVolumeValue.aspx?Option="+ Opt +"&Exchange="+ Exch;
	
	//var requestUrl = "AjaxVolumeValue.aspx?";
	
	if(XmlHttpVolumeValue!=null)	
	{
	    //XmlHttpGL.onreadystatechange = function(){GainLossHomeResponse(Opt,Exch)}
	    XmlHttpVolumeValue.onreadystatechange = function(){VolValHomeResponse()}
		XmlHttpVolumeValue.open('GET', requestUrl,  true);
		XmlHttpVolumeValue.send(null);
	}
	
	return false; 
}

//function GainLossHomeResponse(Opt,Exch)
function VolValHomeResponse()
{
	if(XmlHttpVolumeValue.readyState == 4)
	{
		var td_Id = document.getElementById("tdVolVal");
		
		if(XmlHttpVolumeValue.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpVolumeValue.responseText;
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			document.body.style.cursor = "auto";
		}
	}
}

/* News Ticker */

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)
{	
   
    //var TickerWin = document.getElementById("divTicker").style.display='inline';
    CreateXmlHttpTicker();
	document.body.style.cursor = "progress";
	document.getElementById("MarqueeId").innerHTML = " <img src='loading.gif'>";
	
	if(Exchg == "BSE")
	{
	    document.getElementById("imgBSE").src = "../App_Themes/CommonTheme/images/BSEOn.gif";
	    document.getElementById("imgBSE").style.cursor = "default";
	    document.getElementById("imgNSE").style.cursor = "pointer";
	    document.getElementById("imgNSE").src = "../App_Themes/CommonTheme/images/NSEOff.gif";
	}
	else
	{
	    document.getElementById("imgBSE").src = "../App_Themes/CommonTheme/images/BSEOff.gif";
	    document.getElementById("imgBSE").style.cursor = "pointer";
	    document.getElementById("imgNSE").style.cursor = "default";
	    document.getElementById("imgNSE").src = "../App_Themes/CommonTheme/images/NSEOn.gif";
	}
	
	var requestUrl = "AjaxTickerData.aspx?Exchange="+ Exchg +"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
	
	//alert(requestUrl);
		
	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";
		}
	}
}

function OpenTicker()
{
   var StrUrl = "NewsTicker.aspx?";
   var newWin=window.open(StrUrl,'MyWindow2','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=0,copyhistory=no,width=946,height=20,screenX=0,screenY=0,left=230,top=320'); 
}

 

