$(function() {
    var img = $('<img src="./graphics/logo_perspective-trans.png"/>');
    $(img).css({
        position: 'absolute',
        top: '5px',
        left: '46px',
        'z-index': 10
    });
    $('#head').append(img);
    
    $('#topMenu > li').each(function() {
        var link = $(this).find('a').get(0);
        var div = $('<div></div>').css({
            position: 'absolute',
            top: $(link).position().top,
            left: $(link).position().left,
            width: $(link).width(),
            height: $(link).height(),
            cursor: 'pointer',
            'z-index': 20,
            'background-color': 'green',
            opacity: 0
        });
        $(div).click(function(e) {
            location.href = $(link).attr('href');
        });
        $(div).mouseover(function(e) {
            $(link).css('color', '#00AEEF'); 
        }).mouseout(function(e) {
            if (!$(link).parent('li').hasClass('active')) {
                $(link).css('color', '#FFF');
            }
        });
        $('#head').append(div);
    });

    $('#main > #head').each(function() {
        var link = $(this).find('a').get(0);
        var div = $('<div></div>').css({
            position: 'absolute',
            top: $(link).position().top,
            left: $(link).position().left,
            width: $(link).width(),
            height: $(link).height(),
            cursor: 'pointer',
            'z-index': 20,
            'background-color': 'green',
            opacity: 0
        });
        $(div).click(function(e) {
            location.href = $(link).attr('href');
        })
        $('#head').append(div);
		
    });
    
    // Extra hack - Lav overskrift klikbar!!
    var div_extra = $('<div></div>').css({
        position: 'absolute',
        top:    30,
        left:   125,
        width:  365,
        height: 45,
        cursor: 'pointer',
        'z-index': 20,
        'background-color': 'green',
        opacity: 0
    });
    $(div_extra).click(function(e) {
        location.href = $(link).attr('href');
    })        
    $('#head').append(div_extra);

    $('#footer-email').each(function() {
        var link = $(this).find('a').get(0);
        var div = $('<div></div>').css({
            position: 'absolute',
            top: $(link).position().top,
            left: $(link).position().left,
            width: $(link).width(),
            height: $(link).height(),
            cursor: 'pointer',
            'z-index': 20,
            'background-color': 'green',
            opacity: 0
        });
        $(div).click(function(e) {
            location.href = $(link).attr('href');
        })
        $('#footer').append(div);
    });

});