////////////////////////////////////////////////////////
//  Clear default input box values
//	
jQuery.fn.clearDefault = function(){
		return this.each(function(){
			var default_value = jQuery(this).val();
			jQuery(this).focus(function(){
				if (jQuery(this).val() == default_value) jQuery(this).val("");
			});
			jQuery(this).blur(function(){
				if (jQuery(this).val() == "") jQuery(this).val(default_value);
			});
		 });
};


jQuery(document).ready(function(jQuery){
//Apply Input Clearing Fix	
	jQuery('nav input').clearDefault();
	jQuery('footer input').clearDefault();
	
	// Apply Accordians
	jQuery('.accordion h3').click(function() {
												//Close all
		jQuery('.accordion .bellows').slideUp('');
		
		//If this one was closed, open it and give it the class open.
		if(jQuery(this).hasClass('closed')) {
		jQuery(this).next().slideDown('');
		jQuery('.accordion h3').removeClass('open');
		jQuery('.accordion h3').addClass('closed');
		jQuery(this).removeClass('closed');
		jQuery(this).addClass('open');
		
		//If this one was open, remove the open class and add the closed class.
		} else {
		jQuery(this).removeClass('open');
		jQuery(this).addClass('closed');
		};
		
	});
	
	//RESIZE BUNDLE IMAGES 
	$('#productBundle img').each(function(m){
							 $width = $(this).width();
							 $height = $(this).height();
							 
							 $newWidth = $width/2;
							 $newHeight = $height/2;
							 
							 $(this).width($newWidth);
							 $(this).height($newHeight);
							 
									  });
	
	//HIDE THE DIVS ON PAGE LOAD
	jQuery('.accordion h3').addClass('closed');
	jQuery('.accordion .bellows').hide();
	
	
	//TABS
	jQuery('#detailTabButton').click(function() {
											  jQuery('#reviewTab').slideUp('fast');
											  jQuery('#extraDetails').slideDown('slow');
											  });
											  
											  jQuery('#reviewsTabButton').click(function() {
											  jQuery('#extraDetails').hide();
											  jQuery('#reviewTab').show();
											  });


});
