
function emailvalidation(entered, alertbox)
{
// E-mail Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
apos=value.indexOf("@"); 
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
}


function digitvalidation(entered, min, max, alertbox, datatype)
{
// Digit Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
{smalldatatype=datatype.toLowerCase();
if (smalldatatype.charAt(0)=="i") 
{checkvalue=parseInt(value); if (value.indexOf(".")!=-1) {checkvalue=checkvalue+1}};
}
if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function validateCheckBox(chk, alertbox){

  if (chk.checked == true)
  {
	return true;
  }
  else
  {
    alert(alertbox)
   return false;
  }
}

	
function emptyvalidation(entered, alertbox)
{
// Emptyfield Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}



function EmailFormvalidation(_thisform)
{
	with (_thisform)
	{
		if (emptyvalidation(Name,"Please fill in your name")==false) {Name.focus(); return false;};
		if (emptyvalidation(Email,"Please fill in your email")==false) {Email.focus(); return false;};	
	}
}


function validateTextArea(txt,alertbox)
{
	
	if(txt.value.length>0)
	{
		return true;
	}
	else
	{
		alert(alertbox)
   		return false;
	}
	
}




function validateDropDown(entered, alertbox)
{
	with (entered)
	{
		if (value==null || value=="")
			{if (alertbox!="") {alert(alertbox);} return false;}
		else {return true;}
	}
}


function alphanumeric(alphane,alertbox)
{
	var numaric = alphane.value;
	for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || (hh == 32))
		  {
		  }
		else	{
			 alert(alertbox)
			 return false;
		  }
		}
 return true;

}



function formvalidationbballteam(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form

	
	with (thisform)
	{

		if (emptyvalidation(team_name,"Please fill the Team's Name")==false) {team_name.focus(); return false;};
	
		if (emptyvalidation(cap_fname,"Please fill in captain's first name")==false) {cap_fname.focus(); return false;};
		if (emptyvalidation(cap_lname,"Please fill in captain's last name")==false) {cap_lname.focus(); return false;};
		if (emptyvalidation(cap_age,"Please fill in captain's age")==false) {cap_age.focus(); return false;};
		if (emailvalidation(cap_email,"Please enter a valid email address for the captain")==false) {cap_email.focus(); return false;};
		if (emptyvalidation(cap_cell,"Please fill in captain's cell number")==false) {cap_cell.focus(); return false;};
		if (validateDropDown(cap_skills,"Please fill in captain's skill level")==false) {cap_skills.focus(); return false;};
	
		if (emptyvalidation(two_fname,"Please fill in 2nd player's first name")==false) {two_fname.focus(); return false;};
		if (emptyvalidation(two_lname,"Please fill in 2nd player's last name")==false) {two_lname.focus(); return false;};
		if (emptyvalidation(two_age,"Please fill in 2nd player's age")==false) {two_age.focus(); return false;};
		if (emailvalidation(two_email,"Please enter a valid email address for the 2nd player")==false) {two_email.focus(); return false;};
		if (emptyvalidation(two_cell,"Please fill in 2nd player's cell number")==false) {two_cell.focus(); return false;};
		if (validateDropDown(two_skills,"Please fill in 2nd player''s skill level")==false) {two_skills.focus(); return false;};

		if (emptyvalidation(three_fname,"Please fill in 3rd player's first name")==false) {three_fname.focus(); return false;};
		if (emptyvalidation(three_lname,"Please fill in 3rd player's last name")==false) {three_lname.focus(); return false;};
		if (emptyvalidation(three_age,"Please fill in 3rd player's age")==false) {three_age.focus(); return false;};
		if (emailvalidation(three_email,"Please enter a valid email address for the 3rd player")==false) {three_email.focus(); return false;};
		if (emptyvalidation(three_cell,"Please fill in 3rd player's cell number")==false) {three_cell.focus(); return false;};
		if (validateDropDown(three_skills,"Please fill in 3rd player''s skill level")==false) {three_skills.focus(); return false;};

		if (emptyvalidation(four_fname,"")==true) {			
			if (emptyvalidation(four_lname,"Please fill in 4th player's last name")==false) {four_lname.focus(); return false;};
			if (emptyvalidation(four_age,"Please fill in 4th player's age")==false) {four_age.focus(); return false;};
			if (emailvalidation(four_email,"Please enter a valid email address for the 4th player")==false) {four_email.focus(); return false;};
			if (emptyvalidation(four_cell,"Please fill in 4th player's cell number")==false) {four_cell.focus(); return false;};
			if (validateDropDown(four_skills,"Please fill in 4th player''s skill level")==false) {four_skills.focus(); return false;};
		}

	}
	
	
}


