// JavaScript Document
  $(document).ready(function(){
		
		$("#call_surname").hide();
		$(".con_layer").hide().filter(":first").show();
		var theLayers = $(".con_layer");
		
		$('#cons_menu a').click(function () {
			
			theLayers.hide().filter(this.hash).show();
				
			
			return false;
			
		});
		
				
			
			 $("#call_submit_b").click(function(){
		
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		
		$("p.error").remove();
		var surnameVal = $("#call_surname").val();
		var jobtitleVal = $("#call_job_title").val();
		var emailToVal = $("#call_email").val();
		if(emailToVal == '') {
			$("#call_email").after('<p class="error">You forgot to enter the email address to send to</p>');
			hasError = true;
		} else if(!emailReg.test(emailToVal)) {
			$("#call_email").after('<p class="error">Enter a valid email address.</p>');
			hasError = true;
		}
		
		var phoneVal = $("#call_number").val();
		if(phoneVal == '') {
			$("#call_number").after('<p class="error">You forgot to enter your telephone number</p>');
			hasError = true;
		} 
		
		var nameVal = $("#call_name").val();
		if(nameVal == '') {
			$("#call_name").after('<p class="error">You forgot to enter your Name</p>');
			hasError = true;
		} 
			
		if(hasError == false) {
			var dataString = 'call_name='+ nameVal + '&call_email=' + emailToVal + '&call_number=' + phoneVal + '&call_job_title=' + jobtitleVal + '&call_surname=' + surnameVal;  
			 $.ajax({  
 			type: "POST",  
 			url: "callback.php",  
			data: dataString,  
			 success: function(message) 
    		{ 
        		$("#call_form_space").empty(); 
        		if (message.length > 0) 
        		{ 
        			
            $('#call_form_space').html(message); 
        		} 
    		} 
				});  
				return false;
	
					} else {
			
			return false;
		}
	});
	
	
	
	 $("#contact_submit_b").click(function(){
		
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		
		$("p.error").remove();
		
		var emailToVal = $("#email").val();
		if(emailToVal == '') {
			$("#email").after('<p class="error">You forgot to enter the email address to send to</p>');
			hasError = true;
		} else if(!emailReg.test(emailToVal)) {
			$("#email").after('<p class="error">Enter a valid email address.</p>');
			hasError = true;
		}
		
		var phoneVal = $("#telephone").val();
		if(phoneVal == '') {
			$("#telephone").after('<p class="error">You forgot to enter your telephone number</p>');
			hasError = true;
		} 
		
		var nameVal = $("#firstname").val();
		if(nameVal == '') {
			$("#firstname").after('<p class="error">Please enter your First Name</p>');
			hasError = true;
		} 
		
			var nameVal = $("#surname").val();
		if(nameVal == '') {
			$("#surname").after('<p class="error">Please enter your Surname</p>');
			hasError = true;
		}
			
		if(hasError == false) {
			
			return true;
	
					} else {
			
			return false;
		}
	});

$("#job_app_submit").click(function(){
		
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		
		$("p.error").remove();
		
		var emailToVal = $("#emailTo").val();
		if(emailToVal == '') {
			$("#emailTo").after('<p class="error">You forgot to enter the email address to send to</p>');
			hasError = true;
		} else if(!emailReg.test(emailToVal)) {
			$("#emailTo").after('<p class="error">Enter a valid email address.</p>');
			hasError = true;
		}
		
		var phoneVal = $("#phonenumber").val();
		if(phoneVal == '') {
			$("#phonenumber").after('<p class="error">You forgot to enter your telephone number</p>');
			hasError = true;
		} 
		
		var nameVal = $("#name").val();
		if(nameVal == '') {
			$("#name").after('<p class="error">Please enter your Name</p>');
			hasError = true;
		} 
		
			
		if(hasError == false) {
			
			return true;
	
					} else {
			
			return false;
		}
	});
  

		loadGMAP();
		
 });
  
  
  

