function preloadMenuImages(){
    preloadedImg = document.createElement('img');
    preloadedImg.setAttribute('src', "http://innominate.pl/i/portal/menu_news_over.jpg");
    preloadedImg = document.createElement('img');
    preloadedImg.setAttribute('src', "http://innominate.pl/i/portal/menu_onas_over.jpg");
    preloadedImg = document.createElement('img');
    preloadedImg.setAttribute('src', "http://innominate.pl/i/portal/menu_raid_over.jpg");
    preloadedImg = document.createElement('img');
    preloadedImg.setAttribute('src', "http://innominate.pl/i/portal/menu_gracze_over.jpg");
    preloadedImg = document.createElement('img');
    preloadedImg.setAttribute('src', "http://innominate.pl/i/portal/menu_dkp_over.jpg");
    preloadedImg = document.createElement('img');
    preloadedImg.setAttribute('src', "http://innominate.pl/i/portal/menu_admin_over.jpg");
    preloadedImg = document.createElement('img');
}

function setVacation(){
    var vacationComment = document.getElementById('UserVacationComment').value;
    if (vacationComment == ''){
        alert("Podaj powód wzięcia wakacji.");
        return false;
    }

    var vacationDate = document.getElementById('vacationDate').value;
    if (vacationDate == '0000-00-00 00:00'){
        alert("Musisz podać przybliżoną datę zakończenia wakacji");
        return false;
    }
    document.UserChangeVacationsForm.submit();
    return true;
}


function acceptApplication(){
    var answer = confirm("Na pewno chcesz zaakceptować to podanie ?\nAkcji tej toważyszy wysłanie maila z informacją o decyzji.");
    if (answer){
        document.getElementById('applicationAction').value = "accept";
        document.ApplicationRespondForm.submit();
    }
    return true;
}

function rejectApplication(){
    var answer = confirm("Na pewno chcesz odrzucić to podanie ?\nAkcji tej toważyszy wysłanie maila z informacją o decyzji.");
    if (answer){
        document.getElementById('applicationAction').value = "reject";
        document.ApplicationRespondForm.submit();
    }
    return true;
}

function sendApplication(){
    var answer = confirm("Na pewno chcesz wysłać maila do tej osoby?");
    if (answer){
        document.getElementById('applicationAction').value = "mail";
        document.ApplicationRespondForm.submit();
    }
    return true;
}

function showOpowiesc(){
    document.getElementById('opowiesc_resp').style.display = "block";
    document.getElementById('w_pigulce_resp').style.display = "none";
}

function showWpigulce(){
    document.getElementById('opowiesc_resp').style.display = "none";
    document.getElementById('w_pigulce_resp').style.display = "block";
}

function toggleWotlk(){
    if (document.getElementById('aboutWotlk').style.display == "none"){
        document.getElementById('aboutWotlk').style.display = "block";
    } else {
        document.getElementById('aboutWotlk').style.display = "none";
    }
}

function toggleTbc(){
    if (document.getElementById('aboutTbc').style.display == "none"){
        document.getElementById('aboutTbc').style.display = "block";
    } else {
        document.getElementById('aboutTbc').style.display = "none";
    }
}

function toggleClassic(){
    if (document.getElementById('aboutClassic').style.display == "none"){
        document.getElementById('aboutClassic').style.display = "block";
    } else {
        document.getElementById('aboutClassic').style.display = "none";
    }
}

function toggleLogout(type){
    if (type == 1){
        document.getElementById('loginLogout').src = "http://innominate.pl/i/portal/btn_logout_over.jpg";
    } else {
        document.getElementById('loginLogout').src = "http://innominate.pl/i/portal/btn_logout.jpg";
    }
}

function toggleAccountChange(type){
    if (type == 1){
        document.getElementById('loginChange').src = "http://innominate.pl/i/portal/btn_change_over.jpg";
    } else {
        document.getElementById('loginChange').src = "http://innominate.pl/i/portal/btn_change.jpg";
    }
}
function toggleLogin(type){
    if (type == 1){
        document.getElementById('loginLogin').src = "http://innominate.pl/i/portal/btn_login_over.jpg";
    } else {
        document.getElementById('loginLogin').src = "http://innominate.pl/i/portal/btn_login.jpg";
    }
}
function toggleApply(type){
    if (type == 1){
        document.getElementById('apply').src = "http://innominate.pl/i/portal/btn_apply_over.jpg";
    } else {
        document.getElementById('apply').src = "http://innominate.pl/i/portal/btn_apply.jpg";
    }
}

