local=1;
locmin=0;
function init_tz()
{

t=document.getElementById('tz_tab');
ct=t.getElementsByTagName('TR');
for(i=0;i<ct.length;i++){
  att=ct[i].getAttribute('tim');
  if( att ){
    ct[i].onclick=click_row; 
    if (ct[i].captureEvents) ct[i].captureEvents(Event.ONCLICK); 
    if( ct[i].attachEvent )ct[i].attachEvent('onclick',click_row);
    }
    }
timchg();
}
function click_row(evt){
  if( evt.srcElement ){
    evt=window.event;
    r=evt.srcElement.parentNode;
    }
  else
    r=evt.currentTarget;
  local=r.getAttribute('tim');
  timchg();
  }
  
function timchg(){
t=document.getElementById('tz_tab');
ct=t.getElementsByTagName('TR');
for(i=0;i<ct.length;i++){
  att=ct[i].getAttribute('tim');
  min=ct[i].getAttribute('min');
  if( !min )min=0;
  if( att ){
    if( att==local && min==locmin )
      ct[i].style.background="#AAAAFF";
    else
      ct[i].style.background="none"; 
  nt=(24-(att-local))%24;
  if( min ){
    if( min>0 )
      nt=(nt-1)+":"+min;
    else
      nt=nt+":"+(-min);
    }
  else
    nt=nt+":00";
  
  x=ct[i].getElementsByTagName('TD');
  x[0].innerHTML=nt;
  }
  }

      
  }

