function validate_form ( )
{
    valid = true;

    if ( document.contact_form.fname.value == "" )
    {
        alert ( "Please fill in your first name." );
        valid = false;
    }


	if ( document.contact_form.lname.value == "" )
    {
        alert ( "Please fill in your last name." );
        valid = false;
    }


	if ( document.contact_form.email.value == "" )
	{
        alert ( "Please give us your email address." );
        valid = false;
    }

   return valid; 
   
}

function goback(){
	
history.go(-1)
	
}

function nextField(startField, destField){
	if(startField.value.length==startField.maxLength)
	destField.focus();
}

function confirmPassword(){
	if(document.forms[0].confirmpassword.value != document.forms[0].password.value){
		window.alert("Your password did not match!");
		document.forms[0].confirmpassword.focus();
		}
	}
	
function populateCity(){
	var zipSelect = document.forms[0].zipselect;
	var cityStateZip = zipSelect.options[zipSelect.selectedIndex].text;
	var city = cityStateZip.substring(0,cityStateZip.indexOf(","));
	var state = cityStateZip.substring(cityStateZip.indexOf(",") + 2,cityStateZip.indexOf(",") + 4);
	var zip = cityStateZip.substring(cityStateZip.length - 5, cityStateZip.length);
	
	document.forms[0].city.value = city;
	document.forms[0].state.value = state;
	document.forms[0].zip.value = zip;

}

function validate(){
	if(document.forms[0].username.value == ""){
		window.alert("Please provide a username.");
		return false;
		}
	if(document.forms[0].password.value == ""){
		window.alert("You must enter a password.");
		return false;
	}
	if(document.forms[0].confirmpassword.value == ""){
		window.alert("Confirm password.");
		return false;
	}
	if(document.forms[0].fname.value == ""){
		window.alert("You must enter your first name.");
		return false;
	}
	if(document.forms[0].lname.value == ""){
		window.alert("You must enter your last name.");
		return false;
	}
	if(document.forms[0].address.value == ""){
		window.alert("You must enter a street address.");
		return false;
	}
	if((document.forms[0].zipselect.selectedIndex == 0)&&((document.forms[0].city.value == "")||(document.forms[0].state.value == "")||(document.forms[0].zip.value == ""))){ 
	window.alert("You must select or enter city, state, and zip.");
		return false;
	}
	if(document.forms[0].phone.value == ""){
		window.alert("You must enter a phone number.");
		return false;
	}
	if(document.forms[0].email.value == ""){
		window.alert("You must enter a valid email address.");
		return false;
	}
	if(document.forms[0].school_email.value == ""){
		window.alert("Enter your school email address.");
		return false;
	}
	if(document.forms[0].grad_year.value == ""){
		window.alert("Enter the year of graduation.");
		return false;
	}
	if(document.forms[0].group_id.selectedIndex == 0){
		window.alert("You must select a program.");
		return false;
	}
}