﻿$(document).ready(function() {

    // Info Popup klein und groß
    var Id2; var Id1; var infoPopupTimer;

    Id1 = $(".atinfosmall_id").val();
    Id2 = $(".atinfocontent_id").val();
    infoPopupTimer = $(".atinfopopuptimer").val();

    if (Id1 && Id2) {
        $("#atInfoSmallContent").load(Id1 + " #jcontent");
        $("#atMainInfoContent").load(Id2 + " #jcontent");
        // Timer für das einblenden des kleinen Popups setzen
        setTimeout("activateArticleInfoPopup()", infoPopupTimer);
    }
    $(".carousel_item_container").show();
});

// nicht benötigte Tabs im Artikel Detail ausblenden
setTimeout("hideTabs()", 1000)
function hideTabs() {
    var htabs = $(".hiddentabs").val();
    if (htabs.length > 0) {
        var shtabs = htabs.split(",")
        for (i = 0; i < shtabs.length; i++)
            $("." + shtabs[i]).hide();
    }
}
$(".tab_detail_image_big").ready(function() { hideTabs(); });

function activateArticleInfoPopup() {
        var pos = $(".infopopup").offset();
        var width = $(".infopopup").width();
        $("#atInfoSmallPopup").css({ "left": (pos.left + width+15) + "px", "top": (pos.top+270) + "px" });
        $("#atInfoSmallPopup").fadeIn(300).show();
        infoPopupHideTimer = $(".atinfopopuphidetimer").val();
        setTimeout("$('#atInfoSmallPopup').fadeOut(300)", infoPopupHideTimer);
}

//function activateArticleInfoPopup2() {
//    ArticleInfoPopup();
//    if ($(window).width() > 1100)
//        var x = ($(window).width()/2)+300
//        $("#atInfoSmallPopup").css("left", x +"px" );
//        $("#atInfoSmallPopup").fadeIn("slow");
//        $(window).scroll(function() {
//        ArticleInfoPopup();
//    });
//}

function ArticleInfoPopup() {
    var pPos = $(window).height() + $(window).scrollTop() - 100;
    //var pyPos = $("#add_container_middle").height() + 115 - 100;
    pyPos = 495 + "px";
    $("#atInfoSmallPopup").animate({ top: pyPos }, { queue: false, duration: 100 });
}

function showArticleInfoMainPopup() {
    showzoom("atInfoMainPopup")
    $('#atInfoSmallPopup').hide();
}

function hideATMainInfoPopup() {
    $('#atInfoMainPopup').hide();
}

function showZoomImage() {
    $(".zoomoverlaybox").show();
    if ($(window).width() > 1100)
        $("#zoom_imagediv").css("left", (($(window).width() / 2) + 220) - 400);
        $("#zoom_imagediv").fadeIn("slow");
        $(window).scroll(function() {
    });
}

function showzoom(Id) {
    $("#" + Id).overlay({

        // custom top position 
        //top: 272,

        // some expose tweaks suitable for facebox-looking dialogs 
        expose: {

            // you might also consider a "transparent" color for the mask 
            color: '#909090',

            // load mask a little faster 
            loadSpeed: 200,

            // highly transparent 
            opacity: 0.5
        },

        // disable this for modal dialog-type of overlays 
        closeOnClick: true,

        // we want to use the programming API 
        api: true

        // load it immediately after the construction
    }).load();
}

$(function() {
    $(".carousel_itemlist").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        visible: 4
    });
});

function GotoFAQsSolution(url)
    {
    if(navigator.appName == "Netscape")  
    {
    py=window.pageYOffset;
    px=window.pageXOffset;
    }
    if (navigator.appVersion.indexOf("MSIE") != -1)
    {
    py=document.body.scrollTop;
    px=document.body.scrollLeft;
    } location.href= url  + '&soffsetx=' + px  + '&soffsety=' + py
} 

