$(function() {
  $('.front #content-top').prepend("<div id='sidebar-overlay'></div>");
	$('#product_thumbs .scrollable').scrollable( {
		size: 4
	});
	$('#product_thumbs .scrollable a').hover(function() {
		$('#product_images img').attr('src', $(this).attr('href').replace(/product_large/, 'product_mid'));
		$('#product_images a').attr('href', $(this).attr('href'));
	}, function() {});
	
	$("#product_thumbs li a").overlay({ 
	    // each trigger uses the same overlay with the id "gallery" 
	    target: '#gallery'
	// let the gallery plugin do its magic! 
	}).gallery({ 
	    // the plugin accepts its own set of configuration options 
	    speed: 800
	});
	
	$('#product_images a').overlay( {
		target: '#gallery'
	}).gallery({ 
		speed: 800
	});
	
	$("#tabs ul.tabs").tabs("div.panes-inner > div");
	$('#tabs ul.tabs li:first-child').addClass('first');
	$('#tabs ul.tabs li:last-child').addClass('last');
	$('#tabs ul.tabs a').wrapInner('<span></span>');
	
	$('#edit-submitted-email-address, #edit-submitted-questions-or-comments').each(function(i, elem) {
		$(elem).attr('orig', $(elem).val());
		$(elem).focus(function() {
			$(elem).val('');
		});
		$(elem).blur(function() {
			if($(elem).val() == '') {
				$(elem).val($(elem).attr('orig'));
			}
		});
	});
});