﻿function ChangeMUI(value) {
    var currentLCID = $.cookies.get("lcid");
    //var url = window.location.href;
    var url = window.location.pathname;
    url = url.replace("/" + getLangNameByLCID(currentLCID) + "/", "/" + getLangNameByLCID(value) + "/");
    url = url + window.location.search;
    SwitchMUIAndGoTo(value,url);
}

function SwitchMUIAndGoTo(lcidValue,url) {
    var today = new Date();
    var oneYear = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000);
    document.cookie = "lcid=" + lcidValue + ";path=/;expires=" + oneYear.toGMTString();
    window.location.href = url;
}

function getLangNameByLCID(value) {
    switch (value) {
        case 1033:
        case "1033":
            return "En";
        case 1036:
        case "1036":
            return "Fr";
    }
}
