  timer = new Array();    //czasy dla rozwijanego menu
  var tm;                //czas dla paska menu - przezroczysty czy nie
  var tt;                //czas dla funkcji przewijajacej tekst
  var k=0;               //w zaleznosci od funkcji zmienna okresla co innego
  var pok;
  var t=-85;  //polozenie obrazka na stronie palac
  var znak=-1;  //okresla czy fotka na stronie palac przewija się w gore czy w dol
  var z=1;       //fotka na stronie szef kuchni poleca
  var his=1;    //ktora mini-fotka na stronie historia
  var mapka=1;   //ktora mapa

  function przewin(p)        //przewija ramke z tekstem
  {
      if (p==0){i=3;j=k+3;}else{i=-3;j=k-3;}
          window.moja.scrollBy(0,i);
      k=j;
      tt=setTimeout('przewin('+ p+');',30);
  }

  function odswiez()
  {
      window.frames[0].location.href ='text.htm';

  }

  function znikaj()   //chowa wszystkie podmenu
  {
      styl('tlo2','ukryty');
      styl('tlo3','ukryty');
      styl('tlo4','ukryty');
      styl('tlo6','ukryty');
      styl('tlo7','ukryty');
  }
  function pokaz(co , i)
  {
    if (co!='tlo2'){styl('tlo2','ukryty');}
    if (co!='tlo3'){styl('tlo3','ukryty');}
    if (co!='tlo4'){styl('tlo4','ukryty');}
    if (co!='tlo6'){styl('tlo6','ukryty');}
    if (co!='tlo7'){styl('tlo7','ukryty');}
    try{clearTimeout(timer[0]);}catch(e){}
    try{clearTimeout(timer[1]);}catch(e){}
    try{clearTimeout(timer[2]);}catch(e){}
    try{clearTimeout(timer[3]);}catch(e){}
    try{clearTimeout(timer[4]);}catch(e){}
    try{clearTimeout(tm);}catch(e){}
    styl(co,'odkryty');
    timer[i]=setTimeout("styl('"+co+"','ukryty');", 3000);
    m('block');
  }

  function styl(i, wartosc)
  {
    document.getElementById(i).className=wartosc;
  }

  function m(wartosc)      //chowa pasek menu
  {
      try{clearTimeout(tm);}catch(e){}
      document.images['menu'].style.display=wartosc;
  }

  function wylacz()    //ustawia czas znikniecie dla paska menu
  {
      tm=setTimeout("m('none');",3000);

  }

  function wyl(co, i)
  {
      timer[i]=setTimeout("styl('"+co+"','ukryty');",3000);
      wylacz();
  }

  function pokoj()     //przewija zdjecie na stronie pokoj
  {
     if (t==-85){znak=-1;}
     if (t==-285){znak=1;}
     t=t+znak;
     document.getElementById("foto").style.top=t+'px';
     setTimeout('pokoj();', 20);
  }
  function podmien()   //podmienia mini-fotki - strona szef kuchni poleca
  {
    if (z==1){
    document.getElementById("mini").style.display='none';
    document.getElementById("mini2").style.display='block';
    z=0;}
    else{
    document.getElementById("mini").style.display='block';
    document.getElementById("mini2").style.display='none';
    z=1;
    }
    setTimeout('podmien();',10000);

  }
  function przekieruj(nazwa, lang)   //funkja do okolicy, podmienia tekst i mini-fotke
  {
    document.images['fotka'].src='foto/'+nazwa+'.jpg';
    window.frames[0].location.href ='text.php?id='+nazwa+'&lang='+lang;
    if(nazwa=='safari'){m='8_4';}
    else if(nazwa=='umocniony'){m='8_3';}
    else if(nazwa=='szewc'){m='8_2';}
    else {m='8_1';}
    document.getElementById("okol").href='strona.php?id=foto&lang='+lang+'&idf='+m;
    document.getElementById("okol2").href='strona.php?id=foto&lang='+lang+'&idf='+m;

  }
  function zmieniaj()  //podmienia mini-fotki na stronie historia
  {
     his=his+1;
     if(his==4){his=1;}
     document.images['hist'].src='foto/his'+his+'.jpg';
     setTimeout('zmieniaj();', 10000);
  }
  function chowaj(k)    //chowa wszystkie menu
  {
      document.getElementById('a'+k).style.display='block';
      for (i=1; i<14; i++)
      {
        if(i!=k){
        j='a'+i;
        document.getElementById(j).style.display='none';}
      }
  }

  function palac(nazwa,nr,lang) //dla strony Rekreacja-Pałac, odslania duze zdjecie, wczytueje male i tekst
  {
      document.images['foto'].src='foto/b'+nazwa+'.jpg';
      document.images['zmienny'].src='foto/m'+nazwa+'.jpg';
      document.getElementById("a13").style.display='block';
      document.getElementById("linki1").style.display='none';
      document.getElementById("linki2").style.display='none';
      document.getElementById("ramka2").style.display='block';
      document.getElementById("gal").style.display='block';
      window.frames[0].location.href ='text.php?id='+nazwa+'&lang='+lang;
      document.getElementById("powrot").style.display='block';
      document.getElementById("rolka1").style.display='block';
      document.getElementById("rolka2").style.display='block';
  }
  function wracaj() //dla strony Rekreacja-Pałac, chowa duze zdjecie
  {
      document.images['foto'].src='foto/palacgl.jpg';
      document.getElementById("a13").style.display='none';
      document.getElementById("linki1").style.display='block';
      document.getElementById("linki2").style.display='block';
      document.getElementById("ramka2").style.display='none';
      document.getElementById("gal").style.display='none';
      document.getElementById("powrot").style.display='none';
      document.getElementById("rolka1").style.display='none';
      document.getElementById("rolka2").style.display='none';

  }

  function mapa(k)           //funkcja ustawia foto + linki na stronie dojazd
  {
      mapka=mapka+k;
      document.images['fotka'].src='foto/mapa'+mapka+'.jpg';
      if (mapka==3){document.getElementById("m1").style.display='none';}
        else{document.getElementById("m1").style.display='block';}
      if (mapka==1){document.getElementById("m2").style.display='none';}
        else{document.getElementById("m2").style.display='block';}
      document.getElementById("m3").href='podstrony/druk.php?nr='+mapka;
  }
  function big()          //wyswietla diva z duzym zdjeciem w galerii
  {
      document.getElementById("g").style.display='none';
      document.getElementById("foto").style.display='block';
      document.getElementById("powrot2").style.display='block';
      document.getElementById("powrot").style.display='none';
      document.getElementById("p").style.display='block';
      var a=big.arguments; var j=a.length;
      k=a[1]+1;
      document.images['fotka'].src='../data/1_9/gallery/' + a[0] +'/'+ a[k]+'big.jpg';
      var m="'"+a[0]+"',"+(a[1]+1);
      var n="'"+a[0]+"',"+(a[1]-1);
      for (i=2; i<j; i++)
        { m=m+ ',' + a[i];
        n=n+ ',' + a[i]; }
      if (a[1]>1){document.getElementById("p1").style.display='block';}else{document.getElementById("p1").style.display='none';}
      if (a[1]==(j-2)){document.getElementById("p2").style.display='none';}else{document.getElementById("p2").style.display='block';}
      document.getElementById("pop").href='javascript:big('+n+')';
      document.getElementById("nas").href='javascript:big('+m+')';
  }
  function mini()        //odkrywa diva z miniaturami w galerii
  {
      document.getElementById("g").style.display='block';
      document.getElementById("foto").style.display='none';
      document.getElementById("powrot2").style.display='none';
      document.getElementById("powrot").style.display='block';
      document.getElementById("p").style.display='none';
      document.getElementById("p1").style.display='none';
      document.getElementById("p2").style.display='none';
  }
  function flagi(sc)       //ustawia linki dla stron w galerii dla linkow jezykowych
  {
      if(sc=='pl'){s1='gb'; s2='de';}
      if(sc=='de'){s1='pl'; s2='gb';}
      if(sc=='gb'){s1='pl'; s2='de';}
      document.getElementById("fl1").href='strona.php?id=galeria&lang='+s1;
      document.getElementById("fl2").href='strona.php?id=galeria&lang='+s2;
  }

  function trim(inputString)
 {
   if (typeof inputString != "string") return inputString;
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") {
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length - 1, retValue.length);
   while (ch == " ") {
      retValue = retValue.substring(0, retValue.length - 1);
      ch = retValue.substring(retValue.length - 1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) {
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ") + 1, retValue.length);
   }
   return retValue;
  }
  function poprawny(lang, f)          //poprawnosc danych dla 'adresu'
  {
      if (document.forms[0][0].value.indexOf('@',0) == -1 ||
      document.forms[0][0].value.indexOf('.',0) == -1 || trim(document.forms[0][1].value)=='')
      {
         if (lang=='pl'){l='Wypełnij wszystkie pola';}
           else if (lang== 'de'){l='Bitte Email?Adresse eingeben';}
             else {l='Wrong e-mail address';}
         alert(l);
      }
      else{
         document.forms[f].submit(); }
  }

function poprawny2(lang, f)   // poprawnosc danych dla newsetlera
  {
      if (document.forms[f][0].value.indexOf('@',0) == -1 ||
      document.forms[f][0].value.indexOf('.',0) == -1)
      {
         if (lang=='pl'){l='Niepoprawny e-mail';}
           else if (lang== 'de'){l='Bitte Email?Adresse eingeben';}
             else {l='Wrong e-mail address';}
         alert(l);
      }
      else{
         if(f==0){
         ;//document.forms[0].action='../panel/newsletter/edycja/dodaj.php?email='+document.forms[0][0].value;
         }
         document.forms[f].submit(); }
  }

