// JavaScript Document
$(document).ready(function() {
	//initializing plugins
	$('.wp_bannerize_slideshow').cycle({
		fx: 'fade',
		speed: 1500,
		timeout: 7000
	});
	$('.colorbox').colorbox({transition:'fade', speed:500, maxWidth:600, maxHeight:600, title:true});
	//functions
	var initial_search_val=$("#s").attr("value");
	
	$("#s").bind("focus",function(){
		$(this).attr("value","");
	})
	$("#s").bind("blur",function(){
		if($(this).attr("value")==""){
			$(this).attr("value",initial_search_val);
		}
	})
	
	menuAdjust();
	
	subMenusDropDown();
	
});

function menuAdjust () {
	
	var itemsWidth = 0;
	
	$("ul#nav").children("li").each(function () {
		
		var itemWidth = $(this).outerWidth(true);
		
		itemsWidth += itemWidth;
		
		$("#main_navigation").width(itemsWidth+17);
	});
	
	$("ul#nav li.current_page_ancestor").children("a").css("background","#FF6600");
	
	
}

function subMenusDropDown () {
	
	$("ul#nav li").each(function () {
		
		if ($(this).find("ul"))
		{
			
			$(this).hover(function () {
				
				$(this).children("ul").stop(true,true).slideDown(300);
				}, function(){
				$(this).children("ul").slideUp(100);
				
			});
		}
		
	});
	
}

