window.name = 'afhome';

function quicknav (form) {

	itemNo = form.navMenu.selectedIndex; // get the index number from the select array
	url = form.navMenu.options[itemNo].value; // the value of the selected element

	if ( url == "invalid") {  // check the value
		return false;  // if its a bad url, cancel form submission
		exit;
	} else {
		form.submit();
		return true;
	}
}

function af_pop (obj, w, h) {
	window.open (obj.href, 'afpop', 'width='+w+', height='+h+', scrollbars=yes, resizable=yes, controls=no, toolbar=no');
}

function af_popup (theURL, winName, theWidth, theHeight) {
	window.open (theURL, winName, 'width=' + theWidth + ', height=' + theHeight + ', scrollbars=no, resizable=no, controls=no, toolbar=no');
}

function af_printpopup (theURL, winName, theWidth, theHeight) {
	window.open (theURL, winName, 'width=' + theWidth + ', height=' + theHeight + ', scrollbars=yes, resizable=yes, controls=no, toolbar=yes');
}

function is_valid_email (str) {
	var at		= "@";
	var dot		= ".";
	var lat		= str.indexOf(at);
	var lstr	= str.length;
	var ldot	= str.indexOf(dot);
	
	if (str.indexOf (at) == -1) return false;
	if (str.indexOf (at) == -1 || str.indexOf (at) == 0 || str.indexOf (at) == lstr) return false;
	if (str.indexOf (dot) == -1 || str.indexOf (dot) == 0 || str.indexOf (dot) == lstr) return false;
	if (str.indexOf (at, (lat + 1)) != -1) return false;
	if (str.substring (lat-1, lat) == dot || str.substring (lat + 1, lat + 2) == dot) return false;
	if (str.indexOf (dot, (lat + 2)) == -1) return false;
	if (str.indexOf (" ") != -1) return false;
	if (str.indexOf ("<") != -1) return false;
	
	return true;
}
