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 MarketsGLV(Exchg,price,report,index,Pageopt)
{

	var TopGLVUrl = "TopGLVData.aspx?Exchg="+Exchg+"&price="+price+"&report="+report+"&index="+index+"&Pageopt="+Pageopt;
	var DivTopGLV = document.getElementById("DivTopGLV");
	DivTopGLV.innerHTML = "<img src='../images/loading.gif'>";
	var ajax = new Ajax.Updater('DivTopGLV',TopGLVUrl);
}


function MarketsGLV_Sorting(Exchg,price,report,index,Pageopt,PageNo,FieldName,Order)
{

	var TopGLVUrl = "TopGLVData.aspx?Exchg="+Exchg+"&price="+price+"&report="+report+"&index="+index+"&Pageopt="+Pageopt+"&PageNo=0&FieldName="+FieldName+"&Order="+Order;
	var DivTopGLV = document.getElementById("DivTopGLV");
	DivTopGLV.innerHTML = "<img src='../images/loading.gif'>";
	var ajax = new Ajax.Updater('DivTopGLV',TopGLVUrl,{evalScripts: true});
}



function ChangeReport(ReportVal,Exchg,Opt)
{

	var Exchg,Opt;				
	var Index = document.getElementById("IndexDrop");
	var ReportTxt = document.getElementById("ReportTxt");
	var DefaultTxt;

cnt=1;
	if(Exchg=='BSE'){
		arrGroup = arrBseGroup;
		arrGroupCode = arrBseGroupCode;
		arrIndex = arrBseIndex;
		arrIndexCode = arrBseIndexCode;
	}	
	else
	{
		arrGroup = arrNseGroup;
		arrGroupCode = arrNseGroupCode;
		arrIndex = arrNseIndex;
		arrIndexCode = arrNseIndexCode;
	}
	if(ReportVal=='P'){
		ReportTxt.innerHTML = "Price";
		DefaultTxt = "All Range";
		arrCode = arrPriceCode;
		arrText	= arrPrice;
	}		
	if(ReportVal=='G')	{
		ReportTxt.innerHTML = "Group";
		DefaultTxt = "All Group";
		arrCode = arrGroupCode;
		arrText	= arrGroup;			
	}
	else if(ReportVal=='I'){
		ReportTxt.innerHTML = "Index";
		DefaultTxt = "All Index";
		arrCode = arrIndexCode;
		arrText	= arrIndex;	
	}
	else if(ReportVal==""){		
		DefaultTxt = "Select";
	}				
	Index.length = 0;
	Index.options[0] = new Option();
	Index.options[0].value = "";
	Index.options[0].text = DefaultTxt;
	for(var i=0; i < arrCode.length; i++)
	{
			Index.options[cnt] = new Option(); 
			Index.options[cnt].value = arrCode[i];
			Index.options[cnt].text = arrText[i];
			if(Opt.indexOf("index="+arrCode[i]) != -1){
				Index.options[cnt].selected = true;}
			cnt = cnt + 1;
	}
}

function Redirect_paging(PageNo,Field,Order)
{
	var Last =document.getElementById("Lastpage");
	var Prev=document.getElementById("PrevPage");
	var Next=document.getElementById("NextPage");
	
	var Exchg=document.getElementById("Exchg").value;
	var price=document.getElementById("price").value;
	var report=document.getElementById("report").value;
	var index=document.getElementById("index").value;
	var Pageopt=document.getElementById("Pageopt").value;
	
	
	//alert(Symbol);
	var DivTopGLV = document.getElementById("DivTopGLV");
	DivTopGLV.innerHTML = "<img src='../images/loading.gif'>";
	
	var Urlpage ="TopGLVData.aspx?Exchg="+Exchg+"&PageNo=0&price="+price+"&report="+report+"&index="+index+"&Pageopt="+Pageopt+"&FieldName="+Field+"&Order="+Order;
	
	if(PageNo == "L")
	{	
			var Urlpage ="TopGLVData.aspx?Exchg="+Exchg+"&PageNo="+Last.value+"&price="+price+"&report="+report+"&index="+index+"&Pageopt="+Pageopt+"&FieldName="+Field+"&Order="+Order;
	}
	else if (PageNo =="P")
	{
		var Urlpage ="TopGLVData.aspx?Exchg="+Exchg+"&PageNo="+Prev.value+"&price="+price+"&report="+report+"&index="+index+"&Pageopt="+Pageopt+"&FieldName="+Field+"&Order="+Order;
	}
	else if (PageNo =="N")
	{
		var Urlpage ="TopGLVData.aspx?Exchg="+Exchg+"&PageNo="+Next.value+"&price="+price+"&report="+report+"&index="+index+"&Pageopt="+Pageopt+"&FieldName="+Field+"&Order="+Order;
		//alert(Urlpage);
	}
	var ajax = new Ajax.Updater('DivTopGLV',Urlpage,{evalScripts: true});
}

function homeGLV(Exchg)
{
	if(Exchg=="Bse")
	{
		document.getElementById("abse").className="classred";
		document.getElementById("anse").className="thBgL";
	}
	else
	{
		document.getElementById("anse").className="classred";
		document.getElementById("abse").className="thBgL";
	}
	
	var TopGLVUrl = "HometopGLVdata.aspx?Exchg="+Exchg;
	var Divhome = document.getElementById("Divhome");
	Divhome.innerHTML = "<img src='../images/loading.gif'>";
	var ajax = new Ajax.Updater('Divhome',TopGLVUrl);
}

	

function EqhomeGL(Exchg)
	{
		CreateXmlHttp();
		var GL = document.getElementById("tdequgl");
		GL.innerHTML ="<table cellpadding='0' cellspacing='0' width='100%' height='120px' border='0'><tr><td align='center'><img src='../images/loading.gif'></td></tr></table>";
		if(Exchg=="Bse")
		{
			document.getElementById("eabse").className="classred";
			document.getElementById("eanse").className="";
			var eqUrl = "EquGLHomedata.aspx?Exchg=BSE_Sensex";
		}
		else
		{
			document.getElementById("eanse").className="classred";
			document.getElementById("eabse").className="";
			var eqUrl = "EquGLHomedata.aspx?Exchg=Nifty";
		}

	//alert(eqUrl);
		
		if(XmlHttp)	
		{
			XmlHttp.onreadystatechange = function(){getDataResponse(GL);};
			XmlHttp.open("GET", eqUrl,  true); 
			XmlHttp.send(null);
		}
	}

function getDataResponse(id)
{
	if(XmlHttp.readyState == 4)
	{
		if(XmlHttp.status == 200)
		{			
			id.innerHTML = XmlHttp.responseText; 
		}
	}
}

