/* function to validate form */

function submitbutton()
{ 	

	if (document.frmvelunteer_long.full_name.value == "")
	{
		alert("Please Enter your Full Name");
		document.frmvelunteer_long.full_name.focus();
		return false;
	}
	else if (document.frmvelunteer_long.email.value == "")
	{
		alert("Please Enter your Email");
		document.frmvelunteer_long.email.value=trim(document.frmvelunteer_long.email.value);
		document.frmvelunteer_long.email.focus();
		return false;
	}
	else if (!validateEmail(document.frmvelunteer_long.email.value))
	{
		alert('Please Enter Valid Email ID');
		document.frmvelunteer_long.email.value=trim(document.frmvelunteer_long.email.value);
		document.frmvelunteer_long.email.focus();
		return false;
	}
	else if (document.frmvelunteer_long.address.value == "")
	{
		alert("Please Enter your Address");
		document.frmvelunteer_long.address.value=trim(document.frmvelunteer_long.address.value);
		document.frmvelunteer_long.address.focus();
		return false;
	}	
	else if (document.frmvelunteer_long.city.value == "")
	{
		alert("Please Enter your City");
		document.frmvelunteer_long.city.value=trim(document.frmvelunteer_long.city.value);
		document.frmvelunteer_long.city.focus();
		return false;
	}
	else if (!validateCity(document.frmvelunteer_long.city.value))
	{
		alert('Please Enter Valid City');
		document.frmvelunteer_long.city.value=trim(document.frmvelunteer_long.city.value);
		document.frmvelunteer_long.city.focus();
		return false;
	}
	
	else if (document.frmvelunteer_long.state.value == "0")
	{
		alert("Please Select your State");
		document.frmvelunteer_long.state.focus();
		return false;
	}
	//document.contact_form.age.selectedIndex == 0 				
	else if (document.frmvelunteer_long.zip.value == "")
	{
		alert("Please Enter your Zipcode");
		document.frmvelunteer_long.zip.value=trim(document.frmvelunteer_long.zip.value);
		document.frmvelunteer_long.zip.focus();
		return false;
	}
	else if (!validateNumber(document.frmvelunteer_long.zip.value))
	{
		alert('Please Enter Valid Zipcode');
		document.frmvelunteer_long.zip.value=trim(document.frmvelunteer_long.zip.value);
		document.frmvelunteer_long.zip.focus();
		return false;
	}
	else if (document.frmvelunteer_long.telephone.value == "")
	{
//		alert("Please Enter Valid Telephone number (xxx xxx-xxxx).");
		alert("Please Enter Telephone number.");
		document.frmvelunteer_long.telephone.focus();
		return false;
	}
	else if (document.frmvelunteer_long.quiltpermonth.value == "" )
	{
		alert("Please Select Sign up for a set number of quilts per month");
		document.frmvelunteer_long.quiltpermonth.value=trim(document.frmvelunteer_long.quiltpermonth.value);
		document.frmvelunteer_long.quiltpermonth.focus();
		return false;
	}	
	else if (document.frmvelunteer_long.machine_experience.value == "")
	{
		alert("Please Enter your machine quilting experience");
		document.frmvelunteer_long.machine_experience.value=trim(document.frmvelunteer_long.machine_experience.value);
		document.frmvelunteer_long.machine_experience.focus();
		return false;
	}
 
}

//Radio Button Validation
// copyright Stephen Chapman, 15th Nov 2004,14th Sep 2005
// you may copy this function but please keep the copyright notice with it
function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}

function valUsNumber(string) {
     if (string.length != 12) {
        return false;
     }

     for (var i = 0; i < string.length; i++) {
            var ch = string.charAt(i);
            if (i==3 && ch != ' ') {
                return false;
            } else if (i==7 && ch != '-') {
                return false;
            } else if (i!=3 && i!=7 && !isPositiveInteger(ch)) {
                return false;
            }
      }

      return true;
}
