$(document).ready(function() {	
		//slideshow for the product pages.	
		$('.main-product-image a').lightBox();
        $('.field-field-post-img a').lightBox();
		$('.lightbox').lightBox();
		
        //overlay for the photo/video gallery.	
        $(".modal_gallery").overlay({
            //overlay background, makes the rest of the site dark.
            expose:{
				maskId: "exposeMask",
				color: '#000'		
				},
            closeOnClick: true,
			top:'22%',
			//When the overlay closes, close any open videos too.
            onBeforeClose: function(event) {$(".alldone_gsvb").click();}
        });	

		$(function() {
			// setup ul.tabs to work as tabs for each div directly under div.panes
			//needs jquery.tools.min.source.js
			$("ul.product_tabs").tabs("div.panes > div");
			$("ul.gal_tabs").tabs("div.gal_panes > div");
		});
		
		//2 click functions to display the correct tab on the gallery overlay.
		$("#vidgal").click(function() {
			$("ul.gal_tabs a:eq(1)").click();
		});
		
		$("#picgal").click(function() {
			$("ul.gal_tabs a:eq(0)").click();
		});
		
		//when switching from the video tab to the photo tab, close any open videos.
		$("#pic_tab").click(function() {
			$(".alldone_gsvb").click();
		});  
		$("imagecache-product_list[title]").tooltip();		
		//makes the menu behave as we want it to.
		/*$("#block-menu-primary-links .menutitle").one('mouseenter', function(){
			if($(this).hasClass("collapsed")){							 
				$(this).find("a").click();
			}	
			$(this).find("a").bind('click', function(event){
				$(this).dblclick();
			});
		});*/


	});		
