jQuery(document).ready(function($) {
	
	$('#search').hide();
	
	$('#view-search').bind('click', function() {
		
		$('#search').toggle();
		
		return false;
		
	});
	
	if ($('#entry-additional') != null) {
		$('#entry-additional').contents().prependTo('#sidebar-1');
	}
	
	$('div.product-collapse').addClass('product-collapsed');
	$('div.product-description').hide();
	$('div.product-link').hide();
	
	$('div.product-collapse:eq(0)').removeClass('product-collapsed');
	$('div.product-description:eq(0)').show();
	$('div.product-link:eq(0)').show();
	
	$('h3.product-heading > a').bind('click', function() {
		
		if($(this).parent('h3').parent('div').hasClass('product-collapsed')) {
			
			$('div.product-collapse').each(function() {
				if($(this).children('div.product-description').is(':visible')) {
					$(this).children('div.product-description').hide();
					$(this).children('div.product-link').hide();
					$(this).addClass('product-collapsed');
				}
			});
			
			$(this).parent('h3').parent('div').removeClass('product-collapsed');
			$(this).parent('h3').next('div.product-description').slideDown('fast');
			$(this).parent('h3').next('div.product-description').next('div.product-link').show();
			
		}
		else {
			$(this).parent('h3').parent('div').addClass('product-collapsed');
			$(this).parent('h3').next('div.product-description').hide();
			$(this).parent('h3').next('div.product-description').next('div.product-link').hide();
		}
		
		return false;
		
	});
	
	
});
