jQuery(document).ready(function () {

    $(function () {
        $('#loader').ajaxStop(function () {
            $(this).hide();
        });
    });

    jQuery('#carousel').jcarousel({
        auto: 8,
        scroll: 1,
        wrap: 'circular',
        animation: 2000,
        size: 5,
        itemLoadCallback: function(carousel, state) {
            for (var i = 1; i <= 5; i++) {
                carousel.add(i, '<img src="/images/carousel/carousel' + i + '-' + i + '.png" width="600" height="300" alt="carousel' + i + '" />');
            }
        }
    });

    $("#product a").live("click", function (event) {
        event.preventDefault();
        $('#' + this.id + ' img').after('<img id="loader" width="16" height="11" alt="loader" src="/images/loader.gif" border="0" />');
        //window.location.pathname = this.href;
        $.get(this.href);
    });

    $("#chooser a").live("click", function (event) {
       event.preventDefault();
       $('#' + this.id + ' #loader').show();
       //window.location.pathname = this.href;
       $.get(this.href);
    });

    $("#breadcrumbs a, .paginator a").live("click", function (event) {
       event.preventDefault();
       //window.location.pathname = this.href;
       $.get(this.href);
    });

    $("a.gallery_link").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	500,
		'speedOut'		:	500,
		'overlayShow'	:	true,
        'overlayOpacity' : 0.5,
        'overlayColor' : '#000',
        'showNavArrows' : true
	});

     $("div#map").css({'width' : '930px', 'height' : '300px', 'margin' : '10px 15px 10px 15px'});
});
