﻿Cufon.replace('#topcontainer #topmenu li a, #fronteyecatchertxt h1, #content #contentcol1 h1, #content #contentcol2 h1, #content #contentcol3 h1', {
    fontFamily: 'frutiger'
});

Cufon.replace('#content #contentcol1 h2, #content #contentcol2 h2, #content #contentcol3 h2, #content .leesmeerbtn, #content #righteyecatcherbutton .textfront, #content #righteyecatcherbutton .textshadow', {
    fontFamily: 'frutiger'
});

Cufon.replace('#content #righteyecatcherbutton2 .textfront, #content #righteyecatcherbutton2 .textshadow, #content #contentright h1', {
    fontFamily: 'frutiger'
});

Cufon.replace('#contentfootercol1 h1, .custom_images span', {
    fontFamily: 'frutigerLight'
});

Cufon.replace('#contentfootercol2 h1, .custom_images span', {
    fontFamily: 'frutigerLight'
});

$(document).ready(function () {

    /* TopMenu Hovercontrols */

    if ($.browser.msie && $.browser.version < 9) {

        $("#topcontainer #topmenu a").before('<img src="images/cubilisTopMenuBgLeft.png" alt="" class="topmenuleftimg" />').after('<img src="images/cubilisTopMenuBgRight.png" alt="" class="topmenurightimg" />');

        if ($.browser.version == 7) {
            $("#topcontainer #topmenu a").css({ 'vertical-align': 'middle', 'padding': '8px 0 8px 0' });
        } else {
            $("#topcontainer #topmenu a").css({ 'vertical-align': 'middle', 'padding': '5px 0 6px 0' });
        }
        $("#topcontainer #topmenu .active a").css({ 'background': "url('images/cubilisTopMenuBgMiddle.png')" });
        $("#topcontainer #topmenu .active .topmenurightimg, #topcontainer #topmenu .active .topmenuleftimg").css({ 'visibility': 'visible' });

        $("#topcontainer #topmenu a").css({ 'background-color': 'transparent' }).hover(function () {
            $(this).css({ 'background-color': 'transparent' });
        }, function () {
            $(this).css({ 'background-color': 'transparent' });
        });

        $("#topcontainer #topmenu li").hover(function () {
            if ($(this).hasClass('active')) {
            } else {
                $("#topcontainer #topmenu .active .topmenurightimg, #topcontainer #topmenu .active .topmenuleftimg").css({ 'visibility': 'hidden' });
                $(".topmenurightimg, .topmenuleftimg", this).css({ 'visibility': 'visible' });
                $("#topcontainer #topmenu .active a").css({ 'background': "none" });
                $("a", this).css({ 'background': "url('images/cubilisTopMenuBgMiddle.png')" });
            }
        }, function () {
            if ($(this).hasClass('active')) {
            } else {
                $(".topmenurightimg, .topmenuleftimg", this).css({ 'visibility': 'hidden' });
                $("#topcontainer #topmenu .active .topmenurightimg, #topcontainer #topmenu .active .topmenuleftimg").css({ 'visibility': 'visible' });
                $("a", this).css({ 'background': 'none' });
                $("#topcontainer #topmenu .active a").css({ 'background': "url('images/cubilisTopMenuBgMiddle.png')" });
            }
        });

    } else {

        $("#topcontainer #topmenu li").hover(function () {
            if ($(this).hasClass('active')) {
            } else {
                $("#topcontainer #topmenu .active a").css({ 'background-color': 'transparent' });
            }
        }, function () {
            $("#topcontainer #topmenu .active a").css({ 'background-color': '#dff1f5' });
        });

    }

    $("#contentcontainer #submenu li").hover(function () {
        if ($(this).hasClass('active')) {
        } else {
            $("#contentcontainer #submenu .active a").css({ 'background': "url('images/cubilisSubMenuBg.png') top left no-repeat" });
            $('a', this).css({ 'background': "url('images/cubilisSubMenuBgActive.png') top left no-repeat" });
        }
    }, function () {
        $('a', this).css({ 'background': "url('images/cubilisSubMenuBg.png') top left no-repeat" });
        $("#contentcontainer #submenu .active a").css({ 'background': "url('images/cubilisSubMenuBgActive.png') top left no-repeat" });
    });

    $('#fronteyecatcherbutton, #righteyecatcherbutton2, #footereyecatcherbutton2, #topcontainer #toplangmenu li a img').hover(function () {
        var $activeURL = $(this).attr('src');
        $activeURL = $activeURL.substring(0, $activeURL.length - 4) + "Active.png";
        $(this).attr('src', $activeURL);
    }, function () {
        var $origURL = $(this).attr('src');
        $origURL = $origURL.substring(0, $origURL.length - 10) + ".png";
        $(this).attr('src', $origURL);
    });

    $('.buttonBehavior').click(function () {
        window.location = $("a:first", this).attr("href");
    });

    /* Flip sponsors */
    var $numberOfSponsors = $("#sponsors .sponsor").size();
    var $iCountSponsor = 0;

    function flipSponsor() {
        var elem = $("#sponsors .sponsor:eq(" + $iCountSponsor + ") .sponsor1");
        var parent = elem.parent();

        if (!elem.data('flipped')) {
            elem.flip({
                direction: 'lr',
                speed: 150,
                color: "#ffffff",
                onBefore: function () {
                    elem.html($(".sponsor2", parent).html());
                }, onEnd: function () {
                    elem.css({ "background": "transparent" });

                }
            });

            elem.data('flipped', true);
        } else if (elem.data('flipped')) {
            elem.revertFlip();
            elem.data('flipped', false)
        }

        if ($iCountSponsor == ($numberOfSponsors - 1)) {
            $iCountSponsor = 0;
        } else {
            $iCountSponsor++;
        }
    }
        
    setInterval(flipSponsor, 1000); 
});


