// JavaScript Document
$().ready(function(){
	cat_drop_init();
	init_accordion();
	init_carousel();
	init_lightbox();
	//pause_carousel();
	 $("a[rel^='prettyPhoto']").prettyPhoto({social_tools:false});
	 
	
});


function cat_drop_init(){
	if ($('#prod_drop').length > 0){
		$('#prod_drop').change(function () {
			var url=$('#prod_drop').val();
			window.location=url;
		});			
	}
}

function init_accordion(){
	
	$("#accordion").accordion({ active: false,autoHeight: false });
	$("#accordion h3").click(function(){
	  $(this).blur();
	});

}

function prod_carousel_callback(carousel) {

    // Pause autoscrolling
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


function init_carousel(){
	
	$("#lightbox_carousel").jcarousel({
		visible:5,
		scroll: 1,
	    auto: 2,
	    animation: 600,
	    wrap: 'circular',
	    initCallback: prod_carousel_callback

	});
/*
	$("#prod_carousel").jcarousel({
		visible:5,
		scroll: 1,
	    auto: 2,
	    animation: 600,
	    wrap: 'circular',
	    initCallback: prod_carousel_callback
	});
*/
}


function init_lightbox(){
	
	var carousel = $('#lightbox_carousel').data('jcarousel');
	
	if (carousel) {
		$(".gallery a[rel^='prettyPhoto']").prettyPhoto({
			theme:'dark_square',
			overlay_gallery: false,
			callback: function(){carousel.startAuto();}
			});
	} else {
		$(".gallery a[rel^='prettyPhoto']").prettyPhoto({
			theme:'dark_square',
			overlay_gallery: false
			});
	}

}
	
function pause_carousel(){
	var carousel = $('#lightbox_carousel').data('jcarousel');
	
	if (carousel) {
		$(".lb_but a").click(function(){
			carousel.stopAuto();
			return false;
		});
	}


}



