function ukCoach(){
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	var Error="";
	if (trim(document.registration.fname.value)=="" || trim(document.registration.fname.value)=="First Name"){
		Error+="Please Enter First Name\n";
	}
	if (trim(document.registration.lname.value)=="" || trim(document.registration.lname.value)=="Last Name"){
		Error+="Please Enter Last Name\n";
	}	
	if (trim(document.registration.email.value)=="" || trim(document.registration.email.value)=="Email"){
		Error+="Please Enter Email Address\n";
	}
	else if (!filter.test(document.registration.email.value)){
		Error+="Invalid Email Address\n";
	}
	else if(trim(document.registration.email.value)!=trim(document.registration.cemail.value)){
		Error+="Email and Confirm Email Mismatched \n";
	}
	if (trim(document.registration.password.value)=="" || trim(document.registration.password.value)=="Create Password"){
		Error+="Please Enter Password\n";
	}
	else if (document.registration.password.value.length<8){
		Error+="Password Length must be at least 8 characters.\n";
	}
	else if(trim(document.registration.rpassword.value)!=trim(document.registration.password.value)) {
		Error+="Password and Confirm Password Mismatched \n";		
	}
	if (trim(document.registration.address.value)=="" || trim(document.registration.address.value)=="Address"){
		Error+="Please Enter Address\n";
	}
	if (trim(document.registration.town.value)=="" || trim(document.registration.town.value)=="Town"){
		Error+="Please Enter Town\n";
	}
	if (trim(document.registration.city.value)=="" || trim(document.registration.city.value)=="City"){
		Error+="Please Enter City\n";
	}
	if (trim(document.registration.pcode.value)=="" || trim(document.registration.pcode.value)=="Postal Code"){
		Error+="Please Enter Postal Code\n";
	}
	if (trim(document.registration.hphone.value)=="" || trim(document.registration.hphone.value)=="Primary Number"){
		Error+="Please Enter Home Phone Number\n";
	}
	if (trim(document.registration.mphone.value)=="" || trim(document.registration.mphone.value)=="Mobile Number"){
		Error+="Please Enter Mobile Phone Number\n";
	}	
	if (trim(document.registration.question.value)==""){
		Error+="Please Select Answer\n";
	}
	if (document.registration.question.value=="1" || document.registration.question.value=="3"){
		Error+="Invalid Answer Selected\n";
	}
	if (trim(document.registration.how_hear.value)==""){
		Error+="Please Select How Did You Hear Of Us\n";
	}
	if (trim(document.registration.how_hear.value)=="Other Source" && trim(document.registration.other_source.value)=="" ){
		Error+="Please Enter Other Source\n";
	}
	if (Error!=""){
		alert("Errors:\n\n"+Error);
		return false;
	}
}

function usCoach(){
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	var Error="";
	if (trim(document.registration.fname.value)=="" || trim(document.registration.fname.value)=="First Name"){
		Error+="Please Enter First Name\n";
	}
	if (trim(document.registration.lname.value)=="" || trim(document.registration.lname.value)=="Last Name"){
		Error+="Please Enter Last Name\n";
	}	
	if (trim(document.registration.email.value)=="" || trim(document.registration.email.value)=="Email"){
		Error+="Please Enter Email Address\n";
	}
	else if (!filter.test(document.registration.email.value)){
		Error+="Invalid Email Address\n";
	}
	else if(trim(document.registration.email.value)!=trim(document.registration.cemail.value)){
		Error+="Email and Confirm Email Mismatched \n";
	}
	/*if (trim(document.form1.password.value)==""){
		Error+="Please Enter Password\n";
	}
	else if (document.form1.password.value.length<8){
		Error+="Password Length must be at least 8 characters.\n";
	}
	else if(trim(document.form1.rpassword.value)!=trim(document.form1.password.value)) {
		Error+="Password and Confirm Password Mismatched \n";		
	}*/
	if (trim(document.registration.college.value)=="" || trim(document.registration.college.value)=="College Currently Employed At"){
		Error+="Please Enter College Name\n";
	}	
	if (trim(document.registration.address.value)=="" || trim(document.registration.address.value)=="Address"){
		Error+="Please Enter Address\n";
	}
	if (trim(document.registration.city.value)=="" || trim(document.registration.city.value)=="City"){
		Error+="Please Enter City\n";
	}
	if (trim(document.registration.state.value)==""){
		Error+="Please Select State\n";
	}
	if (trim(document.registration.zipcode.value)=="" || trim(document.registration.zipcode.value)=="Zip Code"){
		Error+="Please Enter Zip Code\n";
	}
	if (trim(document.registration.hphone.value)=="" || trim(document.registration.hphone.value)=="Primary Number"){
		Error+="Please Enter Primary Phone Number\n";
	}
	if (trim(document.registration.cphone.value)=="" || trim(document.registration.cphone.value)=="Cell Number"){
		Error+="Please Enter Cell Phone Number\n";
	}
	if (trim(document.registration.how_hear.value)==""){
		Error+="Please Select How Did You Hear Of Us\n";
	}
	if (trim(document.registration.how_hear.value)=="Other Source" && trim(document.registration.other_source.value)=="" ){
		Error+="Please Enter Other Source\n";
	}
	if (Error!=""){
		alert("Errors:\n\n"+Error);
		return false;
	}
}

