{
  document.writeln('<a name=top></a>');
}

function getCookie(cname)
{
  var s=new String;
  var s2=new String;
  s2=document.cookie+';';
  if (s2.search(cname)>=0)
  {
    s=s2.substr(s2.search(cname)+cname.length+1,255);
    s=s.substr(0,s.search(";"));
  } else {
    s="";
  }
  return s;
}

function langtest()
{
  var s  = new String;
  var s2  = new String;
  s=getCookie("LANG");
  if (s=="") s="hu";
  s2=""+document.location;
  if (s2.search("_"+s)<0)
  {
    s2=s2.replace("_hu","_"+s);
    s2=s2.replace("_en","_"+s);
    s2=s2.replace("_de","_"+s);
    if (top.document.location!=s2) top.document.location=s2;
  }
}

function setlang(s)
{
  document.cookie='LANG='+s+'; Path=/; expires="Tue, 03-Aug-10 00:00:01 GMT"';
  top.document.location=top.document.location;
}

function setCookie(cname, cvalue, refr)
{
  if (document.layers)
  {
    document.cookie='scrolly='+window.scrollY+'; Path=/;';
  } else {
    document.cookie='scrolly='+document.body.scrollTop+'; Path=/;';
  }
  document.cookie=cname+'='+cvalue+'; Path=/;';
  if (refr) { document.location=document.location; }
}

function shownavbar()
{
  var s = new String;
  var s2 = new String;
  var lng = new String;
  s=""+top.document.location;
  s=s.substr(s.search("/_")+5,255);
  if (getCookie("LANG")=="en")
  {
    if (s=='countries.html') s2='Countries';
    if (s=='croatia/index.html') s2='<a href=/_en/countries.html class=navbar>Countries</a> :: Croatia';
  }
  if (getCookie("LANG")=="de")
  {
    if (s=='countries.html') s2='';
    if (s=='croatia/index.html') s2='<a href=/_en/countries.html class=navbar>Countries</a> :: Croatia';
  }
  if (getCookie("LANG")=="hu" || getCookie("LANG")=="")
  {
    if (s=='countries.html') s2='Országok';
    if (s=='croatia/index.html') s2='<a href=/_en/countries.html class=navbar>Országok</a> :: Horvátország';
  }
  document.writeln(s2);
}

function showfoot()
{
  document.writeln("<table width=780 cellspacing=0 cellpadding=0 border=0><tr><td><center><a href=#top><img src=/arc/o_top.gif border=0></a></center>");
  document.writeln("<center><font size=-2>www.info-tourist.com - e-mail: <a href=mailto:infotourist@gmail.com>infotourist@gmail.com</a></font></center></td></tr></table>");
}

function dosearch()
{
  document.cookie="SQUERY="+document.forms["search"].elements["search"].value+"; Path=/;";
  top.document.location="/data/_"+getCookie("LANG")+"_search.html";
}

function chfoto(s,s2)
{
  s3 = new String;
  if (s2.search('.jp')<0) 
  { 
     s3=s2+'.gif'; 
  } else { 
     s3=s2; 
     s2=s2.substring(0,s2.search('.jp'));
  }
  document.images[s2].src=s+'_'+s3;
}

function getLevel(s)
{
  ss=s+"";
  level=0;
  gl_ok=true;
  for (gl_j=0;gl_j<ss.length;gl_j++)
  {
    if (ss.substr(gl_j,1)=='.' && gl_ok) 
    {
      level++;
    } else gl_ok=false;
  }
  return level;
}

function isParent(iph_alevel,iph_i,a)
{
  iph_res=true;
  if (iph_i<=iph_alevel)
  {
    for (j=iph_i+1;j<=iph_alevel;j++)
    {
      if (getLevel(a[j])<=getLevel(a[iph_i])) iph_res=false;
    }
  } else {
    iph_res=false;
  }
  return iph_res;
}

function isChild(ich_alevel,ich_i,a)
{
  ich_res=false;
  if (isParent(ich_i,ich_alevel,a))
  {
    if (getLevel(a[ich_i])==getLevel(a[ich_alevel])+1) 
    {
      ich_res=true;
    } 
  }
  return ich_res;
}

function moreOnThisLevel(i,a,alev)
{
  ok=true;
  res=false;
  for (jj=i+1;jj<a.length;jj++)
  {
    if (getLevel(a[jj])<alev) ok=false;
    if (getLevel(a[jj])==alev && ok) res=true;
  }
  return res;
}

function isOnSameLevel(iso_alev,iso_i,a)
{
  iso_res=true;
  jjj=iso_alev;
   
  while (jjj!=iso_i)
  {
    if (getLevel(a[jjj])<getLevel(a[iso_alev])) iso_res=false;
    if (jjj<iso_i) { jjj++; } else { jjj--; }
  }
  return iso_res && getLevel(a[iso_i])==getLevel(a[iso_alev]);
}

function showFa(a)
{
  document.writeln('<img src=/arc/fa_teto.gif width=12 height=12 border=0><br>');
  alevel=document.location+"?";
  alevel=alevel.substr(alevel.indexOf('?')+1,255);
  alevel=alevel.substr(0,alevel.indexOf('?'));
  nok=false;
  i=0;
  while (i<a.length)
  {
    for (j=0;j<getLevel(a[i]);j++)
    {
      if (moreOnThisLevel(i,a,j))
      {
        document.write('<img src=/arc/fa_vonal.gif width=12 height=25 align=middle border=0 spacing=0>');
      } else {
        document.write('<img src=/arc/fa_semmi.gif width=12 height=25 align=middle border=0 spacing=0>');
      }
    }
    if (moreOnThisLevel(i,a, getLevel(a[i]))) {
      document.write('<img src=/arc/fa_T.gif width=12 height=25 align=middle border=0 spacing=0>');
    } else {
      document.write('<img src=/arc/fa_L.gif width=12 height=25 align=middle border=0 spacing=0>');
    }
    if (getLevel(a[i])<getLevel(a[i+1])) {
      if (getCookie('FA'+i)=='on')
      {
        s='/arc/fa_minus.gif';
      } else {
        s='/arc/fa_plus.gif';
      }
    } else {
      s='/arc/fa_link.gif';
    }
    document.write('<img src='+s+' width=12 height=25 align=middle border=0>');

    if (a[i].indexOf('`')<0)
    {
      if (getCookie('FA'+i)!='on')
      {
        s='javascript:setCookie("FA'+i+'","on",true);';
      } else {
        s='javascript:setCookie("FA'+i+'","off",true);';
      }
      document.writeln(' <a class=directory href='+s+'>'+a[i].substr(getLevel(a[i])),'</a><BR>');
    } else {
      s=a[i].substr(getLevel(a[i]));
      t=s.substr(s.indexOf('`')+1);
      s=s.substr(0,s.indexOf('`'));
      document.writeln(' <a target=_TOP class=file href='+t+'>'+s+'</a><BR>');
    }
    if (getCookie('FA'+i)!='on')
    {
      alevel=getLevel(a[i]);
      i++;
      while (getLevel(a[i])>alevel && (i<a.length))
      { 
        i++;
      }
    } else {
      i++;
    }
  }
  window.scrollTo(0,Number(getCookie('scrolly')));
}