function formvalidationbballsingle(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form

	
	with (thisform)
	{
	
		if (emptyvalidation(fname,"Please fill in your first name")==false) {fname.focus(); return false;};

		if (emptyvalidation(lname,"Please fill in your last name")==false) {lname.focus(); return false;};

		if (emptyvalidation(age,"Please fill in your age")==false) {age.focus(); return false;};
		
		if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
		
		if (emptyvalidation(cell,"Please fill in your cell number")==false) {cell.focus(); return false;};
		
		if (validateDropDown(skills,"Please fill in your skill level")==false) {skills.focus(); return false;};
	}
	
	
}



function formvalidationvballteam(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form

	
	with (thisform)
	{

		if (emptyvalidation(team_name,"Please fill the Team's Name")==false) {team_name.focus(); return false;};
	
		if (emptyvalidation(cap_fname,"Please fill in captain's first name")==false) {cap_fname.focus(); return false;};
		if (emptyvalidation(cap_lname,"Please fill in captain's last name")==false) {cap_lname.focus(); return false;};
		if (emptyvalidation(cap_age,"Please fill in captain's age")==false) {cap_age.focus(); return false;};
		if (emailvalidation(cap_email,"Please enter a valid email address for the captain")==false) {cap_email.focus(); return false;};
		if (emptyvalidation(cap_cell,"Please fill in captain's cell number")==false) {cap_cell.focus(); return false;};
		if (validateDropDown(cap_skills,"Please fill in captain's skill level")==false) {cap_skills.focus(); return false;};
	
		if (emptyvalidation(two_fname,"Please fill in 2nd player's first name")==false) {two_fname.focus(); return false;};
		if (emptyvalidation(two_lname,"Please fill in 2nd player's last name")==false) {two_lname.focus(); return false;};
		if (emptyvalidation(two_age,"Please fill in 2nd player's age")==false) {two_age.focus(); return false;};
		if (emailvalidation(two_email,"Please enter a valid email address for the 2nd player")==false) {two_email.focus(); return false;};
		if (emptyvalidation(two_cell,"Please fill in 2nd player's cell number")==false) {two_cell.focus(); return false;};
		if (validateDropDown(two_skills,"Please fill in 2nd player''s skill level")==false) {two_skills.focus(); return false;};

		if (emptyvalidation(three_fname,"Please fill in 3rd player's first name")==false) {three_fname.focus(); return false;};
		if (emptyvalidation(three_lname,"Please fill in 3rd player's last name")==false) {three_lname.focus(); return false;};
		if (emptyvalidation(three_age,"Please fill in 3rd player's age")==false) {three_age.focus(); return false;};
		if (emailvalidation(three_email,"Please enter a valid email address for the 3rd player")==false) {three_email.focus(); return false;};
		if (emptyvalidation(three_cell,"Please fill in 3rd player's cell number")==false) {three_cell.focus(); return false;};
		if (validateDropDown(three_skills,"Please fill in 3rd player''s skill level")==false) {three_skills.focus(); return false;};

		if (emptyvalidation(four_fname,"Please fill in 4th player's first name")==false) {four_fname.focus(); return false;};
		if (emptyvalidation(four_lname,"Please fill in 4th player's last name")==false) {four_lname.focus(); return false;};
		if (emptyvalidation(four_age,"Please fill in 4th player's age")==false) {four_age.focus(); return false;};
		if (emailvalidation(four_email,"Please enter a valid email address for the 4th player")==false) {four_email.focus(); return false;};
		if (emptyvalidation(four_cell,"Please fill in 4th player's cell number")==false) {four_cell.focus(); return false;};
		if (validateDropDown(four_skills,"Please fill in 4th player''s skill level")==false) {four_skills.focus(); return false;};

		if (emptyvalidation(five_fname,"Please fill in 5th player's first name")==false) {five_fname.focus(); return false;};
		if (emptyvalidation(five_lname,"Please fill in 5th player's last name")==false) {five_lname.focus(); return false;};
		if (emptyvalidation(five_age,"Please fill in 5th player's age")==false) {five_age.focus(); return false;};
		if (emailvalidation(five_email,"Please enter a valid email address for the 5th player")==false) {five_email.focus(); return false;};
		if (emptyvalidation(five_cell,"Please fill in 5th player's cell number")==false) {five_cell.focus(); return false;};
		if (validateDropDown(five_skills,"Please fill in 5th player''s skill level")==false) {five_skills.focus(); return false;};

		if (emptyvalidation(six_fname,"")==true) {			
			if (emptyvalidation(six_lname,"Please fill in 6th player's last name")==false) {six_lname.focus(); return false;};
			if (emptyvalidation(six_age,"Please fill in 6th player's age")==false) {six_age.focus(); return false;};
			if (emailvalidation(six_email,"Please enter a valid email address for the 6th player")==false) {six_email.focus(); return false;};
			if (emptyvalidation(six_cell,"Please fill in 6th player's cell number")==false) {six_cell.focus(); return false;};
			if (validateDropDown(six_skills,"Please fill in 6th player''s skill level")==false) {six_skills.focus(); return false;};
		}
		
		if (emptyvalidation(seven_fname,"")==true) {			
			if (emptyvalidation(seven_lname,"Please fill in 7th player's last name")==false) {seven_lname.focus(); return false;};
			if (emptyvalidation(seven_age,"Please fill in 7th player's age")==false) {seven_age.focus(); return false;};
			if (emailvalidation(seven_email,"Please enter a valid email address for the 7th player")==false) {seven_email.focus(); return false;};
			if (emptyvalidation(seven_cell,"Please fill in 7th player's cell number")==false) {seven_cell.focus(); return false;};
			if (validateDropDown(seven_skills,"Please fill in 7th player''s skill level")==false) {seven_skills.focus(); return false;};
		}
	}
	
	
}



