﻿// JScript File
function sensexvalue(val)
{
    if(val=='BSE')
    {
        document.getElementById("L1").className="UnSelectedTabLeft";
        document.getElementById("M1").className="UnSelectedTabBack";
        document.getElementById("R1").className="UnSelectedTabRight";
        
        document.getElementById("L2").className="selectedTabLeft";
        document.getElementById("M2").className="selectedTabBack";
        document.getElementById("R2").className="selectedTabRight";
        
        document.getElementById("tdTxt").innerHTML= "Sensex Intraday";
        document.getElementById("chart").src="http://content.acesphere.com/Charts/ArchBse.png";
    }
    else
    {
        document.getElementById("L1").className="selectedTabLeft";
        document.getElementById("M1").className="selectedTabBack";
        document.getElementById("R1").className="selectedTabRight";
        
        
        document.getElementById("L2").className="UnSelectedTabLeft";
        document.getElementById("M2").className="UnSelectedTabBack";
        document.getElementById("R2").className="UnSelectedTabRight";
        
        document.getElementById("tdTxt").innerHTML= "Nifty Intraday";
        
        document.getElementById("chart").src="http://content.acesphere.com/Charts/ArchNse.png";
    }
    return true;
}

var XmlHttp_LN;

//Creating object of XMLHTTP For AJAX Method
function CreateXmlHttpLN()
{
    //Creating object of XMLHTTP in IE
	try
	{
	    XmlHttp_LN = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try
		{
			XmlHttp_LN = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp_LN = null;	
		}
	}
	
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp_LN && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp_LN = new XMLHttpRequest();
	}
}

function getNews(opt,secid,subsecid)
{
    
    
    CreateXmlHttpLN();
    
    var MktCom=document.getElementById("LiveNewsTab1_NewsTd");
    
    
    var requestUrl="GetNewsTab.aspx?secid="+secid+"&subsecid="+subsecid+"&opt="+opt+"&timeStamp="+new Date().getTime();
    //alert(requestUrl);
	if(XmlHttp_LN)
	{
		//alert(requestUrl);
		XmlHttp_LN.onreadystatechange=function(){getNewsData(MktCom,opt);};
		XmlHttp_LN.open("GET",requestUrl,true);
		XmlHttp_LN.send(null);
	}
}

function getNewsData(id,opt)
{
    if(XmlHttp_LN.readyState==4)
	{
	    if(XmlHttp_LN.status == 200)
		{
		    id.innerHTML=XmlHttp_LN.responseText;
	
		    if(opt !=null)
            {
                for(var i=1;i<=3;i++)
                {
                    if(i==opt)
                    {
                        document.getElementById("LNL"+opt).className = "selectedTabLeft";
                        document.getElementById("LNM"+opt).className = "selectedTabBack";
                        document.getElementById("LNR"+opt).className = "selectedTabRight";
                    }
                    else
                    {
                        document.getElementById("LNL"+i).className = "UnSelectedTabLeft";
                        document.getElementById("LNM"+i).className = "UnSelectedTabBack";
                        document.getElementById("LNR"+i).className = "UnSelectedTabRight";
                    }
                }
            }
		}
	}
}


var XmlHttp_HN;

//Creating object of XMLHTTP For AJAX Method
function CreateXmlHttpHN()
{
    //Creating object of XMLHTTP in IE
	try
	{
	    XmlHttp_HN = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try
		{
			XmlHttp_HN = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp_HN = null;	
		}
	}
	
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp_HN && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp_HN = new XMLHttpRequest();
	}
}

function getNewsHot(opt,secid,subsecid)
{
    CreateXmlHttpHN();
    
    var MktCom=document.getElementById("HotNewsTab1_NewsTdHot");
    
    var requestUrl="GetNewsTabHot.aspx?secid="+secid+"&subsecid="+subsecid+"&opt="+opt+"&timeStamp="+new Date().getTime();
    //alert(requestUrl);
	if(XmlHttp_HN)
	{
		//alert(requestUrl);
		XmlHttp_HN.onreadystatechange=function(){getNewsDataHot(MktCom,opt);};
		XmlHttp_HN.open("GET",requestUrl,true);
		XmlHttp_HN.send(null);
	}
}

