// NewWindow popup functionality
function NewWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

/* Input highlighting */

inputHighlight = function() {
	var inputs = document.getElementsByTagName("input");
	var selects = document.getElementsByTagName("select");
	var textareas = document.getElementsByTagName("textarea");
	
	for (var i=0; i<inputs.length; i++) {
		if (inputs[i].type == "radio") continue;
		inputs[i].onfocus=function() {
			fieldon(this);
		}
		inputs[i].onblur=function() {
			fieldoff(this);
		}
	}
	for (var i=0; i<selects.length; i++) {
		selects[i].onfocus=function() {
			fieldon(this);
		}
		selects[i].onblur=function() {
			fieldoff(this);
		}
	}
	for (var i=0; i<textareas.length; i++) {
		textareas[i].onfocus=function() {
			fieldon(this);
		}
		textareas[i].onblur=function() {
			fieldoff(this);
		}
	}
}
window.onload = inputHighlight;

function fieldon(el) {
	el.style.backgroundColor = "#fff";
}

function fieldoff(el) {
	el.style.backgroundColor = "#f7f7f7";
}

function EnterSubmit(e, form) {
	// if the enter key is pressed, submit the form

	var key
	
	if(window.event) // IE
	{
		key = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		key = e.which
	}
	
	if (key == 13) {
		form.submit();
	}
}


