$(document).ready(function(){

	// Start the functionality for the listening room button
// 	$('#studio_button').fancybox({
// 				'width'				: '75%',
// 				'height'			: '75%',
// 				'margin'			: '0',
// 				'padding'			: '0',
// 				'autoScale'			: false,
// 				'transitionIn'		: 'none',
// 				'transitionOut'		: 'none'});
	
	// Append the red background elemnts to each nav button, we can't manipualte the actual BG Y or this would be easier.
	var count=0;	
	$('.nav_button').each(function(){
			$(this).prepend("<div class='red_bg'></div>");
			// A little </3 for IE6 which, like an angry cat will crap all over anything it can get on top of.
			count++;
			if(count==8){				
				setTimeout(function(){
					  $('.red_bg').height('5px');
				},800);
			}
	});

	// Additional IE6 Specific Hacks & Exceptions
	if (jQuery.browser.msie && parseInt(jQuery.browser.version) == 6) {
	  $('#main_nav').css('bottom',"0px");
	} 

	// Append the left and right gradients to the subnavs
	$('.sub_nav').append("<div class='left_grad'><img src='http://dreamguitars.com/sprites/down_gradient.png'></div><div class='right_grad'><img src='http://dreamguitars.com/sprites/down_gradient.png'></div>");

	// Add the main nav hover behavior
	// Add the main nav hover behavior
	$('.main_nav').hover(function(){
			$(this).parent().children('.sub_nav').css({width:'100%'});
			width=$(this).parent().children('.sub_nav').width()+20;
			$(this).parent().children('.sub_nav').css({width:width});

	},function(){

	});
	
	/* END SUB NAV ACTIONS*/
	
	//for tabs on instrument details page	
$(function() {
	// setup ul.tabs to work as tabs for each div directly under div.panes
	$("ul.tabs").tabs("div.panes > div");
});

$(function() {
// initialize scrollable
	$(".scrollable").scrollable();
})

//reloads page on "read full description" link so that "description tab opens"
$('.reload').click(function() {
location.reload();
//window.open('instrument-detail.php#full');
});

	/* This is basic - uses default settings */

	
	$("a.single").fancybox();
	
	/* Using custom settings */
	
	$("a#inline").fancybox({
		'hideOnContentClick': true
	});

	/* Apply fancybox to multiple items */
	
	$("a.group").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	false
	});

	$("a.iframe").fancybox({width: '100%', height: '100%' ,overlayOpacity: .7, overlayColor: '#000'});

	$("a[rel=this-gallery]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
		}
	});

});

