function sethtml(id, val)
{
if (!document.getElementById(id))
return;
document.getElementById(id).innerHTML = val;
}
function nullFunc() { return window; }
function pointerP()
{
document.body.style.cursor='pointer';
}
function autoP()
{
document.body.style.cursor='auto';
}
function showHideDiv(div)
{
if(!document.getElementById(div))
return;
if(document.getElementById(div).style.display == 'none')
{
document.getElementById(div).style.display = 'block';
if(document.getElementById(div+'ControlText'))
{
document.getElementById(div+'ControlText').innerHTML = '[ hide ]';
document.getElementById(div+'ControlText').style.fontSize = '9px';
}
}
else
{
document.getElementById(div).style.display = 'none';
if(document.getElementById(div+'ControlText'))
{
document.getElementById(div+'ControlText').innerHTML = "More ►";
document.getElementById(div+'ControlText').style.fontSize = '';
}
}
}
function underLine(id)
{
id.style.textDecoration= 'underline';
}
function noDecoration(id)
{
id.style.textDecoration= '';
}
var gxhp = null;
var gxhp_div;
//var switchDelete = 1;
function gxhpHandler()
{
//alert("div: "+xhp.readyState);
if (gxhp.readyState == 4)
{
document.getElementById(gxhp_div).innerHTML = gxhp.responseText;
launchJavascript(gxhp.responseText);
try
{
// Break circular dep; with this, firefox stops leaking.
gxhp.onreadystatechange = null;
} catch (e)
{
// IE throws an exception because onreadystatechange
// must be a function.
gxhp.onreadystatechange = nullFunc;
}
gxhp = null;
}
}
function gloadOnDiv(div, url, params)
{
if(gxhp != null)
return false;
if (window.XMLHttpRequest)
gxhp = new XMLHttpRequest();
else
gxhp = new ActiveXObject("Microsoft.XMLHTTP");
debugBox('');
debugBox('gload send');
//xhp.div = div;
gxhp_div = div;
gxhp.onreadystatechange = gxhpHandler;
gxhp.open("POST", url, true);
gxhp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=ISO-8859-1");
//if(xhp.overrideMimeType)
// xhp.overrideMimeType("text/html; charset=ISO-8859-1");
gxhp.send(params);
return true;
}
var hxhp = null;
var hxhp_div;
//var switchDelete = 1;
function hxhpHandler()
{
//alert("div: "+xhp.readyState);
if (hxhp.readyState == 4)
{
//document.getElementById(div).innerHTML = "";
document.getElementById(hxhp_div).innerHTML = hxhp.responseText;
launchJavascript(hxhp.responseText);
document.getElementById('statusMess').style.display = 'none';
window.clearTimeout(loadTimeout);
try
{
// Break circular dep; with this, firefox stops leaking.
hxhp.onreadystatechange = null;
} catch (e)
{
// IE throws an exception because onreadystatechange
// must be a function.
hxhp.onreadystatechange = nullFunc;
}
hxhp = null;
debugBox("hloadOnDiv 4 :" + hxhp_div );
}
else
{
debugBox("hloadOnDiv state: "+hxhp.readyState+ "::" + hxhp_div + "::" + hxhp);
}
}
var hxhpretries = 0;
function hloadOnDiv(div, url, params)
{
if(hxhp != null)
{
debugBox("hloadOnDiv busy :" + div +"::"+url+"::"+params);
hxhpretries++;
if(hxhpretries > 30)
hxhp = null;
return false;
}
hxhpretries = 0;
if(navigator.appName == "Microsoft Internet Explorer") //due to ie bug
cancelTrackComm();
debugBox("
");
if (window.XMLHttpRequest)
hxhp = new XMLHttpRequest();
else
hxhp = new ActiveXObject("Microsoft.XMLHTTP");
//xhp.div = div;
hxhp_div = div;
hxhp.onreadystatechange = hxhpHandler;
hxhp.open("POST", url, true);
hxhp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=ISO-8859-1");
//if(xhp.overrideMimeType)
// xhp.overrideMimeType("text/html; charset=ISO-8859-1");
debugBox("hloadOnDiv send :" + div +"::"+url+"::"+params);
hxhp.send(params);
document.getElementById('statusMess').innerHTML = ' Loading... ';
document.getElementById('statusMess').style.display = 'block';
loadTimeout = window.setTimeout("document.getElementById('statusMess').innerHTML = ' Load timeout, try again. '",90000);
return true;
}
var ixhp = null;
var ixhp_div;
//var switchDelete = 1;
function ixhpHandler()
{
//alert("div: "+xhp.readyState);
if (ixhp.readyState == 4)
{
//document.getElementById(div).innerHTML = "";
document.getElementById(ixhp_div).innerHTML = ixhp.responseText;
launchJavascript(ixhp.responseText);
//document.getElementById('statusMess').style.display = 'none';
window.clearTimeout(loadTimeout);
try
{
// Break circular dep; with this, firefox stops leaking.
ixhp.onreadystatechange = null;
} catch (e)
{
// IE throws an exception because onreadystatechange
// must be a function.
ixhp.onreadystatechange = nullFunc;
}
ixhp = null;
debugBox("iloadOnDiv 4 :" + ixhp_div );
}
else
{
debugBox("iloadOnDiv state: "+ixhp.readyState+ "::" + ixhp_div + "::" + ixhp);
}
}
var ixhpretries = 0;
function iloadOnDiv(div, url, params)
{
if(ixhp != null)
{
debugBox("hloadOnDiv busy :" + div +"::"+url+"::"+params);
ixhpretries++;
if(ixhpretries > 30)
ixhp = null;
return false;
}
ixhpretries = 0;
if(navigator.appName == "Microsoft Internet Explorer") //due to ie bug
cancelTrackComm();
debugBox("
");
if (window.XMLHttpRequest)
ixhp = new XMLHttpRequest();
else
ixhp = new ActiveXObject("Microsoft.XMLHTTP");
//xhp.div = div;
ixhp_div = div;
ixhp.onreadystatechange = ixhpHandler;
ixhp.open("POST", url, true);
ixhp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=ISO-8859-1");
//if(xhp.overrideMimeType)
// xhp.overrideMimeType("text/html; charset=ISO-8859-1");
debugBox("iloadOnDiv send :" + div +"::"+url+"::"+params);
ixhp.send(params);
//document.getElementById('statusMess').innerHTML = ' Loading... ';
//document.getElementById('statusMess').style.display = 'block';
//loadTimeout = window.setTimeout("document.getElementById('statusMess').innerHTML = ' Load timeout, try again. '",90000);
return true;
}
function launchJavascript(responseText) {
// RegExp from prototype.sonio.net
var ScriptFragment = '(?:)((\n|.)*?)(?:)';
var match = new RegExp(ScriptFragment, 'img');
var scripts = responseText.match(match);
if(scripts)
{
var js = '';
for(var s = 0; s < scripts.length; s++) {
var match = new RegExp(ScriptFragment, 'im');
js += scripts[s].match(match)[1];
}
eval(js);
}
}
function mileSpeedToString(miles, round)
{
var value;
if(distUnit == 'k')
value = miles*1.609344;
else
value = miles;
if(round)
{
value = Math.round(value*round*10)/(round*10);
}
else
value = Math.round(value);
if(distUnit == 'k')
return value + 'km/h';
else
return value + 'mph';
}
function kiloSpeedToString(kilometers, round)
{
var value;
if(distUnit == 'm')
value = kilometers*0.621371192;
else
value = kilometers;
if(round)
{
value = Math.round(value*round*10)/(round*10);
}
else
value = Math.round(value);
if(distUnit == 'k')
return value + 'km/h';
else
return value + 'mph';
}
function mileDistToString(miles, round)
{
var value;
if(distUnit == 'k')
value = miles*1.609344;
else
value = miles;
if(round)
{
value = Math.round(value*round*10)/(round*10);
}
else
value = Math.round(value);
if(distUnit == 'k')
return value + 'km';
else
return value + 'mi';
}
function kiloDistToString(kilometers, round)
{
var value;
if(distUnit == 'm')
value = kilometers*0.621371192;
else
value = kilometers;
if(round)
{
value = Math.round(value*round*10)/(round*10);
}
else
value = Math.round(value);
if(distUnit == 'k')
return value + 'km';
else
return value + 'mi';
}
function showDebugConsole()
{
document.getElementById('debugConsole').style.display = 'block';
var objDiv = document.getElementById("debugConsoleBox");
if(objDiv)
objDiv.scrollTop = objDiv.scrollHeight;
Drag.init(document.getElementById('debugConsole_handler'), document.getElementById('debugConsole'),0,null,0);
}
function closeDebugConsole()
{
document.getElementById('debugConsole').style.display = 'none';
}
var stopDebug = false;
function stopDebugCall()
{
stopDebug = true;
}
function debugBox(text)
{
if(stopDebug)
return;
var objDiv = document.getElementById("debugConsoleBox");
if(objDiv)
{
var now = new Date();
objDiv.innerHTML += "
";
objDiv.innerHTML += "["+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()+"."+now.getMilliseconds()+"] ";
objDiv.innerHTML += ""+text+"";
objDiv.scrollTop = objDiv.scrollHeight;
}
}