﻿// behaviour for the main menu
$(document).ready(function() {
    $("div#TabMenuContainer .RadTabStrip_Default .rtsSelected, div#SubMenu .RadTabStrip_Default .rtsSelected").parent().addClass("activeMenu");

    $("div#TabMenuContainer .RadTabStrip_Default .rtsLI, div#SubMenu .RadTabStrip_Default .rtsLI").hover(
        function() {
            $(this).addClass("activeMenu");
        },
        function() {
            var link = $(":first", this);
            if (!link.hasClass("rtsSelected")) {
                $(this).removeClass("activeMenu");
            }
        }
    );
});

// behaviour for main portal page
$(document).ready(function() {
    $("img#StartImage").maxImage({
        isBackground: true,
        overflow: 'auto',
        verticalAlign: 'top',
        topSpace: 80,
        bottomSpace: 50,
        horizontalOffset: -50
    });

    // behaviour for sub portal pages
    $("img#ShopHomepageImage").maxImage({
        isBackground: true,
        overflow: 'auto',
        verticalAlign: 'top',
        topSpace: 131,
        bottomSpace: 50
    });
});

// behaviour for the menus on ProductGroup and ProductList pages
$(document).ready(function() {
    $("ul.productMenu li").hover(
        function() {
            $("div.imageHolder", this).stop(true, true).animate({height: "0px"}, 250, "swing");
        },
        function() {
            $("div.imageHolder", this).animate({ height: "280px" }, 250, "swing");
        }
    );
});

// Makes the whole product group box clickable
$(document).ready(function() {
    $("div.textHolder h2 a").bigTarget();
});


// fancybox, used on productpages
$(document).ready(function() {
    $("a#FancyBox").fancybox({
        'titlePosition': 'inside',
        'type': 'image',
        'autoDimensions': false,
        'width': 450,
        'height': 'auto'
    });
});

$(document).ready(function() {
    $("a.extraInfo").fancybox({
        'autoDimensions': false,
        'width': 450,
        'height': 'auto'
    });
});

// PNG fix for IE
$(document).ready(function() {
    $(document).pngFix();
});

// Making document list items clickable
$(document).ready(function () {
    $("ul.documentList li h2 a, ul.productMenu li h2 a").bigTarget();
});
