$(document).ready(function(){
    $("#container .middle .covers .item").fadeIn(500);
    $("#container .subpage .main .covers .item").fadeIn(500);

    $("#container .subpage .card .thumbs .img").mouseover(function(){
        $(this).css("cursor", "pointer");
        $(this).find(".mask:first").hide();
    });

    $("#container .subpage .card .thumbs .img").mouseout(function(){
        $(this).css("cursor", "default");
        $(this).find(".mask:first").show();
    });

    Cufon.replace("#container .products .item .txt h3, #container .subpage .main .list .item .txt h3", { fontFamily: 'font-2' });
    Cufon.replace("#container #footer .links .item .head h4", { fontFamily: 'font-3' });
    Cufon.replace("#container .subpage .main .cat_img h2", { fontFamily: 'font-3' });
    Cufon.replace("#container .subpage .card .txt h2", { fontFamily: 'font-3' });
});

VOOV.SlideShow.Construct({
    paused:false,
    button_activeclass:"imagelink_active",
    animate_interval: 5000,
    animatable: true,
    enable_friendlyuri: false
    });

VOOV.SlideShow.PauseCallback = function(paused) {
    if (paused == true) {
        $("#pause_on").show();
        $("#pause_off").hide();
    } else {
        $("#pause_on").hide();
        $("#pause_off").show();
    }
}
VOOV.SlideShow.OnSwitchCallback = function(index) {
    $("a.SlideShowControlId").each(function() {
        if($(this).attr("rel") == index) {
            $(this).html("<img src=\"http://" + document.domain + "/images/bubble_on.png\" alt=\"\" />");
        } else {
            $(this).html("<img src=\"http://" + document.domain + "/images/bubble.png\" alt=\"\" />");
        }
    });
}

function scrollFw() {
    var scrolling = document.getElementById("hasznos_elem");
    var current_left = parseInt(scrolling.offsetLeft);
    var holder_width = $("#icons_holder").width();
    var scrolling_width = $("#hasznos_elem").width();

    var max_left = (scrolling_width - holder_width) * -1 + 760;

    var steps = 760;
    if (current_left - steps < max_left) steps = current_left - max_left;
    if (current_left <= max_left || isNaN(current_left)) return false;
    current_left -= steps;
    $("#hasznos_elem").animate({left: current_left + "px"}, 400);
    return false;
}

function scrollBw() {
    var scrolling = document.getElementById("hasznos_elem");
    var current_left = parseInt(scrolling.offsetLeft);
    var steps = 760;
    if (current_left + steps > 0) steps = current_left * -1;
    if (current_left >= 0 || isNaN(current_left)) return false;
    current_left += steps;
    $("#hasznos_elem").animate({left: current_left + "px"}, 400);
    return false;
}


function scrollAnim() {
    if (_animated == false) return;
    var scrolling = document.getElementById("hasznos_elem");
    var current_left = parseInt(scrolling.offsetLeft);
    var holder_width = $("#icons_holder").width();
    var scrolling_width = $("#hasznos_elem").width();

    var max_left = (scrolling_width - holder_width) * -1;

    $("#hasznos_elem").animate({left: max_left + "px"}, 4500, function() {
        $("#hasznos_elem").animate({left: 0}, 2500);
    });
    setTimeout("scrollAnim()", 8000);
}
