function changeColors1(el,color1) {

el.style.backgroundColor= color1;      
}

function changeColors2(el,color2) {

el.style.backgroundColor= color2;      
}

function check_add_result_fields()

{
  
 var type1 = document.addResults.type.options.selectedIndex;
 var type2 = document.addResults.type.options[type1].value; 
 
 //alert(type2);
 
 var year1 = document.addResults.year.options.selectedIndex;
 var year2 = document.addResults.year.options[year1].value;
    
 if (type2 == "")
  
  {
  
  alert("Please enter a competition type.");
  return false;
  }
  
  if (year2 == "")
  
  {
  
  alert("Please enter a competition year.");
  return false;
  }
  
  var competition1 = document.addResults.competitionID.options.selectedIndex;
  var competition2 = document.addResults.competitionID.options[competition1].value;
  
  if (competition2 == "")
  
  {
  
  alert("Please enter a competition name.");
  
  return false;
  
  }
}

function check_camp_form_fields()

  {
  
  var camp_name = document.camps.name.value;
  var camp_type0 = document.camps.type[0].checked;
  var camp_type1 = document.camps.type[1].checked;
  var camp_type2 = document.camps.type[2].checked;
  var camp_city = document.camps.city.value;
  var camp_address = document.camps.address.value;
  var camp_zipcode = document.camps.zipcode.value;
  var camp_phone = document.camps.phone.value;  
  
  var state1 = document.camps.state.options.selectedIndex;
  var state2 = document.camps.state.options[state1].value;
  
  var age1 = document.camps.start_age.options.selectedIndex;
  var age2 = document.camps.start_age.options[age1].value;
  
  var age3 = document.camps.end_age.options.selectedIndex;
  var age4 = document.camps.end_age.options[age3].value;
  
   if(camp_type0 == false && camp_type1 == false && camp_type2 == false)
   
    {
    
    alert("Please enter the type of camp.")
    
    return false;
    
    }
   
   if (age2 == "")
  
    {
    
    alert("Please enter the start age range.")
    
    return false;
    
    }
    
    if (age4 == "")
  
    {
    
    alert("Please enter the end age range.")
    
    return false;
    
    }  
       
  if (camp_name == "")
  
    {
    
    alert("Please enter the name of the camp.")
    
    return false;
    
    }
   
       
    if (camp_address == "")
  
    {
    
    alert("Please enter the (location) address.")
    
    return false;
    
    }
    
    if (camp_city == "")
  
    {
    
    alert("Please enter the (location) city.")
    
    return false;
    
    }
           
    if (state2 == "")
  
    {
    
    alert("Please enter the (location) state.")
    
    return false;
    
    }
    
    if (camp_zipcode == "")
  
    {
    
    alert("Please enter the (location) zipcode.")
    
    return false;
    
    }
        
        
  }

function testLink()

  {
  
  var weblink = document.camps.website.value;
  
  if(weblink != "http://")
  
  {
  window.open(weblink);
  }
  
  }