function getNewsDataHot(id,opt)
{
    if(XmlHttp_HN.readyState==4)
	{
	    if(XmlHttp_HN.status == 200)
		{
		    id.innerHTML=XmlHttp_HN.responseText;
	
		    if(opt !=null)
            {
                for(var i=1;i<=3;i++)
                {
                    if(i==opt)
                    {
                        document.getElementById("HNL"+opt).className = "selectedTabLeft";
                        document.getElementById("HNM"+opt).className = "selectedTabBack";
                        document.getElementById("HNR"+opt).className = "selectedTabRight";
                    }
                    else
                    {
                        document.getElementById("HNL"+i).className = "UnSelectedTabLeft";
                        document.getElementById("HNM"+i).className = "UnSelectedTabBack";
                        document.getElementById("HNR"+i).className = "UnSelectedTabRight";
                    }
                }
            }
		}
	}
}


/* Get Quotes */

function Searchempty()
{
    if (document.getElementById("txtCompany").value=="Enter Company Name")
    {
        document.getElementById("txtCompany").value="";
    }
}

function Searchfill()
{
    var getquote=document.getElementById("txtCompany").value;
    
    if (getquote=="")
    {
        document.getElementById("txtCompany").value="Enter 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=="61")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=61";
        } 
        if(ddlQuote=="62")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=62";
        }  
        if(ddlQuote=="63")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=63";
        }
        if(ddlQuote=="64")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=64";
        } 
        if(ddlQuote=="65")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=65";
        }  
        if(ddlQuote=="66")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=66";
        }  
        if(ddlQuote=="67")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=67";
        } 
        if(ddlQuote=="68")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=68";
        } 
        if(ddlQuote=="69")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=69";
        } 
        if(ddlQuote=="70")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=70";
        } 
        if(ddlQuote=="71")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=71";
        } 
        if(ddlQuote=="72")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=72";
        } 
        if(ddlQuote=="73")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=73";
        } 
        if(ddlQuote=="74")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=74";
        } 
        if(ddlQuote=="75")
        {
            document.location = "CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=75";
        } 
    }
}
function Searchempty()
{
	if (document.getElementById("txtCompany").value=="Company Name")
	{
		document.getElementById("txtCompany").value="";
	}
}
        
/* Company Ticker */

function CreateXmlHttpCompTicker1()
{
	try
	{
		XmlHttpCompTicker1 = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpCompTicker1 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpCompTicker1 = null;				
		}
	}
	if(!XmlHttpCompTicker1 && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpCompTicker1 = new XMLHttpRequest();
	}
}

function getTickerData1(Exchg)
{	

//alert(Exchg);
    CreateXmlHttpCompTicker1();
	document.body.style.cursor = "progress";
		
	var requestUrl = "AjaxTickerData.aspx?Exchange="+ Exchg +"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
	
	if(XmlHttpCompTicker1)
	{
		XmlHttpCompTicker1.onreadystatechange = function(){getDataResponseComp1(Exchg);};
		XmlHttpCompTicker1.open("GET", requestUrl,  true);
		XmlHttpCompTicker1.send(null);
	}
}

function getDataResponseComp1(Exchg)
{
    if(XmlHttpCompTicker1.readyState == 4)
	{	
	    if(XmlHttpCompTicker1.status == 200)
		{	
		    var arrCol,Time,Code,CompName,ClPrice,DiffVal,DiffImg;
			var ExchgDet="",stkDet="";
			var MarqueeId = document.getElementById("MarqueeId");
			var TickerData = XmlHttpCompTicker1.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) 
				{
					clss = "<span class='Green'>" ;
				}
				else if(DiffVal<0) 
				{							
					clss = "<span class='Red'>" ;
				}
				else if(DiffVal==0) 
				{
					clss = "<span class='Blue'>"	;				
				}
				
				if(i==0)ExchgDet = "<span class='TickerText'>" + arrCol[0] +" &nbsp; "+ CompName +": "+"<span  class=TickerText>" + ClPrice+"&nbsp;"+ clss +" ["  +"<b>"+ DiffVal+ "</b>"+"]</span> </span>&nbsp;&nbsp;&nbsp;";else stkDet += "<span class='TickerLink'>" + "<a href='CompanyProfile/QuoteFinder.aspx?id=61&Fincode="+arrCol[0]+"'><span  class=TickerText>" + CompName +"</span></a>: " + "<span  class=TickerText>" + ClPrice +"&nbsp;"+ clss +" [" +"<b>"+ DiffVal+ "</b>"+"]</span>  &nbsp;</span>&nbsp;";						
			}
			MarqueeId.innerHTML = "<marquee id='maqid' onmouseover='this.stop();' onmouseout='this.start();' trueSpeed scrollAmount='1' scrollDelay='30' direction='left' loop='repeat' width='100%'>" + ExchgDet + stkDet + "</marquee>";
			document.body.style.cursor = "auto";
		}
	}
}


