function Validator(theForm)
{
	var theForm = document.quiz;
	for(x = 0 ; x <= theForm.elements.length; x++){
		if (theForm.elements[x].type == "radio"){
			var oldquestion = theForm.elements[x].name;
			x = 1965;
		}
	}
	var radioSelected = false;
	var nextquestion = 1;
	for(x = 0 ; x < theForm.elements.length; x++){
		if (theForm.elements[x].type == "radio"){
	        if (oldquestion == theForm.elements[x].name){
				if (theForm.elements[x].checked == true){
			       radioSelected = true;
				}
			}
			else
			{
				if (!radioSelected){
					alert("Please select one of the options for question " + nextquestion +  ".");
				    return (false);
				}
				nextquestion = nextquestion + 1;
				var oldquestion = theForm.elements[x].name;
				if (theForm.elements[x].checked == true){
			        radioSelected = true;
				}
				else
				{
					radioSelected = false;
				}
			}
		}
	}
	if (!radioSelected){
		alert("Please select one of the options for question " + nextquestion +  ".");
	    return (false);
	}
	return (true);
}

function ValidatorLogin(theForm){
var theForm = document.login;
	if (theForm.password.value.length < 6){
	    alert("Password must be at least 6 characters with no spaces.");
	    return (false);
	}

	if (theForm.login.value.length < 6){
	    alert("User Name must be at least 6 characters with no spaces.");
	    return (false);
	}

	 return (true);
}
function ValidatorRegister(theForm){
	var theForm = document.register;
	if (theForm.password.value.length < 6){
	    alert("Password must be at least 6 characters with no spaces.");
	    theForm.password.focus()		
	    return (false);
	}
	if (theForm.password.value != theForm.confirm.value){
	    alert("Password and Confirm Password do not match.");
	    theForm.confirm.focus()		
	    return (false);
	}

	if (theForm.login.value.length < 6){
	    alert("User Name must be at least 6 characters with no spaces.");
	    theForm.login.focus()		
	    return (false);
	}

	if (theForm.first.value.length < 2){
	    alert("First Name must be filled in.");
	    theForm.first.focus()		
	    return (false);
	}
	if (theForm.last.value.length < 2){
	    alert("Last Name must be filled in.");
		theForm.last.focus()
	    return (false);
	}

	if (theForm.question.value == "0"){
		alert("Please select a Security Validation Question.");
	    theForm.question.focus()		
		return (false);
	}

	if (theForm.answer.value.length < 2){
	    alert("Security Validation Answer must be filled in.");
	    theForm.answer.focus()		
	    return (false);
	}
	if (theForm.email.value.length == ""){
	    alert("Please enter your email address.");
	    theForm.email.focus()		
	    return (false);
	}
	if (theForm.zip.value.length < 4){
	    alert("Please enter your zip code.");
	    theForm.zip.focus()		
	    return (false);
	}
	if (theForm.address.value.length < 4){
	    alert("Please enter your address.");
	    theForm.address.focus()		
	    return (false);
	}
	if (theForm.phone.value.length < 4){
	    alert("Please enter your phone number.");
	    theForm.phone.focus()		
	    return (false);
	}
	if (theForm.city.value.length < 4){
	    alert("Please enter your city.");
	    theForm.city.focus()		
	    return (false);
	}

	if (theForm.client.value == "0"){
	    alert("Please select from the Identify yourself drop down.");
	    return (false);
	}

	if (theForm.state.value == "0"){
		alert("Please select a Security Validation Question.");
	    theForm.question.focus()		
		return (false);
	}
	if (!theForm.accept.checked ){
	    alert("You must accept the Terms and Conditions.");
	    theForm.accept.focus()		
 	    return (false);
    }
}

function ValidatorLostLogin(theForm){
var theForm = document.lostlogin;
	if (theForm.question.value == "0"){
		alert("Please select a Security Validation Question.");
		return (false);
	}

	if (theForm.answer.value.length < 2){
	    alert("Security Validation Answer must be filled in.");
	    return (false);
	}


	if ((theForm.login.value == "") && (theForm.email.value == "")){
	    alert("Please select either User Name or Email to search by.");
	    return (false);
	}

	if ((theForm.login.value.length < 6) &&  (theForm.email.value == "")) {
	    alert("User Name must be at least 6 characters with no spaces.");
	    return (false);
	}
	if ((theForm.email.value.length < 6) && (theForm.login.value == "")) {
	    alert("Email must be at least 6 characters with no spaces.");
	    return (false);
	}
}
function ValidatorConfirm(theForm){
var theForm = document.complete;
	if (theForm.first.value.length < 2){
	    alert("First Name must be filled in.");
	    return (false);
	}
	if (theForm.last.value.length < 2){
	    alert("Last Name must be filled in.");
	    return (false);
	}
	if (theForm.city.value.length < 4){
	    alert("Please enter your City.");
	    return (false);
	}

	if (theForm.address.value.length < 4){
	    alert("Please enter your Address.");
	    return (false);
	}

	if (theForm.zip.value.length < 4){
	    alert("Please enter your zip code.");
	    return (false);
	}
	if (!theForm.state.value == "FL" ){
	    alert("You must select a State.");
 	    return (false);
    }
    theForm.completed.value = 1;
    return (true);
}

function ValidatorUnLoadPage(keyid,zip,state,city,address,first,last){
	var theForm = document.complete;
	if (theForm.completed.value == "0"){
		//return (false);
		//passedopen('/7800/heading/confirmpassed.aspx?error=1&keyid=' + keyid +'&zip='+zip+'&state='+state+'&city='+city+'&address='+address+ '&first='+first +'&last='+last ,'',780,575,0,0,0,0,0,0,0);
		//window.location = '/7800/heading/confirmpassed.aspx?error=1&keyid=' + keyid +'&zip='+zip+'&state='+state+'&city='+city+'&address='+address+ '&first='+first +'&last='+last
				
	}
}
