jQuery(function($){
		// setup suckerfish drop down menus
       $('ul.sf-menu').superfish({ 
            delay:       	600, 
            animation:   	{opacity:'show',height:'show'},
            speed:       	'fast',
            onBeforeShow:		 function() { $(this).siblings("a").each(function(){
            								$(this).css({ backgroundPosition: "0 -30px" });
            							});
            						},
            onHide:		 	function() { $(this).siblings("a").each(function(){
            								if (!$(this).hasClass("selected")) {
	            								$(this).css({ backgroundPosition: "0 0" });
	            							}
            							});
            						},
            autoArrows:  	false,
            dropShadows: 	false
        });
        
		// setup modal dialogs
		jQuery(".thumb-popup, .thumb-popup-large").dialog({
			bgiframe: true, autoOpen: false, modal: true,
			buttons: { }, //"Close": function() { $(this).dialog("close"); } },
			show: "blind",
			hide: "blind",
			dialogClass: "thumb-popup",
			title: "",
			width: 400,
			modal: true,
			// make sure dialogs have higher zIndex than suckerfish menus
			zIndex: 9999999
		});
		jQuery(".thumb-popup-large").dialog("option", "width", 550);
		
		// display modal dialog on click
		$("a.prodlink, a.prodlink-side").click(function(event) {
			event.preventDefault();

			var id = '#'+$(this).attr("rel");
			
			// account for regular and large dialogs; only one will display since the id
			// must be unique
			jQuery(".thumb-popup "+id+", .thumb-popup-large "+id).dialog('open');
		});
});

// Safari hack -- we have to add a pixel to the top margin of the suckerfish menus
jQuery(function($) {
	if ($.browser.safari) {
		$("ul.sf-menu ul").css('margin-top', '9px');
	}
});


