var tm = null;
var timeout = 500;
var item=0;

function showDiv(divn){
   cancelHide();
   if (item && divn!=item) { hide(); }
    if (tm) { window.clearTimeout(tm); tm = null; }
    item=divn;
    $('#' + divn).fadeIn('fast');
}
function hide() { 
   $('#' + item).fadeOut('fast');
   item=null;
}
function hideDiv(){
    tm = window.setTimeout(hide, timeout);
}
function cancelHide(){
    if (tm) { window.clearTimeout(tm); tm = null; }
}