
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=0,width=800,height=600,left = 490,top = 387');");
}
// End -->

function validateLogin() {
	
	if (document.SurveyForm.emailAddress.value == '') {
		alert('You must fill in your Email Address.');
		document.SurveyForm.emailAddress.focus();
		return false;
	}
	if (document.SurveyForm.emailAddress.value != ''){
		if (checkEmail(document.SurveyForm.emailAddress)){
			alert('The email address you entered is invalid.');
			document.SurveyForm.emailAddress.focus();
			return false;
		}
	}
	if (document.SurveyForm.userPassword.value == '') {
		alert('You must fill in your Password.');
		document.SurveyForm.userPassword.focus();
		return false;
	}
	if (document.SurveyForm.userPassword.value != '') {
		var checkIt = document.SurveyForm.userPassword.value;
		if ((checkIt.length > 10) || (checkIt.length < 6)) {
			alert('Your password must be 6-10 characters in length.');
			document.SurveyForm.userPassword.focus();
			return false;
		}
	}
}

function validateEmail() {
	
	if (document.SurveyForm.myemail.value == '') {
		alert('You must fill in your Email Address.');
		document.SurveyForm.myemail.focus();
		return false;
	}
	if (document.SurveyForm.myemail.value != ''){
		if (checkEmail(document.SurveyForm.myemail)){
			alert('The email address you entered is invalid.');
			document.SurveyForm.myemail.focus();
			return false;
		}
	}
}

function validateAccountEdit() {
	
	if (document.SurveyForm.emailAddress.value == '') {
		alert('You must fill in your Email Address.');
		document.SurveyForm.emailAddress.focus();
		return false;
	}
	if (document.SurveyForm.userPassword.value != '') {
		var checkIt = document.SurveyForm.userPassword.value;
		if ((checkIt.length > 10) || (checkIt.length < 6)) {
			alert('Your password must be 6-10 characters in length.');
			document.SurveyForm.userPassword.focus();
			return false;
		}
	}
}

function validateKnowItStep1() {
	
	if (document.SurveyForm.passemail.value == '') {
		alert('You must fill in your Email Address to continue.');
		document.SurveyForm.passemail.focus();
		return false;
	}
	if (document.SurveyForm.passemail.value != ''){
		if (checkEmail(document.SurveyForm.passemail)){
			alert('The email address you entered is invalid.');
			document.SurveyForm.passemail.focus();
			return false;
		}
	}
}
	
function validateKnowItStep2() {
	
	if (document.SurveyForm.userEmail.value == '') {
		alert('You must fill in your Email Address.');
		document.SurveyForm.userEmail.focus();
		return false;
	}
	if (document.SurveyForm.userEmail.value != ''){
		if (checkEmail(document.SurveyForm.userEmail)){
		alert('The email address you entered is invalid.');
		document.SurveyForm.userEmail.focus();
		return false;
		}
	}
	if (document.SurveyForm.confirmEmail.value == '') {
		alert('You must confirm your Email Address.');
		document.SurveyForm.confirmEmail.focus();
		return false;
	}
	if (document.SurveyForm.confirmEmail.value != ''){
		if (checkEmail(document.SurveyForm.confirmEmail)){
			alert('The confirm email address you entered is invalid.');
			document.SurveyForm.confirmEmail.focus();
			return false;
		}
	}
	if (document.SurveyForm.userEmail.value != '' && document.SurveyForm.confirmEmail.value != ''){
		if (document.SurveyForm.userEmail.value != document.SurveyForm.confirmEmail.value) {
			alert('Your email addresses do not match.');
			document.SurveyForm.userEmail.focus();
			return false;
		}
	}
	if (document.SurveyForm.userPassword.value != '') {
		var checkIt = document.SurveyForm.userPassword.value;
		if ((checkIt.length > 10) || (checkIt.length < 6)) {
			alert('Your password must be 6-10 characters in length.');
			document.SurveyForm.userPassword.focus();
			return false;
		}
	}
	if (document.SurveyForm.Phone.value != '') {
		if (checkAlpha(document.SurveyForm.Phone)){
			alert('The Phone Number you entered is invalid.');
			document.SurveyForm.Phone.focus();
			return false;
		}
	}	
}

