var mstatus=true;
var timer1=false;


var mstep=99;


var cm=null;




var hide_delay=1;


var tstat=0;

isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;


function switchDiv(objElement,bolVisible){
if(isNS4||isIE4){
     if(!bolVisible) {
       objElement.visibility ="hidden"
     } else {
       objElement.visibility ="visible"
     }
 } else if (isIE5 || isNS6) {
      if(!bolVisible){
         objElement.style.display = "none";

      } else {
        objElement.style.display = "";
        objElement.style.display = "block";
        var m=objElement.id;
                var wmenu=document.getElementById('top_'+m).offsetWidth;
                objElement.style.width="";
                objElement.style.width=wmenu+"px";
        }

      }

return 1;
}


function getPos(el,sProp) {
        var iPos = 0;
        var le2=el;
        while (el!=null) {
                iPos+=el["offset" + sProp]
                el = el.offsetParent
        }
        //var om=document.getElementById('main_onpage')["offset" + sProp];
        //iPos-=om;
        return iPos

}



function getelementbyid(myid) {

   if (isNS4){
        objElement = document.layers[myid];
     }else if (isIE4) {
        objElement = document.all[myid];
     }else if (isIE5 || isNS6) {
             objElement = document.getElementById(myid);
     }
return(objElement);
}

function normalcolor(w){
        var td=document.getElementById('top_popup_'+w);
        td.style.color='#FFFFFF';
}
function show(el,m) {
var ident=m;

if (m!=null) {
var td_id=m.split("_");
        var td=document.getElementById('top_popup_'+td_id[1]);
        td.style.color='#f0f30b';
m=getelementbyid(m);
}




        if ((el==null) && (cm)) {
        mstatus=false;
        movefx()


        } else if ((m!=cm) && (m)) {
        if (cm!=null) switchDiv(cm,false);

        switchDiv(m,true);
        fxel=el;
        fxm=m;
        fxrect=0;



        mstatus=true;
        movefx()
        }

        if (m) cm=m;


  if (tstat==1) {
  clearTimeout(timer1);
  tstat=0

  }

}


function hidemenu(b) {
 if (b)  {
 tstat=1;
 timer1=setTimeout("show(null)",hide_delay);
 } else {
 tstat=0;
 show(null);
 }

}


function cancelhide() {

if (!mstatus) {
mstatus=1;

}

tstat=0;
clearTimeout(timer1);



}



function movefx() {


if ((mstatus) && (fxrect>100)) {
fxrect=100;
return 1;
}



if ((!mstatus) && (fxrect<0)) {
fxrect=0;
switchDiv(fxm,false);
mstatus=true;
cm=null;
return 1;
}

if ((isIE5)||(isIE4)||(isNS6)) {
// fxm.style.top=getPos(fxel,"Top")+(fxel.offsetHeight+2)+'px';
 fxm.style.left=getPos(fxel,"Left")+'px';
 //fxm.style.width=document.getElementById('top_'+ident).offsetWidth+'px';
 if (isNS6) {
 fxm.style.MozOpacity = fxrect/100;
 } else {
 fxm.style.filter = 'alpha(opacity='+fxrect+')';
 }

  if (mstatus) {
  fxrect=fxrect+mstep;
  setTimeout('movefx()',1);
  } else {
  fxrect=fxrect-mstep;
  setTimeout('movefx()',1);
  }

 return 1;
} else {
  if (mstatus) {
  fxm.style.left =getPos(fxel,"Left")+"px";
  //fxm.style.width=document.getElementById('top_'+ident).offsetWidth+'px';
  fxm.style.top = (getPos(fxel,"Top")- fxel.offsetHeight) +"px";
   } else {
  switchDiv(fxm,false);
  cm=null;
  mstatus=true;
  }


return 1
}

document.style.background=''
}
function color_in(el){el.style.backgroundColor='#F2ECD6';el.firstChild.nextSibling.color='#000000';}
function color_out(el){el.style.backgroundColor='#FFFFFF';}