function chkNumeric(objName,comma,period,hyphen)
{
// only allow 0-9 be entered, plus any values passed
// (can be in any order, and don't have to be comma, period, or hyphen)
// if all numbers allow commas, periods, hyphens or whatever,
// just hard code it here and take out the passed parameters
var checkOK = "0123456789" + comma + period + hyphen;
var checkStr = objName;
var allValid = true;
var decPoints = 0;
var allNum = "";

for (i = 0;  i < checkStr.value.length;  i++)
{
ch = checkStr.value.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{	
alertsay = "Please enter only these values \""
alertsay = alertsay + checkOK + "\" in this field."
alert(alertsay);
checkStr.value="";
return (false);
}
}

function check_add_athlete_form_fields()

  {
  
  var firstName = document.add_athlete.firstName.value;
  var lastName = document.add_athlete.lastName.value;
  var usagN = document.add_athlete.usag.value.length;
    
  
  var level1 = document.add_athlete.level.options.selectedIndex;
  var level2 = document.add_athlete.level.options[level1].value;
  
  var clubName1 = document.add_athlete.clubNumber.options.selectedIndex;
  var clubName2 = document.add_athlete.clubNumber.options[clubName1].value;
     
      
   if (firstName == "" || lastName == "")
  
    {
    
    alert("Please enter the athlete first and last name.")
    
    return false;
    
    }
    
    if (usagN < 6)
  
    {
    
    alert("Please enter a six digit USAG number.")
    
    return false;
    
    }  
       
  if (level2 == "")
  
    {
    
    alert("Please select a level.")
    
    return false;
    
    }
   
       
    if (clubName2 == "")
  
    {
    
    alert("Please select a club.")
    
    return false;
    
    }
        
  }
  
  
  function check_add_event_athlete_form_fields()

  {
  
  var firstName = document.add_event_athlete.firstName.value;
  var lastName = document.add_event_athlete.lastName.value;
  var usagN = document.add_event_athlete.usag.value.length;
  
  var bm1 = document.add_event_athlete.birthMonth.options.selectedIndex;
  var bm2 = document.add_event_athlete.birthMonth.options[bm1].value;
  
  var bd1 = document.add_event_athlete.birthDay.options.selectedIndex;
  var bd2 = document.add_event_athlete.birthDay.options[bd1].value;
  
  var by1 = document.add_event_athlete.birthYear.options.selectedIndex;
  var by2 = document.add_event_athlete.birthYear.options[by1].value;
  
  var program = document.add_event_athlete.program.options.selectedIndex;
  var program2 = document.add_event_athlete.program.options[program].value;        
      
   if (firstName == "" || lastName == "")
  
    {
    
    alert("Please enter the athlete first and last name.")
    
    return false;
    
    }
    
    if (usagN < 6)
  
    {
    
    alert("Please enter a six digit USAG number.")
    
    return false;
    
    }
    
    if (program2 == "")
  
    {
    
    alert("Please select a program.")
    
    return false;
    
    }
    
    if (bm2 == "" || bd2 == "" || by2 == "")
  
    {
    
    alert("Please enter the full birth date.")
    
    return false;
    
    }   
      
          
  }
  
  function check_add_event_coach_form_fields()

  {
  
  var firstName = document.add_event_coach.firstName.value;
  var lastName = document.add_event_coach.lastName.value;
  var usagN = document.add_event_coach.usag.value.length;
  var phone = document.add_event_coach.phone.value.length;
  var email = document.add_event_coach.email.value;
  
  var bm1 = document.add_event_coach.birthMonth.options.selectedIndex;
  var bm2 = document.add_event_coach.birthMonth.options[bm1].value;
  
  var bd1 = document.add_event_coach.birthDay.options.selectedIndex;
  var bd2 = document.add_event_coach.birthDay.options[bd1].value;
  
  var by1 = document.add_event_coach.birthYear.options.selectedIndex;
  var by2 = document.add_event_coach.birthYear.options[by1].value;
          
      
   if (firstName == "" || lastName == "")
  
    {
    
    alert("Please enter the athlete first and last name.")
    
    return false;
    
    }
    
    if (usagN < 6)
  
    {
    
    alert("Please enter a six digit USAG number.")
    
    return false;
    
    }
    
    if (bm2 == "" || bd2 == "" || by2 == "")
  
    {
    
    alert("Please enter the full birth date.")
    
    return false;
    
    } 
    
    if (phone < 10)
  
    {
    
    alert("Please enter the full phone number. Only use numbers.")
    
    return false;
    
    } 
    
    if (email == "")
  
    {
    
    alert("Please enter an e-mail address.")
    
    return false;
    
    }
    
         
          
  }
  
  function check_add_club_form_fields()

  {
  
  var name = document.add_club.name.value;
  var usagN = document.add_club.usag.value.length;
  var address = document.add_club.address.value;
  var city = document.add_club.city.value;
    
  var state1 = document.add_club.state.options.selectedIndex;
  var state2 = document.add_club.state.options[state1].value;
  
  var zipcode = document.add_club.zipcode.value;
           
      
   if (name == "" || usagN == "" || address == "" || city == "" || state2 == "" || zipcode == "")
  
    {
    
    alert("Please complete all required fields.")
    
    return false;
    
    }
    
    if (usagN < 6)
  
    {
    
    alert("Please enter a six digit USAG number.")
    
    return false;
    
    }
    
  }
  
  
  function check_ca_cc()

  {
  
  var athlete = document.step1.ca.value;
  
  var coach = document.step1.cc.value;           
  
  alert(athlete);
      
  if (athlete == 0)
  
    {
    
    alert("Go to Add Athlete, to add a new athlete before you proceed.")
    
    return false;
    
    }
    
    if (coach == 0)
  
    {
    
    alert("Go to Add Coach, to add a new coach before you proceed.")
    
    return false;
    
    }
    
  }
  
  
function check_tfc_form(action)

  {
  
  var name = document.tfc.clubName.value;     
  var address = document.tfc.address.value;
  var city = document.tfc.city.value;
  var state1 = document.tfc.state.options.selectedIndex;
  var state2 = document.tfc.state.options[state1].value;
  var zipcode = document.tfc.zipcode.value.length;
  var zipcode2 = document.tfc.zipcode.value;
  var contact = document.tfc.contact.value;
  var email = document.tfc.email.value;
  var phone = document.tfc.phone.value.length;
  var phone2 = document.tfc.phone.value;
  var fax = document.tfc.fax.value;
  var website = document.tfc.website.value;
       
  if (name == "" || address == "" || city == "" || state2 == "" || zipcode < 5 || phone < 10 || email == "")
  
    {
    
    alert("Please complete all required fields.")
    
    return false;
    
    }
    
    else
    
    {
    
    http.open('get', 'ajax/internal_request2.php?action='+action+'&name='+name+'&address='+address+'&city='+city+'&state='+state2+'&zipcode='+zipcode2+'&contact='+contact+'&email='+email+'&phone='+phone2+'&fax='+fax+'&website='+website);
    
  //Send request
  http.onreadystatechange = placelink2;  	
	http.send(null);
    
    }
       
  }
  
  function placelink2(){
	   
	 	  
	if(http.readyState == 4){
		var response = http.responseText;
		//alert(field_id);     	
		document.getElementById("placelink2").innerHTML = response;
	}
}

function testLink2()

  {
  
  var weblink = document.tfc.website.value;
  
  if(weblink != "http://")
  
  {
  window.open(weblink);
  }
  
  }


function check_industry_form()

  {
  
  var name = document.industry.name.value;     
  
  var address = document.industry.address.value;
  var city = document.industry.city.value;
  var state = document.industry.state.value;  
  var country1 = document.industry.country.options.selectedIndex;
  var country2 = document.industry.country.options[country1].value;
  var zipcode = document.industry.zipcode.value.length;
  var zipcode2 = document.industry.zipcode.value;
  var contact = document.industry.contact.value;
  var email = document.industry.email.value;
  var phone = document.industry.phone.value.length;
  var description = document.industry.description.value;
    
  
       
  if (name == "" || address == "" || city == "" || state == "" || zipcode < 5 || phone < 10 || email == "" || contact == "" || description == "")
  
    {
    
    alert("Please complete all required fields.")
    
    return false;
    
    }
    
           
  }
  
  
function check_industry_form2()

  {
  
  var address = document.industry.address.value;
  var city = document.industry.city.value;
  var state = document.industry.state.value;
  var country = document.industry.country.value;
  var zipcode = document.industry.zipcode.value.length;
  var contact = document.industry.contact.value;
  var email = document.industry.email.value;
  var phone = document.industry.phone.value.length;
  var description = document.industry.description.value;
    
       
  if (address == "" || city == "" || state == "" || zipcode < 5 || phone < 10 || email == "" || contact == "" || description == "" || country  == "")
  
    {
    
    alert("Please complete all required fields.")
    
    return false;
    
    }
    
           
  }
 
function check_tg()

  {
  var firstName = document.finish.firstName;
  var lastName = document.finish.lastName;
  var address = document.finish.address.value;
  var city = document.finish.city.value;
  var state = document.finish.state.value;
  var zipcode = document.finish.zipcode.value.length;
  var email = document.finish.email.value;
  var phone = document.finish.dayPhone.value.length;
  var usag = document.finish.usag.value.length;
    
       
  if (firstName == "" || lastName == "" || address == "" || city == "" || state == "" || zipcode < 5 || phone < 10 || email == "" || usag < 6)
  
    {
    
    alert("Please complete all required fields.")
    
    return false;
    
    }
    
           
  }


function check_tfc_form2(action)

  {
  
  var name = document.tfc.clubName.value;     
  var address = document.tfc.address.value;
  var city = document.tfc.city.value;
  var state1 = document.tfc.state.options.selectedIndex;
  var state2 = document.tfc.state.options[state1].value;
  var zipcode = document.tfc.zipcode.value.length;
  var zipcode2 = document.tfc.zipcode.value;
  var contact = document.tfc.contact.value;
  var email = document.tfc.email.value;
  var phone = document.tfc.phone.value.length;
  var phone2 = document.tfc.phone.value;
  var fax = document.tfc.fax.value;
  var website = document.tfc.website.value;
  var plans = document.tfc.plans.value;
  var cmn = document.tfc.cmn.value;
       
  if (plans == "" || name == "" || address == "" || city == "" || state2 == "" || zipcode < 5 || phone < 10 || email == "")
  
    {
    
    alert("Please complete all required fields.")
    
    return false;
    
    }
    
    else
    
    {
    
    http.open('get', 'ajax/internal_request2.php?action='+action+'&name='+name+'&address='+address+'&city='+city+'&state='+state2+'&zipcode='+zipcode2+'&contact='+contact+'&email='+email+'&phone='+phone2+'&fax='+fax+'&website='+website+'&plans='+plans+'&cmn='+cmn);
    
  //Send request
  http.onreadystatechange = placelink;  	
	http.send(null);
    
    }
       
  }

function check_wjo()

  {
  
    var val1 = document.wjo_form.firstName.value;
    var val2 = document.wjo_form.lastName.value;
    var val3= document.wjo_form.usag.value;
    var val4 = document.wjo_form.age.value;
    
    var val5a = document.wjo_form.birthMonth.options.selectedIndex;
    var val5b = document.wjo_form.birthMonth.options[val5a].value;
    
    var val6a = document.wjo_form.birthDay.options.selectedIndex;
    var val6b = document.wjo_form.birthDay.options[val6a].value;
    
    var val7a = document.wjo_form.birthYear.options.selectedIndex;
    var val7b = document.wjo_form.birthYear.options[val7a].value;
    
    var val8a = document.wjo_form.eastwest.options.selectedIndex;
    var val8b = document.wjo_form.eastwest.options[val8a].value;
    
    var val9a = document.wjo_form.region.options.selectedIndex;
    var val9b = document.wjo_form.region.options[val9a].value;
    
    var val10a = document.wjo_form.ageGroup.options.selectedIndex;
    var val10b = document.wjo_form.ageGroup.options[val10a].value;
    
    var val11a = document.wjo_form.ageGroupL.options.selectedIndex;
    var val11b = document.wjo_form.ageGroupL.options[val11a].value;
    
    var val12a = document.wjo_form.grade.options.selectedIndex;
    var val12b = document.wjo_form.grade.options[val12a].value;
    
    var val13 = document.wjo_form.address.value;
    var val14 = document.wjo_form.city.value;
    
    var val15a = document.wjo_form.state.options.selectedIndex;
    var val15b = document.wjo_form.state.options[val15a].value;
    
    var val16 = document.wjo_form.zipcode.value;
    
    var val17a = document.wjo_form.phone1.value.length;
    var val17b = document.wjo_form.phone2.value.length;
    var val17c = document.wjo_form.phone3.value.length;
    
    var val30 = document.wjo_form.clubname.value;
    
    var val18 = document.wjo_form.caddress.value;
    var val19 = document.wjo_form.ccity.value;
    
    var val20a = document.wjo_form.cstate.options.selectedIndex;
    var val20b = document.wjo_form.cstate.options[val20a].value;
    
    var val21 = document.wjo_form.czipcode.value;
    
    var val22a = document.wjo_form.cphone1.value.length;
    var val22b = document.wjo_form.cphone2.value.length;
    var val22c = document.wjo_form.cphone3.value.length;
    
    var val23 = document.wjo_form.coach.value;
    
    if(val1 == "" || val2 == "" || val3 == "" || val4 == "" || val5b == ""  || val6b == "" || val7b == "" || val8b == "" || val9b == "" | val10b == "" || val11b == "" || val12b == "")
    
      {
      
        alert("Please complete all required fields under Athlete Information");
        return false;
      
      }
      
      
    if(val13 == "" || val14 == "" || val15b == "" || val16 == "")
    
      {
      
        alert("Please complete your Current Address");
        return false;
      
      }
      
      
    if(val17a < 3 || val17b < 3 || val17c < 4)
    
      {
      
        alert("Please complete your Phone Number");
        return false;
      
      }
      
    if(val30 == "" || val18 == "" || val19 == "" || val20b == "" || val21 == ""  || val22a < 3 || val22b < 3 || val22c < 4 || val23 == "")
    
      {
      
        alert("Please complete all required fields under Club Information");
        return false;
      
      }
    
    if(val12b == "9th" || val12b == "10th" || val12b == "11th" || val12b == "12th")
    
      {
      
        var val24 = document.wjo_form.gpa.value;
                
        var yes = document.wjo_form.committed[0].checked;
        var no = document.wjo_form.committed[1].checked;
        
        if(val24 == "")
        
          {
          
            alert("Please enter your High School GPA");
            
            return false;
          
          }
          
        if(no == false && yes == false)
      
        {
      
          alert("Please select weather you have committed to a college or university.");
          
          return false;
        
        }
        
      }
      
    
      
    
  
  }
