$(document).ready(function()
{

	$('#navigation li').hover(
		
		function () {
			$(this).addClass('sfhover');
			//alert("sdfsdgf");
		}, 
		function () {
			$(this).removeClass('sfhover');
		}
    );


        // Add onclick handler to checkbox w/id StandardForm
       $("#StandardForm").click(function(){
       
        // If checked
        if ($("#StandardForm").is(":checked"))
        {
            //show the hidden div
            $("#Number_standardforminfo").show("fast");
        }
        else
        {     
            //otherwise, hide it
            $("#Number_standardforminfo").hide("fast");
            $("#Number_Forms_Standard").val('');
            
        }
      });
      
       // Add onclick handler to checkbox w/id DisclosureForm
       $("#DisclosureForm").click(function(){
       
        // If checked
        if ($("#DisclosureForm").is(":checked"))
        {
            //show the hidden div
            $("#Number_disclosureformsinfo").show("fast");
        }
        else
        {     
            //otherwise, hide it
            $("#Number_disclosureformsinfo").hide("fast");
            $("#Number_Forms").val('');
        }
      });
      
// Add onclick handler to checkbox w/id ClubForm
       $("#ClubForm").click(function(){
       
        // If checked
        if ($("#ClubForm").is(":checked"))
        {
            //show the hidden div
            $("#Number_clubforminfo").show("fast");
            
        }
        else
        {     
            //otherwise, hide it
            $("#Number_clubforminfo").hide("fast");
            $("#Number_Forms_Club").val('');
        }
      });
   
       // Add onclick handler to checkbox w/id renewelform
       $("#renewelForm").click(function(){
       
        // If checked
        if ($("#renewelForm").is(":checked"))
        {
            //show the hidden div
            $("#Number_renewalforminfo").show("fast");
        }
        else
        {     
            //otherwise, hide it
            $("#Number_renewalforminfo").hide("fast");
            $("#Number_Forms_Renewel").val('');
        }
      });
      
      
          // Add onclick handler to checkbox w/id facaForm
       $("#facaForm").click(function(){
       
        // If checked
        if ($("#facaForm").is(":checked"))
        {
            //show the hidden div
            $("#Number_facaforminfo").show("fast");
            if ($("#refereeForm").is(":not(:checked)"))
            {
            	$("#clubnameinfo, #clubcwoinfo").hide("fast");
            	$("#club_name, #CWO_name").val('');
            }
        }
        else
        {     
            //otherwise, hide it
            $("#Number_facaforminfo").hide("fast");
            $("#Number_Forms_Faca").val('');
            if ($("#refereeForm").is(":not(:checked)"))
            {
            	$("#clubnameinfo, #clubcwoinfo").show("fast");
            }
        }
      });
      
        // Add onclick handler to checkbox w/id coachForm
       $("#coachForm").click(function(){
       
        // If checked
        if ($("#coachForm").is(":checked"))
        {
            //show the hidden div
            $("#Number_coachforminfo").show("fast");
        }
        else
        {     
            //otherwise, hide it
            $("#Number_coachforminfo").hide("fast");
            $("#Number_Forms_Coach").val('');            
        }
      });
      
                      // Add onclick handler to checkbox w/id refereeForm
       $("#refereeForm").click(function(){
       
        // If checked
        if ($("#refereeForm").is(":checked"))
        {
            //show the hidden div
          //  $("#Number_refereeforminfo").show("fast");
            if ($("#facaForm").is(":not(:checked)"))
            {
            	$("#clubnameinfo,#clubcwoinfo").hide("fast");
            	$("#club_name, #CWO_name").val('');
            }
        }
        else
        {     
            //otherwise, hide it
            $("#Number_refereeforminfo").hide("fast");
           // $("#Number_Forms_Referee").val(''); 
            if ($("#facaForm").is(":not(:checked)"))
            {
            	$("#clubnameinfo, #clubcwoinfo").show("fast");
            }
        }
        
        
      });
      
      //turn them on and off for fa

});

function checkPrint() {
	if(window.print) {
		window.print();
	} else {
		alert("Sorry, your browser doesn't support this method of printing.\n\nPlease use your browsers print button instead.");
	}
}



function searchFocus() {
	if (document.forms.search.searchPhrase.value == 'search our site:') {
		document.forms.search.searchPhrase.value = '';
	}
}

function branchSearchFocus() {
 	if (document.forms.search.searchPhrasehome.value == 'search the site') {
		document.forms.search.searchPhrasehome.value = '';
	}
}

<!--
// formObject javascript edition v.1.0
//
// Public Properties:
//
// versionString
// versionNumber
// getLastError
//
// Public Methods:
//
// validateEmail (email)
// validateAll (email, list of arguments to validate)
//
// Call like this:
// checkForm.validateAll(document.formName.email.value, document.formName.varName1.value, document.formName.varName2.value, etc...)

