﻿
// =========================================================================
// Simple plugins
// =========================================================================
(function($) {

    $.fn.firstChildLink = function() {


    };

})(jQuery);







$(document).ready(function() {



    // Decorator for hover:  .hover-area 
    $(".hover-area").hover(function() {
        $(this).toggleClass("hover");
    }, function() {
        $(this).toggleClass("hover");
    });


    $(".career .frontpage-hover-area").click(function(event) {
        var url = $(this).find("a").attr("href");
        if (url != undefined) {
            event.preventDefault();
            window.location = url;
        }
    });

    $(".sub-career .article-bottom .title-area").click(function(event) {
        var url = $(this).parent().find(".link a").attr("href");
        if (url != undefined) {
            event.preventDefault();
            window.location = url;
        }
    });


    $(".column .opacity-hover-area").click(function(event) {
        var url = $(this).parent().find(".link a").attr("href");
        if (url != undefined) {
            event.preventDefault();
            window.location = url;
        }
    });

    $(".sub-career .article-bottom .opacity-hover-area").click(function(event) {
        var url = $(this).parent().find(".link a").attr("href");
        if (url != undefined) {
            event.preventDefault();
            window.location = url;
        }
    });


    $(".opacity-hover-area").hover(function() {
        $(this).find("img").css({ opacity: 0.5 }).css('cursor', 'pointer');

    }, function() {
        $(this).find("img").css({ opacity: 1 }).css('cursor', 'pointer');
    });


    $(".frontpage-hover-area").hover(function() {
        $(this).css('cursor', 'pointer');
        var link = $(this).attr("class").toString();
        $(this).find(".top-image").css({ opacity: 0.5 });
        $(this).find("img").css({ opacity: 0.5 });
        $(this).toggleClass("hover");
    }, function() {
        $(this).toggleClass("hover");
        $(this).find(".top-image").css({ opacity: 1 });
        $(this).find("img").css({ opacity: 1 });
    });


    $('.career-columns .career-column-bottom').each(function(idx) {
        var maxOffset = 0;
        $(this).find('.article-bottom .article-image').each(function() {                         
           $(this).parent().css('display', 'block');
           if ($(this).offset().top > maxOffset)
                    maxOffset = $(this).offset().top;
        });
        $(this).find('.article-bottom .article-image').each(function() {
            var delta = maxOffset - $(this).offset().top;
            $(this).parent().css('margin-top', delta);
        });
    });
    $('.career-columns .article-bottom').css('display', 'block');


});
