function mycarousel_itemLoadCallback(carousel, state)
{
	  if (state != 'init')
			return;
	$("#loader").css( {display: "block"} );
	
	$.ajax({
	type: "GET",
	url: "galleri.html",
	success: function(msg) {
		$("#loader").css ( { display: "none"} );
	mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, msg);
	
	}});

};

function mycarousel_itemAddCallback(carousel, first, last, data)
{
    // Simply add all items at once and set the size accordingly.
    var items = data.split('|');

    for (i = 0; i < items.length; i++) {
        carousel.add(i+1, items[i]);
    }

    carousel.size(items.length);
};



function mycarousel_initCallback2(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('#mycarouse2-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarouse2-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};


jQuery(document).ready(function() {
								
    jQuery('#mycarousel').jcarousel({
	visible: 8
	 });
	

	jQuery('#mycarouse2').jcarousel({
		visible: 1,
		scroll: 1,
		buttonNextHTML: null,
		buttonPrevHTML: null,
		initCallback: mycarousel_initCallback2,
		itemLoadCallback: mycarousel_itemLoadCallback
		 });
	
	
	$("#sub_foto img").reflect({height:0.5,opacity:0.5});
	
	
$("a[rel^='prettyPhoto']").prettyPhoto({
			animationSpeed: 'normal', /* fast/slow/normal */
			padding: 40, /* padding for each side of the picture */
			opacity: 0.35, /* Value betwee 0 and 1 */
			showTitle: true, /* true/false */
			allowresize: true, /* true/false */
			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'dark_rounded' /* light_rounded / dark_rounded / light_square / dark_square */
		});
	
});