function Player(){ 
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	var Error="";
	if (trim(document.registration.fname.value)=="" || trim(document.registration.fname.value)=="First Name"){
		Error+="Please Enter First Name\n";
	}
	if (trim(document.registration.lname.value)=="" || trim(document.registration.lname.value)=="Last Name"){
		Error+="Please Enter Last Name\n";
	}	
	if (trim(document.registration.email.value)=="" || trim(document.registration.email.value)=="Email"){
		Error+="Please Enter Email Address\n";
	}
	else if (!filter.test(document.registration.email.value)){
		Error+="Invalid Email Address\n";
	}
	else if(trim(document.registration.email.value)!=trim(document.registration.cemail.value)){
		Error+="Email and Confirm Email Mismatched \n";
	}
	if (trim(document.registration.gender.value)==""){
		Error+="Please Select Gender\n";
	}
	if (trim(document.registration.password.value)=="" || trim(document.registration.password.value)=="Create Password"){
		Error+="Please Enter Password\n";
	}
	else if (document.registration.password.value.length<8){
		Error+="Password Length must be at least 8 characters.\n";
	}
	else if(trim(document.registration.rpassword.value)!=trim(document.registration.password.value)) {
		Error+="Password and Confirm Password Mismatched \n";		
	}		
	if (trim(document.registration.region.value)==""){
		Error+="Please Select Region\n";
	}
	if (trim(document.registration.trial_region.value)==""){
		Error+="Please Select Trial Region\n";
	}
	if (trim(document.registration.address.value)=="" || trim(document.registration.address.value)=="Address"){
		Error+="Please Enter Address\n";
	}
	if (trim(document.registration.city.value)=="" || trim(document.registration.city.value)=="City"){
		Error+="Please Enter City\n";
	}
	if (trim(document.registration.pcode.value)=="" || trim(document.registration.pcode.value)=="Postal Code"){
		Error+="Please Enter Postal Code\n";
	}
	if (trim(document.registration.hphone.value)=="" || trim(document.registration.hphone.value)=="Home Telephone"){
		Error+="Please Enter Home Phone Number\n";
	}
	if (trim(document.registration.mphone.value)=="" || trim(document.registration.mphone.value)=="Mobile"){
		Error+="Please Enter Mobile Phone Number\n";
	}	
	if (trim(document.registration.month.value)==""){
		Error+="Please Select Birth Month\n";
	}
	if (trim(document.registration.day.value)==""){
		Error+="Please Select Birth Day\n";
	}
	if (trim(document.registration.year.value)==""){
		Error+="Please Select Birth Year\n";
	}
	if (trim(document.registration.age.value)=="" || trim(document.registration.age.value)=="How old you will be on April 1st 2012"){
		Error+="Please Enter Age\n";
	}
	else if (isNaN(trim(document.registration.age.value))){
		Error+="Age must be a number\n";
	}
	if (trim(document.registration.ft.value)==""){
		Error+="Please Select Height in Feet\n";
	}
	if (trim(document.registration.inch.value)==""){
		Error+="Please Select Height in Inch\n";
	}
	if (trim(document.registration.stone.value)==""){
		Error+="Please Select Weight in Stone\n";
	}
	if (trim(document.registration.lbs.value)==""){
		Error+="Please Select Weight in Lbs\n";
	}
	if (trim(document.registration.position1.value)==""){
		Error+="Please Select First Favorite Position\n";
	}
	if (trim(document.registration.position2.value)==""){
		Error+="Please Select Second Favorite Position\n";
	}
	if (trim(document.registration.position1.value)==trim(document.registration.position2.value)){
		Error+="Favorite Positions should be different\n";
	}
	/*if (trim(document.form1.school.value)==""){
		Error+="Please Enter School/College Attended\n";
	}*/
	if (trim(document.registration.foot.value)==""){
		Error+="Please Select Dominant Foot\n";
	}
	if (trim(document.registration.curr_status.value)==""){
		Error+="Please Select Current Status\n";
	}
	if (trim(document.registration.experience.value)=="" || trim(document.registration.experience.value)=="Level of Playing Experience"){
		Error+="Please Enter Level of Playing Experience\n";
	}
	if (trim(document.registration.how_hear.value)==""){
		Error+="Please Select How Did You Hear Of Us\n";
	}
	if (trim(document.registration.how_hear.value)=="Other Source" && trim(document.registration.other_source.value)=="" ){
		Error+="Please Enter Other Source\n";
	}
	if (Error!=""){
		alert("Errors:\n\n"+Error);
		return false;
	}
}

