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 build(){
  //document.getElementsByTagName('h1')[0].innerHTML=wMain;

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

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

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

  if(0){
    a='Omluvte prosím tuto zprávu,\nmomentálně se testuje.\n';
    a+='hMain: '+hMain;
    a+='\nhLeft: '+hLeft;
    a+='\nhRight: '+hRight;
    alert(a);
  }

  if(hLeft > 0){
    if(hMain<hLeft){//kdyz je main nizsi nez left
      if(hMain < 200){
        document.getElementById('main').style.marginBottom = '300px';
      }
      if(document.getElementById('vocas')){
        document.getElementById('vocas').style.marginTop = (hLeft-hMain)+'px';
      }
    }
    else{//kdyz je main vyssi
      if(document.getElementById('left')){
        document.getElementById('left').style.height = hMain+'px';
      }
    }
  }

  if(hRight > 0){
    if(hMain<hRight && document.getElementById('vocas')){
      document.getElementById('vocas').style.marginTop = (hRight-hMain)+'px';
    }
  }

  //document.getElementById('vocas').style.visibility = 'visible';

  //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';
    }
  }
}
