﻿// JScript File


function HIDETSwitch()
{

var strURL = window.location.href;
    
if(strURL.indexOf("commodity-home.aspx")>= 0 || strURL.indexOf("commodity-home.aspx")>= 0 )
{    		        
document.getElementById("NseBseSwitch").style.display="none";                        
} 
}  

            
function showmnu()
{
var strURL = window.location.href;
var ID1 = document.getElementById("sid1");
var ID2 = document.getElementById("sid2");
var ID3 = document.getElementById("sid3");
var ID4 = document.getElementById("sid4");
var ID5 = document.getElementById("sid5");
var ID6 = document.getElementById("sid6");
var ID7 = document.getElementById("sid7");

if(strURL.indexOf("get-quotes.aspx")>= 0)
{
document.getElementById("sid1").className= "LeftMenuItemLinkG";
SwitchMenu('1');
}
if(strURL.indexOf("gainers-and-losers.aspx")>= 0)
{
document.getElementById("sid2").className= "LeftMenuItemLinkG";
SwitchMenu('1');
}
if(strURL.indexOf("advances-and-declines.aspx")>= 0)
{
document.getElementById("sid3").className= "LeftMenuItemLinkG";
SwitchMenu('1');
}
if(strURL.indexOf("highs-and-lows.aspx")>= 0)
{
document.getElementById("sid4").className= "LeftMenuItemLinkG";
SwitchMenu('1');
}
if(strURL.indexOf("VaueToppers.aspx")>= 0)
{
document.getElementById("sid5").className= "LeftMenuItemLinkG";
SwitchMenu('1');
}
if(strURL.indexOf("VolumeAndValue.aspx")>= 0)
{
document.getElementById("sid6").className= "LeftMenuItemLinkG";
SwitchMenu('1');
}
if(strURL.indexOf("NewsContents.aspx")>= 0)
{
document.getElementById("sid7").className= "LeftMenuItemLinkG";
SwitchMenu('2');
}

if(strURL.indexOf("icx-commodity-quotes.aspx")>= 0)
{
document.getElementById("sid8").className= "LeftMenuItemLinkG";
SwitchMenu('3');
}
if(strURL.indexOf("icx-commodity-gl.aspx")>= 0)
{
document.getElementById("sid9").className= "LeftMenuItemLinkG";
SwitchMenu('3');
}
if(strURL.indexOf("icx-commodity-ls.aspx")>= 0)
{
document.getElementById("sid10").className= "LeftMenuItemLinkG";
SwitchMenu('3');
}
if(strURL.indexOf("icx-commodity-value.aspx")>= 0)
{
document.getElementById("sid11").className= "LeftMenuItemLinkG";
SwitchMenu('3');
}
if(strURL.indexOf("commodity/icx-commodity-volume.aspx")>= 0)
{
document.getElementById("sid12").className= "LeftMenuItemLinkG";
SwitchMenu('3');
}
if(strURL.indexOf("icx-open-interest.aspx")>= 0)
{
document.getElementById("sid13").className= "LeftMenuItemLinkG";
SwitchMenu('3');
}           
}



//function showmnu()
//{	
// var strURL = window.location.href;		
//if(strURL.indexOf("commodity-home.aspx")>= 0 || strURL.indexOf("Commodity-home.aspx")>= 0)
//{}
//else
//{			
//        var ig_a=document.location.search.substring(1);	
//        var ig_b=ig_a.split("&");			

//        for(var ig_c=0;ig_c<ig_b.length;ig_c++)
//        {
//            var ig_d=ig_b[ig_c].indexOf("id=");
//            
//            if(ig_d==-1)continue;