function FormObject () {
	//-----------------
	// Property init --
	//-----------------
	this.formObjversion = "formObject javascript edition v.1.0";
	this.formObjversionNum = 1.0;
	this.getLastError = 0;
	
	
	//----------------
	// Methods init --
	//----------------
	this.validateForm = validateForm; // Checks fields
	this.validateEmail = validateEmail; // Checks email address
	this.validateAll = validateAll; // Checks all fields, including email address
	this.formPass = formPass; // Method to execute if the form passes all the checks
	this.formFail = formFail; // Method to execute if the form fails the checks
	
//---------------------------------
// Define Methods for the object --
//---------------------------------


//---------------------------------//---------------------------------//---------------------------------//---------------------------------
	// Function that validates all the fields sent to it, including email address
	// The email address must be the first argument in the list
	function validateAll () {
		for (var i = 0; i < arguments.length; i++) { // Loops through all the arguments sent to the method
			if (this.validateForm(arguments[i]) == false) {;
				this.getLastError = "Please complete all the required fields"
				this.formFail(this.getLastError);
				return false;
			}
		}
		return this.validateEmail (arguments[0]);
		//return true;
	}

//---------------------------------//---------------------------------//---------------------------------//---------------------------------

	// Function to validate any number of fields. Checks for a value in passed variables.
	// Returns TRUE if email is valid and FALSE if not	
	function validateForm () {
		for (var i = 0; i < arguments.length; i++) { // Loops through all the arguments sent to the method
			if (arguments[i] == null || arguments[i] == "") { // Checks if current field is blank
				this.getLastError = "Please complete all the required fields"
				//this.formFail(this.getLastError);
				return false;
				
			}
		}
		this.getLastError = 0; // Reset the error property to 0
		//this.formPass(this.getLastError);
		return true;
	}
	
//---------------------------------//---------------------------------//---------------------------------//---------------------------------
	
	// Function to validate email address.
	// Returns TRUE if email is valid and FALSE if not
	function validateEmail (emailAddress) {
		var illegalChar = ["!","£","$","%","^","&","*","(",")","+","=","'",","] // List of illegal characters
		var illegalCharLength = illegalChar.length; // Number of illegal characters
		var emailLength = (emailAddress.length - 1); // Number of characters in email address. (-1 because charAt() works with array indexing beginning at 0 not 1)
		var atNumber = 0; // Number of "@" characters found
		var dotNumber = 0; // Number of "." characters found
		var charToCheck = 0; // Current character of email address being checked
		var illegalCharToCheck = 0; // Current array index of illegal character to check against
		
		// This section loops through the email and checks every char with '@', '.' or the 'illegalChar' array
		for (var i=0; i<= emailLength; i++) {
			charToCheck = emailAddress.charAt(i);
	
			if (charToCheck == "@") {
				atNumber++;
				if (atNumber > 1) {
					this.getLastError = "Please enter a valid email address"
					this.formFail(this.getLastError);
					return false;
				} else if (i == 0 || i == emailLength) {
					this.getLastError = "Please enter a valid email address"
					this.formFail(this.getLastError);
					return false;
				}

			} else if (charToCheck == ".") {
				dotNumber++;
				if (i == 0 || i == emailLength) {
					this.getLastError = "Please enter a valid email address"
					this.formFail(this.getLastError);
					return false;
				}
			}

			for (var n = 0; n <= illegalCharLength; n++) {
			//for (n in illegalChar) {
				illegalCharToCheck = illegalChar[n];
				if (illegalCharToCheck == charToCheck) {
					this.getLastError = "Please enter a valid email address"
					this.formFail(this.getLastError);
					return false;
				}
			}
		}

		// Finally, if everything in the above loop passes, we do a final check
		// to see that we have the right number of @s and .s
		if (atNumber == 1 && dotNumber >=1 ) { // one '@' and at least one '.'
			this.getLastError = 0; // Reset the error property to 0
			this.formPass(this.getLastError);
			return true;
		} else {
			this.getLastError = "Please enter a valid email address" 
			this.formFail(this.getLastError);
			return false;
		}
	}
	
//---------------------------------//---------------------------------//---------------------------------//---------------------------------
	
	
	// Code to execute if the form passes all the checks
	function formPass (lastError) {
		//alert("Form OK!\n\n" + lastError);
		return true;
	}

//---------------------------------//---------------------------------//---------------------------------//---------------------------------

	// Code to execute if the form fails the checks
	function formFail (lastError) {
		alert(lastError);
	}
	
	
} // END OF CLASS CODE


// Instantiate Object
checkForm = new FormObject();
	
//-->
// functiuons for tmg select fields
function toggleview(element1, view) {

   element1 = document.getElementById(element1);

   if ((element1.style.display == 'block' && view== 'hide') || (element1.style.display == '' && view == 'hide')){
      element1.style.display = 'none';
   }else if(view == 'show'){
      element1.style.display = 'block';
   }
   
   return;
}

function itemPick(){
	if (document.formecb.PackType.value=="Club pack"){
	 toggleview('PackQTYinfo', 'show'); 
	 toggleview('FormQTYinfo', 'hide');
	}else if(document.formecb.PackType.value=="Disclosure application forms only"){
	 toggleview('PackQTYinfo', 'hide'); 
	 toggleview('FormQTYinfo', 'show'); 
	}else{
	 toggleview('PackQTYinfo', 'hide');
	 toggleview('FormQTYinfo', 'hide');
	}
}

function itemPickfa(){
	if (document.formfa.PackType.value=="Club pack"){
	 toggleview('PackQTYinfo', 'show'); 
	 toggleview('FormQTYinfo', 'hide');
	}else if(document.formfa.PackType.value=="Disclosure application forms only"){
	 toggleview('PackQTYinfo', 'hide'); 
	 toggleview('FormQTYinfo', 'show'); 
	}else{
	 toggleview('PackQTYinfo', 'hide');
	 toggleview('FormQTYinfo', 'hide');
	}
}

//--------------------------
// Shows or hides a div by setting the display style
//--------------------------
function showHide(id, action) {
	if (document.getElementById) {
		document.getElementById(id).style.display = action;
	} else if (document.all) {
		document.all[id].style.display = action;
	} else if (document.layers) {
		document.layers[id].style.display = action;
	}
}


//--------------------------
// Called when the 'Show' or 'Hide' links are clicked
//--------------------------
function showPrices(action) {
	if (action == "hide") {
	
		showHide("turnon", "block");

		showHide("turnoff", "none");

		showHide("textToHide", "none");
		
	} else if (action == "show") {

		showHide("turnon", "none");

		showHide("turnoff", "block");

		showHide("textToHide", "block");
		
	}
}