// Popout a new window with URL and size params
function launch(URL, width, height){
	var winLeft = (screen.width - width) / 2;
	var winUp = (screen.height - height) / 2;

	newWindow = window.open(URL,"newwindow","width="+width+",height="+height+",top="+winUp+",left="+winLeft+",scrollbars=yes,toolbar=no,menubar=no,status=no,resizable=yes");
	newWindow.focus();
}

// This method validates a form
function validate(myform) 
{
	if (!myform.terms[0].checked || myform.terms[1].checked) {
		alert("You must agree to our Terms of Service and our Privacy Policy to proceed.");
		return false;		
	} else if (!isFilled(myform.email)) {	
		alert("Please supply a valid email address.");
		return false;
	} else if (!isFilled(myform.password)) {
		alert("Please supply a password.");
		return false;
	} else if (!(myform.password.value.length >= 5)) {	
		alert("Please supply a password that is at least 5 characters long.");
		return false;
	} else if (myform.password.value != myform.passwordconfirm.value) {
		alert("Your passwords do not match. Please try again.");
		return false;		
	} else if (!isFilled(myform.zipcode)) {
		alert("You forgot to enter your Zipcode.");
		return false;
	} else if (!(myform.zipcode.value.length >= 5)) {	
		alert("Please enter a valid zipcode.");
		return false;				
	} else {
	    return true;
	}
}

function isFilled(elm) {
	if (elm.value == "" || elm.value == " " || elm.value == null) 
		return false;
	else 
		return true;
}