mainPanelWidth = 950;
mainPanelMarginTop = 0;

boxFontSize = 13;

contentWidth = 680;
contentHeight = 380;

switch(screen.width) {
    case 1920:
    case 1680:
    case 1600:
    case 1440:
    case 1400:
        mainPanelWidth = 1330;
        mainPanelMarginTop = 10;
        contentWidth = 1088;
        contentHeight = 500;
        boxFontSize = 15;
        break;

    case 1366:
    case 1280:
        mainPanelWidth = 1230;
        mainPanelMarginTop = 0;
        boxFontSize = 13;
        contentWidth = 980;
        contentHeight = 380;

        break;
}

logoLeft = mainPanelWidth - 204;
boxWidth = mainPanelWidth - contentWidth - 20;
flagPLMarginLeft = mainPanelWidth - 70;
panoramicartTop = 120 + contentHeight;
contentLeft = mainPanelWidth - contentWidth;

function resizeSite() {
    document.getElementById("mainPanel").style.marginTop = mainPanelMarginTop + "px";
    document.getElementById("mainPanel").style.width = mainPanelWidth + "px";
    document.getElementById("logo").style.left = logoLeft +"px";
    document.getElementById("flagPL").style.marginLeft = flagPLMarginLeft + "px";
    document.getElementById("box").style.width = boxWidth + "px";
    document.getElementById("box").style.height = contentHeight + "px";
    document.getElementById("content").style.width = contentWidth + "px";
    document.getElementById("content").style.height = contentHeight + "px";
    document.getElementById("content").style.left = contentLeft + "px";
    document.getElementById("preloader").style.width = contentWidth + "px";
    document.getElementById("preloader").style.height = contentHeight + "px";
    document.getElementById("preloader").style.left = contentLeft + "px";
    document.getElementById("panoramicart").style.top = panoramicartTop + "px";
    document.getElementById("box").style.fontSize = boxFontSize + "px";
}

function rewriteLinks() {
    document.getElementById("linkAktualnosci").href = "#";
    document.getElementById("linkOProjekcie").href = "#";
    //document.getElementById("linkDodaj").href = "#";
    document.getElementById("linkKontakt").href = "#";
    document.getElementById("linkReklama").href = "#";
    document.getElementById("linkGlowny").href = "#";
    if(document.getElementById("mailingForm")!=null) {
        document.getElementById("mailingForm").action = null;
    }
}

function bigPartners() {
    document.getElementById("")
}

function GetXmlHttpObject()
{
    if (window.XMLHttpRequest)
    {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        return new XMLHttpRequest();
    }
    if (window.ActiveXObject)
    {
        // code for IE6, IE5
        return new ActiveXObject("Microsoft.XMLHTTP");
    }
    return null;
}

function showBox(boxId,param) {

    if(boxId!='glowna' && boxId!='aktualnosci' && boxId!='oprojekcie' && boxId!='reklama' && boxId!='kontakt') return;

    var ajax = GetXmlHttpObject();
    ajax.onreadystatechange = function() {
        if(ajax.readyState == 4) {
            document.getElementById("loading").style.display = "none";
            document.getElementById("box").innerHTML = ajax.responseText;
            document.getElementById("box").style.display = "block";
        }
    }
    ajax.open("POST","box_"+boxId+".php",true);
    ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    if(param==null) {
        ajax.send(null);
    }
    else {
        ajax.send("param="+param);
    }
    document.getElementById("box").style.display = "none";
    document.getElementById("loading").style.display = "block";
    document.getElementById("flash").focus();
}

function addEmail() {
    if(document.getElementById("mailing") == null) return;
    var email = document.getElementById("mailing").value;
    var ajax_email = GetXmlHttpObject();
    ajax_email.onreadystatechange = function() {
        if(ajax_email.readyState == 4) {
            if(ajax_email.responseText == 'TRUE') {
                document.getElementById("mailingStatus").innerHTML = 'Dziękujemy, adres został dodany.';
            } else if(ajax_email.responseText == 'FALSE1') {
                document.getElementById("mailingStatus").innerHTML = 'Nieprawidłowy adres.';
            } else if(ajax_email.responseText == 'FALSE2') {
                document.getElementById("mailingStatus").innerHTML = 'Adres jest już w naszej bazie danych.';
            }
        }
    }

    var query = "email="+email;
    document.getElementById("mailingStatus").innerHTML = 'Trwa sprawdzanie adresu...';
    ajax_email.open("POST","box_add_email.php",true);
    ajax_email.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    ajax_email.send(query);
}

function sendForm() {

    document.getElementById("formStatus").innerHTML = 'Wysyłanie...';
    if(document.getElementById("contactForm") == null) return;

    var imie = document.getElementById("imie").value;
    var telefon = document.getElementById("telefon").value;
    var email = document.getElementById("email").value;
    var tresc = document.getElementById("tresc").value;
    var temat = document.getElementById("temat").value;

    var ajax_contactForm = GetXmlHttpObject();
    ajax_contactForm.onreadystatechange = function() {
        if(ajax_contactForm.readyState == 4) {
            if(ajax_contactForm.responseText == '0') {
                document.getElementById("formStatus").innerHTML = 'Dziękujemy, formularz został wysłany.';
            } else if(ajax_contactForm.responseText == '1') {
                document.getElementById("formStatus").innerHTML = 'Proszę poprawnie wypełnić wszystkie pola.';
            } else if(ajax_contactForm.responseText == '2') {
                document.getElementById("formStatus").innerHTML = 'Wystąpił błąd podczas wysyłania formuarza. Prosimy o kontakt pod adresem <a href="mailto:biuro@panoramicart.pl">biuro@panoramicart.pl</a>.';
            } else if(ajax_contactForm.responseText == '3') {
                document.getElementById("formStatus").innerHTML = 'Proszę podać prawidłowy adres e-mail.';
            } 
        }
    }
    var query = "temat="+temat+"&imie="+imie+"&telefon="+telefon+"&liame="+email+"&tresc="+tresc;
    ajax_contactForm.open("POST","box_formsend.php",true);
    ajax_contactForm.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    ajax_contactForm.send(query);
}

function showHelp() {
    //setTimeout('document.getElementById("content").style.top = "-7000px"',1000);
    document.getElementById("content").style.top = "-7000px";
    
//setTimeout('document.getElementById("content").style.top = "-7000px"',4000);
//setTimeout('document.getElementById("content").style.top = "100px"',8000);
}