﻿// JScript File

function CreateXmlHttpHomeNews()
{
	try
	{
		XmlHttpHomeNews = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpHomeNews = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpHomeNews = null;				
		}
	}
	if(!XmlHttpHomeNews && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpHomeNews = new XMLHttpRequest();
	}
}


 function GetNewsHot(SecID,SubSec,NewsType)
	{	
	
			if(NewsType == "Stock")
		    {
		     document.getElementById("TdStock").className= 'TabTextHomeSel';		
		     document.getElementById("TdMrkt").className = 'TabTextHome';
		     document.getElementById("TdCorporate").className = 'TabTextHome';		
		     document.getElementById("TdEconomy").className = 'TabTextHome';
		    }
		   
	        if(NewsType == "Mrkt")
	        {
	         document.getElementById("TdStock").className= 'TabTextHome';		
		     document.getElementById("TdMrkt").className = 'TabTextHomeSel';
		     document.getElementById("TdCorporate").className = 'TabTextHome';		
		     document.getElementById("TdEconomy").className = 'TabTextHome';
	        }
		  
	        if(NewsType == "Cor")
            {
            document.getElementById("TdStock").className= 'TabTextHome';		
		     document.getElementById("TdMrkt").className = 'TabTextHome';
		     document.getElementById("TdCorporate").className = 'TabTextHomeSel';		
		     document.getElementById("TdEconomy").className = 'TabTextHome';
            }
           
             if(NewsType == "Eco")
	         {
	          document.getElementById("TdStock").className= 'TabTextHome';		
		     document.getElementById("TdMrkt").className = 'TabTextHome';
		     document.getElementById("TdCorporate").className = 'TabTextHome';		
		     document.getElementById("TdEconomy").className = 'TabTextHomeSel';
	         }

		CreateXmlHttpHomeNews();
		document.body.style.cursor = "progress"; 
		var requestUrl = "../Equity/AjaxHomeNews.aspx?Sec="+ SecID +"&SubSec="+SubSec+"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
	
		//alert(requestUrl);

		if(XmlHttpHomeNews){
			XmlHttpHomeNews.onreadystatechange = function(){getHomeNewDataResponse();};
			XmlHttpHomeNews.open("GET", requestUrl,  true);
			XmlHttpHomeNews.send(null);
		}
}
function getHomeNewDataResponse()
{
var NewTd = document.getElementById("NewTd");
	if(XmlHttpHomeNews.readyState == 4)
	{	
		if(XmlHttpHomeNews.status == 200)
		{				
			var NewData = XmlHttpHomeNews.responseText;	
			if(NewData != "")
		    {	
				NewTd.innerHTML = NewData;	
				
			}
				document.body.style.cursor = "auto";	
		}
		else
		{
			document.getElementById("NewTd").innerHTML = "<img src='../App_Themes/Common/images/ajax-loader.gif'>";
		}
	}
}

var XmlHttpBA;

function CreateXmlHttpBA()
	{
		try
		{
			XmlHttpBA = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpBA = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpBA = null;
					
			}
		}
		if(!XmlHttpBA && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpBA = new XMLHttpRequest();
		}
	}


function GetBSEAnn(opt)
	{	
		CreateXmlHttpBA();
		document.body.style.cursor = "progress";
		var requestUrl = "AjaxAnnouncements.aspx?Exchange="+opt+"&timeStamp="+new Date().getTime();
		if(XmlHttpBA){
			XmlHttpBA.onreadystatechange = function(){getDataResponseBSEAnn();};
			XmlHttpBA.open("GET", requestUrl,  true);
			XmlHttpBA.send(null);
		}
    }
    
    function getDataResponseBSEAnn()
{
	if(XmlHttpBA.readyState == 4)
	{	

		if(XmlHttpBA.status == 200)
		{				
			var BSEAnn = document.getElementById("tdBseAnn");
			var strData = XmlHttpBA.responseText;
			if(strData != "")
			 {	
			    var arrSchm = strData.split("|");
			   
			    for(i=0; i<arrSchm.length-1; i++) 
			    {	
				    var strSchm = arrSchm[i];
				   
				    var arrSchmCode = strSchm.split("~");
				    BSEAnn.innerHTML = arrSchmCode[1];
			    }
			}
				
		}
	}
}



	var XmlHttpBAI;