//            var ig_f=ig_b[ig_c].substring(3);  
//        }
//        for(var i=0;i<=8;i++)
//        {
//            if(i==ig_f)
//            {
//                document.getElementById(ig_f).className= "LeftMenuSelectedItemTD";
//                document.getElementById("sid"+ig_f).className= "LeftMenuItemLink";
//            }
//            else
//            {
//                document.getElementById(ig_f).className= "LeftMenuSelectedItemTDO";
//                document.getElementById("sid"+ig_f).className= "LeftMenuItemLinkG";
//                
//            }
//            if ((ig_f==1)||(ig_f==2)||(ig_f==3)||(ig_f==4)||(ig_f==5)||(ig_f==6))
//            {
//                SwitchMenu('1');
//            }
//            if ((ig_f==7))
//            {
//                SwitchMenu('2');
//            }
//        }
//    }
//    }

    function SwitchMenu(opt)
    {
        if (opt=='1')
        {
            document.getElementById("mnu1").style.display="inline";
            document.getElementById("mnu2").style.display="none";
              document.getElementById("mnu3").style.display="none";
            document.getElementById("TitleTD1").className="LeftMenuMHeadingTD";
            document.getElementById("TitleTD2").className="LeftMenuMMHeadingTD";
            document.getElementById("TitleTD2").className="LeftMenuMHeadingTDP";
        }
        if (opt=='2')
        {
            document.getElementById("mnu1").style.display="none";
            document.getElementById("mnu2").style.display="inline";
              document.getElementById("mnu3").style.display="none";
            document.getElementById("TitleTD1").className="LeftMenuMHeadingTDP";
            document.getElementById("TitleTD2").className="LeftMenuMMHeadingTDM";
               document.getElementById("TitleTD2").className="LeftMenuMHeadingTDP";
        }
          if (opt=='3')
        {
            document.getElementById("mnu1").style.display="none";
            document.getElementById("mnu2").style.display="none";
             document.getElementById("mnu3").style.display="inline";
            document.getElementById("TitleTD1").className="LeftMenuMHeadingTDP";
            document.getElementById("TitleTD2").className="LeftMenuMHeadingTDP";
             document.getElementById("TitleTD2").className="LeftMenuMMHeadingTDM";
        }
    }
   

  

//Global Variables
var XmlHttp;

//Creating object of XMLHTTP For AJAX Method
function CreateXmlHttpNew()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpFO = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpFO = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpFO = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpFO && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpFO = new XMLHttpRequest();
		}
	}
	
	
	
	//For Getting Symbol Drop Down Contains fillCategory
	
	 function fillSymbol()
     {
   // alert("asd");		
	 var Excha = document.getElementById("Exchg");
	 var Symbol = document.getElementById("Symbol");		
    var ExpiryDate = document.getElementById("ExpDate");    
		
		CreateXmlHttpNew();
		document.body.style.cursor = "progress";
		var requestUrl = "GetSymbolAjax.aspx?timeStamp="+ new Date().getTime() +"&Excha="+Excha.value;
		//alert(requestUrl)
		if(XmlHttpFO)	{
					XmlHttpFO.onreadystatechange = function(){fillSymbolResp(Symbol)};
					XmlHttpFO.open("GET", requestUrl,  true);
					XmlHttpFO.send(null);
				}
		
 }
 
 //Called when response comes back from server Only For Symbol
function fillSymbolResp(ig_)
{

	// To make sure receiving response data from server is completed
	if(XmlHttpFO.readyState == 4)
	{
		
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpFO.status == 200)
		{		
			//alert(ig_)
			//var availSchemes   = document.getElementById(ig_);
			    for (var count = ExpiryDate.options.length-1; count >-1; count--)
	            {
		            ExpiryDate.options[count] = null;
	            }
			var strData = XmlHttpFO.responseText
			//alert(strData)
			if(strData != "") {	
			    
				var arrSchm = strData.split("|");
				ig_.length = 0; 	
				
				for(i=0; i<arrSchm.length-1; i++) {	
								
					var strSchm = arrSchm[i];
					var arrSchmCode = strSchm.split("~");
					
					ig_.options[i] = new Option();
					
					ig_.options[i].value = arrSchmCode[0];
					ig_.options[i].text = arrSchmCode[1];
				}
				
			}
			else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "Symbol 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";		
		}
	}
}

//End of Symbol Function///////////////////////////////////////////////////////////


