function SolveNoImg() {
  imgs = document.getElementsByTagName('img');
  for (i=0;i<imgs.length;i++) {
    //if(imgs[i]) imgs[i].onerror = function() { this.src = "./webdata/_tpl1/noimg.gif"; }
  }
}
function getObj(name)
{
  if (document.getElementById)
    {this.obj = document.getElementById(name);
    this.style = document.getElementById(name).style;}
  else if (document.all)
    {this.obj = document.all[name];
    this.style = document.all[name].style;}
  else if (document.layers)
    {this.obj = document.layers[name];
    this.style = document.layers[name];}
}

function hidestyle(whichid)
{
  mainobject = new getObj(whichid);
  if (mainobject.style.display=='none')
    {mainobject.style.display='';}
  else
    {mainobject.style.display='none';}
}
function hidestyleON(whichid)
{
  mainobject = new getObj(whichid);
  mainobject.style.display='none';
}

function hidestyleOFF(whichid)
{
  mainobject = new getObj(whichid);
  mainobject.style.display='';
}

function SwitchImg(whichid,src)
{
  mainobject = new getObj(whichid);
  mainobject.obj.src=src;
}

function ObjClassGet(whichid) {
  mainobject = new getObj(whichid);
  return mainobject.obj.className;
}
function ObjClassSet(whichid,clss) {
  mainobject = new getObj(whichid);
  mainobject.obj.className = clss;
}

function ObjClass(whichid,clss) {
  mainobject = new getObj(whichid);
  mainobject.obj.className = clss;
}

function WindowOpen(uri,w,h) {
  window.open(uri,'','width='+w+',height='+h+',status=yes,resizable=yes,left='+(screen.width/2-w/2)+',top='+(screen.height/2-h/2)+',scrollbars=no');
}
function jsWindowOpen(uri,w,h) {
  window.open(uri,'','width='+w+',height='+h+',status=yes,resizable=yes,left='+(screen.width/2-w/2)+',top='+(screen.height/2-h/2)+',scrollbars=yes,resizable=yes');
}
function FotoOpen(uri,w,h) {
  window.open(uri,'','width='+(w+20)+',height='+(h+20)+',left='+(screen.width/2-w/2-10)+',top='+(screen.height/2-h/2-10)+',status=yes,resizable=yes,scrollbars=no');
}
function GetName(p) {
  var pole = p.split('\\');
  var file = pole[pole.length-1];
  var pole = file.split('.');
  if(pole.length>=2) return pole[pole.length-2];
  if(pole.length>=1) return pole[pole.length-1];
}
function HotelsHideAll(j) {
  for(i=1;i<j;i++) {
    hidestyleOFF('hotels_hotel_'+i+'a');
    hidestyleON('hotels_hotel_'+i+'b');
  }
}
var lastpulldown = '';
function OpenPullDown(whichid) {
  hidestyleOFF(whichid);
  if(lastpulldown!='' && whichid!=lastpulldown) hidestyleON(lastpulldown);
  lastpulldown = whichid;
}
function ClosePullDown() {
  if(lastpulldown!='') hidestyleON(lastpulldown);
}
function KeepPullDown() {
  if(lastpulldown!='') hidestyleOFF(lastpulldown);
}
function CheckEmail(str) {
  var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  return filter.test(str);
}
function WriteMarquee(str) {
  return '<marquee scrolldelay="10" scrollamount="2">'+str+'</marquee>';
}
function CheckValidDate(month, day, year)
{
  var monthLength = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

  if (!day || !month || !year) return false;

  // check for bisestile year
  if (year/4 == parseInt(year/4)) monthLength[1] = 29;

  if (month < 1 || month > 12) return false;

  if (day > monthLength[month-1]) return false;

  return true;
}

function FindMenuItemsToEmph() {
  cntr = 0;
  tmp1 = document.getElementsByTagName('li');
  for(i=0;i<tmp1.length;i++) {
    if(tmp1[i].className=='menutoemph') {
      tmp2 = tmp1[i].getElementsByTagName('a');
      for(j=0;j<tmp2.length;j++) {
        itemstoemph[cntr] = tmp2[j].id;
        cntr++;
      }
    }
  }
}
function EmphMenuItemsLoop(lp) {
  for(i=0;i<itemstoemph.length;i++) {
    ObjClass(itemstoemph[i],lp==1?'actwebmenu':'');
  }
  if(lp==1) lp=0; else lp=1;
  setTimeout('EmphMenuItemsLoop('+lp+')',500);
}
function WriteFlashCodeWithJS(f,w,h,q,b,t) {
  var output="";
  if(window.navigator.userAgent.indexOf("MSIE") != -1 && window.navigator.userAgent.indexOf("Windows") != -1){
    output=output+"<object width=\""+w+"\" height=\""+h+"\" type=\"application/x-shockwave-flash\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\">";
    output=output+"<param name=\"movie\" value=\""+f+"\">";
    output=output+"<param name=\"menu\" value=\"false\">";
    output=output+"<param name=\"bgcolor\" value=\""+b+"'\">";
    output=output+"<param name=\"quality\" value=\""+q+"\">";
    if(t==1) output=output+"<param name=\"wmode\" value=\"transparent\">";
    output=output+"<"+"/object>";
  } else {
    output=output+"<object data=\""+f+"\" width=\""+w+"\" height=\""+h+"\" type=\"application/x-shockwave-flash\">";
    output=output+"<param name=\"movie\" value=\""+f+"\">";
    output=output+"<param name=\"menu\" value=\"false\">";
    output=output+"<param name=\"bgcolor\" value=\""+b+"'\">";
    output=output+"<param name=\"quality\" value=\""+q+"\">";
    if(t==1) output=output+"<param name=\"wmode\" value=\"transparent\">";
    output=output+"<"+"/object>";
  }
  document.write(output);
}


function ChangeZalozka(whichid) {
  if(ObjClassGet(whichid+'a')=='zalozka_on') ObjClassSet(whichid+'a','zalozka_off'); else ObjClassSet(whichid+'a','zalozka_on');
  if(ObjClassGet(whichid+'b')=='zalozka_on') ObjClassSet(whichid+'b','zalozka_off'); else ObjClassSet(whichid+'b','zalozka_on');
}

function loadXMLdata(url) {
  if(window.XMLHttpRequest) {
    xmlhttp=new XMLHttpRequest();
    xmlhttp.onreadystatechange=state_Change;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
  }
  else if(window.ActiveXObject) {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if(xmlhttp) {
      xmlhttp.onreadystatechange=state_Change;
      xmlhttp.open("GET",url,true);
      xmlhttp.send();
    }
  }
  return true;
}

function state_Change() {
  var src,sources,i;
  if(xmlhttp.readyState==4) {
    //if(xmlhttp.status==200) {
      var src = xmlhttp.responseText;
      if(src && src!='') {
        sources = src.split('#nextajax#');
        for(i=0;i<sources.length;i++) {
          var id = sources[i].substring(0,10);
          source = sources[i].substring(10,sources[i].length);
          tmp = source.split('#javascript#');
          if(tmp.length>0) source = tmp[0]; else source = '';
          if(tmp.length>1) javascript = tmp[1]; else javascript = '';
          //pokud nejde jen o js tak vlepit kod dovnitr
          if(id!='noajaxfunc') {
            mainobject = new getObj(id);
            mainobject.obj.innerHTML = source;
          }
          if(javascript) {
            eval(javascript);
          }
        }
      }
      today = new Date();
      //window.status = 'Last AJAX update '+(today.getHours())+':'+(today.getMinutes())+':'+(today.getSeconds());
      //StyleTabletrs();
    //}
  }
}