// JavaScript Document

$(document).ready(function(){
	
	$("ul.quickfinder-search li").mouseup(function() { //When trigger is clicked...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").fadeIn('fast').show(); //show the subnav on click
		
		//Change the arrow button image to hover
		$(this).find("div.searchbox-updown-arrow").addClass("arrowhover");

		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul.subnav").fadeOut('fast'); //When the mouse hovers out of the subnav, hide it
			
			//Change the arrow button image back to normal
			$(this).find("div.searchbox-updown-arrow").removeClass("arrowhover");
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});	
	
	$("div.searchbox-updown-arrow").mouseover(function() {
		$(this).addClass("arrowhover");		
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().parent().find("ul.subnav").fadeIn('fast').show(); //show the subnav on click
		
		$(this).parent().parent().hover(function() {
		}, function(){	
			$(this).parent().parent().find("ul.subnav").fadeOut('fast'); //When the mouse hovers out of the subnav, hide it
			$(this).find("div.searchbox-updown-arrow").removeClass("arrowhover");
		});
		
	});
	
});