function formvalidationvballsingles(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form

	
	with (thisform)
	{
	
		if (emptyvalidation(fname,"Please fill in your first name")==false) {fname.focus(); return false;};

		if (emptyvalidation(lname,"Please fill in your last name")==false) {lname.focus(); return false;};

		if (emptyvalidation(age,"Please fill in your age")==false) {age.focus(); return false;};
		
		if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
		
		if (emptyvalidation(cell,"Please fill in your cell number")==false) {cell.focus(); return false;};
		
		if (validateDropDown(skills,"Please fill in your skill level")==false) {skills.focus(); return false;};
	}
}


function formvalidationcarrom(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form

	
	with (thisform)
	{

	
		if (emptyvalidation(cap_fname,"Please fill in your first name")==false) {cap_fname.focus(); return false;};
		if (emptyvalidation(cap_lname,"Please fill in your  last name")==false) {cap_lname.focus(); return false;};
		if (emptyvalidation(cap_age,"Please fill in your  age")==false) {cap_age.focus(); return false;};
		if (emailvalidation(cap_email,"Please enter a valid email address")==false) {cap_email.focus(); return false;};
		if (emptyvalidation(cap_cell,"Please fill in your  cell number")==false) {cap_cell.focus(); return false;};
	
		if (emptyvalidation(two_fname,"")==true) {			
			if (emptyvalidation(two_lname,"Please fill in 2nd player's last name")==false) {two_lname.focus(); return false;};
			if (emptyvalidation(two_age,"Please fill in 2nd player's age")==false) {two_age.focus(); return false;};
			if (emailvalidation(two_email,"Please enter a valid email address for the 2nd player")==false) {two_email.focus(); return false;};
			if (emptyvalidation(two_cell,"Please fill in 2nd player's cell number")==false) {two_cell.focus(); return false;};
		}

	}
	
	
}