function CreateXmlHttpBAI()
	{
		try
		{
			XmlHttpBAI = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpBAI = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpBAI = null;
					
			}
		}
		if(!XmlHttpBAI && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpBAI = new XMLHttpRequest();
		}
	}
	
	
	function GetBSEAnnInn(srno,Exchange)
	{	
	//alert(srno);	
	    document.getElementById("divNews").style.display = "inline";
		CreateXmlHttpBAI();
		document.body.style.cursor = "progress";
		
		//if(Exchg=="NSE"){document.NseTickImg.src="../images/NSEon.gif";document.BseTickImg.src="../images/BSEoff.gif";}else{document.NseTickImg.src="../images/NSEoff.gif";document.BseTickImg.src="../images/BSEon.gif";}
		
		var requestUrl = "BSEAnnDetailsAjax.aspx?IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime()+"&srno="+srno+"&Exchange="+Exchange;
		//alert(requestUrl);
		if(XmlHttpBAI){
			XmlHttpBAI.onreadystatechange = function(){getDataResponseBSEAnnIN();};
			XmlHttpBAI.open("GET", requestUrl,  true);
			XmlHttpBAI.send(null);
		}
    }
function getDataResponseBSEAnnIN()
{
	if(XmlHttpBAI.readyState == 4)
	{	
	
		if(XmlHttpBAI.status == 200)
		{				
		
			
			var BSEAnn = document.getElementById("TdNews");
			//var AnnDate = document.getElementById("AnnDate");
			var strData = XmlHttpBAI.responseText;
			if(strData != "")
			 {	
			    var arrSchm = strData.split("|");
			   
			    for(i=0; i<arrSchm.length-1; i++) 
			    {	
				    var strSchm = arrSchm[i];
				   
				    var arrSchmCode = strSchm.split("~");
				  //   AnnDate.innerHTML = arrSchmCode[0];
				    BSEAnn.innerHTML = arrSchmCode[1];
				    document.body.style.cursor = "auto";
			    }
			   
			} 
				
		}
		
		else
		document.body.style.cursor = "auto";
			//MarqueeId.innerHTML = "<img src='../CommonImgs/loading1.gif'>";
	}
}

//function Searchempty()
//{
//    if (document.getElementById("GetQuotes_txtCompany").value=="Enter Company Name")
//    {
//        document.getElementById("GetQuotes_txtCompany").value="";
//    }
//}

//function Searchfill()
//{
//    var getquote=document.getElementById("GetQuotes_txtCompany").value;
//    
//    if (getquote=="")
//    {
//        document.getElementById("GetQuotes_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("GetQuotes_txtCompany").value;
//    var Id = document.getElementById("ddlQuote").value;	
//    		
//    if(SearchTxt =="" || SearchTxt=="Company Name")
//    {
//        alert("Please enter company name ..!!!");
//        document.getElementById("GetQuotes_txtCompany").value="";
//        document.getElementById("GetQuotes_txtCompany").focus();
//        return false;
//    }
//    else
//    {
//        var ddlQuote = document.getElementById("ddlQuote").value
//        
//        if(ddlQuote=="70")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=70";
//            return false;
//            
//        } 
//        if(ddlQuote=="71")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=71";
//            return false;
//        }  
//        if(ddlQuote=="72")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=72";
//            return false;
//        }
//        if(ddlQuote=="73")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=73";
//            return false;
//        } 
//        if(ddlQuote=="74")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=74";
//            return false;
//        }  
//        if(ddlQuote=="75")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=75";
//            return false;
//        }  
//        if(ddlQuote=="76")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=76";
//            return false;
//        } 
//        if(ddlQuote=="78")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=78";
//            return false;
//        } 
//        if(ddlQuote=="79")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=79";
//            return false;
//        } 
//        if(ddlQuote=="80")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=80";
//            return false;
//        } 
//        if(ddlQuote=="81")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=81";
//            return false;
//        } 
//        if(ddlQuote=="82")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=82";
//            return false;
//        } 
//        if(ddlQuote=="83")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=83";
//            return false;
//        } 
//        if(ddlQuote=="84")
//        {
//            document.location = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id=84";
//            return false;
//        } 
//       
//    }
//}
function Searchempty()
{
    if (document.getElementById("txtSearch").value=="Company Name")
    {
        document.getElementById("txtSearch").value="";
    }
}

