
function Browser() {
  var ua, s, i;
  this.isIE    = false;
  this.isNS    = false;
  this.version = null;
  ua = navigator.userAgent;
  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}
var browser = new Browser();
var clockTimeoutID;
//Global Variables
var XmlHttp;
var XmlHttp2;
var XmlHttp3;
var XmlHttpTOP;
var XmlHttpNews;

function CreateXmlHttpTOP()
{
	try
	{
		XmlHttpTOP = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpTOP = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpTOP = null;				
		}
	}
	if(!XmlHttpTOP && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpTOP = new XMLHttpRequest();
	}
}
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 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();
	}
}

//for home ticker
function CreateXmlHttp2()
{
	//Creating object of XMLHTTP in IE
	try
	{
		XmlHttp2 = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp2 = null;	
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp2 && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp2 = new XMLHttpRequest();
	}
}
	
//for home Gainer and Loser Control
function CreateXmlHttp3()
{
	//Creating object of XMLHTTP in IE
	try
	{
		XmlHttp3 = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp3 = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp3 = null;	
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp3 && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp3 = new XMLHttpRequest();
	}
}
	
//for MF Dividends
function CreateXmlHttpSch()
{
	//Creating object of XMLHTTP in IE
	try
	{
		XmlHttpSch = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpSch = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttpSch = null;	
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttpSch && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttpSch = new XMLHttpRequest();
	}
}
	
function ChangeIndex(Exchg)
{

  if(Exchg=="BSE")
  {
   document.getElementById("BSETab").style.display="inline";
   document.getElementById("NSETab").style.display="none";
   GetNewsDetail("BSE");
  }
  else
  {
   document.getElementById("BSETab").style.display="none";
   document.getElementById("NSETab").style.display="inline";
   GetNewsDetail("NSE");
  }
}
	
function GetNewsDetail(Exchng)
{
	
	CreateXmlHttp();
	document.body.style.cursor = "progress";
	
	var requestUrl = "../BNAjax.aspx?Exchng="+ Exchng +"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
	//alert(requestUrl);
	if(XmlHttp)	{
				XmlHttp.onreadystatechange = function(){getDetailsMktSnap();};
				XmlHttp.open("GET", requestUrl,  true);
				XmlHttp.send(null);
			}
}

function getDetailsMktSnap()
{	
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
		
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{		
		 
			document.getElementById("BSETbl").innerHTML = XmlHttp.responseText;			
			document.body.style.cursor = "auto";
		}
		else
		{
		
			document.getElementById("BSETbl").innerHTML = "<img src='../images/loading1.gif'>";
			document.body.style.cursor = "auto";
	    }
	}
}


//For Loading ticker from TickerData.aspx Using AJAX
function getTickerData(Exchg)
	{	
		if(Exchg=="BSE")
		{	
			document.getElementById("TDBseTicker").style.backgroundColor="#cc0001";
			document.getElementById("TDNseTicker").style.backgroundColor="#221e1f";		
			document.getElementById("TDBseTicker").style.cursor="";
			document.getElementById("TDNseTicker").style.cursor="hand";
		}
		else if(Exchg=="NSE")
		{
			document.getElementById("TDBseTicker").style.backgroundColor="#221e1f";
			document.getElementById("TDNseTicker").style.backgroundColor="#cc0001";		
			document.getElementById("TDBseTicker").style.cursor="hand";
			document.getElementById("TDNseTicker").style.cursor="";			
		}
	
		CreateXmlHttp2();
		document.body.style.cursor = "progress";
		document.getElementById("MarqueeId").innerHTML = " <img src='../images/loading1.gif'>";
		
		var requestUrl = "../TickerData.aspx?Exchg="+ Exchg +"&IpTrack="+ window.location.hostname +"&timeStamp="+new Date().getTime();
		if(XmlHttp2)
			{
					XmlHttp2.onreadystatechange = function(){getDataResponse(Exchg);};
					XmlHttp2.open("GET", requestUrl,  true);
					XmlHttp2.send(null);
			}
	}
	
	//Called when response comes back from server Only For Ticker
