function allowpg(){

	if (document.myform.ContactPG){
		if (document.myform.ContactPG.checked==true){
			document.myform.PGFirstName.disabled=false;
		//	alert(document.myform.PGFirstName.style.backgroundColor);
			
			document.myform.PGLastName.disabled=false;
			document.myform.PGAddress1.disabled=false;
			document.myform.PGAddress2.disabled=false;
			document.myform.PGtown.disabled=false;
			document.myform.PGPostCode.disabled=false;
			document.myform.PGMobile.disabled=false;
			document.myform.PGEmail.disabled=false;
		 
			document.myform.PGFirstName.style.backgroundColor="#ffffff";
			document.myform.PGLastName.style.backgroundColor="#ffffff";
			document.myform.PGAddress1.style.backgroundColor="#ffffff";
			document.myform.PGAddress2.style.backgroundColor="#ffffff";
			document.myform.PGtown.style.backgroundColor="#ffffff";
			document.myform.PGPostCode.style.backgroundColor="#ffffff";
			document.myform.PGMobile.style.backgroundColor="#ffffff";
			document.myform.PGEmail.style.backgroundColor="#ffffff";
			
		}else{
	
			document.myform.PGFirstName.disabled=true;
			document.myform.PGLastName.disabled=true;
			document.myform.PGAddress1.disabled=true;
			document.myform.PGAddress2.disabled=true;
			document.myform.PGtown.disabled=true;
			document.myform.PGPostCode.disabled=true;
			document.myform.PGMobile.disabled=true;
			document.myform.PGEmail.disabled=true;
		
			document.myform.PGFirstName.style.backgroundColor="#cccccc";
			document.myform.PGLastName.style.backgroundColor="#cccccc";
			document.myform.PGAddress1.style.backgroundColor="#cccccc";
			document.myform.PGAddress2.style.backgroundColor="#cccccc";
			document.myform.PGtown.style.backgroundColor="#cccccc";
			document.myform.PGPostCode.style.backgroundColor="#cccccc";
			document.myform.PGMobile.style.backgroundColor="#cccccc";
			document.myform.PGEmail.style.backgroundColor="#cccccc";
 		}
	}
}

function checkit(){ 
	 

 var mob = document.myform.Mobile.value; 
 if (mob != ""){ 
 		var mob_len  = mob.length - 1;
 		if (mob_len < 9){
 			alert('Please check mobile number, it appears to be too short'); 
 			return false; 
 		}
		var count;
		if (!mob.match(/^[0-9]+$/)){ 
 			alert('Please check mobile number, it must ONLY CONTAIN NUMBERS and NO SPACES'); 
 			return false; 
 		}
	}

if (document.myform.ContactPG){

 var mob = document.myform.PGMobile.value; 
 if (mob != ""){ 
 		var mob_len  = mob.length - 1;
 		if (mob_len < 9){
 			alert('Please check the parent / guardian mobile number, it appears to be too short'); 
 			return false; 
 		}
		var count;
		if (!mob.match(/^[0-9]+$/)){ 
 			alert('Please check the parent / guardian mobile number, it must ONLY CONTAIN NUMBERS and NO SPACES'); 
 			return false; 
 		}
	}
}

 

 
 if ( (document.myform.ContactPG) && (document.myform.PGEmail.value!="")){
	if (document.myform.PGEmail.value!=""){
		if (!document.myform.PGEmail.value.match(/^[0-9A-Za-z\.\-\_\']+\@[0-9A-Za-z\.\-]+\.[a-zA-Z]{2,4}$/)) 
		{ 
			alert("Please ensure that your Parent / Guardian email address is entered correctly"); 
			return false; 
		} 
	}


 }else{
	if (document.myform.Email.value!=""){
		if (!document.myform.Email.value.match(/^[0-9A-Za-z\.\-\_\']+\@[0-9A-Za-z\.\-]+\.[a-zA-Z]{2,4}$/)) 
		{ 
			alert("Please ensure that your email address is entered correctly"); 
			return false; 
		} 
	}
}



//if they have not entrered an email address check if they want to continue
if ( (document.myform.Email.value == "") || (document.myform.Mobile.value == "") ){
	var is_sure=window.confirm("SMS TEXT / Email Facility\n\nPlease confirm that you have entered all the correct contact details\ne.g. Contact Mobile and Contact Email\n\nPress OK to save these details or Cancel to continue editing them");
	if(is_sure!=true) 
	{
		return false;
	}
}

 
 	// ##need to open in new windows so generate window here 
	var site="blank.html"; 
  	  	mywindow=window.open(site,'thanks','height=75,width=300,left=362,top=347');



} 

//function emailwarning(){
//	if (document.myform.cosentsent.value=="nope"){
//		alert('Adding an email address will result in this person been sent an email requesting their consent to be added to your club website.');
//		document.myform.cosentsent.value="yep"; //prevents the message from being repeated
//		return false;
//	}
//}

//--> 

function checkdeleteimage()
{
	var answer = confirm("Are you sure you wish to delete this image?");
	if(answer)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function checkdeletesponsor()
{
	var answer = confirm("Are you sure you wish to delete this sponsor?");
	if(answer)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function confirmSubmitAction()
{
	var answer = confirm("You are about to change the manager.\nContinue to change manager?");
	if(answer)
	{
		document.myform.submit();
	}
}

function validateSendMail()
{
	if ((document.sendlink.yourname.value != "") && (document.sendlink.youremail.value != "") && (document.sendlink.theirname.value != "") && (document.sendlink.theiremail.value != ""))
	{
		document.sendlink.submit.disabled = false;
	}
	else
	{
		document.sendlink.submit.disabled = true;
	}
}