$(document).ready(function(){
    $('.toplogo_2').mouseover( function() {
        topLogoHover('in');
    })
    $('.toplogo_2').mouseout( function() {
        topLogoHover('out');
    })

    $('.toplogo_1').mouseover( function() {
        topLogoHover('in');
    })
    $('.toplogo_1').mouseout( function() {
        topLogoHover('out');
    })

    $('.toplogo_2').click( function() {
        windows.location = 'http://www.abcbilsyn.dk';
    })

    $('.pristab_grey_middle').mouseover( function(me) {
        priceMouseOver('in', $(this));
    })
    $('.pristab_grey_middle').mouseout( function(me) {
        priceMouseOver('out', $(this));
    })

});

function priceMouseOver(option, caller)
{
    var callfrom = $(caller).attr('id');

    if(option == 'in')
    {
        $('[id='+callfrom+']').each(function() {
           oldclass = $(this).attr('class');
           newclass = oldclass.replace('_grey','');

           $(this).addClass(newclass);
           $(this).removeClass(oldclass);
        });
    }
    else
    {
        $('[id='+callfrom+']').each(function() {
           oldclass = $(this).attr('class');
           newclass = oldclass.replace('_','_grey_');

           $(this).addClass(newclass);
           $(this).removeClass(oldclass);
        });
    }
}

function topLogoHover(option)
{
    if(option == 'in')
    {
        $('.toplogo_2').addClass('toplogo_2_hover');
        $('.toplogo_2').removeClass('toplogo_2');
        //$('.toplogo_2').css('background-image', 'url(images/toplogo_2_hover.gif)');

        $('.toplogo_1').addClass('toplogo_1_hover');
        $('.toplogo_1').removeClass('toplogo_1');
    }
    else
    {
        $('.toplogo_2_hover').addClass('toplogo_2');
        $('.toplogo_2_hover').removeClass('toplogo_2_hover');
        //$('.toplogo_2').css('background-image', 'url(images/toplogo_2.gif)');

        $('.toplogo_1_hover').addClass('toplogo_1');
        $('.toplogo_1_hover').removeClass('toplogo_1_hover');
    }
}
