// JavaScript Document

	<!--<![CDATA[
					
//****************************************************************************************************************************************
					
					


//****************************************************************************************************************************************					
					
					function validate()
										
					{
						
						//declaring the variables here
												
						var prefix = '', 
						    fName = '', 
							mInitial = '', 
							lName = '', 
							address = '', 
							city = '', 
							state = '', 
							zip = '', 
							phone = '', 
							sex = '', 
							dob = '', 
							shirtSize = '', 
							team = '', 
							user = '', 
							pass = '', 
						    checkPass = '',
							email = '',
							checkEmail = '';
																				
						with(window.document.myForm)
						{
							
							prefix = myPrefix.value;
							fName = myFirst.value;
							mInitial = myMiddle.value;
							lName = myLast.value;
							address = myAddress.value;
							city = myCity.value;
							state = myState.value;
							zip = myZip.value;
							phone = myPhone.value;
							sex = mySex.value;
							month = myMonth.value;
							date = myDate.value;
							year = myYear.value;
							dob = month + "/" + date + "/" + year + "/";
							shirtSize = mySize.value;
							team = myTeam.value;
							user = myUser.value;
							pass = myPass.value;
							checkPass = verifyMyPass.value;
							email = myEmail.value;
							checkEmail = verifyMyEmail.value;
						
						}
																		
						if (fName.length < 1 || trim(fName) == '' || fName == null)
						
						{
						
							alert('First Name can not be blank');
							document.myForm.myFirst.focus();
							return false;							
						}
						
						else if (lName.length < 1 || trim(lName) == '' || lName == null)
						
						{
						
							alert('Last Name can not be blank');
							document.myForm.myLast.focus();
							return false;
						
						}
						
						else if (address.length < 1 || trim(address) == '' || address == null)
						
						{
						
							alert('Address can not be blank');
							document.myForm.myAddress.focus();
							return false;
						
						}
												
						else if (city.length < 1 || trim(city) == '' || city == null)
						
						{
						
							alert('City can not be blank');
							document.myForm.myCity.focus();
							return false;
						}
						
						else if (state.length < 2 || trim(state) == '' || state == null)
						
						{
						
							alert('State can not be blank');
							document.myForm.myState.focus();
							return false;
						
						}
						
						else if (zip.length < 5 || trim(zip) == '' || zip == null)
						
						{
						
							alert('Zip Code can not be blank');
							document.myForm.myZip.focus();
							return false;
							
						}
						
						else if (phone.length < 10 || trim(phone) == '' || phone == null)
						
						{
						
							alert('Phone number can not be blank and must be 10 digits long');
							document.myForm.myPhone.focus();
							return false;
						
						}
						
						else if (sex == '')
						
						{
						
							alert('Please choose your sex')
							document.myForm.mySex.focus();
							return false;
						
						}
						
						else if (month == '')
						
						{
						
							alert('Please choose your birth month');
							document.myForm.myMonth.focus();
							return false;
						
						}
						
						else if (date == '')
						
						{
						
							alert('Please choose your birth date');
							document.myForm.myDate.focus();
							return false;
						
						}
						
						else if (year == '')
						
						{
						
							alert('Please choose your birth year');
							document.myForm.myYear.focus();
							return false;
						
						}	
						
						else if (shirtSize == '0')
						
						{
						
							alert('Please choose a shirt size');
							document.myForm.mySize.focus();
							return false;
						
						}
																								
						else if (user.length < 5 || trim(user) == '' || user == null)
						
						{
							alert('User Name must be at least 5 characters long');
							document.myForm.myUser.focus();
							return false;
						
						}
						
						else if (pass.length < 8 || trim(pass) == '' || pass == null)
						
						{
						
							alert('Password must be at least 8 characters long');
							document.myForm.myPass.focus();
							return false;
							
						}
						
						else if (!isVerified(pass, checkPass))
						
						{
							
							alert('Passwords do not match. Please ensure your password and verify password are the same and try again');
							document.myForm.verifyMyPass.focus();
							return false;
						
						}
							
																		
						else if(trim(email) == '' || email == null)
						
						{
							
							alert('Email can not be blank');
							document.myForm.myEmail.focus();
							return false;
						
						}
						
						else if (!isEmail(email))
						
						{
							alert('Email invalid');
							document.myForm.myEmail.focus();
							return false;
						
						}
						
						else if (!window.document.myForm.waiver.checked)
						
						{
							
							alert('You must agree to the Terms and Conditions in order to register.');
							document.myForm.waiver.focus();
							return false;
						}
						
						else if (!isVerified(email, checkEmail))
						
						{
						
							alert('Emails do not match. Please ensure the email address and verify your email address are the same and try again');
							document.myForm.verifyMyEmail.focus();
							return false;
						
						}
						
																	
						else if (team == 0)
						
						{
							
							
							alert('You must choose a team.');
							document.myForm.myTeam.focus();
							return false;
													
						}
																		
						else
						
						{
						
							return true;
						
						}
													
																		
					}
					
//****************************************************************************************************************************************					
					
					//since there is no trim function in JavaScript, we will create our own
					
					function trim(str)

					{
   
   						return str.replace(/^\s+|\s+$/g,'');

					}
					
//****************************************************************************************************************************************					
					
				
					//here we validate that the email format is correct
					
					function isEmail(str)
					
					{
					
						var regex = new RegExp(/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|biz|info|jobs|museum)\b/m);
						
						return regex.test(str);
					
					}

//****************************************************************************************************************************************

					//here we compare the verified input against the original input to see if they do indeed match
					
					function isVerified(initial, verified)
					
					{
						
						initial = initial.toLowerCase();
						verified = verified.toLowerCase();
						
						
						if (verified.match(initial))
						
						{
							
							return true;
						
						}
						
						else
						
						{
						
							return false;
						
						}	
					
					}



//****************************************************************************************************************************************					

					function isDigit(evt)
      				{
        
						var charCode = (evt.which) ? evt.which : event.keyCode;
         
		 				if (charCode > 31 && (charCode < 48 || charCode > 57))
						 {
         
						 	return false;
		 
		 				 }
		 
		 				else
				        {
			 
					         return true;
		 				}

					}
			//	]]>	-->
		