function Searchfill()
{
    var getquote=document.getElementById("txtSearch").value;
    if (getquote=="")
    {
        document.getElementById("txtSearch").value="Company Name";
    }
}	

function QuoteEnterScript(e)
{
    if(e.keyCode==13)	
    {
        var Scripid = document.getElementById("ddlQuote");
       
        var strUrl ="../CompanyProfile/CompanyList.aspx?SrchQuote="+document.getElementById('txtSearch').value+"&id="+ Scripid.value;
       // alert(strUrl)
        var newWindow = window.open(strUrl, '_parent'); 			
        newWindow.focus(); 
        return false; 
        
    }
}


function SearchCompany()
    {
                    	
    var SearchTxt = document.getElementById("txtSearch").value;
    var Compxtbox=document.getElementById("txtSearch");
    var Id = document.getElementById("ddlQuote").value;	
	
    if(SearchTxt =="" || SearchTxt=="Company Name")
    {
        alert("Please enter Company Name");
        Compxtbox.focus();
        return false;
    }
	
    else
    {
	//var StrUrl = ""	
		
   var StrUrl = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id="+Id;

         document.location=StrUrl;
         return false   ;
     
    }
}


function ShowTabEq(Opt1)
{
    if(Opt1 == "Sensex")
    {
        document.getElementById("FirstTab").style.display = "inline";
        document.getElementById("SecondTab").style.display = "none";
        document.getElementById("TdSensexTab").className = "SensexNiftyOn";
        document.getElementById("TdNiftyTab").className = "SensexNiftyOff";
        ChangeControlEq("GAIN","BSE");
    }
    if(Opt1 == "Nifty")
    {
        document.getElementById("FirstTab").style.display = "none";
        document.getElementById("SecondTab").style.display = "inline";
        document.getElementById("TdSensexTab").className = "SensexNiftyOff";
        document.getElementById("TdNiftyTab").className = "SensexNiftyOn";
        ChangeControlEq("GAIN","NSE");
    }
}

function ChangeControlEq(Opt,Exch)
{
    CreateXmlHttpGLVolValEq();
    var currentDivObj = document.getElementById("Td_Data");
	document.body.style.cursor = "progress";
	var requestUrl = "AjaxDataGLVVEq.aspx?Option="+ Opt +"&Exchange="+ Exch;
   
	if(XmlHttpGLVolValEq!=null)	
	{
	    XmlHttpGLVolValEq.onreadystatechange = function(){ChangeControlResponseEq(Opt,Exch)}
		XmlHttpGLVolValEq.open('GET', requestUrl,  true);
		XmlHttpGLVolValEq.send(null);
	}
	return false; 
}	
	
