        function PANEL(){
        window.open("/panel_klient/index.php","PANEL","scrollbars=1,resizable=1,width="+screen.width+",height="+screen.height+",");
        }
        
        
        function Helptxt(txt){
                if(txt!=""){
                document.getElementById("help").innerHTML=txt;
                }
        }
        
        function home(){
                window.location="/";
        }
        
        function porownajObiekty(num){
          por = "porownaj["+num+"]";
          createCookie(por,num,10);
                window.open("/porownanie.php","OBIEKTY","scrollbars=1,resizable=1,width="+screen.width+",height="+screen.height+",");
        }
        
        function wiecejRamka(){
               
                var stylMiastoOpis = document.getElementById("opis_miasto").className;
                
                if(stylMiastoOpis=="ramka"){
                        document.getElementById("opis_miasto").className="ramka_wstep";
                }
                else{
                        document.getElementById("opis_miasto").className="ramka";
                }
               // document.getElementById("opis_miasto").class=ramka;
        }
        
        
        function zakladka(zkl){
                document.getElementById("ztxt").value=zkl;
                for(var z=1; z<=6; z++){
                        if(z==zkl){
                        document.getElementById("z"+zkl).className="menu_Actvz";
                        }
                        else{
                        document.getElementById("z"+z).className="menu";
                        }
                }
                
                wczytajzkl();
        }
        
        function selWoj(num){
                document.getElementById("wojSel").value=num;
                selected=true;
                wczytajMiasta();
        }
        function podWoj(num){
        for(var w=1; w<=16; w++){
        document.getElementById("tagMiasto_"+w).style.color="#555555";
        }
        
        
        document.getElementById("tagMiasto_"+num).style.color="red";
        }
        function wyczyscWojSel(num){
        document.getElementById("tagMiasto_"+num).style.color="black";
        }
        
        function Active(zak){
              var jak = document.getElementById(zak).style.display;
              if(jak=='block'){
                document.getElementById(zak).style.display="none";
              }
                else{
                document.getElementById(zak).style.display="block";
                }
        }
        
        function Polecaj(num){
        //alert("Opcja chwilowo niedostępna.");
        var jroz = document.getElementById("polecaj").style.height;
        
        if(jroz=="150px"){
        
        zwin(150);
        
         }
         else{
         document.getElementById("polecaj").style.display="block";
          rozwin(5);
         }
         
        }
        function rozwin(n){
       // var nn;
        if(n<=150){
                if(n==150){ document.getElementById("polecajContent").style.display="block";  }
                document.getElementById("polecaj").style.height=n+"px";
                nn = n+5;
        setTimeout('rozwin('+nn+')',10);
         }
        }
        function zwin(n){
       // var nn;
        if(n>0){
                nn = n-5;
                if(n==150){ document.getElementById("polecajContent").style.display="none";  }
                document.getElementById("polecaj").style.height=n+"px";
                setTimeout('zwin('+nn+')',10);
         }
         else{
         document.getElementById("polecaj").style.display="none";
         }
        }
        
        
        function PrintOffert(num){
        alert("Wydruk wpisu chwilowo niedostępny.");
        }
        
        function wczytajzkl()
        {
         ADRES = location.toString();
        z = ADRES.indexOf("/", 10);
        domenawpis = ADRES.substring(0,z);
       
        if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
  {

    //http://localhost/_kalendarz/
    Idobj = encodeURIComponent(document.getElementById("Obiekt").value);
    zakladkat = encodeURIComponent(document.getElementById("ztxt").value);
    xmlHttp.open("GET", domenawpis+"/Ajax/zkl.php?Id="+Idobj+"&Z="+zakladkat+"&tm="+JSClock(), true);
    xmlHttp.onreadystatechange = wczytajZKL;
    //xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlHttp.send(null);
  }
  else
    setTimeout('wczytajzkl()', 1000);
}


function wczytajZKL() 
{
  if (xmlHttp.readyState == 4) 
  {
    if (xmlHttp.status == 200)
    {
      xmlResponse = xmlHttp.responseXML;
      xmlDocumentElement = xmlResponse.documentElement;
      helloMessage = xmlDocumentElement.firstChild.data;
    document.getElementById("txt_zakldka").innerHTML =  helloMessage ;
    }
    else
    {
      alert("Wystąpił błąd podczas uzyskiwania dostępu do serwera zamownocleg.pl");
    }
  }
}

