$(document).ready(function() {
		$('a.return').click(function() {									
		$('html,body').animate({scrollTop: $(".header").offset().top},'fast');	
		});					 
							 
		$('.popular ul li a').click(function() {
		var test = $(this).text();	
		
		$("input#s").val(test);
         $("input#go").trigger('click');
		//alert(test);
		}); 
		
		$('ul.post-menu-search li a').click(function() {
		var test = $(this).text();	
		
		$("input#s").val(test);
         $("input#go").trigger('click');
		//alert(test);
		}); 
  
        $('ul.post-menu li a, ul.post-menu-top li a,.wp-pagenavi a').live('click', function(){
		//this prevents default function e.g. disables a hyperlink	
		//e.preventDefault();
		//creates a variable which holds the href of the a tag
		var sidelink = $(this).attr('href');
		//changes the content.html to loading...
		$('.post-cont').slideUp("fast", function() {
											
		$(this).html("<div id='message'><img   src='http://lighthouseconsultants.co.uk/wp-content/themes/Lighthouse/ajax-loader.gif' alt='ajax'/></div>", 4000);				
							
		$('.post-cont').fadeIn(1000);
		//uses jquery load function to load content from the href stored from above and grabs content from specific div
		$('.post-cont').load(sidelink+' .post-cont-inner');
		//$('html,body').animate({scrollTop: $(".header-main").offset().top},'slow');				
		});
		
		});
		
		
		//$('ul.post-menu-search li a').live('click', function(e){
//		this prevents default function e.g. disables a hyperlink	
//		e.preventDefault();
//		alert("hello world");
//		creates a variable which holds the main url and basic search paremers
//		('#s').val() enables us to grab the vallue of the search box
//		var searchLink = 'http://lighthouseconsultants.co.uk/?s='+$('#s').val();
//		we reset the value of the variable and run a global string replace removing blank space and replacing it with a +
//		searchLink = searchLink.replace(/[ ]/g,'+');
//		changes the content.html to loading...
//		$('#s').val(''); 
//		
//		uses jquery load function to load content from the href stored from above and grabs content from specific div
//		$('.post-cont').load(searchLink+' .post-cont-inner');
//		slides back to the top once the a link is clicked.
//		$('html,body').animate({scrollTop: $(".post-cont").offset().top},'fast');	
//		
//	    });
		
		// Expand Panel
	    $("#open").click(function(){
		$("div#panel").slideDown("slow");
		$("div#panel-search").slideUp("slow");
	    });	
 
	
		 // Collapse Panel
	    $("#close").click(function(){
		$("div#panel").slideUp("slow");	
	    });
 
	    // Switch buttons from "Log In | Register" to "Close Panel" on click
	    $(".tab a").click(function () {
		$(".tab a").toggle();
	    });
		
		//Close on body
//		
//		$('#rap').click(function() {
//		$("div#panel-search").slideUp("slow");
//		$("div#panel").slideUp("slow");
//		
//		var search = $("#toggle-search a").text();
//		var contact = $("#toggle a").text();
//		
//		///alert(contact);
//		
//		if ( search == "advanced searchclose search" ) {
//			$("#toggle-search a").toggle();
//			
//		}
//		
//		if ( contact == "contact formclose contact form" ) {
//			$("#toggle a").toggle();
//			
//		}
//		
//		});
		
		
		$('#search-close').click(function() {
		$("#toggle-search a").toggle();
		$("div#panel-search").slideUp("slow");
		});
		
		$('#contact-close').click(function() {
		$("#toggle a").toggle();
		$("div#panel").slideUp("slow");
		});
		
	
	    // Expand Panel
	    $("#open-search").click(function(){
		$("div#panel-search").slideDown("slow");
		$("div#panel").slideUp("slow");	
	    });	
 
	    // Collapse Panel
	    $("#close-search").click(function(){
		$("div#panel-search").slideUp("slow");	
	    });		
 
	    // Switch buttons from "Log In | Register" to "Close Panel" on click
	    $("#toggle-search a").click(function () {
		$("#toggle-search a").toggle();
	    });	
	 
	}); 

function design()
{
window.open("http://www.mikeleachcreative.co.uk/");	
}
