var menu=function(){
	var t=5, t2=1, z=50,s=3,op=1.0;
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p){
		var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		var biomarker=document.getElementById('biomarkermenu');
		var cancer=document.getElementById('cancermenu');
		var h;
		var h0;
		for(i;i<l;i++){
		  h0=0;
			if(biomarker==s[i]) {
        h=document.getElementById('biomarker_search'); /* s[i].parentNode.parentNode; */
        h0=1;
      } else if(cancer==s[i]) {
        h=document.getElementById('cancer_search'); /* s[i].parentNode.parentNode; */
        h0=2;
      } else {
        h=s[i].parentNode;
      }
      this.h[i]=h; this.c[i]=s[i];
			h.onmouseover=new Function(this.n+'.st('+i+',true,'+h0+')');
			h.onmouseout=new Function(this.n+'.st('+i+',false,'+h0+')');
		}
	}
	dd.prototype.st=function(x,f,h0){
		var c=this.c[x], h=this.h[x];
		clearInterval(c.t); c.style.overflow='hidden';
		if(f){
			if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}
			if(c.mh==c.offsetHeight){c.style.overflow='visible'}
			else{
        if(h0==1){
          document.getElementById('scrollup').style.display='block';
        }
        else if(h0==2){
          document.getElementById('scrollup_cancer').style.display='block';
        }
        c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1,h0,h)},t)
      }
		}else{
		  // c.style.height='0px'; c.style.opacity=0; c.style.filter='alpha(opacity='+(0*100)+')';
      c.t=setInterval(function(){sl(c,-1,h0)},t2)
    }
	}
	function sl(c,f,h0,p){
		var h=c.offsetHeight;
		if((h<=0&&f!=1)||(h>=c.mh&&f==1)){
			if(f==1){
        c.style.filter=''; c.style.opacity=op; c.style.overflow='visible';
        // if(h0==1){document.getElementById('scrolldown').style.display='block';}
      }else if(h0==1){
          document.getElementById('scrollup').style.display='none';
          document.getElementById('scrolldown').style.display='none';
      }else if(h0==2){
          document.getElementById('scrollup_cancer').style.display='none';
          document.getElementById('scrolldown_cancer').style.display='none';
      }
			clearInterval(c.t); 
      return;
		}
		var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh*op;
		c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
		c.style.height=h+(d*f)+'px';
		if((h0!=0)&&(f==1)){
		  // hp=document.getElementById('biomarker_search');
      // if((parseInt(c.style.top.replace('px',''))-0-parseInt(hp.style.top.replace('px',''))+c.offsetHeight)>=(9*27)){
      if(c.offsetHeight>=(7*27)){
        if(h0==1)document.getElementById('scrolldown').style.display='block';
        else if(h0==2)document.getElementById('scrolldown_cancer').style.display='block';
      }
    }
	}
	return{dd:dd}
}();

