sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function changeimg(img) {
	if(img.src.match("-norm")) {
		img.src = img.src.split("-norm").join("-fade");
	} else {
		img.src = img.src.split("-fade").join("-norm");
	}
}

function showtxt(txt) {
	if(document.getElementById(txt).style.visibility != 'visible') {
		document.getElementById(txt).style.visibility = 'visible';
	} else {
		document.getElementById(txt).style.visibility = 'hidden';
	}
}

function newwin(lnk) {
	window.open(lnk.href, 'newwindow','toolbar=yes, location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes, resizable=yes');
	return false;
}

function areyousure(txt) {
	var q = confirm(txt);
	if (!q){ return false; }
}

function change_address(num) {
	for(var i=1;i<=7;i++) { document.getElementById('pin_'+i).src = document.getElementById('pin_'+i).src.split("-gold").join("-blue"); }
	document.getElementById('pin_'+num).src = document.getElementById('pin_'+num).src.split("-blue").join("-gold");
	document.getElementById('address').innerHTML = document.getElementById('addmap_'+num).innerHTML;
}

function chkF(field,alerttxt,reject){
	with (field) {
		if (value==null||value==""||value==reject){
			alert(alerttxt);
			return false;
		} else { return true }
	}
}

function chkE(field,alerttxt){
	with (field){
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) 
			  {alert(alerttxt);return false;}
		else {return true;}
	}
}

function pap_form(thisForm) {
	with (thisForm){
		if (chkF(pfo_company, "Please enter your company name.", "asd")==false){
			pfo_company.focus();
			return false
		}
		
		if (chkF(pfo_address, "Please enter your postal address", "asd")==false){
			pfo_address.focus();
			return false
		}
		
		if (chkE(pfo_email,"Sorry that isn't a valid Email Address")==false){
			pfo_email.focus();
			return false
		}
		
	}
}


