_d = document;
pressed=false;
ie = (_d.all ? true : false);
ie4=(!_d.getElementById&&_d.all)?true:false
ie4Plus = (document.all) ? true : false;
ie5 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 5.")!=-1)) ? true : false;
ie6 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 6.")!=-1)) ? true : false;
dom = (_d.getElementById ? true : false);
ns4=(_d.layers)?true:false
ns6=(navigator.userAgent.indexOf("Gecko")!=-1)?true:false
ns61=(parseInt(navigator.productSub)>=20010726)?true:false
mac=(navigator.appVersion.indexOf("Mac")!=-1)?true:false
mac45=(navigator.appVersion.indexOf("MSIE 4.5")!=-1)?true:false
if(ns6||ns4)mac=false
ieMac = ((document.all)&&(mac)) ? true : false;
ver4 = (ns4 || ie4Plus) ? true : false;
opera6=(navigator.userAgent.indexOf("Opera")!=-1)?true:false
opera7=((opera6)&&(navigator.userAgent.indexOf("7.")!=-1))?true:false
konq=(navigator.userAgent.indexOf("Konqueror")!=-1)?true:false
IEDtD=0;if((_d.all&&_d.compatMode=="CSS1Compat")||(mac&&_d.doctype&&_d.doctype.name.indexOf(".dtd")!=-1))IEDtD=1;
var popWin
if (ns4) {
	//Netscape 4 specific code
	pre = '_d.';
	post = '';
}
if (ie){
	//IE4+ specific code
	pre = '_d.all.';
	post = '.style';
}
if (dom){
	//Netscape 6/IE 6?/Opera specific code
	pre = '_d.getElementById("';
	post = '").style';
}

// Dropdown Menu Code
var state='';
function kill(b,n) {var x='drop'+b+'_'+n;document.getElementById(x).style.display='none'}
//function changekill(b,i,t) {var x='drop'+b+'_'+i;window.setTimeout('document.getElementById(x).style.display=\'none\'',2000)}
function show(x) {document.getElementById(x).style.display='block'}
function shallKill(b,n){if(state=='outmenu'){kill(b,n)}}
function inDrop(b,n) {var x='drop'+b+'_'+n;if(document.getElementById(x)){state='inmenu';var i = 1;while (i < 20) {if(document.getElementById('drop'+b+'_'+i)!=null){kill(b,i);i++}else{i++}}show(x)};x=x+'_st';if(document.getElementById(x)){show(x)}}
function notInDrop(b,n,t) {if(document.getElementById('drop'+b+'_'+n)){state='outmenu';window.setTimeout('shallKill(' + b + ',' + n + ')',t)}}
function collapse(b,n) {if(document.getElementById('drop'+b+'_'+n)){
	var abra = document.getElementById('drop'+b+'_'+n).style;
	if(abra.display == 'block') {abra.display = 'none';} else {abra.display = 'block';}
	return false;
	} else {
	return true;}}
// End Dropdown Menu Code

