
//GET Quotes Commodity
function CreateXmlHttp1()
	{
		try
		{
			XmlHttp1 = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHtt1p = null;
					
			}
		}
		if(!XmlHttp1 && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttp1 = new XMLHttpRequest();
		}
	}

//Home page Ticker

var XmlHttp1
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)
{ 
    CreateXmlHttp1();
    var DDL2=document.getElementById("Ticker1_Ddl_FS").value;
	var url="/Markets/Commodity/TickerComData.aspx?sid=" + Math.random() + "&typ="+typ+"&Exchg="+ex
	
XmlHttp1.onreadystatechange = function(){LoadTickerData()};
XmlHttp1.open("GET", url , true)
XmlHttp1.send(null)
} 
function LoadTickerData() 
{ 	
	if(XmlHttp1.readyState == 4)
	{
		if(XmlHttp1.status == 200)
		{	
    		document.getElementById("Ticker1_TD1").innerHTML=XmlHttp1.responseText 
    	}		
	} 
}
//----ticker---

function changeselection(exchng)
{
    ChangeValue(exchng,document.getElementById("Ticker1_Ddl_FS").value);
}
function ChangeValue(val,typ)
{
    if(val=="NCDEX")
	{
	    document.getElementById("FS").value="NCDEX";
	}
	else
	{
	    document.getElementById("FS").value="MCX";
	}
	   	
	var Opt = document.getElementById("FS").value;
	
	if(val == 'NCDEX')
	{
	    document.getElementById("Img_MCX").style.backgroundColor="#b7b7b7";
	    document.getElementById("Img_NCDEX").style.backgroundColor="#5f5f5f";
        document.getElementById("Img_MCX").style.cursor="pointer";
        document.getElementById("Img_NCDEX").style.cursor="default";	
	}
	else if(val=="MCX")
	{
	    document.getElementById("Img_MCX").style.backgroundColor="#5f5f5f";
	    document.getElementById("Img_NCDEX").style.backgroundColor="#b7b7b7";
        document.getElementById("Img_MCX").style.cursor="default";
        document.getElementById("Img_NCDEX").style.cursor="pointer";	
	}
	if(typ == 'F')
	{
	    if(val == 'NCDEX')
		{
			TickerDataCom('NCDEX','F');
		}
		else
		{
			TickerDataCom('MCX','F');
		}
	}
	else if(typ =='S')
	{
		if(val =='NCDEX')
		{
			TickerDataCom('NCDEX','S');
		}
		else
		{
			TickerDataCom('MCX','S');
		}
	}
}

			


