// Mailing List Subscription Form
function checkSubscriberForm() {
if(document.getElementById('uForm').qfirstname.value=="")
{
showdialog('Please enter your first name.');
document.getElementById('uForm').qfirstname.focus();
return;
}
if(document.getElementById('uForm').qsurname.value=="")
{
showdialog('Please enter your surname.');
document.getElementById('uForm').qsurname.focus();
return;
}
if(!isEmailAddr(document.getElementById('uForm').qemail.value))
{
showdialog('Please enter a valid email address.');
document.getElementById('uForm').qemail.focus();
return;
}
if(document.getElementById('uForm').qemail.value != document.getElementById('uForm').qemail2.value)
{
showdialog('The email addresses do not match.');
document.getElementById('uForm').qemail.focus();
return;
}
if(document.getElementById('uForm').qheard.value == "Select")
{
showdialog('Please tell us how you heard about Soccer Trials USA.');
document.getElementById('uForm').qheard.focus();
return;
}
if(document.getElementById('uForm').qday1.value == "01" && document.getElementById('uForm').qmonth1.value == "01" && document.getElementById('uForm').qyear1.value == "1940")
{
showdialog('Please enter your date of birth.');
document.getElementById('uForm').qday1.focus();
return;
}
document.getElementById('uForm').submit();
}

// Mailing List Edit Form //
function checkUnsubscriberForm(){
if(!isEmailAddr(document.getElementById('uForm').qemail.value))
{
showdialog('The email address that you entered is invalid.');
document.getElementById('uForm').qemail.focus();
return;
}
if(document.getElementById('uForm').qemail.value != document.getElementById('uForm').qemail2.value)
{
showdialog('The email addresses do not match.');
document.getElementById('uForm').qemail.focus();
return;
}
document.getElementById('uForm').submit();
}

// Mailing List Quick Form //
function checkQuickForm(){
if(!isEmailAddr(document.getElementById('qForm').qemail.value))
{
showdialog('The email address that you entered is invalid.');
document.getElementById('qForm').qemail.focus();
return;
}
document.getElementById('qForm').submit();
}

// Account Login Form
function checkLoginForm(){
if(document.getElementById('uForm').qbox1.value=="")
{
showdialog('Please enter your username.');
document.getElementById('uForm').qbox1.focus();
return;
}
if(document.getElementById('uForm').qbox2.value=="")
{
showdialog('Please enter your password.');
document.getElementById('uForm').qbox2.focus();
return;
}
document.getElementById('uForm').submit();
}

// Account Edit Form
function checkAccountForm() {
if(document.getElementById('uForm').qfirstname.value=="")
{
showdialog('Please enter your first name.');
document.getElementById('uForm').qfirstname.focus();
return;
}
if(document.getElementById('uForm').qsurname.value=="")
{
showdialog('Please enter your surname.');
document.getElementById('uForm').qsurname.focus();
return;
}
if(!isEmailAddr(document.getElementById('uForm').qemail.value))
{
showdialog('Please enter a valid email address.');
document.getElementById('uForm').qemail.focus();
return;
}
if(document.getElementById('uForm').qheard.value == "Select")
{
showdialog('Please tell us how you heard about Soccer Trials USA.');
document.getElementById('uForm').qheard.focus();
return;
}
if(document.getElementById('uForm').qday1.value == "01" && document.getElementById('uForm').qmonth1.value == "01" && document.getElementById('uForm').qyear1.value == "1940")
{
showdialog('Please enter your date of birth.');
document.getElementById('uForm').qday1.focus();
return;
}
if(document.getElementById('uForm').qphone1.value=="")
{
showdialog('Please enter a contact telephone number.');
document.getElementById('uForm').qphone1.focus();
return;
}
if(document.getElementById('uForm').qadd1.value == "")
{
showdialog('Please enter the first line of your address.');
document.getElementById('uForm').qadd1.focus();
return;
}
if(document.getElementById('uForm').qtown.value == "")
{
showdialog('Please enter your town / city.');
document.getElementById('uForm').qtown.focus();
return;
}
if(document.getElementById('uForm').qcounty.value == "")
{
showdialog('Please enter your county.');
document.getElementById('uForm').qcounty.focus();
return;
}
if(document.getElementById('uForm').qcountry.value == "Select")
{
showdialog('Please select your country.');
document.getElementById('uForm').qcountry.focus();
return;
}
if(document.getElementById('uForm').qpcode.value == "")
{
showdialog('Please enter your postal / zip code.');
document.getElementById('uForm').qpcode.focus();
return;
}
document.getElementById('uForm').submit();
}