function toggleMore(type){
    if (type == 1){
        document.getElementById('filmonateMore').src = "http://innominate.pl/i/portal/btn_more_over.jpg";
    } else {
        document.getElementById('filmonateMore').src = "http://innominate.pl/i/portal/btn_more.jpg";
    }
}
function toggleChangeData(type){
    if (type == 1){
        document.getElementById('accountChangeDataBtn').src = "http://innominate.pl/i/portal/btn_change_data_over.jpg";
    } else {
        document.getElementById('accountChangeDataBtn').src = "http://innominate.pl/i/portal/btn_change_data.jpg";
    }
}
function toggleChangePassword(type){
    if (type == 1){
        document.getElementById('accountChangePasswordBtn').src = "http://innominate.pl/i/portal/btn_change_pass_over.jpg";
    } else {
        document.getElementById('accountChangePasswordBtn').src = "http://innominate.pl/i/portal/btn_change_pass.jpg";
    }
}
function toggleDeactivateVac(type){
    if (type == 1){
        document.getElementById('accountDeactivateVacBtn').src = "http://innominate.pl/i/portal/btn_deactivate_vac_over.jpg";
    } else {
        document.getElementById('accountDeactivateVacBtn').src = "http://innominate.pl/i/portal/btn_deactivate_vac.jpg";
    }
}
function toggleActivateVac(type){
    if (type == 1){
        document.getElementById('accountActivateVacBtn').src = "http://innominate.pl/i/portal/btn_activate_vac_over.jpg";
    } else {
        document.getElementById('accountActivateVacBtn').src = "http://innominate.pl/i/portal/btn_activate_vac.jpg";
    }
}
function displayTime(){
    if (seconds<=0){
        seconds=9
        minutes-=1
    }
    if (minutes<=-1){
        seconds=0
        minutes+=1
    }
    else
        milisec-=1
    document.counter.d2.value=seconds+"."+milisec
    setTimeout("display()",100)
}

function display_c(start){
    window.start = parseFloat(start);
    var end = 0 // change this to stop the counter at a higher value
    var refresh = 1000; // Refresh rate in milli seconds
    if(window.start >= end ){
        mytime = setTimeout('display_ct()',refresh)
    } else {
        document.getElementById('naviTime').innerHTML = 'Brak nierozpoczętych rajdów';
    }
}

function display_ct() {
    // Calculate the number of days left
    var days = Math.floor(window.start / 86400);
    // After deducting the days calculate the number of hours left
    var hours = Math.floor((window.start - (days * 86400 ))/3600)
    // After days and hours , how many minutes are left
    var minutes = Math.floor((window.start - (days * 86400 ) - (hours *3600 ))/60)
    // Finally how many seconds left after removing days, hours and minutes.
    var secs = Math.floor((window.start - (days * 86400 ) - (hours *3600 ) - (minutes*60)))

    var x = "";
    var times = 0;
    if (days > 0){
        x = days + " dni ";
        times++;
    }
    if (hours > 0 ){
        x += hours + " godz ";
        times++;
    }
    if (minutes > 0 && times < 2){
        x += minutes + " min ";
        times++;
    }
    if (secs > 0 && times < 2){
        x += secs + " sek ";
    }

    if (days == 0 && hours == 0){
        document.getElementById('naviTime').className = 'naviTime1';
    }
    if (days == 0 && hours == 0 && minutes < 31){
        document.getElementById('naviTime').className = 'naviTime2';
    }

    document.getElementById('raidTimer').innerHTML = x;
    window.start = window.start- 1;

    tt=display_c(window.start);
}

function toggleSignup(type){
    if (type == 1){
        document.getElementById('signup').src = "http://innominate.pl/i/portal/btn_bede_over.jpg";
    } else {
        document.getElementById('signup').src = "http://innominate.pl/i/portal/btn_bede.jpg";
    }
}
function toggleSignout(type){
    if (type == 1){
        document.getElementById('signout').src = "http://innominate.pl/i/portal/btn_nmp_over.jpg";
    } else {
        document.getElementById('signout').src = "http://innominate.pl/i/portal/btn_nmp.jpg";
    }
}
function toggleSignFree(type){
    if (type == 1){
        document.getElementById('signFree').src = "http://innominate.pl/i/portal/btn_jnw_over.jpg";
    } else {
        document.getElementById('signFree').src = "http://innominate.pl/i/portal/btn_jnw.jpg";
    }
}

function toggleSend(type){
    if (type == 1){
        document.getElementById('send').src = "http://innominate.pl/i/portal/btn_send_over.jpg";
    } else {
        document.getElementById('send').src = "http://innominate.pl/i/portal/btn_send.jpg";
    }
}

function singup(){
    document.getElementById('status').value = 1;
    document.RaidSignupForm.submit();
    return true;
}
function singout(){
    document.getElementById('status').value = 2;
    document.RaidSignupForm.submit();
    return true;
}
function singFree(){
    document.getElementById('status').value = 0;
    document.RaidSignupForm.submit();
    return true;
}
function sendQuestion(){
    document.ContactAddForm.submit();
    return true;
}
function sendContactResponse(){
    var answer = confirm("Na pewno chcesz wysłać taką odpowiedź?");
    if (answer){
        document.ContactRespondForm.submit();
    }
    return true;
}
function saveFreq(){
    document.getElementById('is_ended').value = '0';
    document.RaidEndRaidForm.submit();
    return true;
}

function endRaid(){
    document.getElementById('is_ended').value = '1';
    document.RaidEndRaidForm.submit();
    return true;
}

function sendComment(){
    document.CommentAddForm.submit();
    return true;
}

function changeToPvP(){
}
