$(function (){

	// search form	
	$(":input", "#searchform").not(':submit').focus(function(){
		$(this).css('color', '#666666').css('border-color', '#666666');
		if ($(this).val() == $(this).attr('title')) $(this).val('');
	});
	$(":input", "#searchform").not(':submit').blur(function(){
		if ($(this).val() == '') $(this).val($(this).attr('title'));
		$(this).animate({ color: "#CCCCCC" }, { queue: false, duration: 200 }).animate({ borderColor: "#CCCCCC" }, 200);
	});
	
	// initialise superfish menu on main nav
	$('header nav ul.menu').superfish();
	
	// add white marker image to the top of any ul.listings list elements
	
	$('<img src="images/components/white.png" class="marker" width="28" height="12" alt="[]" />').prependTo("ul.listings li");
	
	
	// main nav animated hover effect
	
	$("header nav li").not(".current-menu-item, .current-page-ancestor, .selected").find("a").mouseover(function() {
//		$(this).stop().animate({borderRight:'155px'},{queue:false, duration:600, easing: 'easeOutBounce'})
		$(this).stop().animate({width:'280px'},{queue:false, duration:600, easing: 'easeOutBounce'})
	});
	$("header nav li").not(".current-menu-item, .current-page-ancestor, .selected").find("a").mouseout(function() {
//		$(this).stop().animate({borderRight:'28px'},{queue:false, duration:600, easing: 'easeOutBounce'})
		$(this).stop().animate({width:'153px'},{queue:false, duration:600, easing: 'easeOutBounce'})
	});
	
	// General subnav hover effect
	$(".subnav nav li").not(".current-menu-item, .selected").find("a").mouseover(function() {
		$(this).stop().animate({width:'280px'},{queue:false, duration:300, easing: 'easeOutBounce'})
	});
	$(".subnav nav li").not(".current-menu-item, .selected").find("a").mouseout(function() {
		$(this).stop().animate({width:'252px'},{queue:false, duration:300, easing: 'easeOutBounce'})
	});
	
	// Our Team subnav hover effect
	$("#team .subnav nav li").not(".selected").find("a").mouseover(function() {
		$(this).stop().animate({width:'262px'},{queue:false, duration:400, easing: 'easeOutBounce'})
	});
	$("#team .subnav nav li").not(".selected").find("a").mouseout(function() {
		$(this).stop().animate({width:'172px'},{queue:false, duration:400, easing: 'easeOutBounce'})
	});
	
	// add link to whole 'listings-blocks' list elements
	$("ul.listings-blocks li").mouseover(function() {
//		alert('Gday!');
		$(this).css( 'cursor', 'pointer' );
	});
	$("ul.listings-blocks li").mouseout(function() {
		$(this).css( 'cursor', 'default' );
	});
	
});
