﻿
function showLangList() {
    $('#langList').show(200);
}

function hideLangList() {
    $('#langList').hide(200);
}

function setLanguage(selectedlanguage) {
    $langID = $('#' + selectedlanguage + ' > input').val();
    var today = new Date();
    var expiresDate = new Date(today.getFullYear(), today.getMonth() + 1, today.getDate());
    document.cookie = 'lang=' + $langID + '; expires=' + expiresDate.toGMTString();
    window.location.reload();
}

function setCurrentLang() {
    var langID = getCurrentLangID();    
    if (langID != 1049) {
        $('#dwsch').css('display', 'none');
    }
    else {
        $('#dwsch').css('display', 'list-item');
    }
    $currentLang = $('#langCurrent');
    $langSel = $("li[id$='_" + langID + "']");
    $currentLang.html($langSel.html());
}

function getCurrentLangID() {
    var langID = getCookieValue('lang');
    if (langID == undefined) langID = 1033;
    return langID;
}

function getCountryCode() {
    var countryCode = getCookieValue('ccode'); ;
    if (countryCode == undefined) countryCode = 'US';
    return countryCode;
}

$(function () {
    $('#langList').mouseleave(function () {
        hideLangList();
    });
});
