﻿
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 GetXmlHttpObject(handler)
{ 
var objXmlHttp=null
if (navigator.userAgent.indexOf("Opera")>=0)
{
alert("This example doesn't work in Opera") 
return 
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{ 
var strName="Msxml2.XMLHTTP"
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP"
} 
try
{ 
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler 
return objXmlHttp
} 
catch(e)
{ 
alert("Error. Scripting for ActiveX might be disabled") 
return 
} 
} 
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler 
return objXmlHttp
}
} 

function CreateXmlHttpSymb()
	{
		//Creating object of XmlHttp in IE
		try
		{
			XmlHttpSymb = new ActiveXObject("Msxml2.XmlHttp");
		}
		catch(e)
		{
			try
			{
				XmlHttpSymb = new ActiveXObject("Microsoft.XmlHttp");
			} 
			catch(oc)
			{
				XmlHttpSymb = null;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if(!XmlHttpSymb && typeof XmlHttpRequest != "undefined") 
		{
			XmlHttpSymb = new XmlHttpRequest();
		}
	}

function CreateXmlHttp()
	{
		//Creating object of XmlHttp in IE
		try
		{
			XmlHttp = new ActiveXObject("Msxml2.XmlHttp");
		}
		catch(e)
		{
			try
			{
				XmlHttp = new ActiveXObject("Microsoft.XmlHttp");
			} 
			catch(oc)
			{
				XmlHttp = null;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if(!XmlHttp && typeof XmlHttpRequest != "undefined") 
		{
			XmlHttp = new XmlHttpRequest();
		}
	}
	
	
function CreateXmlHttpVV()
	{
		//Creating object of XmlHttp in IE
		try
		{
			XmlHttpVV = new ActiveXObject("Msxml2.XmlHttp");
		}
		catch(e)
		{
			try
			{
				XmlHttpVV = new ActiveXObject("Microsoft.XmlHttp");
			} 
			catch(oc)
			{
				XmlHttpVV = null;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if(!XmlHttpVV && typeof XmlHttpRequest != "undefined") 
		{
			XmlHttpVV = new XmlHttpRequest();
		}
	}


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 LookUpData(str,typ)
{ 

        if (str=="MCX")
        {
        	
            
	        document.getElementById("tblFirst").style.display="inline" ;
	        document.getElementById("tblSecond").style.display="none" ;
	        HomeTicker('MCX','F');
	     //  ShowVolumeValue('MCX','Vol');
	        ShowBseGL('MCX','G')
        }   
        else
        {
        //	alert('F');

	        
	        document.getElementById("tblFirst").style.display="none" ;
	        document.getElementById("tblSecond").style.display="inline" ;
	        HomeTicker('NCDEX','F');
	       // ShowVolumeValue('NCDEX','Vol');
	       ShowBseGL('NCDEX','G')
        }
	
} 


 
 
 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
	//alert(requestUrl);
	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(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 ShowBseGL(ex,glctrl)
{

 if (ex == "")
    {
       ex=="NCDEX";
         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"
	        }
	        
	       
        	
        }
       // alert(document.getElementById("MCXID").value);
   
        CreateXmlHttpVV2();
        //alert(document.getElementById("GL").value);

	var requestUrl="AjaxGainerLoser.aspx?sid=" + Math.random() + "&Exchg="+document.getElementById("MCXID").value+"&typeGL="+document.getElementById("GL").value;

	
	
	if(XmlHttpVV2)	
			{
					//alert("hi");
					XmlHttpVV2.onreadystatechange = function(){ShowShowGLData();}; 
					XmlHttpVV2.open("GET", requestUrl,  true);
					XmlHttpVV2.send(null);
			}
	
}

function ShowShowGLData() 
{ 
//alert(XmlHttpVV.status);
if(XmlHttpVV2.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpVV2.status == 200)
		{			
			var ShowGLData   = document.getElementById("ShowGLData");
		var strData = XmlHttpVV2.responseText;
		//alert(strData);
			if(strData != "")
			{
				ShowGLData.innerHTML   =  strData;
			}
			document.body.style.cursor = "auto";	
		}
		else
		{var ShowGLData   = document.getElementById("ShowGLData");
			ShowGLData.innerHTML = "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}

	
} 
function ShowMCXNDEXBseGL(ex)
{
    
    if(ex=="NCDEX")
    {
    
    document.getElementById("NCDEXTD").className="ComHomeSelTab";
      document.getElementById("NCDEXTDL").className="ComHomeSelTabL";
      document.getElementById("NCDEXTDR").className="ComHomeSelTabR";
            
	  document.getElementById("MCXTD").className="ComHomeUnSelTab";
	  document.getElementById("MCXTDL").className="ComHomeUnSelTabL";
	  document.getElementById("MCXTDR").className="ComHomeUnSelTabR";
    
    
      //document.getElementById("NCDEXTD").className="TophomGLSL";
	  //document.getElementById("MCXTD").className="TophomBSEL";
     var valvol =document.getElementById("VV").value;
    
      document.getElementById("MCXID").value = 
     ShowBseGL(ex,'G');
    }
     if(ex=="MCX")
     {
     
     document.getElementById("NCDEXTD").className="ComHomeUnSelTab";
        document.getElementById("NCDEXTDL").className="ComHomeUnSelTabL";
        document.getElementById("NCDEXTDR").className="ComHomeUnSelTabR";
        
        
	    document.getElementById("MCXTD").className="ComHomeSelTab";
	    document.getElementById("MCXTDL").className="ComHomeSelTabL";
	    document.getElementById("MCXTDR").className="ComHomeSelTabR";
     
    //   document.getElementById("NCDEXTD").className="TophomBSEL";
	  // document.getElementById("MCXTD").className="TophomGLSL";
      var valvol =document.getElementById("VV").value;
    
      document.getElementById("MCXID").value = 
     ShowBseGL(ex,'G');
     }
     
}




function CreateXmlHttpVV2()
	{
		//Creating object of XmlHttp in IE
		try
		{
			XmlHttpVV2 = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{  
				XmlHttpVV2 = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpVV2 = false;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if (!XmlHttpVV2 && typeof XMLHttpRequest!='undefined') 
		{
	        try 
	        {
		        XmlHttpVV2 = new XMLHttpRequest();
	        } 
	        catch (e) 
	        {
		        XmlHttpVV2=false;
	        }
        }
        if (!XmlHttpVV2 && window.createRequest) 
        {
	        try 
	        {
		        XmlHttpVV2 = window.createRequest();
	        } 
	        catch (e)
	        {
		        XmlHttpVV2=false;
	        }
        }


}



// For High & Low

 function ShowVolumeValue(ex,glctrl)
{

 if (ex == "")
    {
         if (glctrl=="Val")
	    {
	 
	     
	  
	    document.getElementById("VV").value = "Val"
	    }
	    else
	    {
	  
	    document.getElementById("VV").value = "Vol"
	    }
	 }
	 else
        {
	        if(ex=="MCX")
	        {
	        
		        document.getElementById("MCXNCD").value = "MCX"
	        }
	        else
	        {
        	
		        document.getElementById("MCXNCD").value = "NCDEX"
	        }
        	
        }
   
        CreateXmlHttpVV();
	var requestUrl="AjaxValueVol.aspx?sid=" + Math.random() + "&Exchg="+document.getElementById("MCXNCD").value+"&typeGL="+document.getElementById("VV").value;
	//alert(requestUrl);
	
	
	if(XmlHttpVV)	
			{
					//alert("hi");
					XmlHttpVV.onreadystatechange = function(){ShowVolumeValueData();}; 
					XmlHttpVV.open("GET", requestUrl,  true);
					XmlHttpVV.send(null);
			}
	
}

function ShowVolumeValueData() 
{ 

if(XmlHttpVV.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpVV.status == 200)
		{			
			var ShowVolumeValueData   = document.getElementById("ShowVVData");
		var strData = XmlHttpVV.responseText;
			//alert(strData);
			if(strData != "")
			{
				ShowVolumeValueData.innerHTML   =  strData;
			}
			document.body.style.cursor = "auto";	
		}
		else
		{
			ShowVolumeValueData.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("GoldS").style.display="inline";
	        document.getElementById("SilverS").style.display="none";
	          document.getElementById("tblGraphF").style.display="inline";
	        document.getElementById("tblGraphS").style.display="none";
	      
	    }
	    else
	    {
	      document.getElementById("SilverS").style.display="inline";
	      document.getElementById("GoldS").style.display="none";
	        document.getElementById("tblGraphF").style.display="none";
	        document.getElementById("tblGraphS").style.display="inline";
	      
	    }
    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"
	            }
        	
        }
       // CreateXmlHttpSymb();
	        var requestUrl="Chart.aspx?sid=" + Math.random() + "&Exchange="+document.getElementById("Ech").value +"&Symbol="+symbol ;
	    document.getElementById("ChartComm").src=requestUrl;
	//alert(requestUrl);
	
//	if(XmlHttpSymb)	
//			{
//					//alert("hi");
//					XmlHttpSymb.onreadystatechange = function(){ShowGoldData();}; 
//					XmlHttpSymb.open("GET", requestUrl,  true);
//					XmlHttpSymb.send(null);
//			}
	
}

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";
		}
	}

	
} 


/// Get Quotes

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 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";
		}
	}
}

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();
		}
	}

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 = "CmGetExpDateAjax.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
			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 fillSymbol()
 {
		
	 var Excha = document.getElementById("Exchg");
	// alert(Excha);
	
 		var Symbol = document.getElementById("Symbol");		
		CreateXmlHttpNew();
		document.body.style.cursor = "progress";
		var requestUrl = "CmGetSymbolAjax.aspx?timeStamp="+ new Date().getTime() +"&Excha="+document.getElementById("Exchg").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_)
{
 //var txtSymbol = document.getElementById("txtSymbol");
		
	// To make sure receiving response data from server is completed
	if(XmlHttpFO.readyState == 4)
	{
	// var txtIndex = document.getElementById("txtSymbol");
	 //alert(txtIndex);
		
		// 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];
					
				}
				//alert(ig_.selectedvalue);
				//ig_.options[ig_.selectedIndex].value=txtSymbol.value;
				
			
				
			}
			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";		
		}
	}
}


  
    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)
	{
       // alert(requestUrl);
		var NewsWin = document.getElementById("divNews").style.display='inline';
		var currentDivObj;	
		
			currentDivObj = document.getElementById("TDNews");
			//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;
		
		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("TDNews").innerHTML = XmlHttpPop.responseText;
				
				document.body.style.cursor = "auto";
			}
			else
			{
				
					document.getElementById("NewsId").innerHTML = "<img src=../App_Themes/Common/images/ajax-loader.gif>";
				
			}
		}
	}
	
	
	
	
	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();
		}
	}
	
	function openNews(NewsID)
    {
    
        //document.getElementById('newsid').value=NewsID;
       	CreateXmlHttpNew();
		document.body.style.cursor = "progress";
		var requestUrl = "../News/GetNews.aspx?timeStamp="+ new Date().getTime() +"&NewsID="+NewsID;
		//alert(requestUrl)
		if(XmlHttpFO)	
		{
		    XmlHttpFO.onreadystatechange = function(){getNewsResp()};
			XmlHttpFO.open("GET", requestUrl,  true);
			XmlHttpFO.send(null);
		}
    }
     function getNewsResp()
    {

	if(XmlHttpFO.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		var td_Id = document.getElementById("divNews").style.display="inline";
		document.getElementById("divNews").style.top = tempY + "px";
		if(XmlHttpFO.status == 200)//
		{
		//alert(XmlHttpFO.responseText);
		
		var mydiv=document.getElementById("TDNews")
//            var filterscheck=mydiv.filters && mydiv.filters.length>0 //check if element supports filter/ has at least 1 filter defined

//            if (filterscheck) //if browser supports filters
//            mydiv.filters[0].apply() //capture initial state of content
//            //mydiv.style.backgroundColor="blue" //change content background to blue (not visible yet)
//            if (filterscheck) //if browser supports filters
//            mydiv.filters[0].play() //play transition to reveal new background

			document.getElementById("TDNews").innerHTML =  XmlHttpFO.responseText;
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}







function GetExpDatehome()
 {
        var Excha = document.getElementById("Exchg");
  		var Symbol = document.getElementById("Symbol");
 		var ExpiryDate = document.getElementById("ExpDate"); 
 				
		CreateXmlHttpEDH();
		document.body.style.cursor = "progress";
		var requestUrl = "CmGetExpDateAjax.aspx?timeStamp="+ new Date().getTime() +"&Excha="+Excha.value +"&Symbol="+Symbol.value;
	
		if(XmlHttpEDH)	{
					XmlHttpEDH.onreadystatechange = function(){getDateResphome(ExpiryDate)};
					XmlHttpEDH.open("GET", requestUrl,  true);
					XmlHttpEDH.send(null);
				}
		
 }
 
 //Called when response comes back from server Only For Symbol
function getDateResphome(ig_)
{

	// To make sure receiving response data from server is completed
	if(XmlHttpEDH.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpEDH.status == 200)
		{
			//alert(ig_)
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpEDH.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 = "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 CreateXmlHttpEDH()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpEDH = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpEDH = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpEDH = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpEDH && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpEDH = new XMLHttpRequest();
		}
	}



function fillSymbolhome()
     {
		
	 var Excha = document.getElementById("Exchg");
	 var Symbol = document.getElementById("Symbol");		

		
		CreateXmlHttpFS();
		document.body.style.cursor = "progress";
		var requestUrl = "CmGetSymbolAjax.aspx?timeStamp="+ new Date().getTime() +"&Excha="+Excha.value;
		//alert(requestUrl)
		if(XmlHttpFS)	{
					XmlHttpFS.onreadystatechange = function(){fillSymbolResphome(Symbol)};
					XmlHttpFS.open("GET", requestUrl,  true);
					XmlHttpFS.send(null);
				}
		
 }
 
 //Called when response comes back from server Only For Symbol
function fillSymbolResphome(ig_)
{

	// To make sure receiving response data from server is completed
	if(XmlHttpFS.readyState == 4)
	{
		
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttpFS.status == 200)
		{		
			//alert(ig_)
			//var availSchemes   = document.getElementById(ig_);
			var strData = XmlHttpFS.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";		
		}
	}
}


function CreateXmlHttpFS()
	{
		//Creating object of XMLHTTP in IE
		try
		{
			XmlHttpFS = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpFS = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpFS = null;	
			}
		}
		//Creating object of XMLHTTP in Mozilla and Safari 
		if(!XmlHttpFS && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpFS = new XMLHttpRequest();
		}
	}
	
	
	
var tempX = 0;
 var tempY = 0;


 
 var IE = document.all?true:false
 
 if (!IE) document.captureEvents(Event.MOUSEMOVE)
 document.onmousemove = getMouseXY;
 
 function getMouseXY(e) 
 {
 	if(IE)
 	{
 	  //  tempX = event.clientX + screen.width/2 ;
 	 tempY = document.body.scrollTop+50;

 	}
 	else
 	{
 		tempX = e.pageX;
 	    tempY = e.pageY;
 	}
 	return true;
 }