function getDataResponse(Exchg)
{
	
	// To make sure receiving response data from server is completed
	if(XmlHttp2.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp2.status == 200)
		{			
		
			var arrCol,Time,Code,CompName,ClPrice,DiffVal,DiffImg;
			var ExchgDet="",stkDet="";
			var MarqueeId = document.getElementById("MarqueeId");
			var Mq_Data = XmlHttp2.responseText;
			
			if(Mq_Data != "")
			var arrRow = Mq_Data.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='greentxt'>"
						}
						else if(DiffVal<0) 
						{
							clss = "<span class='Redtxt'>"							
						}
						else 
						{
							clss = "<span class='greentxt'>"											
						}
						
						//if(i==0)ExchgDet = arrCol[0] +" &nbsp; "+ CompName +"&nbsp; "+ ClPrice +" " + DiffImg + "&nbsp;(" + clss + DiffVal + "</span>) &nbsp;&nbsp;&nbsp;";else stkDet += "<a target=_parent href='../Corporateinfo/CompSearch.aspx?id=GQR1&cocode="+ arrCol[0] +"' class=BlueLinkDark>" + CompName +"</a>&nbsp; "+ ClPrice +" "+ DiffImg +"&nbsp("+ clss + DiffVal + "</span>)  &nbsp;";
						if(i==0)ExchgDet = arrCol[0] +"&nbsp; "+ CompName + " " + ClPrice + "&nbsp;(" + clss + DiffVal +"</span>) &nbsp;&nbsp;&nbsp;";
						else stkDet += "<a href='../Corporateinfo/CompSearch.aspx?id=GQR1&cocode=" + arrCol[0] + "' class='BlueLinkDark'>" + CompName + "</a> &nbsp; " + ClPrice +" (" + clss + DiffVal +"</span>)  &nbsp;";
						
						
						//if(i==0)ExchgDet = arrCol[0] +"&nbsp; " + CompName + " " + ClPrice + "&nbsp;(" + clss + DiffVal +"</span>) &nbsp;&nbsp;&nbsp;";else stkDet += "&nbsp; " + CompName +" "+ ClPrice +"&nbsp("+ clss + DiffVal + "</span>)  &nbsp;";
				}
				if(browser.isIE)
					MarqueeId.innerHTML = "<marquee onmouseover='this.stop();' id='marq' onmouseout='this.start();' trueSpeed scrollAmount='1' scrollDelay='35' direction='left' loop='repeat' width='100%'>" + ExchgDet + stkDet + "</marquee>";
				else
					MarqueeId.innerHTML = ExchgDet + stkDet;				
				document.body.style.cursor = "auto";
				//ExchngTimeClock(Exchg);
	
		}
		else
			MarqueeId.innerHTML = "<img src='../images/loading1.gif'>";
	}
}
//for emailalert data  //

function CreateXmlHttpEmail()
{
	//Creating object of XMLHTTP in IE
	try
	{
		XmlHttpEmail = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpEmail = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttpEmail = null;	
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttpEmail && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttpEmail = new XMLHttpRequest();
	}
}

//created for email alerts data insertion
function insertdata(Subscription,Name,EmailId,cno)
{

CreateXmlHttpEmail()
	var requestUrl="../Ajax/emaildata.aspx?Subscription="+ Subscription +"&Name="+ Name +"&EmailID="+ EmailId +"&cno="+cno;;
	alert(requestUrl)
}


