﻿// JScript File
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 LoadMTData()
{

    CreateXmlHttp();
   var requestUrl = "CurrPricewatchData.aspx?timeStamp="+new Date().getTime();

    if(XmlHttp)	
        {
                XmlHttp.onreadystatechange = function(){getdata()}
				XmlHttp.open('GET', requestUrl,  true);
				XmlHttp.send(null);

        }
        
}
function getdata()
{
   
	// To make sure receiving response data from server is completed
	if(XmlHttp.readyState == 4)
	{
	    
		// To make sure valid response is received from the server, 200 means response received is OK
		if(XmlHttp.status == 200)
		{
			
			
			var strData   = document.getElementById("PriceData");
            
			strData.innerHTML = XmlHttp.responseText;	
			
		

			document.body.style.cursor = "auto";	
			
			 TriggerTimerClock();	 
		}
		else 
		{
		   
		  document.body.style.cursor = "auto";		
		}
	}
}

    
function TriggerTimerClock() 
{

    var time = new Date();
    var hour = time.getHours();
    if (hour >= 9 && hour <= 23)
       ClockTimeOut = setTimeout("LoadMTData()",20000);
 }	

