function emil(id,jm,dom2,dom1,param){
  if(!document.getElementById(id)){
    return;
  }
  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 img(src,w,h,n){
  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='/?win=img&src='+src+'&w='+w+'&h='+h+'&n='+n;
  vla='width='+wid+',height='+hei+',toolbar=no, ';
  vla+='menubar=no, location=no, scrollbars=yes, resize=yes, ';
  vla+='top='+tp+', left='+le;
  window.open(url,'foto',vla);
  return true;
}

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

function timed_redir(kam, time){
  kam1=kam;
  setTimeout("redir1()",time);
}

/*
function build(){
  if(document.getElementById('main_in')){
    tMainIn=document.getElementById('main_in').offsetTop;
    if(tMainIn>300){ // kdyz main_in ujede,
      wMainIn=document.getElementById('main_in').offsetWidth; // zjistim jeho sirku
      if(wMainIn>200){ // kdyz je sirka vetsi nez minimalni,
        document.getElementById('main_in').style.width=(wMainIn-5) + 'px'; // zmensim sirku
        setTimeout('build()',0); // a zkusim to znovu
      }
    }
    else{
      setTimeout('build()',1000); // obcas to zkontroluju
    }
  }
}
*/

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

function elementClose(id){
  if(document.getElementById(id)){
    document.getElementById(id).style.display='none';
  }
}

function elementOpen(id){
  if(document.getElementById(id)){
    document.getElementById(id).style.display='block';
  }
}

function setCookie(c_name,value,expiredays){
  var exdate=new Date();
  exdate.setDate(exdate.getDate()+expiredays);
  document.cookie=c_name+ "=" +escape(value)+
  ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name){
  if (document.cookie.length>0)
    {
    c_start=document.cookie.indexOf(c_name + "=");
    if (c_start!=-1)
      {
      c_start=c_start + c_name.length+1;
      c_end=document.cookie.indexOf(";",c_start);
      if (c_end==-1) c_end=document.cookie.length;
      return unescape(document.cookie.substring(c_start,c_end));
      }
    }
  return "";
}

