jQuery("document").ready(function() {
	
	// SLIDING DROPDOWNS
	
	jQuery(".nav ul").css({display: "none"});
		
	jQuery(".nav li").each(function() {	
		
		var $sublist = jQuery(this).find("ul:first");
		
		jQuery(this).hover(function() {	
			jQuery(this).addClass("hover");
			$sublist.stop().css( {height:"auto", overflow:"hidden", display:"none"} ).slideDown(500, function() {
				jQuery(this).css( {height:"auto", overflow:"visible"} );
			});	
		},
		function() {	
			jQuery(this).removeClass("hover");
			$sublist.stop().slideUp(200, function()	{	
				jQuery(this).css( {display:"none", overflow:"hidden"} );
			});
		});	
	});
	
	// NAV DESCRIPTION
	
	jQuery("#mainnav li a").each(function() {
		var title = jQuery(this).attr("title");
		var link = jQuery(this).html();
		
	});
	
	
	// PRETTYPHOTO
	
	jQuery("a[rel^='prettyPhoto']").prettyPhoto();
	
	
	// TABS WIDGET 
	
	jQuery(function() {
		var contentWrapper = jQuery('.side .tab-wrap > .tab');
		// only show the first item, hide the rest
		contentWrapper.hide().filter(':first').fadeIn();
		
		jQuery('.side .tabs ul.tab-nav li a').click(function () {
		
		    // check if this item doesn't have class "current"
		    // if it has class "current" it must not execute the script again
		    if (this.className.indexOf('current') == -1){
		    	contentWrapper.hide();
		    	contentWrapper.filter(this.hash).fadeIn();
		    	jQuery('.side .tabs ul.tab-nav li a').removeClass('current');
		    	jQuery(this).addClass('current');
		    }
		    return false;
		});
	});
	
	
});