function ChangeControlResponseEq(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(XmlHttpGLVolValEq.readyState == 4)
	{
		var td_Id = document.getElementById("Td_Data");
		
		if(XmlHttpGLVolValEq.status == 200)
		{
			td_Id.innerHTML =  XmlHttpGLVolValEq.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 XmlHttpGLVolValEq;
function CreateXmlHttpGLVolValEq()
{
	try
	{
		XmlHttpGLVolValEq = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpGLVolValEq = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpGLVolValEq = null;				
		}
	}
	
	if(!XmlHttpGLVolValEq && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpGLVolValEq = new XMLHttpRequest();
	}
}

function ContributionTab(Opt)
{
    if(Opt == "Sensex")
    {
       GetDataCTI('BSE');
    }
    else
    {
       GetDataCTI('NSE');
    }
}
var XmlHttpCTI;
function CreateXmlHttpCTI()
{
	try
	{
		XmlHttpCTI = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpCTI = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpCTI = null;				
		}
	}
	if(!XmlHttpCTI && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpCTI = new XMLHttpRequest();
	}
}

function GetDataCTI(Exch)
{
    CreateXmlHttpCTI();
    var currentDivObj = document.getElementById("tdCTIndex");
    
    if(Exch=='BSE')
    {
        document.getElementById("MoreCTI").href="../Equity/ContributionToIndex.aspx?id=15&Option=GAIN&EXCHG=BSE";
    }
    else
    {
        document.getElementById("MoreCTI").href="../Equity/ContributionToIndex.aspx?id=15&Option=GAIN&EXCHG=NSE";
    }
    
    currentDivObj.innerHTML ="<img src='../App_Themes/Seeta/Images/loading.gif'>";
	document.body.style.cursor = "progress";
	
	var requestUrl = "../Equity/AjaxCTI.aspx?Exchange="+ Exch;
	
	if(XmlHttpCTI!=null)	
	{
	    XmlHttpCTI.onreadystatechange = function(){ChangeResponseCTI(Exch)}
		XmlHttpCTI.open('GET', requestUrl,  true);
		XmlHttpCTI.send(null);
    }
	return false; 
}	
	
function ChangeResponseCTI(Exch)
{
	if(XmlHttpCTI.readyState == 4)
	{
		var td_Id = document.getElementById("tdCTIndex");
		if(XmlHttpCTI.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpCTI.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 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");
			//alert(currentDivObj);
//			currentDivObj.innerHTML ="<img src=App_Themes/Common/images/ajax-loader.gif>"; 
		
		CreateXmlHttpPop();
		document.body.style.cursor = "progress";
		var requestUrl = "../PopupNewsData.aspx?SecId="+ secId +"&SubSecId="+ SubSecId+"&NewsID="+NewsID+"&timeStamp="+new Date().getTime()+"opt="+opt;
		//alert(requestUrl);
		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("NewTd").innerHTML = "<img src=../App_Themes/Common/images/ajax-loader.gif>";
					
				
			}
		}
	}
	
	
	
	
	/* Market Update */

function ChangeBseNSeVal(val)
{

        if(val=='BSE')
        {
//            document.getElementById('tdBSE').style.display = "inline"; 
//            document.getElementById('tdNSE').style.display = "none"; 
            
            document.getElementById("tdBSE11").className="SensexNiftyOn";
	        document.getElementById("tdNSE11").className="SensexNiftyOff";
	        document.getElementById('Sensex').style.display="inline";
           document.getElementById('Nifty').style.display="none";
           //document.getElementById("chart").src="http://content.acesphere.com/Charts/FortShareBse.png?time=" + new Date().getTime();
         sensexChartF("BSE");
           ChangeControl("GAIN","BSE");
        }
        else
        { 
        
             document.getElementById("tdNSE11").className="SensexNiftyOn";
	         document.getElementById("tdBSE11").className="SensexNiftyOff";
	         document.getElementById('Sensex').style.display="none";
             document.getElementById('Nifty').style.display="inline";
//            document.getElementById('tdBSE').style.display = "none"; 
//            document.getElementById('tdNSE').style.display = "inline"; 
            //document.getElementById("chart").src="http://content.acesphere.com/Charts/FortShareNse.png?time=" + new Date().getTime();
           sensexChartF("NSE");
            ChangeControl('GAIN','NSE');
    }
}
function sensexChartF(Exchg)
	{
		var so = new SWFObject("../amline/amline.swf", "BSENSEline", "100%", "125px", "0", "#f7f7f7");
        var url ="../BSENSEchartAjax.aspx?Exchg="+Exchg;
		so.addVariable("path", "../amline/");
		so.addParam("wmode","opaque");
		so.addVariable("preloader_color", "#f7f7f7");
		so.addVariable("settings_file", encodeURIComponent("../amline/Equity_settings.xml"));
		so.addVariable("data_file", encodeURIComponent(url));
		so.write("Chart");	
	}



var XmlHttpx


function CreateXmlHttpp()
{
	try
	{
		XmlHttpx = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpx = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpx = null;				
		}
	}
	if(!XmlHttpx && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpx = new XMLHttpRequest();
	}
}




function ChangeControl(Opt,Exch)
{
	//alert()
	CreateXmlHttpp();
        var currentDivObj = document.getElementById("Td_Data");
        document.body.style.cursor = "progress";
	
	    var requestUrl = "AjaxDataGLVV.aspx?Option="+ Opt +"&Exchange="+ Exch;
   //alert(requestUrl) 
	if(XmlHttpx!=null)	
	        {
				XmlHttpx.onreadystatechange = function(){ChangeControlResponse(Opt,Exch)}
				XmlHttpx.open('GET', requestUrl,  true);
				XmlHttpx.send(null);
			}
			 return false; 
}	
	
