﻿$(document).ready(function () {
    //bredden p� menuen (DAMN YOU IE7!!!)
    var width = 0;
    $('.countryname').each(function () {
        var this_width = $(this).width();
        if (this_width > width) {
            width = this_width;
        }
    });

    if (80 + width < 160) {
        $('#languagepicker').css('width', 160);
        width = 160;
    }
    else {
        $('#languagepicker').css('width', 80 + width);
        width = 80 + width;
    }
    $('#languagepicker').css('margin-left', -width);

    var ua = $.browser;
    // hent h�jden p� menuen (uden fanebladet, derfor minus 36 px)
    var height = $('#languagepicker').outerHeight();
    var $currentLang = $('#currentlanguage');
    var height2 = ((height - $currentLang.outerHeight()));
    height2 = height + 110;
    // placer div'en
    if (ua.msie && ua.version == "7.0") {
        $('#languagepicker').css('margin-top', -(height + 117))
    }
    else {
        //        $('#languagepicker').css('top', -(height2))
        $('#languagepicker').css('top', -(height2))
    }



    $('#languagepicker').mouseenter(function () {
        if (ua.msie && ua.version == "7.0") {
            $('#languagepicker').stop().animate({ "margin-top": "-146px" }, "medium");
        }
        else {
            $('#languagepicker').stop().animate({ "top": "-146px" }, "medium");
        }
    });
    $('#languagepicker').mouseleave(function () {
        if (ua.msie && ua.version == "7.0") {
            $('#languagepicker').stop().animate({ "margin-top": -(height + 117) }, "medium");
        }
        else {
            $('#languagepicker').stop().animate({ "top": -(height2) }, "medium");
        }
    });
});

//$(document).ready(function () {


//    // hent h�jden p� menuen (uden fanebladet, derfor minus 36 px)
//    var height = $('#languagepicker').height();
//    var height2 = height - 46;
//    // placer div'en
//    $('#languagepicker').css('top', -height2)

//    //bredden p� menuen (DAMN YOU IE7!!!)
//    var width = 0;
//    $('.countryname').each(function () {
//        var this_width = $(this).width();
//        if (this_width > width) {
//            width = this_width;
//        }
//    });

//    $('#languagepicker').css('width', 80 + width);

//    //og g�r den synlig
//    $('#languagepicker').css('visibility', 'visible')
//    $('#languagepicker').mouseenter(function () {
//        $('#languagepicker').stop().animate({ "top": "-36px" }, "medium");
//    });
//    $('#languagepicker').mouseleave(function () {
//        $('#languagepicker').stop().animate({ "top": -height2 }, "medium");
//    });
//});