// WorldPay Form
function checkWPForm() {
document.getElementById('uForm').submit();
}

// Football Form
function checkFootballForm() {
document.getElementById('uForm').submit();
}

// Quals Form
function checkQualsForm() {
document.getElementById('uForm').submit();
}

// Social Media Form
function checkSocialForm() {
document.getElementById('uForm').submit();
}

// Thumbnail Form
function checkThumbForm() {
if(document.getElementById('tForm').qphoto.value == "")
{
showdialog('Please select the photograph.');
document.getElementById('tForm').qphoto.focus();
return;
}
showupload('Uploading your photograph.');
document.getElementById('tForm').submit();
}

// Photograph Form
function checkPhotoForm() {
if(document.getElementById('uForm').qname.value == "")
{
showdialog('Please enter a descriptive name for the photograph.');
document.getElementById('uForm').qname.focus();
return;
}
if(document.getElementById('uForm').qphoto.value == "")
{
showdialog('Please select the photograph.');
document.getElementById('uForm').qphoto.focus();
return;
}
showupload('Uploading your photograph.');
document.getElementById('uForm').submit();
}

// Registration Form
function checkRegisterForm(){
var str=stripBlanks(document.getElementById('uForm').qusername.value)
if(!isEmail(str) || str==null || str.length<6 || str.length>10)
{
showdialog('Please enter a valid username (please use alphanumeric characters only).');
return;
}
if(document.getElementById('uForm').qpassword1.value.length < 6 || document.getElementById('uForm').qpassword1.value.length >10)
{
showdialog('Passwords must be between 6-10 characters long and contain at least one number.');
document.getElementById('uForm').qpassword1.focus();
return;
}
var valid1=/(?=.+\d)/;
if(!valid1.test(document.getElementById('uForm').qpassword1.value)) 
{ 
showdialog('Passwords must be between 6-10 characters long and contain at least one number.');
return;
}
if(document.getElementById('uForm').qpassword1.value != document.getElementById('uForm').qpassword2.value)
{
showdialog('The supplied passwords do not match.');
return;
}
if(document.getElementById('uForm').qpid.value=="Select")
{
alert("Please select your registration period");
document.getElementById('uForm').qpid.focus();
return;
}
if(document.getElementById('uForm').qfirstname.value=="")
{
showdialog('Please enter your first name.');
return;
}
if(document.getElementById('uForm').qsurname.value=="")
{
showdialog('Please enter your surname.');
return;
}
if(document.getElementById('uForm').qphone1.value == "")
{
showdialog('Please enter your main telephone number.');
return;
}
if(document.getElementById('uForm').qphone3.value=="")
{
showdialog('Please enter your mobile telephone number.');
document.getElementById('uForm').qphone3.focus();
return;
}
if(document.getElementById('uForm').qday1.value == "01" && document.getElementById('uForm').qmonth1.value == "01" && document.getElementById('uForm').qyear1.value == "1940")
{
alert("Please enter your date of birth");
return;
}
if(!isEmailAddr(document.getElementById('uForm').qemail.value))
{
showdialog('The email address that you entered is invalid.');
return;
}
if(document.getElementById('uForm').qemail.value != document.getElementById('uForm').qemail2.value)
{
showdialog('The email addresses do not match.');
return;
}
if(document.getElementById('uForm').qadd1.value == "")
{
showdialog('Please enter the first line of your address.');
return;
}
if(document.getElementById('uForm').qtown.value == "")
{
showdialog('Please enter your town / city.');
return;
}
if(document.getElementById('uForm').qcounty.value == "")
{
showdialog('Please select your county.');
return;
}
if(document.getElementById('uForm').qcountry.value == "")
{
showdialog('Please select your country.');
return;
}
if(document.getElementById('uForm').qpcode.value == "")
{
showdialog('Please enter your postal / zip code.');
return;
}
if(document.getElementById('uForm').qpos1.value == "Select")
{
showdialog('Please select your preferred playing position.');
document.getElementById('uForm').qpos1.focus();
return;
}
if(document.getElementById('uForm').qpos2.value == "Select")
{
showdialog('Please select your second preferred playing position.');
document.getElementById('uForm').qpos2.focus();
return;
}
if(document.getElementById('uForm').qguardianname.value == "")
{
showdialog('Please enter the name of your parent/guardian.');
document.getElementById('uForm').qguardianname.focus();
return;
}
if(document.getElementById('uForm').qguardianemail.value == "")
{
showdialog('Please enter the email address of your parent/guardian.');
document.getElementById('uForm').qguardianemail.focus();
return;
}
if(document.getElementById('uForm').qheard.value == "Select")
{
showdialog('Please tell us how you heard about Soccer Trials USA.');
document.getElementById('uForm').qheard.focus();
return;
}
document.getElementById('uForm').submit();
}

