function Paging(e){
    if(e==0){
        document.getElementById("menu_paging_1").style.background = "url(../layout/img/RamkaAktywnyPrzedzialAlfabetycznyProducenci.png)";
        return false;
    }
    var element = document.getElementById("left_top");
    var e1 = document.getElementById("menu_paging_"+e);
    e1.style.background = "url(../layout/img/RamkaAktywnyPrzedzialAlfabetycznyProducenci.png)";
    if(e!=1){
        document.getElementById("menu_paging_1").style.background = "";
    }
    if(e!=2){
        document.getElementById("menu_paging_2").style.background = "";
    }
    if(e!=3){
        document.getElementById("menu_paging_3").style.background = "";
    }
    if(e!=4){
        document.getElementById("menu_paging_4").style.background = "";
    }
    var ajax = $.ajax({
               url: "engine/left_paging/pages.php",
               global:false,
               type: "GET",
               data: {
                   e: e
               },
               dataType: "html",
               async:false
           }).responseText;
    element.innerHTML=ajax;
    return false;
}
function rozwin_opis(){
    var element = document.getElementById("bottom1");
    var e = document.getElementById("producent_text");
    var all = document.getElementById("all");
    var bottom = document.getElementById("bottom");
    var seo = document.getElementById("seo");
    if(element.clientHeight<=e.scrollHeight+36){
        all.style.height=(all.clientHeight+5)+"px";
        bottom.style.height=(bottom.clientHeight+5)+"px";
        seo.style.height=(seo.clientHeight+5)+"px";
        e.style.height=(e.clientHeight+5)+"px";
        element.style.height=(element.clientHeight+5)+"px";
        var button = document.getElementById("rozwin_button");
        button.innerHTML="<a onclick='zwin_opis();'>zwin</a>";
        setTimeout(rozwin_opis,40);
    }
}
function zwin_opis(){
    var element = document.getElementById("bottom1");
    var e = document.getElementById("producent_text");
    var all = document.getElementById("all");
    var bottom = document.getElementById("bottom");
    var seo = document.getElementById("seo");
    if(element.clientHeight!=180){
        all.style.height=(all.clientHeight-5)+"px";
        bottom.style.height=(bottom.clientHeight-5)+"px";
        seo.style.height=(seo.clientHeight-5)+"px";
        e.style.height=(e.clientHeight-5)+"px";
        element.style.height=(element.clientHeight-5)+"px";
        var button = document.getElementById("rozwin_button");
        button.innerHTML="<a onclick='rozwin_opis();'>rozwin</a>";
        setTimeout(zwin_opis,40);
    }
}
function Close(){
    var element = document.getElementById("flying0");
    element.style.display="none";
    var element1 = document.getElementById("flying1");
    element1.style.display="none";
    return false;
}
function Edit(e){
     var element = document.getElementById("opinia_edit_"+e);
     var element1 = document.getElementById("button_"+e);
     element.innerHTML = "<textarea cols='92' rows='3' id='text'>"+element.innerHTML+"</textarea>";
     element1.innerHTML = "<a href='Zapisz' onclick='return Save("+e+");'>Zapisz</a> ";
     return false;
}
function Save(e){
    var element = document.getElementById("opinia_edit_"+e);
    var element1 = document.getElementById("button_"+e);
    var element2 = document.getElementById("text");
    text = element2.value;
    var ajax = $.ajax({
               url: "engine/dodaj.php",
               global:false,
               type: "POST",
               data: {
                   e: e,
                   text: text
               },
               dataType: "html",
               async:false
           }).responseText;
    element.innerHTML=ajax;
     element1.innerHTML = "<a href='Edytuj' onclick='return Edit("+e+");'>Edytuj</a>";
     return false;
}
function lewa_polowa_click(nr){
    var e = document.getElementById('ocena_hidden');
    var n = nr+nr-1;
    e.value=n;
    var tlo = document.getElementById('male_gwiazdki'+nr);
    tlo.style.background = "url(../layout/img/GwiazdkaPolowka.png)";
}
function prawa_polowa_click(nr){
    var e = document.getElementById('ocena_hidden');
    var n = nr*2;
    e.value=n;
    var tlo = document.getElementById('male_gwiazdki'+nr);
    tlo.style.background = "url(../layout/img/GwiazdkaCala.png)";
}
function link(link){
    window.location=link;
}
function Menu(e){
                if(e=="login"){
                    var element = document.getElementById("flying0");
                    element.style.display="block";
                    var element1 = document.getElementById("flying1");
                    element1.style.display="block";
                    element1.innerHTML="<div style='float:right; width:50px;' align='right'><a href='close' onclick='return Close();'><img src='../layout/img/zamknij.png' width='22px' height='22px' alt=''></a></div>"
                    +"<div style='float:left;width:200px'><span class='logowanie_tekst'>LOGOWANIE</span><br><span class='logowanie_perfumer_tekst'>PERFUMER.PL</span></div>"
                    +"<div style='clear:both;'></div><br>"
                    +"<div id='formLogin1' align='center'>"
                    +"<form method='POST' action='engine/rej_login/login.php' onsubmit='return Check_Login(this);'>"
                    +"<label style='display:block;'>Login:<input type='edit' class='v_login' name='login'></label>"
                    +"<label style='display:block;'>Haslo:<input type='password' class='v_pass' name='pass'></label><br>"
                    +"<input type='submit' value='Log In'>"
                    +"</form><br>"
                    +"<a href='Zarejestruj Sie' class='rej1' onclick='return Menu(this.className)'>Zarejestruj sie</a>"
                    +"</div>";
                }
                if(e=="rej"||e=="rej1"){
                    var element = document.getElementById("flying0");
                    element.style.display="block";
                    var element1 = document.getElementById("flying1");
                    element1.style.display="block";
                    element1.innerHTML="<div style='float:right; width:50px;' align='right'><a href='close' onclick='return Close();'><img src='../layout/img/zamknij.png' width='22px' height='22px' alt=''></a></div>"
                    +"<div style='float:left;width:200px'><span class='logowanie_tekst'>REJESTRACJA</span><br><span class='logowanie_perfumer_tekst'>PERFUMER.PL</span></div>"
                    +"<div style='clear:both;'></div><br>"
                    +"<div class='rej_form' align='center'>"
                    +"<form method='POST' action='engine/rej_login/rej.php' onsubmit='return Check(this)'>"
                    +"<label style='display:block;margin-top:5px;height:25px;'>Imie/Nick <input class='v_nick' type='edit' name='nick' style='float:right;'></label>"
                    +"<label style='display:block;margin-top:5px;height:25px;'>Email <input class='v_email' type='text' name='email' style='float:right;'></label>"
                    +"<label style='display:block;margin-top:5px;height:25px;'>Haslo <input class='v_pass' type='password' name='pass' style='float:right;'></label>"
                    +"<label style='display:block;margin-top:5px;height:25px;'>Powtorz Hasło <input class='v_vpass' type='password' name='verPass' style='float:right;'></label><br>"
                    +"<input type='submit' value='Zarejestruj sie'>"
                    +"</form>"
                    +"</div>";
                }
                return false;
            }
