/* script for popup window */

function showPopup( width, height, file) {
	x = (640 - width)/2, y = (480 - height)/2;

	if (screen) {
	y = (screen.availHeight - height)/2;
	x = (screen.availWidth - width)/2;
	}
	if (screen.availWidth > 1800) {
	x = ((screen.availWidth/2) - width)/2;
	}

   	var newWindow =

	window.open(file+'?page='+escape(location.href),'','width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x+',scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes,status=no');

}


function validate() {
	if(document.signup.name.value == ""){
		alert("Please fill in your name in the name field.");
		document.signup.name.focus();
		return false;
	}	

	else if(document.signup.company.value == ""){
		alert("Please fill in your company name in the company field.");
		document.signup.company.focus();
		return false;
	}
	
	else if(document.signup.email.value == ""){
		alert("Please fill in your E-mail address.");
		document.signup.email.focus();
		return false;
	}
	
	else if(document.signup.email.value != document.signup.confirm.value){
		alert("E-mail addresses don't match.");
		document.signup.confirm.focus();
		return false;
	}
	
	var emailID = document.signup.email;
		
	if (checkemail(emailID.value) == false) {
		emailID.value= "";
		emailID.focus();
		return false;
	}

	else {
		return true;
	}
}

function checkemail(str) {
	var invalidcheck = 0;	
	var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (filter.test(str)) {
		var tempstring = str.split("@");
		tempstring = tempstring[1].split(".");
		for (i=0;i<invalidaddress.length;i++) {
			if (tempstring[0]==invalidaddress[i]) {
				invalidcheck = 1;
			}
		}
		if (invalidcheck!=1) {
			testresults=true;
		}
		else {
			alert("Please input a more official email address!");
			testresults = false;
		}
	}
	else {
		alert("Please input a valid email address!");
		testresults = false;
	}
	return (testresults);
}