var mainMenus={
	animateDuration: {over: 150, out: 100}, //duration of slide in/ out animation, in milliseconds
	buildMenus:function(){
	function show() {
		var menu = $(this);
		$(this).addClass("active");
		menu.children("ul").css({display:'block'});
		var $siblings=$(this).siblings();
		$siblings.each(function(i){
			$(this).removeClass("active");
			$(this).children("ul").css({display:'none'});
		}) //end $siblings.each()
	}
	function hide() { 
		var menu = $(this);
		$(this).removeClass("active");
		menu.children("ul").css({display:'none'});
	}
		var $mainMenu=$(".main_menu")
		var $headers=$mainMenu.find("ul").parent()
		$headers.each(function(i){
			$(this).addClass("has_submenu")
	$(this).hoverIntent({
		interval: 0, // milliseconds delay before onMouseOver
		over: show, 
		timeout: 500, // milliseconds delay before onMouseOut
		out: hide
	});
		}) //end $headers.each()
		$mainMenu.find("ul").css({display:'none', visibility:'visible'})
	} //end buildMenus:function()
} //end var mainMenus

//if the document is ready, apply all functions
$(document).ready(function() {
	//set up animations for drop down menus
	mainMenus.buildMenus();
	//loop through all links and set external ones to target="_blank"
	$('a[rel*=external]').attr("target","_blank");
	$('a[rel*=external]').attr("title","(opens in new window)");
	$('a[rel*=nofollow]').attr("target","_blank");
	$('a[rel*=nofollow]').attr("title","(opens in new window)");
	//apply lightbox to links
	$('a[rel*=lightbox]').lightBox();
	//autosubmission for shopping basket updates
	$("table#shopping_basket_table select[name*=quantity]").bind("change", function() { this.form.submit(); }); //change quantity
});