function formvalidationcricketteam(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form

	
	with (thisform)
	{

		if (emptyvalidation(team_name,"Please fill the Team's Name")==false) {team_name.focus(); return false;};
	
		if (emptyvalidation(cap_fname,"Please fill in captain's first name")==false) {cap_fname.focus(); return false;};
		if (emptyvalidation(cap_lname,"Please fill in captain's last name")==false) {cap_lname.focus(); return false;};
		if (emptyvalidation(cap_age,"Please fill in captain's age")==false) {cap_age.focus(); return false;};
		if (emailvalidation(cap_email,"Please enter a valid email address for the captain")==false) {cap_email.focus(); return false;};
		if (emptyvalidation(cap_cell,"Please fill in captain's cell number")==false) {cap_cell.focus(); return false;};
		if (validateDropDown(cap_skills,"Please fill in captain's skill level")==false) {cap_skills.focus(); return false;};
	
		if (emptyvalidation(two_fname,"Please fill in 2nd player's first name")==false) {two_fname.focus(); return false;};
		if (emptyvalidation(two_lname,"Please fill in 2nd player's last name")==false) {two_lname.focus(); return false;};
		if (emptyvalidation(two_age,"Please fill in 2nd player's age")==false) {two_age.focus(); return false;};
		if (emailvalidation(two_email,"Please enter a valid email address for the 2nd player")==false) {two_email.focus(); return false;};
		if (emptyvalidation(two_cell,"Please fill in 2nd player's cell number")==false) {two_cell.focus(); return false;};
		if (validateDropDown(two_skills,"Please fill in 2nd player''s skill level")==false) {two_skills.focus(); return false;};

		if (emptyvalidation(three_fname,"Please fill in 3rd player's first name")==false) {three_fname.focus(); return false;};
		if (emptyvalidation(three_lname,"Please fill in 3rd player's last name")==false) {three_lname.focus(); return false;};
		if (emptyvalidation(three_age,"Please fill in 3rd player's age")==false) {three_age.focus(); return false;};
		if (emailvalidation(three_email,"Please enter a valid email address for the 3rd player")==false) {three_email.focus(); return false;};
		if (emptyvalidation(three_cell,"Please fill in 3rd player's cell number")==false) {three_cell.focus(); return false;};
		if (validateDropDown(three_skills,"Please fill in 3rd player''s skill level")==false) {three_skills.focus(); return false;};

		if (emptyvalidation(four_fname,"Please fill in 4th player's first name")==false) {four_fname.focus(); return false;};
		if (emptyvalidation(four_lname,"Please fill in 4th player's last name")==false) {four_lname.focus(); return false;};
		if (emptyvalidation(four_age,"Please fill in 4th player's age")==false) {four_age.focus(); return false;};
		if (emailvalidation(four_email,"Please enter a valid email address for the 4th player")==false) {four_email.focus(); return false;};
		if (emptyvalidation(four_cell,"Please fill in 4th player's cell number")==false) {four_cell.focus(); return false;};
		if (validateDropDown(four_skills,"Please fill in 4th player''s skill level")==false) {four_skills.focus(); return false;};

		if (emptyvalidation(five_fname,"Please fill in 5th player's first name")==false) {five_fname.focus(); return false;};
		if (emptyvalidation(five_lname,"Please fill in 5th player's last name")==false) {five_lname.focus(); return false;};
		if (emptyvalidation(five_age,"Please fill in 5th player's age")==false) {five_age.focus(); return false;};
		if (emailvalidation(five_email,"Please enter a valid email address for the 5th player")==false) {five_email.focus(); return false;};
		if (emptyvalidation(five_cell,"Please fill in 5th player's cell number")==false) {five_cell.focus(); return false;};
		if (validateDropDown(five_skills,"Please fill in 5th player''s skill level")==false) {five_skills.focus(); return false;};

		if (emptyvalidation(six_lname,"Please fill in 6th player's last name")==false) {six_lname.focus(); return false;};
		if (emptyvalidation(six_age,"Please fill in 6th player's age")==false) {six_age.focus(); return false;};
		if (emailvalidation(six_email,"Please enter a valid email address for the 6th player")==false) {six_email.focus(); return false;};
		if (emptyvalidation(six_cell,"Please fill in 6th player's cell number")==false) {six_cell.focus(); return false;};
		if (validateDropDown(six_skills,"Please fill in 6th player''s skill level")==false) {six_skills.focus(); return false;};
	
		if (emptyvalidation(seven_lname,"Please fill in 7th player's last name")==false) {seven_lname.focus(); return false;};
		if (emptyvalidation(seven_age,"Please fill in 7th player's age")==false) {seven_age.focus(); return false;};
		if (emailvalidation(seven_email,"Please enter a valid email address for the 7th player")==false) {seven_email.focus(); return false;};
		if (emptyvalidation(seven_cell,"Please fill in 7th player's cell number")==false) {seven_cell.focus(); return false;};
		if (validateDropDown(seven_skills,"Please fill in 7th player''s skill level")==false) {seven_skills.focus(); return false;};

		if (emptyvalidation(eight_lname,"Please fill in 8th player's last name")==false) {eight_lname.focus(); return false;};
		if (emptyvalidation(eight_age,"Please fill in 8th player's age")==false) {eight_age.focus(); return false;};
		if (emailvalidation(eight_email,"Please enter a valid email address for the 8th player")==false) {eight_email.focus(); return false;};
		if (emptyvalidation(eight_cell,"Please fill in 8th player's cell number")==false) {eight_cell.focus(); return false;};
		if (validateDropDown(eight_skills,"Please fill in 8th player''s skill level")==false) {eight_skills.focus(); return false;};

		if (emptyvalidation(nine_lname,"Please fill in 9th player's last name")==false) {nine_lname.focus(); return false;};
		if (emptyvalidation(nine_age,"Please fill in 9th player's age")==false) {nine_age.focus(); return false;};
		if (emailvalidation(nine_email,"Please enter a valid email address for the 9th player")==false) {nine_email.focus(); return false;};
		if (emptyvalidation(nine_cell,"Please fill in 9th player's cell number")==false) {nine_cell.focus(); return false;};
		if (validateDropDown(nine_skills,"Please fill in 9th player''s skill level")==false) {nine_skills.focus(); return false;};

		if (emptyvalidation(ten_lname,"Please fill in 10th player's last name")==false) {ten_lname.focus(); return false;};
		if (emptyvalidation(ten_age,"Please fill in 10th player's age")==false) {ten_age.focus(); return false;};
		if (emailvalidation(ten_email,"Please enter a valid email address for the 10th player")==false) {ten_email.focus(); return false;};
		if (emptyvalidation(ten_cell,"Please fill in 10th player's cell number")==false) {ten_cell.focus(); return false;};
		if (validateDropDown(ten_skills,"Please fill in 10th player''s skill level")==false) {ten_skills.focus(); return false;};

		if (emptyvalidation(eleven_lname,"Please fill in 11th player's last name")==false) {eleven_lname.focus(); return false;};
		if (emptyvalidation(eleven_age,"Please fill in 11th player's age")==false) {eleven_age.focus(); return false;};
		if (emailvalidation(eleven_email,"Please enter a valid email address for the 11th player")==false) {eleven_email.focus(); return false;};
		if (emptyvalidation(eleven_cell,"Please fill in 11th player's cell number")==false) {eleven_cell.focus(); return false;};
		if (validateDropDown(eleven_skills,"Please fill in 11th player''s skill level")==false) {eleven_skills.focus(); return false;};

		if (emptyvalidation(twelve_fname,"")==true) {			
			if (emptyvalidation(twelve_lname,"Please fill in 12th player's last name")==false) {twelve_lname.focus(); return false;};
			if (emptyvalidation(twelve_age,"Please fill in 12th player's age")==false) {twelve_age.focus(); return false;};
			if (emailvalidation(twelve_email,"Please enter a valid email address for the 12th player")==false) {twelve_email.focus(); return false;};
			if (emptyvalidation(twelve_cell,"Please fill in 12th player's cell number")==false) {twelve_cell.focus(); return false;};
			if (validateDropDown(twelve_skills,"Please fill in 12th player''s skill level")==false) {twelve_skills.focus(); return false;};
		}

		if (emptyvalidation(thirteen_fname,"")==true) {			
			if (emptyvalidation(thirteen_lname,"Please fill in 13th player's last name")==false) {thirteen_lname.focus(); return false;};
			if (emptyvalidation(thirteen_age,"Please fill in 13th player's age")==false) {thirteen_age.focus(); return false;};
			if (emailvalidation(thirteen_email,"Please enter a valid email address for the 13th player")==false) {thirteen_email.focus(); return false;};
			if (emptyvalidation(thirteen_cell,"Please fill in 13th player's cell number")==false) {thirteen_cell.focus(); return false;};
			if (validateDropDown(thirteen_skills,"Please fill in 13th player''s skill level")==false) {thirteen_skills.focus(); return false;};
		}

		if (emptyvalidation(fourteen_fname,"")==true) {			
			if (emptyvalidation(fourteen_lname,"Please fill in 14th player's last name")==false) {fourteen_lname.focus(); return false;};
			if (emptyvalidation(fourteen_age,"Please fill in 14th player's age")==false) {fourteen_age.focus(); return false;};
			if (emailvalidation(fourteen_email,"Please enter a valid email address for the 14th player")==false) {fourteen_email.focus(); return false;};
			if (emptyvalidation(fourteen_cell,"Please fill in 14th player's cell number")==false) {fourteen_cell.focus(); return false;};
			if (validateDropDown(fourteen_skills,"Please fill in 14th player''s skill level")==false) {fourteen_skills.focus(); return false;};
		}
		
	}
	
	
}


function formvalidationcricketsingles(thisform)
{
// This function checks the entire form before it is submitted
// Note: This function needs to be customized to fit your form

	
	with (thisform)
	{
	
		if (emptyvalidation(fname,"Please fill in your first name")==false) {fname.focus(); return false;};

		if (emptyvalidation(lname,"Please fill in your last name")==false) {lname.focus(); return false;};

		if (emptyvalidation(age,"Please fill in your age")==false) {age.focus(); return false;};
		
		if (emailvalidation(email,"Please enter a valid email address")==false) {email.focus(); return false;};
		
		if (emptyvalidation(cell,"Please fill in your cell number")==false) {cell.focus(); return false;};
		
		if (validateDropDown(skills,"Please fill in your skill level")==false) {skills.focus(); return false;};
	}
}


