var active = false;

function showdd(divname){
	if (active){
		document.getElementById(divname).style.display = 'block';
	}
}

function hidedd(divname){
	document.getElementById(divname).style.display = 'none'
}

function getAbsPos(elt,which){
	iPos = 0;
	while (elt != null){
		iPos += elt["offset" + which];
		if ((document.getElementById && !document.all)&&((elt.id) != '')){
			var stylestoget = new Array ("paddingTop","paddingBottom","borderTopWidth","borderBottomWidth");
			for (x=0; x<stylestoget.length; x++){
				var nsStyle = stylestoget[x];
				var stylepx = getstyle(elt.id, nsStyle).replace(/px/, "");
				if (stylepx >= 0){
					iPos += Math.round(stylepx)
				}
			}
		}
		elt = elt.offsetParent;
	}
	return iPos;
}

function getstyle(cssdiv,styletoget){
	var output = '';
	var dCSS = document.styleSheets;
	for (i = 0; i<dCSS.length; i++) {
		for (j=0; j<dCSS[i].cssRules.length; j++) {
			if (dCSS[i].cssRules[j].selectorText == '#'+cssdiv){
				if(eval("dCSS[i].cssRules[j].style."+styletoget)){
					output = eval("dCSS[i].cssRules[j].style."+styletoget);
				}
			}
		}
	}
	return output;
}

function emsTweak(){
	if ((document.createElement) && (document.createTextNode)){
		document.writeln('<div id="emsTest" style="position:absolute; visibility:hidden; font-family:arial,helvetica,sans-serif">&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br /></div>');
		var scaling=100;
		if ((navigator.platform=="Win32") && (navigator.appName=="Microsoft Internet Explorer")) scaling=105;
		var h=999;
		if (document.getElementById('emsTest').clientHeight) h=parseInt(document.getElementById('emsTest').clientHeight);
		else if (document.getElementById('emsTest').offsetHeight) h=parseInt(document.getElementById('emsTest').offsetHeight);
		if (h<70) alert("This Website uses scalable fonts for visually impaired users.\n\nYou may notice that some of the text is small and unreadable. This is because your browser is set display small fonts.\n\nPlease adjust the setting (View/Text size - in Internet Explorer : View/Text zoom - in Netscape) to view this website normally.");
	}
}

function showdetails(item){
	if ((typeof showdetailswin == 'undefined') || showdetailswin.closed) {
		showdetailswin = window.open('/showdetails.php?id='+item,'showdetailswin','width=640,height=320,scrollbars=yes');
	} else {
		showdetailswin.location.replace('/showdetails.php?id='+item);
		showdetailswin.focus();
	}
}


var numChecked = 0;
var maxChecked = 3;

function getChecked() {
	var theForm = document.compareform;
	for (i=0; i<theForm.elements.length; i++) {
		if (theForm.elements[i].type == 'checkbox' && theForm.elements[i].checked) numChecked++;
	}
}

function checkCheck(theBox) {
	if (theBox.checked) {
		if (numChecked == maxChecked){
			theBox.checked = false;
		} else {
			numChecked++;
		}
	} else {
		numChecked--
	}
	return true;
}

function chkfeedbackfrm(what) {
	if (what.name.value == "") {
		alert("Please enter your Name");
		what.name.focus();
		return false;
	}
	else if (what.email.value == "") {
		alert("Please enter your email address");
		what.email.focus();
		return false;
	}
}

