$(document).ready(function(){ 
	 // initialize scrollable  
	$("div.scrollable").scrollable({ 
        items: 'div.items',
		size: 3,
		speed: 2000,
		easing: 'swing',
		clickable: false,
		disabledClass: 'disabled'
    }).circular().autoscroll({ 
		autoplay: true,
		interval: 6000
	});
	
	$("#thumbs img").click(function(e) { 
 		
		e.preventDefault();
		// calclulate large image's URL based on the thumbnail URL  (replace 'thumb' with 'large')
		var url = $(this).parent().attr("href"); 
		// get handle to element that wraps the image and make it semitransparent 
		var wrap = $("#image_wrap").fadeTo("medium", 0.5); 
		// the large image from flickr 
		var img = new Image(); 
		// call this function after it's loaded 
		img.onload = function() { 
			// make wrapper fully visible 
			wrap.fadeTo("fast", 1); 
			// change the image 
			wrap.find("img").attr("src", url); 
		}; 
		// begin loading the image from flickr 
		img.src = url; 
	 // when page loads simulate a "click" on the first image 
	}).filter(":first").click();
	
	$("#inner-filter-mod").animate( { height:'60px' }, 800 );
	$("#filter-container").animate( { top:'0' }, 800 );
	
	$('div.collapse:eq(0)> div').hide();
  	$('div.collapse:eq(0)> h4').click(function() {
		$(this).next('div:hidden').slideDown('fast').siblings('div:visible').slideUp('fast');
  	});
	
	$("#filter-container input, #filter-container select option").click(function () {
		var filter = $("input[name='occasion']:checked").val();
		var brand = $("select[name='brand']").val();
		$(".object").each(function () {
			$(this).show();
			if ($(this).attr('id').substr(0,1)!=filter&&filter!='%') {
				$(this).hide();
			}
			if ($(this).attr('id').substr(2)!=brand&&brand!='%') {
				$(this).hide();
			}
		});
	});	

	$(document).pngFix();
});