/* Commodity Ticker */

function CreateXmlHttpCommTicker()
{
	try
	{
		XmlHttpCommTicker = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpCommTicker = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpCommTicker = null;				
		}
	}
	if(!XmlHttpCommTicker && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpCommTicker = new XMLHttpRequest();
	}
}

function getCommodityTicker(Exchg)
{	
    CreateXmlHttpCommTicker();
	document.body.style.cursor = "progress";
		
	var requestUrl = "AjaxCommodityTickerData.aspx?Exchange="+ Exchg +"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
	
	if(XmlHttpCommTicker)
	{
		XmlHttpCommTicker.onreadystatechange = function(){getDataResponseComm(Exchg);};
		XmlHttpCommTicker.open("GET", requestUrl,  true);
		XmlHttpCommTicker.send(null);
	}
}

function getDataResponseComm(Exchg)
{
    if(XmlHttpCommTicker.readyState == 4)
	{	
	    if(XmlHttpCommTicker.status == 200)
		{	
		    var arrCol,Time,Code,CompName,ClPrice,DiffVal,DiffImg;
			var ExchgDet="",stkDet="";
			var MarqueeId = document.getElementById("CommodityTickerId");
			var TickerData = XmlHttpCommTicker.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];
			   if(i==0)ExchgDet = "<span class='TickerText'>" + arrCol[0] +" &nbsp; "+ CompName +": "+"<span  class=TickerText>" + ClPrice+"&nbsp;</span> </span>&nbsp;&nbsp;&nbsp;";else stkDet += "<span class='TickerLink'>" + "<a href='../companyprofile/QuoteFinder.aspx?id=1&Fincode="+arrCol[0]+"'><span  class=TickerText>" + CompName +"</span></a>: " + "<span  class=TickerText>" + ClPrice +"&nbsp;</span>  &nbsp;</span>&nbsp;";	
			}
			
			MarqueeId.innerHTML = "<marquee id='maqidNew1' onmouseover='this.stop();' onmouseout='this.start();' trueSpeed scrollAmount='1' scrollDelay='30' direction='left' loop='repeat' width='100%'>" + ExchgDet + stkDet + "</marquee>";
			document.getElementById('maqidNew1').start();
			
			document.body.style.cursor = "auto";
		}
	}
}


function CreateXmlHttp1()
{
	try
	{
		XmlHttp1 = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttp1 = null;				
		}
	}
	if(!XmlHttp1 && typeof XMLHttpRequest != "undefined")
	{
		XmlHttp1 = new XMLHttpRequest();
	}
}

function HomeTicker(exchg)
{
    CreateXmlHttp1();
	
	var requestUrl="CommTicker.aspx?sid=" + Math.random() + "&Exchg="+exchg;
	//alert(requestUrl);
	
	if(XmlHttp1)	
    {
	    XmlHttp1.onreadystatechange = function(){ShowTickerData();}; 
		XmlHttp1.open("GET", requestUrl,  true);
		XmlHttp1.send(null);
	}
	
}

