var LAND_URL = "msejf.pl";//todo use this to switch domains!
var SECURE_URL = "moj.msejf.pl"; //todo: use this to switch domains!

/* ##### FAQ ##### */
function getUrlVars() {
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for (var i = 0; i < hashes.length; i++) {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}


$(document).ready(function() {

    var _show = getUrlVars()["show"];

    if (_show) {
        var _box = "";

        if (_show == "ogolne") _box = "faq-box1";
        if (_show == "o_msejf") _box = "faq-box2";
        if (_show == "msejf_dla_firmy") _box = "faq03";
        if (_show == "twoje_konto") _box = "faq-box3";
        if (_show == "instalacja") _box = "faq-box4";
        if (_show == "backup_danych") _box = "faq-box5";
        if (_show == "odzyskiwanie_danych") _box = "faq-box6";
        if (_show == "ustawienia") _box = "faq-box7";
        if (_show == "bezpieczenstwo") _box = "faq-box8";
        if (_show == "lacze_internetowe") _box = "faq-box9";
        if (_show == "platnosci") _box = "faq-box10";
        if (_show == "prezenty_i_promocje") _box = "faq-box11";
        if (_show == "inne") _box = "faq-box12";

        $('#' + _box).show();


        var _q = getUrlVars()["q"];


        $.scrollTo($('#q' + _q), {axis:'y', duration: 1000});

    }
    else {
        $('#faq-box1').show();
    }


});


$(document).ready(function() {

    $('#topic').change(function() {
        var str = "";
        $("#topic option:selected").each(function () {
            str = $(this).text();
            if (str == 'oświadczenie o rozwiązaniu Umowy') {
                $('#content').append('"Niniejszym składam oświadczenie o rozwiązaniu Umowy [z dniem dzisiejszym], zgodnie z Regulaminem Świadczenia Usług przez Msejf Sp. z o.o. Powodem rozwiazania Umowy jest [ ]"');
            } else {
                str = "";
                $('#content').html('');
            }

        });
    });

});


function getHeader() {
    var content = '';

    if ($.cookies.get('MSEJFLANDINPAGECOOKIE') == null) {
        content = "<a class=\"header-links\" href=\"https://" + SECURE_URL + "/login.htm\">zaloguj się</a> lub<a class=\"header-links\" href=\"https://" + SECURE_URL + "/register.htm\">zarejestruj</a>";
    } else {
        content = $.cookies.get('MSEJFLANDINPAGECOOKIE') + "<a class=\"header-links\" href=\"https://" + SECURE_URL + "/Application.jsp#logout\">wyloguj</a>";
    }

    return content;
}


