var ie4 = false;
var ie5 = false;
var ns4 = false;
var ns6 = false;
var mac = false;
var loaded = false;
var testing = false;
var dir_images = 'images/english/';
if(document.layers){origWidth=innerWidth;origHeight=innerHeight;onresize=function(){if(innerWidth!=origWidth||innerHeight!=origHeight)location.reload()}}else{onresize=function(){window.location.reload();}}
function SetFocus(fieldname,formname){if (formname == ''){ formname = 'form'; }if (eval("document."+formname+".elements[fieldname].value == ''")){ eval("document."+formname+".elements[fieldname].focus();"); }}
function Popup(title,filename,w,h,scroll,resizable){if (title == ''){ title = 'popup'; }if (scroll == 'scroll'){ scroll = 'yes'; }else{ scroll = 'no'; }if (resizable == 'lock'){ resizable = 'no'; }else{ resizable = 'no'; }winOptions = eval("'width="+w+",height="+h+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scroll+",resizable="+resizable+",copyhistory=no'");window.open(filename,title,winOptions);return;}
function safemail(name,domain,display) {displayed = (typeof(display) == "undefined") ? name+"@"+domain : display;document.write(''+displayed+'');}
function StartTimer(event){running = true; timerId = setTimeout(event,delay);}
function StopTimer(){running = false; clearTimeout(timerId);}
function SetElementPosition(id,top,left){
if (testing) { alert("SetElementPosition\nid = "+id+"\ntop = "+top+"\nleft = "+left); }
if (ns4) {
eval('document.'+id).top = top;
eval('document.'+id).left = left;
} else if (ns6) {
document.getElementById(id).style.top = top;
document.getElementById(id).style.left = left;
} else {
eval(id).style.top = top;
eval(id).style.left = left;
}
}
function SetVisibility(id,flag) {
if (ns4) {
var str = (flag) ? 'show' : 'hide';
eval("document."+id).visibility = str;
} else if (ns6) {
var str = (flag) ? 'visible' : 'hidden';
document.getElementById(id).style.visibility = str;
} else {
var str = (flag) ? 'visible' : 'hidden';
eval("document.all."+id).style.visibility = str;
}
}
function getImageTop(imgID) {
if (ns4) return eval(imgID).y;
else return getRealTop(imgID);
}
function getImageLeft(imgID) {
if (ns4) return eval(imgID).x
else return getRealLeft(imgID);
}
function getRealTop(imgElem) {
yPos = eval(imgElem).offsetTop;
tempEl = eval(imgElem).offsetParent;
while (tempEl != null) {
yPos += tempEl.offsetTop;
tempEl = tempEl.offsetParent;
}
return yPos;
}
function getRealLeft(imgObj) {
xPos = eval(imgObj).offsetLeft;
tempObj = eval(imgObj).offsetParent;
while (tempObj != null){
xPos += tempObj.offsetLeft;
tempObj = tempObj.offsetParent;
}
return xPos;
}
function getImageWidth(id) {
if (ie4){
return eval('document.all.'+id).style.pixelWidth;
} else if (ns4) {
return eval('document.'+id).width;
} else {
return document.getElementById(id).offsetWidth;
}
}
function getElementWidth(id) {
if (ie4){ return eval('document.all.'+id).offsetWidth; }
else if (ns4){ return eval('document.'+id).clip.width; }
else { return document.getElementById(id).offsetWidth; }
}
function getElementHeight(id) {
if (ie4){ return eval('document.all.'+id).offsetHeight; }
else if (ns4){ return eval('document.'+id).clip.height; }
else { return document.getElementById(id).offsetHeight; }
}
function layerWrite(id,text) {
if (ns4) {
var lyr = document.layers[id].document;
lyr.open();
lyr.write(text);
lyr.close();
} else if (ns6) {
rng = document.createRange();
el = document.getElementById(id);
rng.setStartBefore(el);
htmlFrag = rng.createContextualFragment(text);
while (el.hasChildNodes()) el.removeChild(el.lastChild);
el.appendChild(htmlFrag);
} else if (ie4 || ie5) {
document.all[id].innerHTML = text;
}
}
function FormatMoney(amount) {
re = /[^-.0-9]/g;
var s = "";
var decimal;
val = new String(amount);
amount = val.replace(re, "");
len = amount.length + 2;
if (!amount.indexOf(".")) len++;
amount = parseFloat(amount);
neg = (amount < 0) ? true : false;
if (neg) {
amount = Math.abs(amount);
--len;
}
if (!(isNaN(amount))) {
//round to nearest cent
amount = new String(amount * 100);
amount = amount.substring(0,len);
amount = Math.ceil(amount);
amount = amount / 100;
//format the output
s = new String(amount);
decimal = s.indexOf(".");
if (decimal == -1) {
//whole number
s+= ".00";
} else {
if (decimal == (s.length - 2)) {
//needs a trailing zero
s+= "0";
}
}
//add commas
decimal = s.indexOf(".");
if (decimal > 3) {
s = s.substring(0, decimal-3) + "," + s.substring(decimal-3, s.length);
comma = s.indexOf(",");
while (comma > 3) {
s = s.substring(0, comma-3) + "," + s.substring(comma-3, s.length);
comma = s.indexOf(",");
}
}
} else {
//not a number so return zero
s = "0.00";
}
if (neg) s = '-' + s;
return s;
}
//////////////////////////////////////////
//////////////////////////////////////////
function Init(id) {
SetBrowser();
LoadImages();
loaded = true;
}
function SetBrowser() {
agent = navigator.userAgent.toLowerCase();
mac = (agent.indexOf("mac")!=-1);
ie4 = (document.all && !document.getElementById) ? true : false;
ie5 = (document.all && document.getElementById) ? true : false;
ns4 = (document.layers) ? true : false;
ns6 = (document.getElementById && !document.all) ? true : false;
if (testing){ alert("agent: "+agent+"\nmac: "+mac+"\nie4: "+ie4+"\nie5: "+ie5+"\nns4: "+ns4+"\nns6: "+ns6+"\n"); }
}
function LoadImages() {
var num_images = 60;
ImagesOff = new Array(num_images);
for (var i=0; i