var XmlHttpCommNews;
function CreateXmlHttpCommNews()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpCommNews = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpCommNews = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpCommNews = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpCommNews && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpCommNews = new XMLHttpRequest();
		}
	}



    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("NewsPop");
			//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("NewsPop").innerHTML = XmlHttpPop.responseText;
				
				document.body.style.cursor = "auto";
			}
			else
			{
				
					document.getElementById("NewsPop").innerHTML = "<img src=../App_Themes/Common/images/ajax-loader.gif>";
				
			}
		}
	}
	
  function openCommHome(SecId,SubSecId)
    {
        
      
        
        	CreateXmlHttpCommNews();
		document.body.style.cursor = "progress";
		var requestUrl = "CommNewsAjax.aspx?timeStamp="+ new Date().getTime() +"&SecId="+SecId+"&SubSecID="+SubSecId;
		// alert(requestUrl)
		if(XmlHttpCommNews)	{
					XmlHttpCommNews.onreadystatechange = function(){getNewsRespCorpHome()};
					XmlHttpCommNews.open("GET", requestUrl,  true);
					XmlHttpCommNews.send(null);
				}
    }
    
    function getNewsRespCorpHome()
{

	if(XmlHttpCommNews.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
	
	//  alert(XmlHttpCommNews.status) 
	    
			var	Td_HotS = document.getElementById("Td_CommN");
		if(XmlHttpCommNews.status == 200)//
		{
		   var data=XmlHttpCommNews.responseText
		  //alert(data);
			Td_HotS.innerHTML = data;
		
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			Td_HotS.innerHTML='There was a problem retrieving data from the server.';
			
			document.body.style.cursor = "auto";
		}
	}
}
// For Chart Data

 function HomeChart(ex,symbol)
{
 var Gold=document.getElementById("GoldS");
 var Silver=document.getElementById("SilverS");

        if (symbol=="GOLD" || symbol=="GLDPURMUMK")
	    {
	         document.getElementById("tdGold").src="../App_Themes/Common/images/goldOn.gif";
	        document.getElementById("tdSilver").src="../App_Themes/Common/images/silverOff.gif";
	       document.getElementById("GoldS").style.display="inline";
	        document.getElementById("SilverS").style.display="none";
	      
	    }
	    else
	    {
	     document.getElementById("tdGold").src="../App_Themes/Common/images/goldOff.gif";
	    document.getElementById("tdSilver").src="../App_Themes/Common/images/silverOn.gif";
	      document.getElementById("SilverS").style.display="inline";
	      document.getElementById("GoldS").style.display="none";
	      
	    }
    if (ex == "")
    {
   
	
	    if (symbol=="GOLD")
	    {
	       
	      
	       document.getElementById("GS").value = "GOLD"
	    }
	    else
	    {
	         
	        document.getElementById("GS").value = "SILVER"
	    }
    }
        else
        {
	        if(ex=="MCX")
	        {
	          

		        document.getElementById("Ech").value = "MCX"
	        }
	            else
	            {
	           
	          
	                
            	
		            document.getElementById("Ech").value = "NCDEX"
	            }
        	
        }
      
	        var requestUrl="Chart.aspx?sid=" + Math.random() + "&Exchange="+document.getElementById("Ech").value +"&Symbol="+symbol ;
	    document.getElementById("ChartComm").src=requestUrl;
	
	
}

function ShowGoldData() 
{ 

if(XmlHttpSymb.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpSymb.status == 200)
		{			
			var GoldData   = document.getElementById("Chart");
		var strData = XmlHttpSymb.responseText;
			//alert(strData);
			if(strData != "")
			{
				GoldData.innerHTML   =  strData;
			}
			document.body.style.cursor = "auto";	
		}
		else
		{
			GoldData.innerHTML = "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}

	
} 

//For Getting Symbol Drop Down Contains 
	
	 function fillCategory()
    {//alert("Asd");
		
	    var Excha = document.getElementById("ctl00_ContentPlaceHolder1_Exchg");
	   var Symbol = document.getElementById("ctl00_ContentPlaceHolder1_ddlCategory");
		
 				
		CreateXmlHttpNew();
		document.body.style.cursor = "progress";
		var requestUrl = "GetCategoryAjax.aspx?timeStamp="+ new Date().getTime() +"&Excha="+Excha.value;
		//alert(requestUrl)
		if(XmlHttpFO)	{
					XmlHttpFO.onreadystatechange = function(){fillSymbolResp(Symbol)};
					XmlHttpFO.open("GET", requestUrl,  true);
					XmlHttpFO.send(null);
				}
		
    }
 
 //Called when response comes back from server Only For Symbol
function fillSymbolResp(ig_)
{

	// To make sure receiving response data from server is completed
	if(XmlHttpFO.readyState == 4)
	{
		
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpFO.status == 200)
		{		
			//alert(ig_)
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpFO.responseText
			//alert(strData)
			if(strData != "") {	
			    
				var arrSchm = strData.split("|");
				ig_.length = 0; 	
				
				for(i=0; i<arrSchm.length-1; i++) {	
								
					var strSchm = arrSchm[i];
					var arrSchmCode = strSchm.split("~");
					
					ig_.options[i] = new Option();
					
					ig_.options[i].value = arrSchmCode[0];
					ig_.options[i].text = arrSchmCode[1];
				}
				
			}
			else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "Category 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";		
		}
	}
}