function ShowTickerData() 
{ 
    if(XmlHttp1.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
	    if(XmlHttp1.status == 200)
		{		
		    var arrCol,Time,Code,CompName,ClPrice,DiffVal,DiffImg;
			var ExchgDet="",stkDet="";	
			var TikerData   = document.getElementById("TikerData");
		    var strData = XmlHttp1.responseText;
			
			if(strData != "")
			    var arrNse = strData.split("|");
				for(i=0; i<arrNse.length-1; i++)
				 {
					arrCol = arrNse[i].split("~");
					CompName = arrCol[0];
					ClPrice  = arrCol[1];
					DiffVal  = arrCol[2];
						
					if(i==0)
					ExchgDet = " <span  class=TickerText>"+ CompName +"</span><span  class=TickerText>" + " &nbsp; "+ ClPrice+"&nbsp;&nbsp; "  +"<b>"+ DiffVal+ "</b>"+"</span> </span>&nbsp;&nbsp;&nbsp;";
					else 
					stkDet += "<span  class=TickerText>" + CompName +"</span><span  class=TickerText>" + " &nbsp; "+ ClPrice +"&nbsp;&nbsp;" +"<b>"+ DiffVal+ "</b>"+"</span>  &nbsp;</span>&nbsp;";						
						
				}
				
				TikerData.innerHTML   =  "<marquee onmouseover='this.stop();' onmouseout='this.start();' trueSpeed scrollAmount='1' scrollDelay='40'  direction='right' loop='repeat' width='100%'>" + ExchgDet + stkDet + "</marquee>";
			
			document.body.style.cursor = "auto";	
		}
		else
		{
			TikerData.innerHTML = "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
	
}

function OpenNews(SecId,SubSecId,newsid)
{
    var StrUrl = "News/NewsDetails.aspx?sec="+SecId+"&subsec="+SubSecId+"&Newsid="+newsid;
    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=500,height=520,screenX=0,screenY=0,left=210,top=200');	
}


function ChangeExch(Exchg)
{	
    var Exchg;
	if(Exchg=="BSE")
	{		
        document.getElementById("L11").className="selectedTabLeft";
        document.getElementById("M11").className="selectedTabBack";
        document.getElementById("R11").className="selectedTabRight";
        
        document.getElementById("L21").className="UnSelectedTabLeft";
        document.getElementById("M21").className="UnSelectedTabBack";
        document.getElementById("R21").className="UnSelectedTabRight";
        
        
	    
	    GetData("BSE");			
	}
	else 
	{	
        document.getElementById("L11").className="UnSelectedTabLeft";
        document.getElementById("M11").className="UnSelectedTabBack";
        document.getElementById("R11").className="UnSelectedTabRight";
        
        document.getElementById("L21").className="selectedTabLeft";
        document.getElementById("M21").className="selectedTabBack";
        document.getElementById("R21").className="selectedTabRight";
        
        GetData("NSE");	
	}	
}

var XmlHttpGL;

function CreateXmlHttpGL()
{
	try
	{
		XmlHttpGL = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpGL = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpGL = null;				
		}
	}
	if(!XmlHttpGL && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpGL = new XMLHttpRequest();
	}
}

function GetData(Exch)
{
    CreateXmlHttpGL();
    var currentDivObj = document.getElementById("Td_Data");
    currentDivObj.innerHTML ="<img src=App_Themes/Common/images/ajax-loader.gif>";
	document.body.style.cursor = "progress";
	var requestUrl = "AjaxValVolGL.aspx?Exchange="+ Exch;
	
	if(XmlHttpGL!=null)	
	{
	    XmlHttpGL.onreadystatechange = function(){ChangeResponse(Exch)}
		XmlHttpGL.open('GET', requestUrl,  true);
		XmlHttpGL.send(null);
	}
	return false; 
}	
	
function ChangeResponse(Exch)
{
    var More=document.getElementById("More");
	
	if(XmlHttpGL.readyState == 4)
	{
	    var td_Id = document.getElementById("Td_Data");
		
		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";
		}
	}
}

function ChangeExch1(Exchg)
{	
    var Exchg;
	if(Exchg=="BSE")
	{		
        document.getElementById("L12").className="selectedTabLeft";
        document.getElementById("M12").className="selectedTabBack";
        document.getElementById("R12").className="selectedTabRight";
        
        document.getElementById("L22").className="UnSelectedTabLeft";
        document.getElementById("M22").className="UnSelectedTabBack";
        document.getElementById("R22").className="UnSelectedTabRight";
	    GetData1("BSE");			
	}
	else 
	{	
        document.getElementById("L12").className="UnSelectedTabLeft";
        document.getElementById("M12").className="UnSelectedTabBack";
        document.getElementById("R12").className="UnSelectedTabRight";
        
        document.getElementById("L22").className="selectedTabLeft";
        document.getElementById("M22").className="selectedTabBack";
        document.getElementById("R22").className="selectedTabRight";
        GetData1("NSE");	
	}	
}

