   function isPhoneNumber(phone)
   {
     var pattern = /[0-9]{10}/;
     return pattern.test(phone);
   }
   function validEmail(email) {
     var invalidChars = " /:,;";
     if (email == "") {
       return false;
     }
     for (i=0; i<invalidChars.length;i++) {
      var  badChar = invalidChars.charAt(i);
       if (email.indexOf(badChar,0) > -1) {
         return false;
       }
     }
     var atPos = email.indexOf("@",1);
     if (atPos == -1) {
       return false;
     }
     if (email.indexOf("@",atPos+1) > -1) {
       return false;
     }
     var periodPos = email.indexOf(".",atPos);
     if (periodPos == -1) {
       return false;
     }
     if (periodPos+3 > email.length) {
       return false;
     }
     return true;
   }

   function onSubmitForm() {
//	     alert('test');
      if (window.document.getElementById('name').value=='') {alert("Name can't be empty"); window.document.getElementById('name').focus(); return false;}
      if (!window.document.getElementById('phone').value) {alert("Phone can't be empty"); window.document.getElementById('phone').focus(); return false;}
      var phone = window.document.getElementById('phone').value;
      if (!isPhoneNumber(phone)) {alert("Phone is not correct! Correct 1122334455");window.document.getElementById('phone').focus(); return false;}
      if (window.document.getElementById('email').value=='') {alert("Email can't be empty"); window.document.getElementById('email').focus(); return false;}
      if (!validEmail(window.document.getElementById('email').value)) {alert("Email is not correct!"); window.document.getElementById('email').focus();return false;} 
      return true;
   }

   function onSubmitForm_() {
      
      if (window.document.getElementById('namec').value=='') {alert("Name can't be empty"); window.document.getElementById('namec').focus(); return false;}
      if (!window.document.getElementById('phonec').value) {alert("Phone can't be empty"); window.document.getElementById('phonec').focus(); return false;}
      var phone = window.document.getElementById('phonec').value;
      if (!isPhoneNumber(phone)) {alert("Phone is not correct! Correct 1122334455");window.document.getElementById('phonec').focus(); return false;}
      if (window.document.getElementById('emailc').value=='') {alert("Email can't be empty"); window.document.getElementById('emailc').focus(); return false;}
      if (!validEmail(window.document.getElementById('emailc').value)) {alert("Email is not correct!"); window.document.getElementById('emailc').focus();return false;}
      var sel = window.document.getElementById('select_fighter').options[window.document.getElementById('select_fighter').selectedIndex].value;
      var inp = window.document.getElementById('yourname').value;
      if (inp=='' && sel=='new'){alert("Your Name can't be empty!");window.document.getElementById('yourname').focus(); return false;}
    
      return true;
   }


   function onSubmitFormA() {
      //$_POST[name1] && $_POST[name2] && $_POST[emaila] && $_POST[phonea]
      if (window.document.getElementById('name1').value=='') {alert("First Name can't be empty"); window.document.getElementById('name1').focus(); return false;}
      if (window.document.getElementById('name2').value=='') {alert("Last Name can't be empty"); window.document.getElementById('name2').focus(); return false;}
      if (window.document.getElementById('emaila').value=='') {alert("Email can't be empty"); window.document.getElementById('emaila').focus(); return false;}    
      if (window.document.getElementById('phonea').value=='') {alert("Phone can't be empty"); window.document.getElementById('phonea').focus(); return false;}    
      if (!validEmail(window.document.getElementById('emaila').value)) {alert("Email is not correct!"); window.document.getElementById('emaila').focus();return false;}
      return true;
   }




    /*
   function onSubmitForm() {
      if (window.document.getElementById('name').value=='') {alert("Name can't be empty"); window.document.getElementById('name').focus(); return false;}
      if (!window.document.getElementById('phone').value) {alert("Phone can't be empty"); window.document.getElementById('phone').focus(); return false;}
      var phone = window.document.getElementById('phone').value;
      if (!isPhoneNumber(phone)) {alert("Phone is not correct! Correct 1122334455");window.document.getElementById('phone').focus(); return false;}
      if (window.document.getElementById('email').value=='') {alert("Email can't be empty"); window.document.getElementById('email').focus(); return false;}
      if (!validEmail(window.document.getElementById('email').value)) {alert("Email is not correct!"); window.document.getElementById('email').focus();return false;} 
      return true;
   }

   function onSubmitForm_() {
      if (window.document.getElementById('namec').value=='') {alert("Name can't be empty"); window.document.getElementById('namec').focus(); return false;}
      if (!window.document.getElementById('phonec').value) {alert("Phone can't be empty"); window.document.getElementById('phonec').focus(); return false;}
      var phone = window.document.getElementById('phonec').value;
      if (!isPhoneNumber(phone)) {alert("Phone is not correct! Correct 1122334455");window.document.getElementById('phonec').focus(); return false;}
      if (window.document.getElementById('emailc').value=='') {alert("Email can't be empty"); window.document.getElementById('emailc').focus(); return false;}
      if (!validEmail(window.document.getElementById('emailc').value)) {alert("Email is not correct!"); window.document.getElementById('emailc').focus();return false;} 
      return true;
   }
	  */
	 function changeTrainer(str){
			switch(str){
				case 'greenville':
				  window.document.location='/greenville2.php';
				  break;
				case 'augusta':
				  window.document.location='/greenville.php';
				  break;
				case 'pelham':
				  window.document.location='/greenville3.php';
				  break;
				case 'simpsonville':
				  window.document.location='/simpsonville.php';
				  break;
				case 'boynton':
				  window.document.location='/boynton_beach_florida.php';
				  break;
				case 'highpoint':
				  window.document.location='/high_point_nc.php';
				  break;
				case 'madison':
				  window.document.location='/madison.php';
				  break;
				case 'millwaukee':
				  window.document.location='/Milwaukee.php';
				  break;
				case 'greer':
				  window.document.location='/greer.php';
				  break;
				case 'greensboro':
				  window.document.location='/greensboro.php';
				  break;
				case 'spartanburg':
				  window.document.location='/spartanburg.php';
				  break;
				case 'easley':
				  window.document.location='/easley.php';
				  break;
				case 'chattanooga':
				  window.document.location='/chattanooga.php';
				  break;
				default:
				  alert('Please select trainer');
			}
		}