function Authorize(){
	var Error="";
	var re1=/^[a-zA-z\s]*[a-zA-z]$/;
	var re2=/^[a-zA-z]+$/;
	var re3=/^[0-9]+$/;
	var type=document.form1.card_type.value;
	var ccnum=document.form1.card_number.value;
	
	if (document.form1.card_number.value==""){
		Error+="Please Enter Credit Card Number\n";
	}
	
	if (document.form1.month.value==""){
		Error+="Please Select Expiry Month\n";
	}
	
	if (document.form1.year.value==""){
		Error+="Please Select Expiry Year\n";
	}
	
	if (document.form1.month.value!="" && document.form1.year.value!=""){
		today = new Date();
		var expiry_year=20+document.form1.year.value;
		expiry = new Date(expiry_year,document.form1.month.value);
		if (today.getTime() > expiry.getTime()){
			Error+="Invalid Expiry Date.\n";
		}
	}
	
	if (document.form1.security_code.value==""){
		Error+="Please Enter Credit Card Security Code\n";
	}
	
	else if (!re3.test(document.form1.security_code.value)){
		Error+="Security code can only contain numbers\n";
	}
	
	else if (document.form1.security_code.value.length<3 || document.form1.security_code.value.length>4){
		Error+="Invalid Security Code\n";
	}
	
	if (document.form1.card_number.value.length>0){
		if (type == "VisaCard") {
					var re = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/;
					if (document.form1.security_code.value.length>3){
						Error+="Must be 3 digit security code.\n";
					}
			} 
			else if (type == "MasterCard") {
					var re = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/;
					if (document.form1.security_code.value.length>3){
						Error+="Must be 3 digit security code.\n";
					}
			} 
			else if (type == "DiscoverCard") {      
					var re = /^6011-?\d{4}-?\d{4}-?\d{4}$/;
					if (document.form1.security_code.value.length>3){
						Error+="Must be 3 digit security code.\n";
					}
			} 
			else if (type == "AmExCard") {
					var re = /^3[4,7]\d{13}$/;
					if (document.form1.security_code.value.length<4){
						Error+="Must be 4 digit security code.\n";
					}
			} 
			else if (type == "DinersClubCard") {
					var re = /^3[0,6,8]\d{12}$/;
					if (document.form1.security_code.value.length>3){
						Error+="Invalid Security Code.\n";
					}
			}
			if (!re.test(ccnum)) {
						Error+="Invalid Credit Card Number.\n";
			 }
			else{
				ccnum = ccnum.split("-").join("");
				var checksum = 0;
				 for (var i=(2-(ccnum.length % 2)); i<=ccnum.length; i+=2) {
					checksum += parseInt(ccnum.charAt(i-1));
				}
	
				for (var i=(ccnum.length % 2) + 1; i<ccnum.length; i+=2){
					var digit = parseInt(ccnum.charAt(i-1)) * 2;
					if (digit < 10) 
				{ 
					checksum += digit; 
			} 
			else { 
				checksum += (digit-9); 
			}
			}
			if ((checksum % 10) != 0) {
				Error+="Invalid Credit Card Number.\n";
			}
			}
	}
	
	if (Error!=""){
		alert("Errors:\n\n"+Error);
		return false;
	}
}
function trim(str)
{
	return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}

function getPassword(){
	var Error="";
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	
	if (document.form1.email.value==""){
		Error+="Please Enter Email Address\n";
	}	
	else if (!filter.test(document.form1.email.value)){
		Error+="Invalid Email Address\n";
	}
	if (Error!=""){
		alert("Errors:\n\n"+Error);
		return false;
	}	
	
}

function changePassword(){
	var Error="";		
	if (document.form1.password1.value==""){
		Error+="Please Enter Password\n";
	}	
	else if (document.form1.password1.value.length<8){
		Error+="Password must be at least 8 characters long\n";
	}	
	else if (document.form1.password1.value!=document.form1.password2.value){
		Error+="Passwords don't match\n";
	}	
	if (Error!=""){
		alert("Errors:\n\n"+Error);
		return false;
	}		
}

function showHidePlayer (id){	
	if(document.getElementById("view"+id).style.display == 'none'){
		document.getElementById("view"+id).style.display = '';
		document.getElementById("pid"+id).innerHTML = '<a href="javascript: showHidePlayer('+id+')">Hide</a>';
	}
	else{
		document.getElementById("view"+id).style.display = 'none';
		document.getElementById("pid"+id).innerHTML = '<a href="javascript: showHidePlayer('+id+')">View</a>'
	}
}
function PopupCenter(pageURL, title,w,h) {
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
	var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
