$('div#langwnd').css('opacity', 0);
$('a#langmenu').hover(function () {
    clearTimeout(lmtimeout);
    $('div#langwnd:not(:animated)').animate({ height: 'show', opacity: 1 }, 1000)
}, function () {
    lmtimeout = setTimeout(hideLangMenu, 1000)
});
var lmtimeout;
$('div#langwnd').mouseout(function (e) {
    if (e.pageX < $(this).offset().left || e.pageY < $(this).offset().top || e.pageX > $(this).offset().left + $(this).width() || e.pageY > $(this).offset().top + $(this).height())
        lmtimeout = setTimeout(hideLangMenu, 1000)
});
$('div#langwnd').mouseover(function (e) {
    clearTimeout(lmtimeout);
    $(this).filter(':animated').animate({ height: 'show', opacity: 1 }, 1000)
});
$.get('../content/langs.htm', function (data) {
    $('div#langwnd').html(data);
    $('div#langwnd div img[src$="' + $('input#lang').attr('value') + '.png"]').parent().remove();
    var fix = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
    if (fix)
        $('img[src$=.png]').each(function () {
            fixPng(this)
        });
    function fixPng(png) {
        var src = png.src;
        png.src = '/../images/trans.gif';
        png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')"
    }
});
$('div#menulinks a[href*=".easybitskids.com"]').each(function () {
    $(this).attr('href', $(this).attr('href') + '?lang=' + $('input#lang').attr('value'))
});
function hideLangMenu() {
    $('div#langwnd').animate({ height: 'hide', opacity: 0 }, 1000)
}
function changeLang(l) {
    $('form').append($('<input type="hidden" id="nlang" name="nlang" />').attr('value', l)).append($('<input type="hidden" id="location" name="location" />').attr('value', location));
    document.forms[0].submit()
}
function getMD() {
    try { _gat._getTrackerByName()._trackEvent('Download', 'Setup'); } catch (e) { }
    location = 'http://download.magicdesktop.com/MDSetupPremium.exe';
}
function getMsgViewer() {
    try { _gat._getTrackerByName()._trackEvent('Download', 'Message Viewer'); } catch (e) { }
    location = 'http://download.magicdesktop.com/ezMsgViewerSetup.exe';
}