//End of Symbol Function///////////////////////////////////





//For Getting Expiry Date

function GetExpDate()
 {
        var Excha = document.getElementById("Exchg");
  		var Symbol = document.getElementById("Symbol");
 		var ExpiryDate = document.getElementById("ExpDate"); 
 				
		CreateXmlHttpNew();
		document.body.style.cursor = "progress";
		var requestUrl = "GetExpDateAjax.aspx?timeStamp="+ new Date().getTime() +"&Excha="+Excha.value +"&Symbol="+Symbol.value;
	  
		if(XmlHttpFO)	{
					XmlHttpFO.onreadystatechange = function(){getDateResp(ExpiryDate)};
					XmlHttpFO.open("GET", requestUrl,  true);
					XmlHttpFO.send(null);
				}
		
 }
 
 //Called when response comes back from server Only For Symbol
function getDateResp(ig_)
{

	// To make sure receiving response data from server is completed
	if(XmlHttpFO.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpFO.status == 200)
		{
			//alert(ig_)
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpFO.responseText
			//alert(strData);
			if(strData != "") {	
				var arrSchm = strData.split("|");
				ig_.length = 0; 	
				for(i=0; i<arrSchm.length-1; i++) {	
					var strSchm = arrSchm[i];
					var arrSchmCode = strSchm.split("~");
					ig_.options[i] = new Option();
					ig_.options[i].value = arrSchmCode[0];
					ig_.options[i].text = arrSchmCode[1];
				}
			}
			else {
					ig_.length = 0;
					ig_.options[0] = new Option(); 
					ig_.options[0].value = "";
					ig_.options[0].text = "Date 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";		
		}
	}
}


function ClearAndSetExpListItems(countryNode)
{
    var stateList = document.getElementById("ExpDate");
	//Clears the state combo box contents.
	for (var count = stateList.options.length-1; count >-1; count--)
	{
		stateList.options[count] = null;
	}

	var stateNodes = countryNode.getElementsByTagName('ExpDate');
	var textValue; 
	var optionItem;
	//Add new states list to the state combo box.
	for (var count = 0; count < stateNodes.length; count++)
	{
   		textValue = GetInnerText(stateNodes[count]);
		optionItem = new Option( textValue, textValue,  false, false);
		stateList.options[stateList.length] = optionItem;
	}
}
// End of Expiry Date Funtion////////////////


function LookUpData(str,typ)
{ 

        if (str=="MCX")
        {
        	
            
	        document.getElementById("BtnMcx").src="../App_Themes/Common/images/MCXOn.gif" 
	        document.getElementById("BtnNcdex").src="../App_Themes/Common/images/NCDEXOff.gif"
	        HomeTicker('MCX','F');
	        //ShowVolumeValue('MCX','Val');
	        ShowBseGL('MCX','G')
        }
        else
        {
        //	alert('F');

	        document.getElementById("BtnMcx").src="../App_Themes/Common/images/MCXOff.gif" 
	        document.getElementById("BtnNcdex").src="../App_Themes/Common/images/NCDEXOn.gif"
	        HomeTicker('NCDEX','F');
	        //ShowVolumeValue('NCDEX','Val');
	       ShowBseGL('NCDEX','G')
        }
	
} 
var XmlHttpGL;
function CreateXmlHttpGL()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpGL = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpGL = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpGL = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpGL && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpGL = new XMLHttpRequest();
		}
	}
	

 function ShowBseGL(ex,glctrl)
{

 if (ex == "")
    {
       ex=="MCX";
         if (glctrl=="G")
	    {
	        document.getElementById("GL").value = "G"
	    }
	    else
	    {
	    document.getElementById("GL").value = "L"
	    }
	 }
	 else
        {
	        if(ex=="MCX")
	        {

		        document.getElementById("MCXID").value = "MCX"
	        }
	        else
	        {
        	
		        document.getElementById("MCXID").value = "NCDEX"
	        }
        	
        }
   
        CreateXmlHttpGL();
        //alert(document.getElementById("GL").value);

	var requestUrl="AjaxGainerLoser.aspx?sid=" + Math.random() + "&Exchg="+document.getElementById("MCXID").value+"&typeGL="+document.getElementById("GL").value;
	//alert(requestUrl);
	
	
	if(XmlHttpGL)	
			{
					//alert("hi");
					XmlHttpGL.onreadystatechange = function(){ShowShowGLData();}; 
					XmlHttpGL.open("GET", requestUrl,  true);
					XmlHttpGL.send(null);
			}
	
}

