/* for pulldown (level 2) */
var current = '';
var menu_timer = null;
var menu_hide_timeout = 500;
var menu_show_timeout = 105;

function pulldown_level2(id, show){
 if(menu_timer){ window.clearTimeout(menu_timer); }
 if(current.length>0 && show){
  tmp = document.getElementById(current);
  if(tmp){
   if(current == id){
    tmp.style.visibility = 'visible';
   }else{
    tmp.style.visibility = 'hidden';
    current = '';
   }
  }
 }
 if(!document.getElementById(id)){ return; }
 current = id;
 menu_timer = show?
  window.setTimeout("set_visibility('"+id+"', true)", menu_show_timeout):
  window.setTimeout("set_visibility('"+id+"', false)", menu_hide_timeout);
}

function set_visibility(id, show){
 document.getElementById(id).style.visibility = show?'visible':'hidden'; 
 if(!show && current==id){ current = ''; }  
}

/* for pulldown (level 3) */
var current_sub = '';
var menu_timer_sub = null;
var menu_hide_timeout_sub = 500;
var menu_show_timeout_sub = 105;

function pulldown_level3(id_sub, show_sub){
 if(menu_timer_sub){ window.clearTimeout(menu_timer_sub); }
 if(current_sub.length>0 && show_sub){
  tmp_sub = document.getElementById(current_sub);
  if (obj_sub = document.getElementById('level3_'+current_sub))
  {
  }
  else ;//alert('level3_'+current_sub);
  if(tmp_sub){
   if(current_sub == id_sub){
    tmp_sub.style.visibility = 'visible';
    obj_sub.className='active';
   }else{
    tmp_sub.style.visibility = 'hidden';
    obj_sub.className='';
    current_sub = '';
   }
  }
 }
 if(!document.getElementById(id_sub)){ return; }
 current_sub = id_sub;
 menu_timer_sub = show_sub?
  window.setTimeout("set_visibility_sub('"+id_sub+"', true)", menu_show_timeout_sub):
  window.setTimeout("set_visibility_sub('"+id_sub+"', false)", menu_hide_timeout_sub);
}

function set_visibility_sub(id_sub, show_sub){
 document.getElementById(id_sub).style.visibility = show_sub?'visible':'hidden'; 
 obj_sub = document.getElementById('level3_'+current_sub);
 if(!show_sub && current_sub==id_sub){ obj_sub.className=''; current_sub = ''; }  
}
// for roll-up menu
function turn_dir(id,pref){
 var subobj = document.getElementById(id);
 var prefobj = document.getElementById(pref);
 if(subobj.style.display=='none'){
   subobj.style.display = '';
   prefobj.className='dir_open';
 } else {
   subobj.style.display = 'none';  
   prefobj.className='dir_close';
 }
}
/* for popup window */
function create_popup(locat){ 
  var win = window.open(locat,"popup","width=300, height=165, toolbar=no, location=no, scrollbars=no, menubar=no, status=no, resizable=no"); 
  win.focus();
}

/* for masking e-mail */
function amg(n,s1,s2,s3)
{
        if(n == 0)
          location='mailto:'+s1+'@'+s2;
}