function wczytajMiasta()
{
        ADRES = location.toString();
        z = ADRES.indexOf("/", 10);
        domenawpis = ADRES.substring(0,z);
        
  if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
  {
    WojWbr = encodeURIComponent(document.getElementById("wojSel").value);
    xmlHttp.open("GET", domenawpis+"/Ajax/miasta.php?Id="+WojWbr+"&tm="+JSClock(), true);
    xmlHttp.onreadystatechange = wczytajMiastaWyn;
    //xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlHttp.send(null);
  }
  else
    setTimeout('wczytajMiasta()', 1000);
}

function wczytajMiastaBox()
{
         ADRES = location.toString();
        z = ADRES.indexOf("/", 10);
        domenawpis = ADRES.substring(0,z);
  if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
  {
    WojWbr = encodeURIComponent(document.getElementById("wojSel").value);
    xmlHttp.open("GET", domenawpis+"/Ajax/miasta.php?Id="+WojWbr+"&tm="+JSClock()+"&box=1", true);
    xmlHttp.onreadystatechange = wczytajMiastaWyn;
    //xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlHttp.send(null);
  }
  else
    setTimeout('wczytajMiastaBox()', 1000);
}

function wczytajMiastaWyn()
{
  if (xmlHttp.readyState == 4) 
  {
    if (xmlHttp.status == 200)
    {
      xmlResponse = xmlHttp.responseXML;
      xmlDocumentElement = xmlResponse.documentElement;
      helloMessage = xmlDocumentElement.firstChild.data;
    document.getElementById("miastaWybrane").innerHTML =  helloMessage ;
    }
    else
    {
      alert("Wystąpił błąd podczas uzyskiwania dostępu do serwera zamownocleg.pl");
    }
  }
}


        /*********************************************************/
        function schowek(num){
              //  var sch = "schowk["+num+"]";
               // createCookie(sch,num,10);
               // alert("Obiekt dodano do schowka.");
              // alert("W przygotowaniu.");
               
               window.location="http://www.zamownocleg.pl/schowek.php?Id="+num;
               
        }
              
                
        function delSchowek(num){
                alert("Obiekt został usuniety z schowka.");
                eraseCookie('schowk['+num+']');
        }


        /**************************************************************************/


  function createCookie(name,value,days) {
       
            if (days) {
                var date = new Date();
                date.setTime(date.getTime()+(days*24*60*60*1000));
                var expires = "; expires="+date.toGMTString();    }
            else var expires = "";
            document.cookie = name+"="+value+expires+"; path=/";
        }

        function readCookie(name) {
            var nameEQ = name + "=";
            var ca = document.cookie.split(';');
            for(var i=0;i < ca.length;i++) {
                var c = ca[i];
                while (c.charAt(0)==' ') c = c.substring(1,c.length);
                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
            }
            return null;
        }

        function eraseCookie(name) {
            createCookie(name,"",-1);
        }
        
        function ocena(pkt){
                for(var i=1;i<=5;i++){
                        if(i<=pkt){
                        document.getElementById("gw_"+i).src="gfx/g1.gif";
                        }
                        else{
                        document.getElementById("gw_"+i).src="gfx/g0.gif";
                        }
                }
        }
        
        
function glos(glos,idf)
{
        ADRES = location.toString();
        z = ADRES.indexOf("/", 10);
        domenaglos = ADRES.substring(0,z);
  if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
  {
  var idf = idf;
        xmlHttp.open("GET", domenaglos+"/Ajax/ocena.php?idf="+idf+"&glos="+glos, true);
      xmlHttp.onreadystatechange = handleRequestStateChangeGlos;
      xmlHttp.send(null);
      //setTimeout('UserInfo()', 1000);
           }
 else{
  setTimeout('glos('+glos+','+idf+')', 1000);
 }
}

function handleRequestStateChangeGlos()
{
  if (xmlHttp.readyState == 4) 
  {
    if (xmlHttp.status == 200) 
    {
      try
      {
        handleServerResponseGlos();
      }
      catch(e)
      {
       alert("Błąd odczytu odpowiedzi: yy" + e.toString());
      }
    } 
    else
    {
      alert("Pojawił się problem w uzyskaniu danych:\n" +xmlHttp.statusText);
    }
  }
}

// obsługuje odpowiedź otrzymaną z serwera
function handleServerResponseGlos()
{
  var xmlResponse = xmlHttp.responseXML;
  xmlRoot = xmlResponse.documentElement;  
  infoArray = xmlRoot.getElementsByTagName("kom");
  document.getElementById("InfoGlos").innerHTML = infoArray.item(0).firstChild.data;
}

function loadajaxmiasta(){

        miasto = document.getElementById("wojSel").value;
        if(miasto>0){
        setTimeout('wczytajMiasta()', 1000);
             
        }

}
