﻿(function($) {
    $.fn.customFadeIn = function(speed, callback) {
        $(this).fadeIn(speed, function() {
            if (jQuery.browser.msie)
                $(this).get(0).style.removeAttribute('filter');
            if (callback != undefined)
                callback();
        });
    };
    $.fn.customFadeOut = function(speed, callback) {
        $(this).fadeOut(speed, function() {
            if (jQuery.browser.msie)
                $(this).get(0).style.removeAttribute('filter');
            if (callback != undefined)
                callback();
        });
    };
})(jQuery);

function getWidth() {
    //opera Netscape 6 Netscape 4x Mozilla 
    if (window.innerWidth || window.innerHeight) {
        docwidth = window.innerWidth;
        docheight = window.innerHeight;
    }
    //IE Mozilla 
    if (document.body.clientWidth || document.body.clientHeight) {
        docwidth = document.body.clientWidth;
        docheight = document.body.clientHeight;
    }

    return docwidth;
}

$(document).ready(function() {
//    $('#txtcontent > p:first').addClass("firstparagraph");
    $('.menu > .menuitem:last-child').addClass("lastlink");

    $('#logo').mouseover(function(e) {
        var leftVal = getWidth() / 2 - 450;
        var topVal = 173;
        $('.popoutcontainer').css({ top: topVal, left: leftVal }).customFadeIn("fast");
    });

    $('#logo').mouseout(function(e) {
        $('.popoutcontainer').customFadeOut("fast");
    });

    menuReady();
});

function hover(control) {
    if (control.id == "programme-button") {
        control.src = "images/programme-button-2.png";
    } else if (control.id == "brochure-button") {
        control.src = "images/brochure-button-2.png";
    } else if (control.id == "registration-button") {
        control.src = "images/registration-button-2.png";
    } else if (control.id == "papers-button") {
        control.src = "images/papers-button-2.png";
    } else if (control.id == "welcome-button") {
        control.src = "images/welcome_button_hover.gif";
    } else if (control.id == "detailed-programme") {
        control.src = "images/detailed-programme-2.png";
    } else if (control.id == "home-button") {
        control.src = "images/home-button-2.png";
    } else if (control.id == "pdf-button") {
        control.src = "images/pdf-button-2.png";
    }
}

function unhover(control) {
    if (control.id == "programme-button") {
        control.src = "images/programme-button-1.png";
    } else if (control.id == "brochure-button") {
        control.src = "images/brochure-button-1.png";
    } else if (control.id == "registration-button") {
        control.src = "images/registration-button-1.png";
    } else if (control.id == "papers-button") {
        control.src = "images/papers-button-1.png";
    } else if (control.id == "welcome-button") {
        control.src = "images/welcome_button.gif";
    } else if (control.id == "detailed-programme") {
        control.src = "images/detailed-programme-1.png";
    } else if (control.id == "home-button") {
        control.src = "images/home-button-1.png";
    } else if (control.id == "pdf-button") {
        control.src = "images/pdf-button-1.png";
    }
}
