function emil(id,jm,dom2,dom1,param){
  if(dom1==''){
    dom1='cz';
  }
  adr=jm+'@'+dom2+'.'+dom1;
  href='mailto:'+adr;
  if(param){href+= '?'+param;}
  document.getElementById(id).href=href;
  document.getElementById(id).innerHTML=adr;
}



function i(id,w,h){
  sw=screen.width;
  sh=screen.height;
  wid=Math.min(w,sw);
  hei=Math.min(h,sh);
  tp=(sh-hei)/2;
  le=(sw-wid)/2;
  url='/index.php?i='+id+'&w='+w+'&h='+h;
  vla='width='+wid+',height='+hei+',toolbar=no, ';
  vla+='menubar=no, location=no, scrollbars=auto, resize=yes, ';
  vla+='top='+tp+', left='+le;
  window.open(url,'foto',vla);
}


var kam1;//global
function redir(kam){
  kam1=kam;
  setTimeout("redir1()",1000);
}
function redir1(){
  document.location=kam1;
}

function max3(a,b,c){
  ab=Math.max(a,b);
  bc=Math.max(b,c);
  return Math.max(ab,bc);
}


function build(){
  debug=0;
  hMin=600;
  


  if(document.getElementById('left')){
    hLeft=document.getElementById('left').offsetHeight;
    
    if(document.getElementById('left_in')){
      hLeftIn=document.getElementById('left_in').offsetHeight;
    }
    else{
      hLeftIn=0;
    }
    
    if(document.getElementById('main')){
      hMain=document.getElementById('main').offsetHeight;
    }
    else{
      hMain=0;
    }

    if(document.getElementById('main_in')){
      hMainIn=document.getElementById('main_in').offsetHeight;
    }
    else{
      hMainIn=0;
    }

    if(document.getElementById('right')){
      hRight=document.getElementById('right').offsetHeight;
    }
    else{
      hRight=0;
    }

    if(debug){
      a='PŘED:\nOmluvte prosím tuto zprávu,\nmomentálně se testuje.\n';
      a+='hMain: '+hMain;
      a+='\nhMainIn: '+hMainIn;
      a+='\nhLeft: '+hLeft;
      a+='\nhLeftIn: '+hLeftIn;
      a+='\nhRight: '+hRight;
      alert(a);
    }


    hLeft=Math.max(hLeftIn,hLeft);
    hMain=Math.max(hMainIn,hMain);


    hMax=max3(hMain,hLeft,hRight);


    if( (hMain<hMin) || (hMain < hMax) ){
      if(document.getElementById('main_in')){
        //alert('main_in');
        document.getElementById('main_in').style.height = hMax+'px';
      }
    }

    if(hLeft < hMax){
      if(document.getElementById('left')){
        document.getElementById('left').style.height = hMax+'px';
      }
    }


    if(debug){
      a='PO:\nOmluvte prosím tuto zprávu,\nmomentálně se testuje.\n';
      a+='hMain: '+hMain;
      a+='\nhMainIn: '+hMainIn;
      a+='\nhLeft: '+hLeft;
      a+='\nhLeftIn: '+hLeftIn;
      a+='\nhRight: '+hRight;
      alert(a);
    }

  }
  else{
    hLeft=0;
  }





  //setTimeout('build()',1000);
}



function elementSwap(id){
  disp=document.getElementById(id).style.display;
  if(disp=='block'){
    elementClose(id);
  }
  else if(disp=='none'){
    elementOpen(id);
  }
}
function elementClose(id){
  document.getElementById(id).style.display='none';
}
function elementOpen(id){
  document.getElementById(id).style.display='block';
}


function zmensiObrazek(id_obr,id_blok){
  if(document.getElementById(id_obr) && document.getElementById(id_blok)){
    w_obr =document.getElementById(id_obr).offsetWidth;
    w_blok=document.getElementById(id_blok).offsetWidth;
    if( w_obr > (w_blok/2) ){
      document.getElementById(id_obr).style.width=w_obr/2 + 'px';
      h_obr =document.getElementById(id_obr).offsetHeight;
      document.getElementById(id_obr).style.height=h_obr/2 + 'px';
    }
  }
}


function k_search_fo(){
  q=document.getElementById('search_q').value;
  if( (q=='') || (q=='Hledej na cho.cz pomocí Google') ){
    return false;
  }
  else{
    return true;
  }
}