//----------------------
// slide menu navigation
//----------------------

//pause before animation
$.fn.pause = function(duration) {
	$(this).stop().animate({ dummy: 1 }, duration);
	return this;
};

function mouseleft() {
	$("#nav-bar").triggerHandler("mouseleave");
}

//slide open navigation on over (add focus someday)
$(document).ready(function(){
	var selectedInput = null;
	
	$("#query").focus(function() {
		selectedInput = this;
	});
	$("#query").blur(function() {
		selectedInput = null;
	});
	$("#nav-bar").mouseenter(
		function () {
			$("#query").unbind("blur", mouseleft);
			$(this).stop().pause(60).animate({ height:"270px" }, 400, "easeOutQuart" );
		}).mouseleave(
		function () {
			$("#query").bind("blur", mouseleft);
			if (selectedInput == null) {
				$(this).stop().pause(60).animate({ height:"35px" }, 400, "easeOutQuart" );
			}
		}
	);
});

//--------------------------------
// slide content intialize
//--------------------------------
$(document).ready(function(){ $('#browse').bxSlider(); });

//--------------------------------
// menu bar
//--------------------------------
$(document).ready( function() {
	$("a.menu").mouseenter(
		function() {
			$("a.menu").removeClass("selected");
			$("div.submenu").hide();
			$("#"+$(this).attr("id")).addClass("selected");
			$("#sub"+$(this).attr("id")).show();
		}
	);
	$("#menubox").mouseleave(
		function() {
			$("a.menu").removeClass("selected");
			$("div.submenu").fadeOut();
		}
	);
});

//--------------------------------
// slide news intialize
//--------------------------------
/*
featuredcontentslider.init({
	id: "slider2",  
	contentsource: ["inline", ""],  
	toc: "markup",  
	nextprev: ["Previous", "Next"],  
	revealtype: "click", 
	enablefade: [true, 0.2],  
	autorotate: [false, 3000],  
	onChange: function(previndex, curindex){}
})*/