function validateRegisterIt() {
	
	if (document.SurveyForm.FirstName.value == '') {
		alert('You must fill in your First Name.');
		document.SurveyForm.FirstName.focus();
		return false;
	}
	if (document.SurveyForm.LastName.value == '') {
		alert('You must fill in your Last Name.');
		document.SurveyForm.LastName.focus();
		return false;
	}
	if (document.SurveyForm.Phone.value == '') {
		alert('You must fill in your Phone.');
		document.SurveyForm.Phone.focus();
		return false;
	}
	if (document.SurveyForm.Phone.value != '') {
		if (checkAlpha(document.SurveyForm.Phone)){
			alert('The Phone Number you entered is invalid.');
			document.SurveyForm.Phone.focus();
			return false;
		}
	}	
	if (document.SurveyForm.userEmail.value == '') {
		alert('You must fill in your Email Address.');
		document.SurveyForm.userEmail.focus();
		return false;
	}
	if (document.SurveyForm.userEmail.value != ''){
		if (checkEmail(document.SurveyForm.userEmail)){
		alert('The email address you entered is invalid.');
		document.SurveyForm.userEmail.focus();
		return false;
		}
	}
	if (document.SurveyForm.confirmEmail.value == '') {
		alert('You must confirm your Email Address.');
		document.SurveyForm.confirmEmail.focus();
		return false;
	}
	if (document.SurveyForm.confirmEmail.value != ''){
		if (checkEmail(document.SurveyForm.confirmEmail)){
			alert('The confirm email address you entered is invalid.');
			document.SurveyForm.confirmEmail.focus();
			return false;
		}
	}
	if (document.SurveyForm.userEmail.value != '' && document.SurveyForm.confirmEmail.value != ''){
		if (document.SurveyForm.userEmail.value != document.SurveyForm.confirmEmail.value) {
			alert('Your email addresses do not match.');
			document.SurveyForm.userEmail.focus();
			return false;
		}
	}
	if (document.SurveyForm.userPassword.value != '') {
		var checkIt = document.SurveyForm.userPassword.value;
		if ((checkIt.length > 10) || (checkIt.length < 6)) {
			alert('Your password must be 6-10 characters in length.');
			document.SurveyForm.userPassword.focus();
			return false;
		}
	}
	if (document.SurveyForm.address.value == '') {
		alert('You must fill in your Address.');
		document.SurveyForm.address.focus();
		return false;
	}
	if (document.SurveyForm.city.value == '') {
		alert('You must fill in your City.');
		document.SurveyForm.city.focus();
		return false;
	}
	if (document.SurveyForm.state.value == '') {
		alert('You must fill in your State.');
		document.SurveyForm.state.focus();
		return false;
	}
	if (document.SurveyForm.zipPostal.value == '') {
		alert('You must fill in your Zip.');
		document.SurveyForm.zipPostal.focus();
		return false;
	}
	if (document.SurveyForm.productName.value == '') {
		alert('You must fill in your Product Name.');
		document.SurveyForm.productName.focus();
		return false;
	}
	if (document.SurveyForm.modelNumber.value == '') {
		alert('You must fill in your Model Number.');
		document.SurveyForm.modelNumber.focus();
		return false;
	}
	if (document.SurveyForm.date1.value == '') {
		alert('You must select the purchase date.');
		document.SurveyForm.date1.focus();
		return false;
	}
	if (document.SurveyForm.purchasePlace.value == '') {
		alert('You must fill in the purchase place.');
		document.SurveyForm.purchasePlace.focus();
		return false;
	}
	
}

function dealerLocatorForm() {
	
	if (document.SurveyForm.firstName.value == '') {
		alert('You must fill in your First Name.');
		document.SurveyForm.firstName.focus();
		return false;
	}
	if (document.SurveyForm.lastName.value == '') {
		alert('You must fill in your Last Name.');
		document.SurveyForm.lastName.focus();
		return false;
	}
	if (document.SurveyForm.email.value == '') {
		alert('You must fill in your Email Address.');
		document.SurveyForm.email.focus();
		return false;
	}
	if (document.SurveyForm.email.value != ''){
		if (checkEmail(document.SurveyForm.email)){
			alert('The Email Address you entered is invalid.');
			document.SurveyForm.email.focus();
			return false;
		}
	}
	if (document.SurveyForm.phone.value == '') {
		alert('You must fill in your Phone Number.');
		document.SurveyForm.phone.focus();
		return false;
	}

}

function checkAlpha(field) {
	string = field.value;
	var Chars = "-0123456789";

    for (var i = 0; i < string.length; i++) {
       if (Chars.indexOf(string.charAt(i)) == -1){
			return true;          
       }
    }
    return false;
} 

function checkEmail(field) {
	string = field.value;
 	if (string.indexOf(' ')==-1 
      	&& 0<string.indexOf('@')
      	&& string.indexOf('@')+1 < string.length){
			return false;
	}
 	return true;
}

