/**
 * shortcut for poping new windows
 */
function popup_window(url, target, w, h) {
	var newwin;
	var params = 'toolbar=no,location=no,scrollbars=yes,resize=yes,width='+ w +',height=' + h;
	newwin = window.open(url,target,params);
	newwin.focus();
}

/**
 * a utility function to check all form elements, and if any elements whose
 * name begins with 'req_' and have an empty value exist... pop an error window
 * and return false
 */
function checkRequired(form) {
	var i;
	for (i = 0; i < form.elements.length; i++) {
		var value = form.elements[i].value;
		var name = form.elements[i].name;
		if (name.substring(0,4) == 'req_' && value == '') {
			var pName = name.substring(4);
			alert("Required fields are not completed:\n" + pName + " is required");
			return false;
		}
	}
	return true;
}

/**
 * a util for <select> boxes for jumping to the selected index
 */
function jump(menu) {
	var loc = menu[menu.selectedIndex].value.split("|");
	if (loc.length == 2) 
		window.open(loc[1],loc[0]);
}
