/********************************************************************
* Author:   Andrew Connick
* Date:     10/05/07
********************************************************************/

var prvColor;

function showDd(elm) { 
	for (i=0; i<elm.childNodes.length; i++) {
		n = elm.childNodes[i];
		if (n.className=="ddMenu") n.style.display = "block";
	}
}

function hideDd(elm) { 
	for (i=0; i<elm.childNodes.length; i++) {
		n = elm.childNodes[i];
		if (n.className=="ddMenu") n.style.display = "none";
	}
}

function vldEmail(e) {
	// define a regular expression to validate the email address
	r = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	if (r.test(e.value)) return true;                        // quit if the email is valid.
	// otherwise set an error.
	e.select();
	alert("Please enter a valid email address.");
	e.focus();
	return false;                                            // return false to halt processing.
}

function vldName(n) {
	// define a regular expression to validate the name (alpha, number or space)
	r = /^[\w ]+$/;
	if (r.test(n.value)) return true;
	n.select();
	alert("Please enter a valid name.");
	n.focus();
	return false;
}

function chkRqd(fld, name) {
	if (isBlank(fld)) {
		alert("Please enter " + name);
		fld.focus();
		return false;
	} 
	else return true;
}

function isBlank(f) {
//	var r = /^\S+$/;
//	if (r.test(f.value)) return false;
//	else return true;
	if (f.value == "") return true;
	else return false;
}

function vldForm(form) {
	for (var i=0; i<form.length; i++) {
		var e = form.elements[i];
		if (e.type=="text" || e.type=="textarea") {
			if (e.value.indexOf('>')>=0 || e.value.indexOf('<')>=0) {
				e.select();
				alert("Text contains an invalid character < > are not allowed.");
				e.focus();
				return false;
			}
		}
	}
	return true;
}

function setBg(e) {
	prvColor = e.style.backgroundColor; 
	e.style.backgroundColor = "#000033"; 
}

function resetBg(e) { e.style.backgroundColor = prvColor; }

// function to fix IE bug
function setMinHeight() {
	var h = document.getElementById("content").offsetHeight;
	if (h != 0 && h < 540) {
		h = 540 - h;
	document.write("<div style='height: " + h + "px; '></div>");
	}
}
