﻿// JScript File

 var XmlHttpBull;
    
    function CreateXmlHttpBull()
	{
		try
		{
			XmlHttpBull = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpBull = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpBull = null;
			}
		}
		if(!XmlHttpBull && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpBull = new XMLHttpRequest();
		}
	}
    
function GetBullion()
{
	CreateXmlHttpBull();
	
      var currentDivObj = document.getElementById("TD_Bullion");         
       currentDivObj.innerHTML ="<img src=../App_Themes/images/loader.gif>";
      // alert(currentDivObj);
	document.body.style.cursor = "progress";
	
	var requestUrl = "../AjaxBullion.aspx?time="+ Math.random();
	
	 //alert(requestUrl) 
	if(XmlHttpBull!=null)	
	        {
				XmlHttpBull.onreadystatechange = function(){ChangeResponseBull()}
				XmlHttpBull.open('GET', requestUrl,  true);
				XmlHttpBull.send(null);
			}
			 return false; 
}	
	
function ChangeResponseBull()
{
	if(XmlHttpBull.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		//alert(XmlHttpBull.readyState);
		    var td_Id = document.getElementById("TD_Bullion");
		
	    //alert(XmlHttpBull.status)
		if(XmlHttpBull.status == 200)//
		{
			//alert(XmlHttpBull.responseText);
			td_Id.innerHTML =  XmlHttpBull.responseText;
			//alert(td_Id.innerHTML);
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}	



var XmlHttpForex;
function CreateXmlHttpForex()
	{
		try
		{
			XmlHttpForex = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttpForex = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttpForex = null;
					
			}
		}
		if(!XmlHttpForex && typeof XMLHttpRequest != "undefined") 
		{
			XmlHttpForex = new XMLHttpRequest();
		}
	}
function GetDataForex()
{
	CreateXmlHttpForex();
     var currentDivObj = document.getElementById("Forexdata");
 
	currentDivObj.innerHTML ="<img src=../App_Themes/images/loader.gif>";
	document.body.style.cursor = "progress";
	var requestUrl = "../AjaxForex.aspx?Exchange="+ Math.random();
	 //alert(requestUrl) 
	if(XmlHttpForex!=null)	
	        {
				XmlHttpForex.onreadystatechange = function(){ChangeResponseForex()}
				XmlHttpForex.open('GET', requestUrl,  true);
				XmlHttpForex.send(null);
			}
			 return false; 
}	
	
function ChangeResponseForex()
{
   
	// To make sure receiving response data from server is completed
	
	if(XmlHttpForex.readyState == 4)
	{
		// To make sure valid response is received from the server, 200 means response received is OK
		
		    var td_Id = document.getElementById("Forexdata");
		
	    //alert(XmlHttp.status)
		if(XmlHttpForex.status == 200)//
		{
			td_Id.innerHTML =  XmlHttpForex.responseText;
				
			document.body.style.cursor = "auto";		
		}
		else
		{
			td_Id.innerHTML =  "There was a problem retrieving data from the server.";
			
			document.body.style.cursor = "auto";
		}
	}
}	

var XmlHttp_MktRnd;
function CreateXmlHttp_MktRnd()
{

        try
		{
			XmlHttp_MktRnd = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{  
				XmlHttp_MktRnd = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(oc)
			{
				XmlHttp_MktRnd = false;	
			}
		}
		//Creating object of XmlHttp in Mozilla and Safari 
		if (!XmlHttp_MktRnd && typeof XMLHttpRequest!='undefined') 
		{
	        try 
	        {
		        XmlHttp_MktRnd = new XMLHttpRequest();
	        } 
	        catch (e) 
	        {
		        XmlHttp_MktRnd=false;
	        }
        }
        if (!XmlHttp_MktRnd && window.createRequest) 
        {
	        try 
	        {
		        XmlHttp_MktRnd = window.createRequest();
	        } 
	        catch (e)
	        {
		        XmlHttp_MktRnd=false;
	        }
        }
}
function GetNewData_MktRnd()
{
    CreateXmlHttp_MktRnd();
    document.body.style.cursor = "progress";
    document.getElementById("td_MktRnd").innerHTML="<table cellspacing=0 cellpadding=0 width=100%><tr><td align=center><img src='../../App_Themes/images/loader.gif'></td></tr></table>"
 
  var requestUrl = "../OnlineTrading/DisplayBarChartAD.aspx?timeStamp="+new Date().getTime();
  
   if(XmlHttp_MktRnd!=null)	
	{
	    XmlHttp_MktRnd.onreadystatechange = function(){getResponse_MktRnd()}
		XmlHttp_MktRnd.open('GET', requestUrl,  true);
		XmlHttp_MktRnd.send(null);
	}
	return false; 

}

function getResponse_MktRnd()
{
var td_Id=document.getElementById("td_MktRnd");
if(XmlHttp_MktRnd.readyState == 4)
	{
     if(XmlHttp_MktRnd.status == 200)//
		{
		
		//alert(XmlHttp_MktRnd.responseText);
			td_Id.innerHTML =  XmlHttp_MktRnd.responseText;
			document.body.style.cursor = "auto";
					
		}
		else
		{
			td_Id.innerHTML =  "Server is busy, please try later.";
			document.body.style.cursor = "auto";
		}
     }		
}
function CreateXmlHttpNews()
{
	try
	{
		XmlHttpNews = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttpNews = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			XmlHttpNews = null;				
		}
	}
	if(!XmlHttpNews && typeof XMLHttpRequest != "undefined")
	{
		XmlHttpNews = new XMLHttpRequest();
	}
}

function GetNewsDetail(secId,SubSecId,NewsID,opt)
{	
   CreateXmlHttpNews();
	document.body.style.cursor = "progress";
	document.getElementById("divNews").style.display="inline";
	document.getElementById("TdNews").innerHTML="<table align=center><tr><td><img src =../App_Themes/Common/images/loader.gif /></td></tr></table>";
	var requestUrl = "../PopupNewsData.aspx?SecId="+ secId +"&SubSecId="+ SubSecId+"&NewsID="+NewsID+"&timeStamp="+new Date().getTime()+"opt="+opt;

	
	if(XmlHttpNews)
	{
	    XmlHttpNews.onreadystatechange = function(){GetNewsDetailResponseHot();};
		XmlHttpNews.open("GET", requestUrl,  true);
		XmlHttpNews.send(null);
	}
   
}

function GetNewsDetailResponseHot()
{
	var td_Id=document.getElementById("TdNews");
if(XmlHttpNews.readyState == 4)
	{
     if(XmlHttpNews.status == 200)//
		{
		
		//alert(XmlHttpNews.responseText);
			td_Id.innerHTML =  XmlHttpNews.responseText;
			document.body.style.cursor = "auto";
					
		}
		else
		{
			td_Id.innerHTML =  "Server is busy, please try later.";
			document.body.style.cursor = "auto";
		}
     }	
}