// Checklist Form
function checkChecklistForm() {
if(document.getElementById('uForm').qstart.value == "Select")
{
showdialog('Please select your preferred start date.');
document.getElementById('uForm').qstart.focus();
return;
}
document.getElementById('uForm').submit();
}

// Agents Form
function checkAgentsForm() {
if(document.getElementById('uForm').qfirstname.value=="")
{
showdialog('Please enter your first name.');
return;
}
if(document.getElementById('uForm').qsurname.value=="")
{
showdialog('Please enter your surname.');
return;
}
if(document.getElementById('uForm').qcompany.value=="")
{
showdialog('Please enter your university/club/company.');
document.getElementById('uForm').qcompany.focus();
return;
}
if(document.getElementById('uForm').qposition.value=="")
{
showdialog('Please enter your position.');
document.getElementById('uForm').qposition.focus();
return;
}
if(document.getElementById('uForm').qphone1.value=="")
{
showdialog('Please enter your telephone number.');
document.getElementById('uForm').qphone1.focus();
return;
}
if(!isEmailAddr(document.getElementById('uForm').qemail.value))
{
showdialog('Please enter a valid email address.');
document.getElementById('uForm').qemail.focus();
return;
}
if(document.getElementById('uForm').qemail.value != document.getElementById('uForm').qemail2.value)
{
showdialog('The email addresses provided do not match.');
document.getElementById('uForm').qemail.focus();
return;
}
if(document.getElementById('uForm').qadd1.value == "")
{
showdialog('Please enter the first line of your address.');
document.getElementById('uForm').qadd1.focus();
return;
}
if(document.getElementById('uForm').qtown.value == "")
{
showdialog('Please enter your town / city.');
document.getElementById('uForm').qtown.focus();
return;
}
if(document.getElementById('uForm').qcounty.value == "")
{
showdialog('Please enter your county.');
document.getElementById('uForm').qcounty.focus();
return;
}
if(document.getElementById('uForm').qcountry.value == "")
{
showdialog('Please select your country.');
document.getElementById('uForm').qcountry.focus();
return;
}
if(document.getElementById('uForm').qpcode.value == "")
{
showdialog('Please enter your postal / zip code.');
document.getElementById('uForm').qpcode.focus();
return;
}
if(document.getElementById('uForm').qheard.value == "Select")
{
showdialog('Please tell us how you heard about Soccer Trials USA.');
document.getElementById('uForm').qheard.focus();
return;
}
document.getElementById('uForm').submit();
}

