﻿
// TODO: Move to js file reference
function changeLanguage(value) {
    var location = String(document.location);

    // Remove the last "#" in the url.
    var pos = location.lastIndexOf("#");
    if (pos >= 0) {
        location = location.substring(0, pos);
    }

    location = location.replace(/(&)?lng=[^&]*/, "").replace(/\?$|(\?)&/, "$1");
    document.location = location + (/\?/.test(location) ? "&" : "?") + "lng=" + value;
}

jQuery(function() {
    // change language bar
    jQuery('.ChooseLanguage').hover(function() { jQuery('.ChooseLanguage ul').show() },
        function() { jQuery('.ChooseLanguage ul').hide() });
});

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.href);
    if (results == null) {
        return "";
    }
    else {
        return results[1];
    }
}

function openPopup(url, name, width, height, top, left) {
    if (!width) width = 600;
    if (!height) height = 600;
    if (!top) top = 200;
    if (!left) left = 300;

    window.open(url, name, 'height=' + height + ',width=' + width + ',scrollbars=1,resizable=0,top=' + top + ',left=' + left + ',status=yes');
}

function openWindow(url, name, width, height, top, left) {
    if (!width) width = 1024;
    if (!height) height = 800;
    if (!top) top = 50;
    if (!left) left = 100;

    window.open(url, name, 'height=' + height + ',width=' + width + ',top=' + top + ',left=' + left + ',status=1, scrollbars=1,resizable=1, toolbar=1,location=1,menubar=1');
}