var XmlHttpGL1;

function CreateXmlHttpGL1()
{
	try
	{
		XmlHttpGL1 = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpGL1 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpGL1 = null;				
		}
	}
	if(!XmlHttpGL1 && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpGL1 = new XMLHttpRequest();
	}
}

function GetData1(Exch)
{
    CreateXmlHttpGL1();
    var currentDivObj = document.getElementById("Td_Data1");
    currentDivObj.innerHTML ="<img src=App_Themes/Common/images/ajax-loader.gif>";
	document.body.style.cursor = "progress";
	var requestUrl = "AjaxValVolGL1.aspx?Exchange="+ Exch;
	
	if(XmlHttpGL1!=null)	
	{
	    XmlHttpGL1.onreadystatechange = function(){ChangeResponse1(Exch)}
		XmlHttpGL1.open('GET', requestUrl,  true);
		XmlHttpGL1.send(null);
	}
	return false; 
}	
	
function ChangeResponse1(Exch)
{
    var More=document.getElementById("More");
	
	if(XmlHttpGL1.readyState == 4)
	{
	    var td_Id = document.getElementById("Td_Data1");
		
		if(XmlHttpGL1.status == 200)//
		{
		    td_Id.innerHTML =  XmlHttpGL1.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 ChangeExchV(Exchg)
{	
	var Exchg;
	if(Exchg=="BSE")
	{	   
	    document.getElementById("L13").className="selectedTabLeft";
        document.getElementById("M13").className="selectedTabBack";
        document.getElementById("R13").className="selectedTabRight";
        
        document.getElementById("L23").className="UnSelectedTabLeft";
        document.getElementById("M23").className="UnSelectedTabBack";
        document.getElementById("R23").className="UnSelectedTabRight";
		
		GetDataVol("BSE");	
	}
	else 
	{	    
	    document.getElementById("L13").className="UnSelectedTabLeft";
        document.getElementById("M13").className="UnSelectedTabBack";
        document.getElementById("R13").className="UnSelectedTabRight";
        
        document.getElementById("L23").className="selectedTabLeft";
        document.getElementById("M23").className="selectedTabBack";
        document.getElementById("R23").className="selectedTabRight";
       	GetDataVol("NSE");	
	}	
}

var XmlHttpV;

function CreateXmlHttpV()
{
	try
	{
		XmlHttpV = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpV = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpV = null;				
		}
	}
	if(!XmlHttpV && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpV = new XMLHttpRequest();
	}
}

function GetDataVol(Exch)
{
    CreateXmlHttpV();
    var currentDivObj = document.getElementById("Td_DataVV");
	currentDivObj.innerHTML ="<img src=App_Themes/Common/images/ajax-loader.gif>";
	document.body.style.cursor = "progress";
	var requestUrl = "AjaxVolume.aspx?Exchange="+ Exch;
	
	if(XmlHttpV!=null)	
	{
	    XmlHttpV.onreadystatechange = function(){ChangeResponseVol(Exch)}
		XmlHttpV.open('GET', requestUrl,  true);
		XmlHttpV.send(null);
	}
	return false; 
}	
	
function ChangeResponseVol(Exch)
{
    var Head_td =document.getElementById("Heading");
    var More=document.getElementById("More");
   
	if(XmlHttpV.readyState == 4)
	{
	    var td_Id = document.getElementById("Td_DataVV");
		
		if(XmlHttpV.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpV.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 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=App_Themes/Common/images/ajax-loader.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";
		}
	}
}	

var XmlHttpBull;
    
function CreateXmlHttpBull()
{
    try
	{
		XmlHttpBull = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try
		{
			XmlHttpBull = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttpBull = null;
		}
	}
	if(!XmlHttpBull && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttpBull = new XMLHttpRequest();
	}
}
    
function GetBullion()
{
    CreateXmlHttpBull();
    
    var currentDivObj = document.getElementById("TD_Bullion");
    
    currentDivObj.innerHTML ="<img src=App_Themes/Common/images/ajax-loader.gif>";
	document.body.style.cursor = "progress";
	
	var requestUrl = "AjaxBullion.aspx?time="+ Math.random();
	
	if(XmlHttpBull!=null)	
	{
	    XmlHttpBull.onreadystatechange = function(){ChangeResponseBull()}
		XmlHttpBull.open('GET', requestUrl,  true);
		XmlHttpBull.send(null);
	}
	return false; 
}	
	
function ChangeResponseBull(Exch)
{
    if(XmlHttpBull.readyState == 4)
	{
	    var td_Id = document.getElementById("TD_Bullion");
		
		if(XmlHttpBull.status == 200)
		{
			td_Id.innerHTML =  XmlHttpBull.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 sensexvaluechart(val)
//{
//    
//    
//    if(val=='BSE')
//    {
//        document.getElementById("L1").className="UnSelectedTabLeft";
//        document.getElementById("M1").className="UnSelectedTabBack";
//        document.getElementById("R1").className="UnSelectedTabRight";
//        
//        document.getElementById("L2").className="selectedTabLeft";
//        document.getElementById("M2").className="selectedTabBack";
//        document.getElementById("R2").className="selectedTabRight";
//     
//     //Bellow condition added by laxman to show sensex value on haome page graph
//        if( document.getElementById("ShowSensex"))
//        {  
//            document.getElementById("ShowSensex").style.display = "inline";
//        }
//        if(document.getElementById("ShowNifty"))
//        {
//	        document.getElementById("ShowNifty").style.display = "none";
//	    }
//    //End of code added by laxman to show sensex value on haome page graph
//        
//    }
//    else
//    {
//        document.getElementById("L1").className="selectedTabLeft";
//        document.getElementById("M1").className="selectedTabBack";
//        document.getElementById("R1").className="selectedTabRight";
//   
//        document.getElementById("L2").className="UnSelectedTabLeft";
//        document.getElementById("M2").className="UnSelectedTabBack";
//        document.getElementById("R2").className="UnSelectedTabRight";
//        
//        //Bellow condition added by laxman to show sensex value on haome page graph
//        
//        if(document.getElementById("ShowSensex"))
//        {
//            document.getElementById("ShowSensex").style.display = "none";
//        }
//        if(document.getElementById("ShowNifty"))
//        {
//	        document.getElementById("ShowNifty").style.display = "inline";
//	    }
//	    
//	    //End of code added by laxman to show sensex value on haome page graph
//  
//   
//    }
////      var so = new SWFObject("amcharts/amline/amline.swf", "BSENSEline", "100%", "160", "8", "#FFFFFF");
////		so.addVariable("path", "amcharts/amline/");
////		so.addParam("wmode","opaque");
////		so.addVariable("settings_file", encodeURIComponent("BSENSEline_settings.xml"));
////		so.addVariable("data_file", encodeURIComponent("MarketChartAjax.aspx?Exchg="+val+"&TimeStamp="+new Date().getTime()));
////		so.write("HomeChart");
//		
//		var so = new SWFObject("amcharts/amline/amline.swf", "BSENSEline", "100%", "100%", "8", "FFFFFF");
//		so.addVariable("path", "amcharts/amline/");
//		so.addParam("wmode","opaque");
//		so.addVariable("settings_file", encodeURIComponent("BSENSEline_settings.xml"));
//		so.addVariable("data_file", encodeURIComponent("MarketChartAjax.aspx?Exchg="+val+"&TimeStamp="+new Date().getTime()));
//		so.write("HomeChart");
//		so.addParam("wmode","opaque");
//		
//    return true;
//}
////////////////////

//function Homesensexvaluechart(val)
function sensexvaluechart(val)
{
    if(val=='BSE')
    {
        document.getElementById("L2").className="UnSelectedTabLeft";
        document.getElementById("M2").className="UnSelectedTabBack";
        document.getElementById("R2").className="UnSelectedTabRight";
        
        document.getElementById("L1").className="selectedTabLeft";
        document.getElementById("M1").className="selectedTabBack";
        document.getElementById("R1").className="selectedTabRight";
        
        document.getElementById("LG1").className="selectedTabLeft";
        document.getElementById("MG1").className="selectedTabBack";
        document.getElementById("RG1").className="selectedTabRight";
        
        document.getElementById("LG2").className="selectedTabLeft";
        document.getElementById("MG2").className="selectedTabBack";
        document.getElementById("RG2").className="selectedTabRight";

        if( document.getElementById("ShowSensex"))
        {  
            document.getElementById("ShowSensex").style.display = "inline";
        }
        if(document.getElementById("ShowNifty"))
        {
	        document.getElementById("ShowNifty").style.display = "none";
	    }
       if(document.getElementById("ShowGold"))
        {
	       document.getElementById("ShowGold").style.display = "none";
	    }
       if(document.getElementById("ShowSilver"))
        {
	        document.getElementById("ShowSilver").style.display = "none";
	    }
	    	    
	    SensexChart('BSE');
   
    }
    else if(val=='NSE')
    {
//    alert();
        document.getElementById("L2").className="selectedTabLeft";
        document.getElementById("M2").className="selectedTabBack";
        document.getElementById("R2").className="selectedTabRight";
   
        document.getElementById("L1").className="UnSelectedTabLeft";
        document.getElementById("M1").className="UnSelectedTabBack";
        document.getElementById("R1").className="UnSelectedTabRight";
        
        document.getElementById("LG1").className="selectedTabLeft";
        document.getElementById("MG1").className="selectedTabBack";
        document.getElementById("RG1").className="selectedTabRight";
        
        document.getElementById("LG2").className="selectedTabLeft";
        document.getElementById("MG2").className="selectedTabBack";
        document.getElementById("RG2").className="selectedTabRight";
        
       if(document.getElementById("ShowSensex"))
        {
            document.getElementById("ShowSensex").style.display = "none";
        }
        if(document.getElementById("ShowNifty"))
        {
	        document.getElementById("ShowNifty").style.display = "inline";
	    }
	    
        if(document.getElementById("ShowGold"))
        {
	       document.getElementById("ShowGold").style.display = "none";
	    }
        if(document.getElementById("ShowSilver"))
        {
	        document.getElementById("ShowSilver").style.display = "none";
	    }

        SensexChart('NSE');
        
    }
    else if(val=='GOLD')
    {
        document.getElementById("L1").className="selectedTabLeft";
        document.getElementById("M1").className="selectedTabBack";
        document.getElementById("R1").className="selectedTabRight";
        
        document.getElementById("L2").className="selectedTabLeft";
        document.getElementById("M2").className="selectedTabBack";
        document.getElementById("R2").className="selectedTabRight";
        
        document.getElementById("LG1").className="UnSelectedTabLeft";
        document.getElementById("MG1").className="UnSelectedTabBack";
        document.getElementById("RG1").className="UnSelectedTabRight";
        
        document.getElementById("LG2").className="selectedTabLeft";
        document.getElementById("MG2").className="selectedTabBack";
        document.getElementById("RG2").className="selectedTabRight";
        
       if(document.getElementById("ShowSensex"))
        {
            document.getElementById("ShowSensex").style.display = "none";
        }
        if(document.getElementById("ShowNifty"))
        {
	        document.getElementById("ShowNifty").style.display = "none";
	    }
	    
        if(document.getElementById("ShowGold"))
        {
	       document.getElementById("ShowGold").style.display = "inline";
	    }
        if(document.getElementById("ShowSilver"))
        {
	        document.getElementById("ShowSilver").style.display = "none";
	    }

	    GoldChart('GOLD');
   
    }
	else if(val=='SILVER')
    {
        document.getElementById("L1").className="selectedTabLeft";
        document.getElementById("M1").className="selectedTabBack";
        document.getElementById("R1").className="selectedTabRight";
        
        document.getElementById("L2").className="selectedTabLeft";
        document.getElementById("M2").className="selectedTabBack";
        document.getElementById("R2").className="selectedTabRight";
        
        document.getElementById("LG1").className="selectedTabLeft";
        document.getElementById("MG1").className="selectedTabBack";
        document.getElementById("RG1").className="selectedTabRight";
        
        document.getElementById("LG2").className="UnSelectedTabLeft";
        document.getElementById("MG2").className="UnSelectedTabBack";
        document.getElementById("RG2").className="UnSelectedTabRight";
        
        if(document.getElementById("ShowSensex"))
        {
            document.getElementById("ShowSensex").style.display = "none";
        }
        if(document.getElementById("ShowNifty"))
        {
	        document.getElementById("ShowNifty").style.display = "none";
	    }
	    
        if(document.getElementById("ShowGold"))
        {
	       document.getElementById("ShowGold").style.display = "none";
	    }
        if(document.getElementById("ShowSilver"))
        {
	        document.getElementById("ShowSilver").style.display = "inline";
	    }
	    
	    GoldChart('SILVER');
   
    }
			
	    
    
    
}




function SensexChart(val)
{
    var so = new SWFObject("amcharts/amline/amline.swf", "BSENSEline", "100%", "100%", "8", "FFFFFF");
	so.addVariable("path", "amcharts/amline/");
	so.addParam("wmode","opaque");
	so.addVariable("settings_file", encodeURIComponent("BSENSEline_settings.xml"));
    so.addVariable("data_file", encodeURIComponent("MarketChartAjax.aspx?Exchg="+val+"&TimeStamp="+new Date().getTime()));
	so.write("HomeChart");
		
	    
}
function GoldChart(Symbol)
{
    var so = new SWFObject("amcharts/amline/amline.swf", "BSENSEline", "100%", "100%", "8", "FFFFFF");
    so.addVariable("path", "amcharts/amline/");
    so.addParam("wmode","opaque");
   	so.addVariable("settings_file", encodeURIComponent("BSENSEline_settings.xml"));
    so.addVariable("data_file", encodeURIComponent("GetPriceChart.aspx?Exchg=MCX&Symbol="+Symbol+"&ExpDate=null&TimeStamp="+new Date().getTime()));
    so.write("HomeChart");
}





///////////////

var XmlHttpnew;
    
function CreateXmlHttpnew()
{
    try
	{
		XmlHttpnew = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
	    try
		{
			XmlHttpnew = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttpnew = null;
		}
	}
	if(!XmlHttpnew && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttpnew = new XMLHttpRequest();
	}
}

function GetnewChart(val)
{
CreateXmlHttpnew();
      
      document.body.style.cursor = "progress";
	
	
	var requestUrl = "ChartLink.aspx?Exchg="+ val;
  //alert(requestUrl) 
	if(XmlHttpnew!=null)	
	        {
				XmlHttpnew.onreadystatechange = function(){ChangeResponsenew(val)}
				XmlHttpnew.open('GET', requestUrl,  true);
				XmlHttpnew.send(null);
			}
			 return false; 
}


function ChangeResponsenew(val)
{

	if(XmlHttpnew.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		var td_Id = document.getElementById("tdchart");
	    //alert(XmlHttp.status)
		if(XmlHttpnew.status == 200)//
		{
		alert(XmlHttpnew.responseText);
		
			td_Id.innerHTML =  XmlHttpnew.responseText;
				//alert(td_Id.innerHTML);
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}
function CreateXmlHttpTS()
	{
		try
		{
			XmlHttpTS = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpTS = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpTS = null;
					
			}
		}
		if(!XmlHttpTS && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpTS = new XMLHttpRequest();
		}
	}



function GetChart(opt)
{
	CreateXmlHttpTS();
      
      document.body.style.cursor = "progress";
	
	
	var requestUrl = "AjaxValVolGL.aspx?Exchange="+ Exch;
  //alert(requestUrl) 
	if(XmlHttpTS!=null)	
	        {
				XmlHttpTS.onreadystatechange = function(){ChangeResponseTS(opt)}
				XmlHttpTS.open('GET', requestUrl,  true);
				XmlHttpTS.send(null);
			}
			 return false; 

}



function ChangeResponseTS(opt)
{

	if(XmlHttpTS.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		var td_Id = document.getElementById("imgchart");
	    //alert(XmlHttp.status)
		if(XmlHttpTS.status == 200)//
		{
			//td_Id.src = 
				//alert(td_Id.innerHTML);
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}