// Customise those settings

var seconds = 30;
var divid = "liveupdate";
var url = "/livequote?jid="+ gup('jid');

////////////////////////////////
//
// Refreshing the DIV
//
////////////////////////////////

function refreshdiv(){

// The XMLHttpRequest object

var xmlHttp;
try{
xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
}
catch (e){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
}
catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){
alert("Your browser does not support AJAX.");
return false;
}
}
}

// Timestamp for preventing IE caching the GET request

fetch_unix_timestamp = function()
{
return parseInt(new Date().getTime().toString().substring(0, 10))
}

var timestamp = fetch_unix_timestamp();
var nocacheurl = url+"&t="+timestamp;


xmlHttp.open("GET",nocacheurl,true);
xmlHttp.onreadystatechange=function(){

if(xmlHttp.readyState==4){
	if(document.getElementById('status') != null) {
		document.getElementById('status').innerHTML = "";
		document.getElementById('status').style.visibility = "hidden";
		document.getElementById(divid).innerHTML=xmlHttp.responseText;
		setTimeout('refreshdiv()',seconds*1000);
	}
} else {
	if(document.getElementById('status') != null) {
		document.getElementById('status').innerHTML = "Updating...";
		document.getElementById('status').style.visibility = "visible";
	}
}

}

xmlHttp.send(null);
}

// Start the refreshing process

window.onload = function startrefresh(){
setTimeout('refreshdiv()',seconds*1000);
}



// Fucntion for getting variables from URL
function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}