function ShowShowGLData() 
{ 
//alert(XmlHttpGL.status);
if(XmlHttpGL.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpGL.status == 200)
		{			
			var ShowGLData   = document.getElementById("ShowGLData");
		var strData = XmlHttpGL.responseText;
		//alert(strData);
			if(strData != "")
			{
				ShowGLData.innerHTML   =  strData;
			}
			document.body.style.cursor = "auto";	
		}
		else
		{
			ShowGLData.innerHTML = "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}

	
} 


function CreateXmlHttp1()
	{
		//Creating object of XmlHttp in IE
		try
		{
			XmlHttp1 = new ActiveXObject("Msxml2.XmlHttp");
		}
		catch(e)
		{
			try
			{
				XmlHttp1 = new ActiveXObject("Microsoft.XmlHttp");
			} 
			catch(oc)
			{
				XmlHttp1 = null;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if(!XmlHttp1 && typeof XmlHttpRequest != "undefined") 
		{
			XmlHttp1 = new XmlHttpRequest();
		}
	}
 
 function CreateXmlHttp()
	{
		//Creating object of XmlHttp in IE
		try
		{
			XmlHttp1 = new ActiveXObject("Msxml2.XmlHttp");
		}
		catch(e)
		{
			try
			{
				XmlHttp1 = new ActiveXObject("Microsoft.XmlHttp");
			} 
			catch(oc)
			{
				XmlHttp1 = null;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if(!XmlHttp1 && typeof XmlHttpRequest != "undefined") 
		{
			XmlHttp1 = new XmlHttpRequest();
		}
	}
	
 function HomeTicker(ex,typ)
{
    if (ex == "")
    {
	
	    if (typ=="S")
	    {
	
	    document.getElementById("SF").value = "S"
	    }
	    else
	    {
	
	    document.getElementById("SF").value = "F"
	    }
    }
        else
        {
	        if(ex=="MCX")
	        {

		        document.getElementById("Ech").value = "MCX"
	        }
	        else
	        {
        	
		        document.getElementById("Ech").value = "NCDEX"
	        }
        	
        }
        CreateXmlHttp1();
	var requestUrl="CommTicker.aspx?sid=" + Math.random() + "&Exchg="+document.getElementById("Ech").value+"&type="+document.getElementById("SF").value
	
	
	if(XmlHttp1)	
			{
					//alert("hi");
					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("|");
			   // alert(arrNse);
				for(var i=0; i<arrNse.length-1; i++)
				 {
					arrCol = arrNse[i].split("~");
					//alert(arrCol[0]);
						CompName = arrCol[0];
						ClPrice  = arrCol[1];
						DiffVal  = arrCol[2];
						
					if(i==0)
					ExchgDet = " <span  class=DataCommL>"+ CompName +"</span><span  class=DataCommR>" + " &nbsp; "+ ClPrice+"&nbsp;&nbsp; "  +"<b>"+ DiffVal+ "</b>"+"</span> </span>&nbsp;&nbsp;&nbsp;";
					else 
					stkDet += "<span  class=DataCommL>" + CompName +"</span><span  class=DataCommR>" + " &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='Left' 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 Godetails()
{
var Excha = document.getElementById("Exchg");
var Symbol = document.getElementById("Symbol");
var ExpiryDate = document.getElementById("ExpDate");
	if(Excha.value=="")
		{
			alert("Please select Exchange before you proceed")
			Excha.focus();
			return false;
		}
		//alert(Symbol.value);
		if(Symbol.value=="Select Symbol")	
		{
		alert("Please select Symbol before you proceed")
		Symbol.focus();
		return false;
		}
		else if(ExpiryDate.value=="")
		{
		alert("Please select Expiry Date  before you proceed")
		ExpiryDate.focus()
		return false;
		}
			
		

     var requestUrl = "get-quotes.aspx?timeStamp="+ new Date().getTime() +"&Excha="+Excha.value +"&Symbol="+Symbol.value+"&ExpDate="+ExpiryDate.value+"&id=1";
 	  //alert(requestUrl);
  var newWindow = window.open(requestUrl, '_parent'); 
			  
			  newWindow.focus(); 
             return false; 
}
    
