$(function(){

       $('#nav li').children('ul').hide().end();
        $('#nav li').hover(
        	function(){
        		$(this).find('> ul').stop(true, true).slideDown();
        	},
        	function(){
        		$(this).find('> ul').stop(true, true).hide();
        	}
        );
    
   
   
   $('a.zoom').fancybox({
   	'transitionIn'	: 'elastic',
   	'transitionOut'	: 'elastic'
   });
   
    var box = 'info';
	var domain = 'bramblecreative.co.uk ';
	$("#email").html('<a href="mailto:' + box + '@' + domain + '">' + box + '@' + domain + '</a>');
	
	function valid_email(email) {
	  if (email.match(/^[0-9a-z_.-]+@([0-9a-z-]+\.)+[a-z]{2,6}$/)) {
	    return true;
	  } else return false;
 	}
	
	
	
   $('#footer_contact_form').submit(function(){
   		$('#footer_contact').slideUp('normal', function(){
   			var message = $('textarea[name="message"]').val();
   			if(message =='' ){
   				$(this).slideDown('normal', function(){
   					$('#footer_contact .errors').html('<div class="error">PLease write your feedback before</div>').slideDown();
   				})
   			} else {
   				// form submitted, do AJAX
   				$.post("/open_ajax/feedback/", { message : message, spam : 2},
				   function(data) {
				     $('#footer_contact').html(data).slideDown();
				   });
   			}
   			
   			
   		});
   		return false;
   });
   
   $('#contact_form').submit(function(){
   		$('input[name="action"]').val(2);
   });
   
   
 
}); 
