function showMessage(message) {
    var container = $('#messageBox');
    container.children(".data").html(message);
    $.blockUI({message: container, css: { width: '275px' }});
}
function switchLocale(language) {
    try{
        $.get("/front/setPrevLangToSession", function(data){
            switchLocaleAction(language);
        });
    } catch (e) {
        switchLocaleAction(language);
    }
}
function switchLocaleAction(language) {
    var url = window.location.href;
    if (url.indexOf("?") != -1) {
        if (url.indexOf("lang=") != -1) {
            window.location.href = url.substring(0, url.indexOf("lang=")) + "lang=" + language;
        } else {
            window.location.href = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + window.location.pathname + window.location.search + "&lang=" + language;
        }
    } else {
        window.location.href = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + window.location.pathname + "?lang=" + language;
    }
    //window.location.href = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + window.location.pathname + "?lang=" + language;
}
