// JavaScript Document

//Schedule Form
function schdchk(form) {


//fields
strfield1 = document.forms[0].sdate.value 
strfield2 = document.forms[0].edate.value
strfield3 = document.forms[0].session.value

  //Start Date
    if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
    {
    alert("\"Start Date\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

  //End Date
    if (strfield2 == "" || strfield2 == null || strfield2.charAt(0) == ' ')
    {
    alert("\"End Date\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

  //Session Name
    if (strfield3 == "" || strfield3 == null || strfield3.charAt(0) == ' ')
    {
    alert("\"Session Name\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }
    return true;
}


//Special Events Form
function spchk(form) {


//fields
strfield1 = document.forms[0].uspn.value 
strfield2 = document.forms[0].uspd.value
strfield3 = document.forms[0].uspdd.value

  //Event Title
    if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
    {
    alert("\"Event Title\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

  //Event Date 
    if (strfield2 == "" || strfield2 == null || strfield2.charAt(0) == ' ')
    {
    alert("\"Event Date\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

  //Display Date
    if (strfield3 == "" || strfield3 == null || strfield3.charAt(0) == ' ')
    {
    alert("\"Display Date\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }
    return true;
}


//User Edit Form
function userchk(form) {


//fields
strfield1 = document.forms[0].uname.value 
strfield2 = document.forms[0].ufname.value
strfield3 = document.forms[0].uemail.value
strfield4 = document.forms[0].upass.value
strfield5 = document.forms[0].upassc.value

  //User Name
    if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
    {
    alert("\"User Name\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }
	
	//User Name Length
    if (strfield1.length < 6)
    {
    alert("\"User Name\" must be at least 6 characters in length.\nPlease amend and retry.")
    return false;
    }

  //First Name
    if (strfield2 == "" || strfield2 == null || strfield2.charAt(0) == ' ')
    {
    alert("\"First Name\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

  //Email
    if (strfield3 == "" || strfield3 == null || strfield3.charAt(0) == ' ')
    {
    alert("\"E-mail\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }
	
	//Pass
    if (strfield4 == "" || strfield4 == null || strfield4.charAt(0) == ' ')
    {
    alert("\"Password\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }
	
	//Pass Length
    if (strfield4.length < 8)
    {
    alert("Passwords must be at least 8 characters in length.\nPlease amend and retry.")
    return false;
    }
	
	//Confirm Pass
    if (strfield5 == "" || strfield5 == null || strfield5.charAt(0) == ' ' || strfield5 != strfield4)
    {
    alert("\"Confirm Password\" is a mandatory field and must match the \"Password\" field.\nPlease amend and retry.")
    return false;
    }
	
    return true;
}


//Program Form
function progchk(form) {


//fields
strfield1 = document.forms[0].prog.value 
strfield2 = document.forms[0].pdesc.value

  //Program Name
    if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
    {
    alert("\"Program Name\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

  //Program Description 
    if (strfield2 == "" || strfield2 == null || strfield2.charAt(0) == ' ')
    {
    alert("\"Program Description\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

}


//Provider Form
function provchk(form) {


//fields
strfield1 = document.forms[0].prov.value 

  //Provider Name
    if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
    {
    alert("\"Provider Name\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

}


//Fun Friday
function ffchk(form) {


//fields
strfield1 = document.forms[0].uffn.value 
strfield2 = document.forms[0].uffdt.value
strfield3 = document.forms[0].uffd.value

  //Event Title
    if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
    {
    alert("\"Title\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

  //Event Date 
    if (strfield2 == "" || strfield2 == null || strfield2.charAt(0) == ' ')
    {
    alert("\"Date\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

  //Display Date
    if (strfield3 == "" || strfield3 == null || strfield3.charAt(0) == ' ')
    {
    alert("\"Description\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }
    return true;
}

//E-mail Subscribe
function subchk(form) {


//fields
strfield1 = document.forms[0].email.value 
strfield2 = document.forms[0].cemail.value
strfield3 = document.forms[0].sp.value
strfield4 = document.forms[0].news.value
strfield5 = document.forms[0].ff.value
strfield6 = document.forms[0].msg.value

  //Email
    if (strfield1 == "" || strfield1 == null || !isNaN(strfield1) || strfield1.charAt(0) == ' ')
    {
    alert("\"E-mail\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }

  //C Email 
    if (strfield2 == "" || strfield2 == null || strfield2.charAt(0) == ' ')
    {
    alert("\"Confirm E-mail\" is a mandatory field.\nPlease amend and retry.")
    return false;
    }
	
  //Check E-mail
  	if (strfield1 != strfield2)
    {
    alert("E-mail addresses do not match.\nPlease amend and retry.")
    return false;
    }	

  //Subscribtion Options
    if (strfield3 == "" && strfield4 == "" && strfield5 == "" && strfield6 == "")
    {
    alert("You must choose at least one subscribtion option.\nPlease amend and retry.")
    return false;
    }
    return true;
}