//For top performers data
function loadGLData(Period,Category,TopGl)
{
	CreateXmlHttpTOP()
	document.body.style.cursor = "progress";
	var TopGl;
	if(Period=='')
		Period = "1YEAR";
	if(Category=='')	
		Category="ALL";
	
	var requestUrl = "../Ajax/MFtopglData.aspx?Period="+ Period +"&Cat="+ Category +"&TopGl="+ TopGl;
		
	if(XmlHttpTOP)	{
				XmlHttpTOP.onreadystatechange = function(){GLResponse(TopGl)}
				XmlHttpTOP.open("GET", requestUrl,  true);
				XmlHttpTOP.send(null);
			}
}	
	
	function GLResponse(TopGl)
{
            var GainerId = document.getElementById("TopBotPerformers1_GainerId");
			var LoserId  = document.getElementById("TopBotPerformers1_LoserId");
	// To make sure receiving response data from server is completed
	if(XmlHttpTOP.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK

		if(XmlHttpTOP.status == 200)//TopBotPerformers
		{	
			var strGlData = XmlHttpTOP.responseText
			if(TopGl=='T')
				GainerId.innerHTML = strGlData;
			  else
				LoserId.innerHTML = strGlData;
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			if(TopGl=='T')
				GainerId.innerHTML = "There was a problem retrieving data from the server.";
			else
				LoserId.innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}

//for new index

function loadGLDataNew(Period,Category,TopGl)
{
	CreateXmlHttpTOP()
	document.body.style.cursor = "progress";
	var TopGl;
	if(Period=='')
		Period = "1YEAR";
	if(Category=='')	
		Category="ALL";
	
	var requestUrl = "../Ajax/MFtopglDataNew.aspx?Period="+ Period +"&Cat="+ Category +"&TopGl="+ TopGl;
		
	if(XmlHttpTOP)	{
				XmlHttpTOP.onreadystatechange = function(){GLResponseNew(TopGl)}
				XmlHttpTOP.open("GET", requestUrl,  true);
				XmlHttpTOP.send(null);
			}
}	
	
	function GLResponseNew(TopGl)
{
            var GainerId = document.getElementById("TopBotPerformersNew1_GainerId");
			var LoserId  = document.getElementById("TopBotPerformersNew1_LoserId");
	// To make sure receiving response data from server is completed
	if(XmlHttpTOP.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK

		if(XmlHttpTOP.status == 200)//TopBotPerformers
		{	
			var strGlData = XmlHttpTOP.responseText
			if(TopGl=='T')
				GainerId.innerHTML = strGlData;
			  else
				LoserId.innerHTML = strGlData;
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			if(TopGl=='T')
				GainerId.innerHTML = "There was a problem retrieving data from the server.";
			else
				LoserId.innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}		 		 
/*News popup*/

function GetHomeNewsDetail(SrNo,secId,SubSecId,opt,title)
{
	var NewsWin;	
	
	if(SubSecId == "D")
	{
		NewsWin = document.getElementById("cm_window").style.display='inline';
		NewsWin = document.getElementById("cm_window").style.top='400';
	}
	else if(SubSecId == "M")
	{
		NewsWin = document.getElementById("cm_window").style.display='inline';
		NewsWin = document.getElementById("cm_window").style.top='320';
	}
	else if(SubSecId == "H")
	{
		NewsWin = document.getElementById("cm_window").style.display='inline';
		NewsWin = document.getElementById("cm_window").style.top='130';
	}
	else
	{
		NewsWin = document.getElementById("cm_window").style.display='inline';
		
	}
	var currentDivObj,currentTitle
	currentTitle = document.getElementById("Title");
	if(opt=="in")
	{
		currentDivObj = document.getElementById("NewsId1");
		currentDivObj.innerHTML ="<img src=../images/loading1.gif>";
		//currentTitle.innerHTML = title
	}
	
	CreateXmlHttpNews();
	document.body.style.cursor = "progress";
	if (title == "CorpInfo")
		Section = "CorpInfo"
	else
		Section = ""
	var requestUrl = "../Ajax/NewsData.aspx?Section="+Section+"&SecId="+ secId +"&SubSecId="+ SubSecId+"&SrNo="+ SrNo+"";
	
	if(XmlHttpNews)
	{
		XmlHttpNews.onreadystatechange = function(){getHomeDetails(opt);};
		XmlHttpNews.open("GET", requestUrl,  true);
		XmlHttpNews.send(null);
	}	
}


function getHomeDetails(opt)
{
	// To make sure receiving response data from server is completed
	if(XmlHttpNews.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpNews.status == 200)
		{
			if(opt=="in")
				document.getElementById("NewsId1").innerHTML = XmlHttpNews.responseText;
				document.body.style.cursor = "auto";
		}
		else
		{
			if(opt=="in")
				document.getElementById("NewsId1").innerHTML = "<img src='../images/loading1.gif'>";
		}

	}
}


function getDetails(opt)
{
	// To make sure receiving response data from server is completed
	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(opt=="in")
				
				document.getElementById("NewsId1").innerHTML = XmlHttp.responseText;
				document.body.style.cursor = "auto";
		}
		else
		{
			if(opt=="in")
				document.getElementById("NewsId1").innerHTML = "<img src='../images/loading1.gif'>";
		}
	}
}


// For Gainer and loser,value,vulume

//For top performers data
function ChangeControl(CltName,Exch)
{
	var BSE_td =document.getElementById("Td_BSE");
	var NSE_td =document.getElementById("Td_NSE");
	var BSE_td1 =document.getElementById("Td_BSE1");
	var NSE_td1 =document.getElementById("Td_NSE1");		
	if(Exch=="BSE")
	{
		BSE_td.className="BlackBold";
		NSE_td.className="BlackMormal";
		BSE_td1.className="BlackBold";
		NSE_td1.className="BlackMormal";
	    document.getElementById("BSETab1").style.display="inline";
        document.getElementById("NSETab1").style.display="none";				
	}
	else if (Exch=="NSE")
	{
		BSE_td.className="BlackMormal";
		NSE_td.className="BlackBold";
		BSE_td1.className="BlackMormal";
		NSE_td1.className="BlackBold";
		document.getElementById("BSETab1").style.display="none";
        document.getElementById("NSETab1").style.display="inline";				
	}
	
	CreateXmlHttp3()
    
    var currentDivObj = document.getElementById("HomeRightPart1_GLVoVa1_Td_Data");
	currentDivObj.innerHTML ="<img src=../images/loading1.gif>";
	document.body.style.cursor = "progress";
	
	var requestUrl = "../Ajax/GainerLoserData.aspx?CltName="+ CltName +"&Exchange="+ Exch;

	if(XmlHttp3)	{
				XmlHttp3.onreadystatechange = function(){ChangeControlResponse(CltName)}
				XmlHttp3.open("GET", requestUrl,  true);
				XmlHttp3.send(null);
			}
}	
	
function ChangeControlResponse(name)
{
	var Head_td =document.getElementById("Heading");
	var Head_td1 =document.getElementById("Heading1");
	var BSE_td =document.getElementById("Td_BSE");
	var NSE_td =document.getElementById("Td_NSE");
	var BSE_td1 =document.getElementById("Td_BSE1");
	var NSE_td1 =document.getElementById("Td_NSE1");
	switch (name)
	{
	case "G":
		Head_td.innerHTML="Gainers";
		Head_td1.innerHTML="Gainers";
		BSE_td.innerHTML="<a href=javascript:ChangeControl('G','BSE')> BSE</a>";
		NSE_td.innerHTML="<a href=javascript:ChangeControl('G','NSE')> NSE</a>";
		BSE_td1.innerHTML="<a href=javascript:ChangeControl('G','BSE')> BSE</a>";
		NSE_td1.innerHTML="<a href=javascript:ChangeControl('G','NSE')> NSE</a>";
	break;
	case "L":
		Head_td.innerHTML="Losers";
		Head_td1.innerHTML="Losers";
		BSE_td.innerHTML="<a href=javascript:ChangeControl('L','BSE')> BSE</a>";
		NSE_td.innerHTML="<a href=javascript:ChangeControl('L','NSE')> NSE</a>";
		BSE_td1.innerHTML="<a href=javascript:ChangeControl('L','BSE')> BSE</a>";
		NSE_td1.innerHTML="<a href=javascript:ChangeControl('L','NSE')> NSE</a>";
	break;
	case "Vo":
		Head_td.innerHTML="Volume";
		Head_td1.innerHTML="Volume";
		BSE_td.innerHTML="<a href=javascript:ChangeControl('Vo','BSE')> BSE</a>";
		NSE_td.innerHTML="<a href=javascript:ChangeControl('Vo','NSE')> NSE</a>";
		BSE_td1.innerHTML="<a href=javascript:ChangeControl('Vo','BSE')> BSE</a>";
		NSE_td1.innerHTML="<a href=javascript:ChangeControl('Vo','NSE')> NSE</a>";
	break;
	case "Va":
		Head_td.innerHTML="Value";
		Head_td1.innerHTML="Value";
		BSE_td.innerHTML="<a href=javascript:ChangeControl('Va','BSE')> BSE</a>";
		NSE_td.innerHTML="<a href=javascript:ChangeControl('Va','NSE')> NSE</a>";
		BSE_td1.innerHTML="<a href=javascript:ChangeControl('Va','BSE')> BSE</a>";
		NSE_td1.innerHTML="<a href=javascript:ChangeControl('Va','NSE')> NSE</a>";
	break;
	}

	// To make sure receiving response data from server is completed
	
	if(XmlHttp3.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		var td_Id = document.getElementById("HomeRightPart1_GLVoVa1_Td_Data");
		if(XmlHttp3.status == 200)//
		{
			td_Id.innerHTML =  XmlHttp3.responseText;
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}	
//for new index
function ChangeControlNew(CltName,Exch)
{
	var BSE_td =document.getElementById("Td_BSE");
	var NSE_td =document.getElementById("Td_NSE");
	var BSE_td1 =document.getElementById("Td_BSE1");
	var NSE_td1 =document.getElementById("Td_NSE1");		
	if(Exch=="BSE")
	{
		BSE_td.className="BlackBold";
		NSE_td.className="BlackMormal";
		BSE_td1.className="BlackBold";
		NSE_td1.className="BlackMormal";
	    document.getElementById("BSETab1").style.display="inline";
        document.getElementById("NSETab1").style.display="none";				
	}
	else if (Exch=="NSE")
	{
		BSE_td.className="BlackMormal";
		NSE_td.className="BlackBold";
		BSE_td1.className="BlackMormal";
		NSE_td1.className="BlackBold";
		document.getElementById("BSETab1").style.display="none";
        document.getElementById("NSETab1").style.display="inline";				
	}
	
	CreateXmlHttp3()
    
    var currentDivObj = document.getElementById("HomeRightPartNew1_GLVoVaNew1_Td_Data");
	currentDivObj.innerHTML ="<img src=../images/loading1.gif>";
	document.body.style.cursor = "progress";
	
	var requestUrl = "../Ajax/GainerLoserDataNew.aspx?CltName="+ CltName +"&Exchange="+ Exch;

	if(XmlHttp3)	{
				XmlHttp3.onreadystatechange = function(){ChangeControlResponseNew(CltName)}
				XmlHttp3.open("GET", requestUrl,  true);
				XmlHttp3.send(null);
			}
}	

function ChangeControlResponseNew(name)
{
	var Head_td =document.getElementById("Heading");
	var Head_td1 =document.getElementById("Heading1");
	var BSE_td =document.getElementById("Td_BSE");
	var NSE_td =document.getElementById("Td_NSE");
	var BSE_td1 =document.getElementById("Td_BSE1");
	var NSE_td1 =document.getElementById("Td_NSE1");
	switch (name)
	{
	case "G":
		Head_td.innerHTML="Gainers";
		Head_td1.innerHTML="Gainers";
		BSE_td.innerHTML="<a href=javascript:ChangeControlNew('G','BSE')> BSE</a>";
		NSE_td.innerHTML="<a href=javascript:ChangeControlNew('G','NSE')> NSE</a>";
		BSE_td1.innerHTML="<a href=javascript:ChangeControlNew('G','BSE')> BSE</a>";
		NSE_td1.innerHTML="<a href=javascript:ChangeControlNew('G','NSE')> NSE</a>";
	break;
	case "L":
		Head_td.innerHTML="Losers";
		Head_td1.innerHTML="Losers";
		BSE_td.innerHTML="<a href=javascript:ChangeControlNew('L','BSE')> BSE</a>";
		NSE_td.innerHTML="<a href=javascript:ChangeControlNew('L','NSE')> NSE</a>";
		BSE_td1.innerHTML="<a href=javascript:ChangeControlNew('L','BSE')> BSE</a>";
		NSE_td1.innerHTML="<a href=javascript:ChangeControlNew('L','NSE')> NSE</a>";
	break;
	case "Vo":
		Head_td.innerHTML="Volume";
		Head_td1.innerHTML="Volume";
		BSE_td.innerHTML="<a href=javascript:ChangeControlNew('Vo','BSE')> BSE</a>";
		NSE_td.innerHTML="<a href=javascript:ChangeControlNew('Vo','NSE')> NSE</a>";
		BSE_td1.innerHTML="<a href=javascript:ChangeControlNew('Vo','BSE')> BSE</a>";
		NSE_td1.innerHTML="<a href=javascript:ChangeControlNew('Vo','NSE')> NSE</a>";
	break;
	case "Va":
		Head_td.innerHTML="Value";
		Head_td1.innerHTML="Value";
		BSE_td.innerHTML="<a href=javascript:ChangeControlNew('Va','BSE')> BSE</a>";
		NSE_td.innerHTML="<a href=javascript:ChangeControlNew('Va','NSE')> NSE</a>";
		BSE_td1.innerHTML="<a href=javascript:ChangeControlNew('Va','BSE')> BSE</a>";
		NSE_td1.innerHTML="<a href=javascript:ChangeControlNew('Va','NSE')> NSE</a>";
	break;
	}

	// To make sure receiving response data from server is completed
	
	if(XmlHttp3.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		var td_Id = document.getElementById("HomeRightPartNew1_GLVoVaNew1_Td_Data");
		if(XmlHttp3.status == 200)//
		{
			td_Id.innerHTML =  XmlHttp3.responseText;
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}	 

/* for MF Dividends */
function SelectSchemeInner()
{
	var Fund = document.getElementById("cForm_FundsDrop");
	var category  = document.getElementById("cForm_Categorydrop");

	CreateXmlHttpSch();
	document.body.style.cursor = "progress";
	var requestUrl = "../Ajax/MF_SchemeData.aspx?IpTrack="+ window.location.hostname +"&timeStamp="+ new Date().getTime() +"&Fund="+ Fund.value;
	//alert(requestUrl)
	if(XmlHttpSch)	{
			XmlHttpSch.onreadystatechange = function(){getSchemeRespinner(category)};
			XmlHttpSch.open("GET", requestUrl,  true);
			XmlHttpSch.send(null);
	}
}

function getSchemeRespinner(ig_)
{
	// To make sure receiving response data from server is completed
	if(XmlHttpSch.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpSch.status == 200)
		{
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpSch.responseText
			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 = "Scheme is not available";			
			}
			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";		
		}
	}
}

//What in What out
function SelectScheme()
{						
		var fund = document.getElementById("cForm_drp_FundHouse");
		var category = document.getElementById("cForm_drp_Category");
		var scheme = document.getElementById("cForm_drp_Scheme");
													  
		CreateXmlHttpINOUT();		
		document.body.style.cursor = "progress";	
		var requestUrl = "../Ajax/MF_SchemeData.aspx?IpTrack="+ window.location.hostname +"&timeStamp="+ new Date().getTime() +"&Fund="+ fund.value +"&Category="+category.value;
	
		if(XmlHttpINOUT)
		{		
					XmlHttpINOUT.onreadystatechange = function(){getSchemeResp(scheme)};
					XmlHttpINOUT.open("GET",requestUrl,  true);
					XmlHttpINOUT.send(null);
		}
}
	
function getSchemeResp(ig_)
{	
	// To make sure receiving response data from server is completed
	if(XmlHttpINOUT.readyState == 4)
	{		
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpINOUT.status == 200)
		{
			
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpINOUT.responseText			
				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 = "Scheme is not available";			
				}
				
			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";		
		}		
	}			
	///document.getElementById("Loading").innerHTML = "<table height='280'><tr><td align='center' valign='middile'><img src='../images/loading.gif' width='130' height='60'></td></tr></table>";
}

function CreateXmlHttpINOUT()
{
	try
	{
		XmlHttpINOUT = new ActiveXObject("Msxml2.XMLHTTP");		
	}
	catch(e)
	{
		try
		{		
			XmlHttpINOUT = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpINOUT = null;				
		}
	}
	if(!XmlHttpINOUT && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpINOUT = new XMLHttpRequest();
	}
}	


/*For making the T&C popup visible*/
function ShowTCWin()
{
	var TCWin = document.getElementById("tc_window").style.display='inline';
}