var RecaptchaOptions = {
    theme : 'white'
 };
 
function validateAddPlayer()
{
	var x=document.forms["addPlayer"]["name"].value
	if (x==null || x=="")
	{
	alert("Name must be filled out");
		return false;
	}
}

function garbledEmail(code)
{
	myemail = ""
	for(i = 0; i < (code.length); i++){myemail = myemail + String.fromCharCode(code.charCodeAt(i)-1);}
	document.write(myemail);
}

function limitText(limitField, limitNum) 
{
	if (limitField.value.length > limitNum) limitField.value = limitField.value.substring(0, limitNum)
}

function validateDiary()
{
	var x=document.forms["addDiary"]["venue"].value
	if (x==null || x=="")
	{
		alert("Venue must be filled out");
		return false;
	}
}

function validateAddGB()
{
	var x=document.forms["addMessage"]["name"].value
	if (x==null || x=="")
	{
		alert("Name must be filled out");
		return false;
	}
	var y=document.forms["addMessage"]["message"].value
	if (y==null || y=="")
	{
		alert("Message must be filled out");
		return false;
	}
}

function validateAddComment()
{
	var x=document.forms["comment"]["name"].value
	if (x==null || x=="")
	{
		alert("Name must be filled out");
		return false;
	}
	var y=document.forms["comment"]["txtComment"].value
	if (y==null || y=="")
	{
		alert("Comment must be filled out");
		return false;
	}
}

function validateAddNews()
{
	var x=document.forms["addNews"]["newsTitle"].value
	if (x==null || x=="")
	{
		alert("News Title must be filled out");
		return false;
	}
	/*var y=document.forms["addNews"]["newsBody"].value
	if (y==null || y=="")
	{
		alert("News Body must be filled out");
		return false;
	}*/
}

function validateNewPassword()
{
	var x=document.forms["passwordSettings"]["password"].value
	if (x==null || x=="")
	{
		alert("Password must be filled out");
		return false;
	}
	var y=document.forms["passwordSettings"]["confirmPassword"].value
	if (y==null || y=="")
	{
		alert("Confirm Password must be filled out");
		return false;
	}
	if (x !=y)
	{
		alert("Both fields must be the same");
		return false;
	}
}

function validateNewEmail()
{
	var x=document.forms["emailSettings"]["email"].value
	if (x==null || x=="")
	{
		alert("Email must be filled out");
		return false;
	}
	var y=document.forms["emailSettings"]["confirmEmail"].value
	if (y==null || y=="")
	{
		alert("Confirm Email must be filled out");
		return false;
	}
	if (x !=y)
	{
		alert("Both fields must be the same");
		return false;
	}
}

function validateContact()
{
	var x=document.forms["sendMail"]["subject"].value
	if (x==null || x=="")
	{
		alert("Subject must be filled out");
		return false;
	}
	var y=document.forms["sendMail"]["detail"].value
	if (y==null || y=="")
	{
		alert("Detail must be filled out");
		return false;
	}
	var z=document.forms["sendMail"]["name"].value
	if (z==null || z=="")
	{
		alert("Name must be filled out");
		return false;
	}
	var a=document.forms["sendMail"]["customer_mail"].value
	if (a==null || a=="")
	{
		alert("Email must be filled out");
		return false;
	}
}

function validateGalleryComment()
{
	var x=document.forms["comment"]["commentName"].value
	if (x==null || x=="")
	{
		alert("Name must be filled out");
		return false;
	}
	var y=document.forms["comment"]["txtComment"].value
	if (y==null || y=="")
	{
		alert("Comment must be filled out");
		return false;
	}
}

function validateAddGallery()
{
	var y=document.forms["number"]["name"].value
	if (y==null || y=="")
	{
		alert("Name must be filled out");
		return false;
	}
	var x=document.forms["number"]["numFiles"].value
	if (isNaN(x) || x=="")
	{
		alert("The value for number of images to upload must be a number");
		return false;
	}
	if (x>20)
	{
		alert("The number of images to upload must be less than 20");
		return false;
	}
}

function validateExistingGallery()
{
	var x=document.forms["number"]["numFilesToAdd"].value
	if (isNaN(x) || x=="")
	{
		alert("The value for number of images to upload must be a number");
		return false;
	}
	if (x>20)
	{
		alert("The number of images to upload must be less than 20");
		return false;
	}
}

function validateNewUser()
{
	var x=document.forms["addUser"]["addUsername"].value
	if (x==null || x=="")
	{
		alert("Username must be filled out");
		return false;
	}
	var y=document.forms["addUser"]["addEmail"].value
	if (y==null || y=="")
	{
		alert("User email must be filled out");
		return false;
	}
}
/*function SelectAll(id)
{
    document.getElementById(id).focus();
    document.getElementById(id).select();
}

function setText(id,text)
{
	document.getElementById(id).value = text;
}*/
