//GET Quotes Commodity
function CreateXmlHttptic()
	{
		try
		{
			XmlHttptic = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttptic = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttptic = null;
					
			}
		}
		if(!XmlHttptic && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttptic = new XMLHttpRequest();
		}
	}

//Home page Ticker

var XmlHttptic
var browser = new Browser();

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;
  }
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

function ExchngTimeClock(Exchg) {
	 var time = new Date()
	 var hour = time.getHours()
	 if (hour >= 10 && hour <= 20)
		  clockTimeoutID = setTimeout("getTickerData('"+ Exchg +"')",600000);
	}


// For Commodity Ticker Data
function TickerDataCom(ex,typ)
{ 
    CreateXmlHttptic();
    var url="TickerComData.aspx?sid=" + Math.random() + "&typ="+typ+"&Exchg="+ex
    //alert(url);
    XmlHttptic.onreadystatechange = function(){LoadTickerData()};
    XmlHttptic.open("GET", url , true)
    XmlHttptic.send(null)
} 
function LoadTickerData() 
{ 	
	if (XmlHttptic.readyState==4 || XmlHttptic.readyState=="complete")
	{ 
	//alert(XmlHttptic.responseText);
		document.getElementById("td1").innerHTML=XmlHttptic.responseText;
    } 
}
//----ticker---
function ChangeValue(Exchg,Opt)
{
    document.getElementById("hid_Opt").value=Opt;
	document.getElementById("hid_Exchg").value=Exchg;
	if(Opt == 'S')
	{
	    document.getElementById("tdspot").className="tickon";
		document.getElementById("tdfut").className="tickoff";
		document.getElementById("aspot").className="lnktextON";
		document.getElementById("afut").className="tictextOFF";
		if(Exchg == 'MCX')
		{
		    document.getElementById("tdmcx").className="tickoff";
		    document.getElementById("tdncdex").className="tickon";
		    document.getElementById("amcx").className="tictextOFF";
		    document.getElementById("ancdex").className="lnktextON";
			TickerDataCom('MCX','S');
		}
		else
		{
		    document.getElementById("tdmcx").className="tickon";
		    document.getElementById("tdncdex").className="tickoff";
		    document.getElementById("amcx").className="lnktextON";
		    document.getElementById("ancdex").className="tictextOFF";
			TickerDataCom('NCDEX','S');
		}
	}
	else if(Opt =='F')
	{
	    document.getElementById("tdspot").className="tickoff";
		document.getElementById("tdfut").className="tickon";
		document.getElementById("aspot").className="tictextOFF";
		document.getElementById("afut").className="lnktextON";
		if(Exchg == 'MCX')
		{
		    document.getElementById("tdmcx").className="tickoff";
		    document.getElementById("tdncdex").className="tickon";
		    document.getElementById("amcx").className="tictextOFF";
		    document.getElementById("ancdex").className="lnktextON";
			TickerDataCom('MCX','F');
		}
		else
		{
		    document.getElementById("tdmcx").className="tickon";
		    document.getElementById("tdncdex").className="tickoff";
		    document.getElementById("amcx").className="lnktextON";
		    document.getElementById("ancdex").className="tictextOFF";
			TickerDataCom('NCDEX','F');
		}
	}
	
}
function startstop()
{
	var id=document.getElementById("PlayImg");
	if (id.src.indexOf("tic_stop")!=-1)
	{
		id.src = "/images/tic_play.gif"
		document.getElementById("MarqueeId").stop();
		document.getElementById("Marqueecur").stop();
		id.title = "Play";
	}
	else
	{
		id.src="/images/tic_stop.gif";
		document.getElementById("MarqueeId").start();
		document.getElementById("Marqueecur").start();
		id.title = "Stop";
	}
}