// Account Reminder Form
function checkReminderForm(){
if(!isEmailAddr(document.getElementById('uForm').qemail.value))
{
showdialog('Please enter a valid email address.');
document.getElementById('uForm').qemail.focus();
return;
}
if(document.getElementById('uForm').qemail.value != document.getElementById('uForm').qemail2.value)
{
showdialog('The email addresses provided do not match.');
document.getElementById('uForm').qemail.focus();
return;
}
document.getElementById('uForm').submit();
}

// Agents Form
function checkAgentsAccountForm() {
if(document.getElementById('uForm').qfirstname.value=="")
{
showdialog('Please enter your first name.');
return;
}
if(document.getElementById('uForm').qsurname.value=="")
{
showdialog('Please enter your surname.');
return;
}
if(document.getElementById('uForm').qcompany.value=="")
{
showdialog('Please enter your university/club/company.');
document.getElementById('uForm').qcompany.focus();
return;
}
if(document.getElementById('uForm').qposition.value=="")
{
showdialog('Please enter your position.');
document.getElementById('uForm').qposition.focus();
return;
}
if(document.getElementById('uForm').qphone1.value=="")
{
showdialog('Please enter your telephone number.');
document.getElementById('uForm').qphone1.focus();
return;
}
if(!isEmailAddr(document.getElementById('uForm').qemail.value))
{
showdialog('Please enter a valid email address.');
document.getElementById('uForm').qemail.focus();
return;
}
if(document.getElementById('uForm').qadd1.value == "")
{
showdialog('Please enter the first line of your address.');
document.getElementById('uForm').qadd1.focus();
return;
}
if(document.getElementById('uForm').qtown.value == "")
{
showdialog('Please enter your town / city.');
document.getElementById('uForm').qtown.focus();
return;
}
if(document.getElementById('uForm').qcounty.value == "")
{
showdialog('Please enter your county.');
document.getElementById('uForm').qcounty.focus();
return;
}
if(document.getElementById('uForm').qcountry.value == "")
{
showdialog('Please select your country.');
document.getElementById('uForm').qcountry.focus();
return;
}
if(document.getElementById('uForm').qpcode.value == "")
{
showdialog('Please enter your postal / zip code.');
document.getElementById('uForm').qpcode.focus();
return;
}
if(document.getElementById('uForm').qheard.value == "Select")
{
showdialog('Please tell us how you heard about Soccer Trials USA.');
document.getElementById('uForm').qheard.focus();
return;
}
document.getElementById('uForm').submit();
}

// Player Search Form
function checkSearchForm(){
document.getElementById('uForm').submit();
}

// Trials Day Form
function checkTrialsForm() {
if (document.getElementById('uForm').qbox1.value==''){
showdialog('Please enter your username.');
document.getElementById('uForm').qbox1.focus();
return;
}
if (document.getElementById('uForm').qbox2.value==''){
showdialog('Please enter your password.');
document.getElementById('uForm').qbox2.focus();
return;
}
if(document.getElementById('uForm').qpid.value == "Select")
{
showdialog('Please select your age range and position.');
document.getElementById('uForm').qpid.focus();
return;
}
document.getElementById('uForm').submit();
}

// Access Form //
function checkAccessForm(){
var str=stripBlanks(document.getElementById('uForm').qusername.value)
if(!isEmail(str) || str==null || str.length<1)
{
showdialog('Please enter a valid username.');
document.getElementById('uForm').qusername.focus();
return;
}
if(document.getElementById('uForm').qbox1.value.length < 6 || document.getElementById('uForm').qbox1.value.length >10)
{
showdialog('Passwords must be between 6-10 characters long and contain at least one number.');
document.getElementById('uForm').qbox1.focus();
return;
}
if(document.getElementById('uForm').qbox1.value != document.getElementById('uForm').qbox2.value)
{
showdialog('The supplied passwords do not match.');
document.getElementById('uForm').qbox1.focus();
return;
}
document.getElementById('uForm').submit();
}
