// JavaScript Document
  $(document).ready(function(){
		$('#gallery_loader').hide();
				$(".job_app_error").hide();
				$("#job_app_loader").hide();
				$("#seo_review_form").hide();
				$(".temp_hide").hide();
    $('a.outlink').click(function() { window.open($(this).attr('href')); return false; });
    
	$('a.seo_review').click(function(){
									 $("#seo_review_form").fadeIn();
									 return false;
									 });
	
	$('a#seo_close_form').click(function(){
									 $("#seo_review_form").fadeOut();
									 return false;
									 });
    if($('body').hasClass('search')){
							
							$('input.qf_button').attr('src', 'img/quick_form_submit_green.gif');
	}
	
    $('#flash_intro').flash(
    		{ src: 'flash/impl_header.swf', width: 800,height: 280,  wmode: 'transparent' }, 
   		 	{ expressInstall: true });

	$('a[rel=gallery_image]').click(function(){
		
		$('#gallery_loader').show();
		
		var new_img= $(this).attr('href');
		
			$('#gallery_main_image').animate({opacity:0}, "slow", function(){
			$('#gallery_main_image').attr('src', new_img).load(function(){
			$(this).animate({opacity:1}, "slow");
			$('#gallery_loader').fadeOut();
			});
		});
		
		return false;
		});
			
			$('#types_filter').change(function(){
	
	$('#jobs_filter').submit();
	
		});
		
		

  $("#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 to send to.</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">You forgot to enter your Name</p>');
			hasError = true;
		} 
			
		if(hasError == false) {
			$("#job_app_loader").show();
			return true;
	
	
} else {


		return false;
		}
	});
	
            
 	loadGMAP();
 });
 
 function gallery(){
 	
 }
  
  
