﻿
//    Removing the padding and margin right from the last li element within the ul "level1"

jQuery(document).ready(function ($) {
    $("#headerTop ul.level0 li:last-child")

            .css({ paddingRight: "0px", marginRight: "0px", borderRight: "0px" })
});

/*jQuery(document).ready(function ($) {
    $("#headerTop ul.level0 li:last-child a")

            .css({ backgroundColor: "#00b9e4", padding: "0.1em 0.8em 0.1em 0.8em", color: "#fff" })
});*/

jQuery(document).ready(function ($) {
    $(".fcontentLeft ul.level0 li:last-child")

            .css({ borderRight: "0px", paddingRight: "0px", marginRight: "0px" })
});

//        Removing the border bottom, padding bottom and margin bottom from the last li element within the ul "newsPost"

jQuery(document).ready(function ($) {
    $("ul.newsPost li:last-child")

            .css({ borderBottom: "0px", paddingBottom: "0px", marginBottom: "0px" })
});

//        Removing the border bottom, padding bottom and margin bottom from the last li element within the ul "eventsPost"

jQuery(document).ready(function ($) {
    $("ul.eventsPost li:last-child")

            .css({ borderBottom: "0px", paddingBottom: "0px", marginBottom: "0px" })
});

jQuery(document).ready(function ($) {
    $("ul.twitterPosts li:last-child")

            .css({ paddingBottom: "0px" })
});

jQuery(document).ready(function ($) {
    $("ul.worklistfilter li:last-child")

            .css({ paddingRight: "0px" })
});

jQuery(document).ready(function ($) {
    $("#SubNav ul.level0 li:last-child")

            .css({ borderBottom: "0px", paddingBottom: "0px", marginBottom: "0px" })
});

// Removing padding from the last of the accolades li element

function positionFooter() {
    if ($("#footer").length > 0) {

        if ($("#mobileShare").length > 0) {
            var mobileShareHeight = $("#mobileShare")[0].offsetHeight;
            var ToggleButtonHeight = $("#ToggleButton")[0].offsetHeight;
            var SubNavHeight = $("#SubNav")[0].offsetHeight;
            $("#footer").css("height", mobileShareHeight + ToggleButtonHeight + 30 + SubNavHeight + "px");
        }        
        
        var footerTop = $("#footer")[0].offsetTop;
        var footerHeight = $("#footer")[0].offsetHeight;
        var wrapperHeight = $("#wrapper")[0].offsetHeight;
        var windowHeight = $(window).height();
        var windowFooterTop = (windowHeight - footerHeight);

        //console.log("windowHeight: " + windowHeight);
        //console.log("footerTop: " + footerTop);
        //console.log("footerHeight: " + footerHeight);

        if (footerTop > wrapperHeight)
            $("#footer").css("top", wrapperHeight);

        if (footerTop <= wrapperHeight)
            $("#footer").css("top", wrapperHeight);

        if ((footerTop >= wrapperHeight) && (footerTop < windowFooterTop))
            $("#footer").css("top", windowFooterTop);

        if ((footerTop >= windowFooterTop) && (windowFooterTop >= wrapperHeight))
            $("#footer").css("top", windowFooterTop);
    }
}

$(document).ready(function () {
    BindHover();    

});


$(window).resize(function () {
    positionFooter();
});

$(window).load(function() {
    positionFooter();
});

function BindHover() {
    //move the image in pixel
    var move = -15;

    //zoom percentage, 1.2 =120%
    var zoom = 1.2;

    //On mouse over those thumbnail
    $('.item').hover(function () {
        //Set the width and height according to the zoom percentage
        width = $('.item').width() * zoom;
        height = $('.item').height() * zoom;

        //Move and zoom the image
        $(this).find('img').stop(false, true).animate({ 'width': width, 'height': height, 'top': move, 'left': move }, { duration: 200 });

        //Display the caption
        $(this).find('div.caption').stop(false, true).fadeIn(200);
    },
	function () {
	    //Reset the image
	    $(this).find('img').stop(false, true).animate({ 'width': $('.item').width(), 'height': $('.item').height(), 'top': '0', 'left': '0' }, { duration: 100 });

	    //Hide the caption
	    $(this).find('div.caption').stop(false, true).fadeOut(200);
	});
}

$(document).ready(function () {
    positionFooter();
    $(".colorbox-inline").colorbox({ inline: true, width: "50%", height: "50%" });
    //Set default open/close settings
    $('.acc_container').hide(); //Hide/close all containers
    $('.acc_trigger:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container

    //On Click
    $('.acc_trigger').click(function () {
        if ($(this).next().is(':hidden')) { //If immediate next container is closed...
            $('.acc_trigger').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
            $(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
        }
        return false; //Prevent the browser jump to the link anchor
    });
});