function ChangeControlResponse(Opt,Exch)
{
//alert()
    var Head_td =document.getElementById("Heading");
   // var More=document.getElementById("More");
    var BSE_td =document.getElementById("tdBSE");
    var NSE_td =document.getElementById("tdNSE");
  // alert()	
	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(XmlHttpx.readyState == 4)
	{
	//alert()
		// 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.responseText)
		if(XmlHttpx.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpx.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 SearchCompanyOut()
    {
                    	
    var SearchTxt = document.getElementById("txtSearch").value;
    var Id = document.getElementById("ddlQuote").value;	
	
    if(SearchTxt =="" || SearchTxt=="Company Name")
    {
        alert("Please enter Company Name");
        document.getElementById("txtSearch").focus();
        
        return false;
    }
	
    else
    {
		//var StrUrl = "Underconstruction.aspx";
   var StrUrl = "../CompanyProfile/CompanyList.aspx?SrchQuote="+SearchTxt+"&id="+Id;

         document.location=StrUrl;
         return false   ;
     
    }
}



// Advance Chart Start

function GetQuoteData(Type)
    {                
                    document.getElementById("BSEUpdTd").style.display="none";
		            document.getElementById("FNOTime").style.display="none";
		            document.getElementById("NSEUpdTd").style.display="none";
		            document.getElementById("fnobest").style.display="none";
    
            if(Type=='BSE')
		     {
		            //document.getElementById("BNFTab").innerHTML="<table cellpadding='0' cellspacing='0' width='100%'><tr><td align='center' style='height: 32px;' valign='bottom'><table cellpadding='0' cellspacing='0' width='100%'><tr><td style='width: 290px;' valign='bottom'><table cellspacing='0' cellpadding='0' border='0' width='100%'><tr><td align='left' valign='middle' style='text-align: left; height: 32px; width: 80px;'><table cellpadding='0' cellspacing='0' width='100%'><tr><td valign='top' align='right'class='tabs4'><img src='../App_Themes/Common/images/LeftSelectTab.gif' alt='' /></td><td id='Td5' class='InnerSelTab'>BSE</td><td valign='top' align='left' width='6px;'><img src='../App_Themes/Common/images/RightSelectTab.gif' alt='' /></td></tr></table></td><td id='B' onclick='GetQuoteData(&#39;NSE&#39;);' style='height: 32px;padding-left:10px;width: 80px; text-align: left;' class='TabSelectedIn'>NSE</td><td style='width: 115px;'></td></tr></table></td></tr></table></td></tr></table>";
		           document.getElementById("BNFTab").innerHTML="<div class='tabs4' style=''><ul style=''><li ><a href='#' class='current' style='text-decoration: none'><span style=''>BSE</span></a> </li><li onclick='GetQuoteData(&#39;NSE&#39;);' id='NSEHED'><a href='#' style='text-decoration: none'><span>NSE</span></a></li><li id='nb'><a href='#' style='text-decoration: none'><span></span></a></li></ul> </div>";
		            document.getElementById("BSEUpdTd").style.display="";		            
		            Profilechart1('I',Type,document.getElementById('ctl00_ContentPlaceHolder1_Advance_HidFinCode').value,'D','1');
		    }
		    else if(Type=='NSE')
		    {      
//		    alert(Type);
//                    if(document.getElementById("ctl00_ContentPlaceHolder1_DisFno").value !="NA")
//                    {
                      //document.getElementById("BNFTab").innerHTML="<table cellpadding='0' cellspacing='0' width='100%'><tr><td align='center' style='width: 290px;height: 32px;' valign='bottom'><table cellpadding='0' cellspacing='0' width='100%'><tr><td id='Td1' onclick='GetQuoteData(&#39;BSE&#39;);' style='height: 32px; width: 40px;text-align: center;' class='TabSelectedIn'>&nbsp;BSE</td><td id='Td3' align='left' valign='middle' style='text-align: left; height: 32px;width: 80px;' class='TabUnSelected'><table cellpadding='0' cellspacing='0' width='100%'><tr><td valign='top' align='right'><img src='../App_Themes/Common/images/LeftSelectTab.gif' alt='' /></td><td id='Td2' class='InnerSelTab'>NSE</td><td valign='top' align='left' width='6px;'><img src='../App_Themes/Common/images/RightSelectTab.gif' alt='' /></td></tr></table></td><td style='height: 32px; width: 80px; text-align: center;' onclick='GetQuoteData(&#39;FNO&#39;);' class='TabSelectedIn'>NSE F & O</td><td style='width: 55px;'></td></tr></table></td></tr></table>";
                       document.getElementById("BNFTab").innerHTML="<div class='tabs4' style=''><ul style=''><li><a href='#' class='' style='text-decoration: none' onclick='GetQuoteData(&#39;BSE&#39;);' ><span style=''>BSE</span></a></li><li><a href='#' class='current' style='text-decoration: none'><span style=''>NSE</span></a></li><li onclick='GetQuoteData(&#39;FNO&#39;);'><a href='#' style='text-decoration: none'><span>NSE&nbsp;F&nbsp;&&nbsp;O</span></a></li></ul> </div>";
//                    }
                    
//                    else
//                    {           
//                   document.getElementById("BNFTab").innerHTML="<table cellpadding='0' cellspacing='0' width='100%'><tr><td align='center' style='width: 290px; height: 32px;' valign='bottom'><table cellpadding='0' cellspacing='0' width='100%'><tr><td id='Td1' onclick='GetQuoteData(&#39;BSE&#39;);' style='height: 32px; width: 40px;text-align: center;' class='TabSelectedIn'>&nbsp;BSE</td><td id='Td3' align='left' valign='middle' style='text-align: left; height: 32px;width: 80px;' class='TabUnSelected'><table cellpadding='0' cellspacing='0' width='100%'><tr><td valign='top' align='right'><img src='../App_Themes/Common/images/LeftSelectTab.gif' alt='' /></td><td id='Td2' class='InnerSelTab'>NSE</td><td valign='top' align='left' width='6px;'><img src='../App_Themes/Common/images/RightSelectTab.gif' alt='' /></td></tr></table></td><td style='height: 32px; width: 80px; text-align: center;'></td><td style='width: 55px;'></td></tr></table></td></tr></table>";
//                  // document.getElementById("BNFTab").innerHTML="<div class='tabs4' style=''><ul style=''><li ><a href='#' class='current' style='text-decoration: none'><span style=''>BSE</span></a> </li><li onclick='GetQuoteData(&#39;NSE&#39;);' id='NSEHED'><a href='#' style='text-decoration: none'><span>BSE</span></a></li><li id='nb'><a href='#' style='text-decoration: none'><span></span></a></li></ul> </div>";
//                    }		            
		            document.getElementById("NSEUpdTd").style.display="";		           
		            Profilechart1('I',Type,document.getElementById('ctl00_ContentPlaceHolder1_Advance_HidFinCode').value,'D','1');
		   }
		    
	        else if(Type=='FNO')
	        {
	              //document.getElementById("BNFTab").innerHTML="<table cellpadding='0' cellspacing='0' width='100%'><tr><td  class='tabs4' align='center' style='width:290px;height: 32px;' valign='bottom'><table cellpadding='0' cellspacing='0' width='100%'><tr><td id='B' onclick='GetQuoteData(&#39;BSE&#39;);' style='height: 32px; width: 40px;text-align: center;' class='TabSelectedIn'>&nbsp;BSE</td><td id='Td3' onclick='GetQuoteData(&#39;NSE&#39;);' style='height: 32px; width: 40px;text-align: center;' class='TabSelectedIn'>NSE</td><td align='left' valign='middle' style='text-align: left; height: 32px; width: 100px;' class='TabUnSelected'><table cellpadding='0' cellspacing='0' width='100%'><tr><td valign='top' align='right'></td><td id='Td4' class='current'>NSE F & O</td><td valign='top' align='left' width='6px;'></td></tr></table></td><td style='width: 75px;'></td></tr></table></td></tr></table>";	             
	               
	                   document.getElementById("BNFTab").innerHTML="<div class='tabs4' style=''><ul style=''><li ><a href='#' class='' style='text-decoration: none'onclick='GetQuoteData(&#39;BSE&#39;);' ><span style=''>BSE</span></a> </li><li><a href='#' class='' style='text-decoration: none' onclick='GetQuoteData(&#39;NSE&#39;);'><span style=''>NSE</span></a></li><li onclick='GetQuoteData(&#39;FNO&#39;);'><a href='#' style='text-decoration: none' class='current'><span>NSE&nbsp;F&nbsp;&&nbsp;O</span></a></li></ul> </div>";
                  
	               
	               
	                // document.getElementById("BNFTab").innerHTML="<div class='tabs4' style=''><ul style=''><li><a href='#' class='current' style='text-decoration: none'><span style=''>NSE</span></a></li><li onclick='GetQuoteData(&#39;FNO&#39;);'><a href='#' style='text-decoration: none'><span>NSE&nbsp;F&nbsp;&&nbsp;O</span></a></li></ul> </div>";
	                  // document.getElementById("BNFTab").innerHTML="<div class='tabs4' style=''><ul style=''><li ><a href='#' class='current' style='text-decoration: none'><span style=''>BSE</span></a> </li><li onclick='GetQuoteData(&#39;NSE&#39;);' id='NSEHED'><a href='#' style='text-decoration: none'><span>NSE</span></a></li><li id='nb'><a href='#' style='text-decoration: none'><span></span></a></li></ul> </div>";
	                document.getElementById("FNOTime").style.display="";
	                document.getElementById("fnobest").style.display="";
	                Profilechart1('I',Type,document.getElementById('ctl00_ContentPlaceHolder1_Advance_HidFinCode').value,'D','1');
	        }
		    
		   ShowDataCompany(Type);

    }
    
    function ShowDataCompany(value)
{
//alert(value);
        var bsebest=document.getElementById("bsebest");
        var nsebest=document.getElementById("nsebest");
        var fnobest = document.getElementById("fnobest");
        var FNO = document.getElementById("FNO");
        if(value=='FNO')
        {
            document.getElementById("Exchg").value='NSE';
        }
        else 
        {
        document.getElementById("Exchg").value=value;
        }

            
         document.getElementById('NseQuote').style.display="none";
         document.getElementById('BseQuote').style.display="none";
         document.getElementById('FNO').style.display="none";
         bsebest.style.display="none";
         nsebest.style.display="none"; 
         fnobest.style.display="none";
            
       if(value=="BSE")
        {
            document.getElementById('BseQuote').style.display="";       
            bsebest.style.display="";
        }
        if(value=="NSE")
        {    
            document.getElementById('NseQuote').style.display="";
            nsebest.style.display="";
        }
         
         if(value=='FNO')
        {   
             document.getElementById('FNO').style.display="";
             fnobest.style.display="";
        }
    

 }
    
     function Profilechart1(GraphType,val,FinCode,DateOpt,DateCnt)
{
            document.getElementById("1days").className="BSENSETabUnSel";          
            document.getElementById("1Week").className="BSENSETabUnSel";
            document.getElementById("1Mon").className="BSENSETabUnSel";
            document.getElementById("1Year").className="BSENSETabUnSel";
            
            if(DateOpt=='D')
            {
            document.getElementById("1days").className="BSENSETabSel";          
            }
             if(DateOpt=='M')
            {
                if( DateCnt=='3')
                {
                document.getElementById("1Week").className="BSENSETabSel";            
                }
                else if(DateCnt=='1')
                {      
                document.getElementById("1Mon").className="BSENSETabSel";
                }
            
            }
             if(DateOpt=='Y')
            {           
             document.getElementById("1Year").className="BSENSETabSel";
            }
            document.getElementById("ctl00_ContentPlaceHolder1_Advance_hdnExchange").value=val;  
            document.getElementById("ctl00_ContentPlaceHolder1_Advance_hdnGraphType" ).value=GraphType;
            document.getElementById("ctl00_ContentPlaceHolder1_Advance_hdnDateOpt").value=DateOpt;
            var so = new SWFObject("../amline/amline.swf", "BSENSEline", "280", "200", "0", "#f9f9f9");
		    so.addVariable("path", "../amline/");
		    so.addParam("wmode","opaque");
		    so.addVariable("preloader_color", "#999999");
		    so.addVariable("settings_file", encodeURIComponent("../Amline/Equity_settings.xml"));
		    document.getElementById("ChartPeriod").style.display=""; 
		    if(val!='FNO')
		    {
            so.addVariable("data_file", encodeURIComponent("../CompanyProfile/MarketChartAjax.aspx?GraphType="+GraphType+"&DateOpt="+DateOpt+"&Exchg="+val+"&DateCnt="+DateCnt+"&fincode="+FinCode+"&TimeStamp="+new Date().getTime()));
            }
            else
            {
                   so.addVariable("settings_file", encodeURIComponent("../Amline/SmartQuotes.xml"));
                   so.addVariable("data_file", encodeURIComponent("../CompanyProfile/GetQuoteChart.aspx?Fincode="+FinCode+"&TimeStamp="+new Date().getTime()));
                   document.getElementById("ChartPeriod").style.display="none";  

            }
		    so.write("flashcontent");
		
}
//Advance Chart End
