// JavaScript Document
function toggle(targetId) {
	if (document.getElementById) {
	target = document.getElementById (targetId);
	if (target.style.display == "none"){target.style.display = ""; }
	else {target.style.display = "none";}}}
	
	function contact_show_date() {
	if (document.getElementById) {
	target = document.getElementById('show_date');
	target.style.display = ""; }
	}
	function contact_hide_date() {
	if (document.getElementById) {
	target = document.getElementById('show_date');
	target.style.display = "none"; }
	}
	
	function contact_show_spec() {
	if (document.getElementById) {
	target = document.getElementById('show_spec');
	target.style.display = ""; }
	}
	function contact_hide_spec() {
	if (document.getElementById) {
	target = document.getElementById('show_spec');
	target.style.display = "none"; }
	}

//function to check valid email address
function vEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;

   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      return false;
    } 
    return true; 
}

function enquiry() {

    var theMessage1 = "Please complete the following: \n-----------------------------------\n";
    var noErrors1 = theMessage1;
	
	
    // make sure field is not blank
    if (document.contactform.realname.value=="") {
    theMessage1 = theMessage1 + "\n - Your Name";
    }
	 
	 if (document.contactform.add1.value=="" ) {
    theMessage1 = theMessage1 + "\n - Your Address";
    }
	if (document.contactform.postcode.value=="") {
    theMessage1 = theMessage1 + "\n - Your Postcode";
    }
	if (document.contactform.telephone.value=="") {
    theMessage1 = theMessage1 + "\n - Your Telephone Number";
    }
	if (document.contactform.mobile.value=="") {
    theMessage1 = theMessage1 + "\n - Your Mobile";
    }
	 if (!vEmail(document.contactform.email.value)) {
    theMessage1 = theMessage1 + "\n - Your email";
    }
	if (document.contactform.occupation.value=="") {
    theMessage1 = theMessage1 + "\n - Your Occupation";
    }
	
	
	
    // If no errors, submit the form
    if (theMessage1 == noErrors1) {
    return true;

    } else {

    // If errors were found, show alert message
    alert(theMessage1);
   return false;
    }
    }
	
	
	function callme() {

    var theMessage2 = "Please complete the following: \n-----------------------------------\n";
    var noErrors2 = theMessage2;
	
    // make sure field is not blank
    if (document.cback_form.c_name.value=="") {
    theMessage2 = theMessage2 + "\n - Your Name";
    }
	
	 if (document.cback_form.c_phone.value=="") {
    theMessage2 = theMessage2 + "\n - Your telephone number";
    }
	
    // If no errors, submit the form
    if (theMessage2 == noErrors2) {
    return true;

    } else {

    // If errors were found, show alert message
    alert(theMessage2);
   return false;
    }
    }
	
	function pgp_valid() {

    var theMessage3 = "Please complete the following: \n-----------------------------------\n";
    var noErrors3 = theMessage3;

    // make sure field is not blank
	 if (document.pgp.pgpname.value=="") {
    theMessage3 = theMessage3 + "\n - Your Name";
    }
	 if (document.pgp.pgpemail.value=="") {
    theMessage3 = theMessage3 + "\n - Your Email";
    }
    if (document.pgp.pgpnumber.value=="") {
    theMessage3 = theMessage3 + "\n - Your Phonenumber";
    }
	

    // If no errors, submit the form
    if (theMessage3 == noErrors3) {
    return true;

    } else {

    // If errors were found, show alert message
    alert(theMessage3);
   return false;
    }
    }