// www.bmxunity.com

// ----------------

// check form entries



function checkJoin() {



  if(document.join_form.j_username.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.join_form.j_username.focus();

   return false;

  } 



   if(document.join_form.j_password.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.join_form.j_password.focus();

   return false;

  } 

	

   if(document.join_form.j_name.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.join_form.j_name.focus();

   return false;

  }   

  

   if(document.join_form.j_city.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.join_form.j_city.focus();

   return false;

  }  

  

   if(document.join_form.j_email.value.indexOf('@') == -1)  {

   alert("Email-Adress is not valid. Please correct.");

   document.join_form.j_email.focus();

   return false;

  }

   

   if(document.join_form.j_name.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.join_form.j_name.focus();

   return false;

  }

  

 /* if(document.join_form.j_style[0].checked == false && 

	 document.join_form.j_style[1].checked == false && 

	 document.join_form.j_style[2].checked == false && 

	 document.join_form.j_style[3].checked == false && 

	 document.join_form.j_style[4].checked == false && 

	 document.join_form.j_style[5].checked == false ) {

   alert("You didn't specify your riding style.");

   document.join_form.j_style[0].focus();

   return false;

  }*/

  var style = document.getElementsByName("j_style[]");

  var styleLength = style.length;



  for (var i=0; i < styleLength; i++) {

  	if (style[i].checked == true) { var styleOn = 1; }

  }

  if (styleOn != 1) {

    alert ("You didn't specify your riding style.");

	return false;

  }

}

function checkJoin1() {



  if(document.join_form.j_username.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.join_form.j_username.focus();

   return false;

  } 



   if(document.join_form.j_password.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.join_form.j_password.focus();

   return false;

  } 

	

   if(document.join_form.j_name.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.join_form.j_name.focus();

   return false;

  }   

  

   if(document.join_form.j_city.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.join_form.j_city.focus();

   return false;

  }  

  

   if(document.join_form.j_email.value.indexOf('@') == -1)  {

   alert("Email-Adress is not valid. Please correct.");

   document.join_form.j_email.focus();

   return false;

  }

   

   if(document.join_form.j_name.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.join_form.j_name.focus();

   return false;

  }

  

 /* if(document.join_form.j_style[0].checked == false && 

	 document.join_form.j_style[1].checked == false && 

	 document.join_form.j_style[2].checked == false && 

	 document.join_form.j_style[3].checked == false && 

	 document.join_form.j_style[4].checked == false && 

	 document.join_form.j_style[5].checked == false ) {

   alert("You didn't specify your riding style.");

   document.join_form.j_style[0].focus();

   return false;

  }*/

}




function checkLogin() {



   if(document.login_form.u_username.value == "")  {

   alert("Please enter your username and password.");

   document.login_form.u_username.focus();

   return false;

  }

  

   if(document.login_form.u_password.value == "")  {

   alert("Please enter your username and password.");

   document.login_form.u_password.focus();

   return false;

  }



}



function checkPasswordRequest() {



   if(document.forgot_password.f_username.value == "")  {

   alert("Please enter your name and your email-address.");

   document.forgot_password.f_username.focus();

   return false;

  }

  

   if(document.forgot_password.f_email.value.indexOf('@') == -1)  {

   alert("Email-address is not valid. Please correct.");

   document.forgot_password.f_email.focus();

   return false;

  }



}



function checkUpdate() {

	

   if(document.update_form.up_name.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.update_form.up_name.focus();

   return false;

  }   

  

   if(document.update_form.up_city.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.update_form.up_city.focus();

   return false;

  }  

  

   if(document.update_form.up_email.value.indexOf('@') == -1)  {

   alert("Email-Adress is not valid. Please correct.");

   document.update_form.up_email.focus();

   return false;

  }

   

   if(document.update_form.up_name.value == "")  {

   alert("Please fill out all fields marked with a red star.");

   document.update_form.up_name.focus();

   return false;

  }

  

  /*if(document.update_form.up_style[0].checked == false && 

	 document.update_form.up_style[1].checked == false && 

	 document.update_form.up_style[2].checked == false && 

	 document.update_form.up_style[3].checked == false && 

	 document.update_form.up_style[4].checked == false && 

	 document.update_form.up_style[5].checked == false ) {

   alert("You didn't specify your riding style.");

   document.update_form.up_style[0].focus();

   return false;

  }*/

  

  var upstyle = document.getElementsByName("up_style[]");

  var upstyleLength = upstyle.length;



  for (var i=0; i < upstyleLength; i++) {

  	if (upstyle[i].checked == true) { var upstyleOn = 1; }

  }

  if (upstyleOn != 1) {

    alert ("You didn't specify your riding style.");

	return false;

  }

}