var bgPosition = 0;
var maxBgPosition = -510;
function move_horizontal() {
    if (bgPosition > maxBgPosition) {
        bgPosition--;
        document.getElementById('home').style.backgroundPosition = bgPosition + 'px ' + '0px';
        setTimeout(move_horizontal, 100);
    }
}



$(document).ready(function() {

        if(/MSIE 6/.test(navigator.userAgent))
        {
        $("#goldbar").css("display","");
        }
        $("#update_close").click(function(){
            $("#goldbar").css("display","none");
            })

        $('.toggle').click(function() {

            var id = $(this).attr("id");
            var describe = "#describe" + id;

            if ($(describe).hasClass('disabled')) {
            $(describe).removeClass('disabled');
            $(this).html('Ukryj szczegóły');
            } else {
            $(describe).addClass('disabled');
            $(this).html('Pokaż szczegóły');
            }

            return false;
            });

        // wrap image to overlay with html
        //
        $("img.class_to_overlay").addClass('img_product_thumb').each(function(){
                var str = $(this).attr('src');
                var largePic = str.match(/([a-zA-Z0-9]*)_(\w*)\.(\w*)$/);
                //var largePic = str.match(/([a-zA-Z0-9]*(?!_))\.(\w*)$/);
                $(this).after('<div id="' + largePic[2] + '" class="overlay" style="display: none;"><div class="close" style="color: #FFFFFF;">[ x ]</div><div><img src="/static/uploads/overlays/'+ largePic[2] + '.' + largePic[3] +'"></div></div>');
                $(this).wrap('<a href="#" rel="#'+ largePic[2] +'"></a>');
                });

        // overlay start
        $(function() { 
                $("a[rel]").overlay({expose: '#000'}); 
                }); 


        // start superfish!
        $(".navigation").superfish({
hoverClass: "hover",
pathClass: "active",
pathLevels: 3,
delay: 0,
speed: 100,
autoArrows: false,
dropShadows: false
});
});