function trim(str) {
return str.replace(/^\s*|\s*$/g,"");
}
function nothing(){}
function sure() {
	press = window.confirm('Are you sure?');
}
function preLoadImages(imageList){
	var imageArray = imageList.split(',');
	var image
	for (var i = 0; i < imageArray.length; i++) {
		image = new Image();
		image.src = imageArray[i];
	}
}
function goToURL() {
  var i, args=goToURL.arguments; _d.returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function newWindow(url,width,height,windowName){ //Liam's version
	if (width==0||width>screen.width-40) {width=screen.width-40; }
	if (height==0||height>screen.height-100) {height=screen.height-100; }
	var left = (screen.width - width) / 8;
	var top = (screen.height - height) / 8;
	newwindow=window.open(url,windowName,'height='+height+',width='+width+',top='+top+',left='+left+',resizable=1,status=1,scrollbars=1');
	if (window.focus) {newwindow.focus()}
	return false;
}
function createWindow(url, paramList, paramValues) {
	var paramArray = paramList.split(',');
	var valueArray = paramValues.split(String.fromCharCode(176));
	for (var i = 1; i < paramArray.length; i++) {
		url=url+'&'+paramArray[i]+'='+valueArray[i];
	}
	if (valueArray[0] == 'newWin'){
		newWindow(url,valueArray[1],valueArray[2]);
	} else {
		_d.buttons.action=url;_d.buttons.target='_blank';_d.buttons.submit();
	}
}
function resizeWindow(showWidth,showHeight) {
	if (showWidth==0||showWidth>screen.width-40) {showWidth=screen.width-40; }
	if (showHeight==0||showHeight>screen.height-100) {showHeight=screen.height-100; }
	width=showWidth+12;
	height=showHeight+31;
	var left=(screen.width-width)/8+2;
	var top=(screen.height - height)/8+4;
	window.moveTo(left,top);
	window.resizeTo(width,height);
}
function midWindow(url, name, w, h, scrol) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scrol+',resizable'
	win = window.open(url, name, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
var currentLayer = 'initialLayer';
function toggleLayer(lyr){
	hideLayer(currentLayer);
	eval(pre + lyr + post).display = 'block';
	currentLayer = lyr;
}
function showLayer(lyr){
	eval(pre + lyr + post).display = 'block';
}
function hideLayer(lyr){
	eval(pre + lyr + post).display = 'none';
}
// get the true offset of anything on NS4, IE4/5 & NS6, even if it's in a table!
function getAbsX(elt) {return (elt.x) ? elt.x : getAbsPos(elt,"Left"); }
function getAbsY(elt) { return (elt.y) ? elt.y : getAbsPos(elt,"Top"); }
function getAbsPos(elt,which) {
	iPos = 0;
	while (elt != null) {
		iPos += elt["offset" + which];
//		alert(elt.id+' '+elt.nodeName+' '+which+' '+iPos);
//		if (elt.nodeName=="DIV"){
//			iPos -= elt["offset" + which];
//		alert(elt.id+' '+elt.nodeName+' '+which+' '+iPos);
//			break;
//		}
		elt = elt.offsetParent;
	}
	return iPos;
}
function getStyle(elt) {
	var style;
	if (dom) {
		style = _d.getElementById(elt).style;
	} else {
		style = ie ? _d.all[elt].style : _d.layers[elt];
	}
	return style;
}
function setPositions(eltList,offset,show) {
	if (eltList==""){return;}
	var eltListSplit = eltList.split(",");
	for (var i = 0; i < eltListSplit.length; i++) {
		setPosition(eltListSplit[i],offset,false);
		if (show==1){
			showLayer(eltListSplit[i]);
		} else if(show==2) {
			if (eval(pre + eltListSplit[i] + post).display=="block") {
				hideLayer(eltListSplit[i]);
			} else {	
				showLayer(eltListSplit[i]);
			}	
		}
	}
}
function togglePositions(eltList) {
	if (eltList==""){return;}
	var eltListSplit = eltList.split(",");
	for (var i = 0; i < eltListSplit.length; i++) {
		if (eval(pre + eltListSplit[i] + post).display!="none") {
			hideLayer(eltListSplit[i]);
		} else {	
			showLayer(eltListSplit[i]);
		}	
	}
}
function setPosition(elt,offset,isPlacedUnder) {
	var eltStyle = getStyle(elt);
	var positionerName = elt+"Pos";
	var positioner;
	if (ie) {
		positioner = _d.all[positionerName];
	} else {
		if (dom) {
			positioner = _d.getElementById(positionerName);
		} else {
			positioner = _d.images[positionerName];
		}
	}
	positioner = _d.all[positionerName];
	eltStyle.left = getAbsX(positioner)+offset;
	eltStyle.top = getAbsY(positioner) + (isPlacedUnder ? positioner.height : 0);
}
function display(id){
	eval(pre + id + post).display = 'block';
}
function rowdisplay(id){
	if(ie){
		eval(pre + id + post).display = 'block';
	}else{
		eval(pre + id + post).display = 'table-row';
	}
}
function undisplay(id){
	eval(pre + id + post).display = 'none';
}
function changeColor(id,colorVar){
	eval(pre + id + post).color = colorVar;
}
function toggleUnder(id){
	if (eval(pre + id + post).textDecorationUnderline == true) {
		eval(pre + id + post).textDecorationUnderline = false;
	} else {
		eval(pre + id + post).textDecorationUnderline = true;
	}
}