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=500;
  
  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('left')){
    hLeft=document.getElementById('left').offsetHeight;
 
  }
  else{
    hLeft=0;
  }

  if(document.getElementById('left_in')){
    hLeftIn=document.getElementById('left_in').offsetHeight;
  }
  else{
    hLeftIn=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){
    if(document.getElementById('main_in')){
      document.getElementById('main_in').style.height = hMin+'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);
  }
  //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_forum_user_login(){
  lo=document.getElementById('login');
  he=document.getElementById('heslo');
  ret=true;

  if(lo.value==''){
    alert('Zadejte prosím přihlašovací jméno.');
    lo.focus();
    ret=false;
  }
  else if(he.value==''){
    alert("Zadejte prosím heslo.");
    he.focus();
    ret=false;
  }

  return ret;
}



function k_forum_register_login(){
  lo=document.getElementById('forum_login');

  ret=true;
  if(lo.value==''){
    alert('Zadejte prosím přihlašovací jméno.');
    lo.focus();
    ret=false;
  }
  return ret;
}


function k_forum_register_user_data(){
  jm=document.getElementById('jmeno');
  em=document.getElementById('e');
  ret=true;

  if(jm.value==''){
    alert('Zadejte prosím své jméno.');
    jm.focus();
    ret=false;
  }
  else if(em.value==''){
    alert("Zadejte prosím svůj e-mail,\naby Vám mohlo být zasláno heslo pro přihlášení.");
    em.focus();
    ret=false;
  }

  if(ret){
    return(confirm('Hotovo?'));
  }
  else{
    return false;
  }
}



function k_forum_change_data(){
  he1=document.getElementById('forum_heslo_1');
  he2=document.getElementById('forum_heslo_2');

  ret=true;
  if( (he1.value=='') || (he2.value=='') ){
    alert('Zadejte prosím nové heslo.');
    he1.focus();
    ret=false;
  }
  if( (he1.value) != (he2.value) ){
    alert('Hesla se neshodují!\nAsi jste se překlepl(a).');
    he1.focus();
    ret=false;
  }
  return ret;
}



function k_forum_public_form(){
  pt=document.getElementById('predmet');
  tx=document.getElementById('text');
  ret=true;

  if(pt.value==''){
    alert('Zadejte prosím předmět příspěvku.');
    pt.focus();
    ret=false;
  }
  else if(tx.value==''){
    alert("Zadejte prosím svůj příspěvek.");
    tx.focus();
    ret=false;
  }

  if(ret){
    return(confirm('Odeslat?'));
  }
  else{
    return false;
  }
}



