var iframeHack = function( ul ) {
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
		 f1 = document.createElement("IFRAME");  	
		 f1.setAttribute("src", "javascript: false;");	
		 f1.setAttribute("marginWidth", "0");		 
		 f1.setAttribute("marginHeight", "0");		 	 
		 f1.setAttribute("align", "bottom");		 	 
		 f1.setAttribute("scrolling", "no");		 	 	 
		 f1.setAttribute("align", "bottom");		 	 	 
		 f1.style.position = "absolute";
		 f1.style.display = "block";
		 f1.style.zIndex = "-1";
		 f1.style.top = "0";
		 f1.style.left = "0";
		 f1.style.filter = "alpha(opacity=50)";
		 f1.style.height = ul.offsetHeight+'px';			 
		 f1.style.width = ul.offsetWidth+'px';			 			 
		 ul.appendChild(f1);
		 ul.hasIframeHack = true;
	}	
}

var menu=function(){
	var t=10,z=50,s=6,a;

	function dd(n){
    this.n=n; 
    this.h=[]; 
    this.c=[];
  }
  
	dd.prototype.init=function(p,c){
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;

		for(i; i<l; i++){
			var h=s[i].parentNode;
      this.h[i]=h; 
      this.c[i]=s[i];
      this.c[i].hasIframeHack = false;
      h.index = i;
      
      h.onmouseover=new Function(this.n+'.st('+i+',true)');
			h.onmouseout=new Function(this.n+'.st('+i+')');  

		}
	}
	dd.prototype.st=function(x,f){
		var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];
 
    c.style.overflow='hidden';
   
		if(f){
			p.className+=' '+a;
			if(!c.mh){
        c.style.display='block';
        c.style.height='';
        c.mh=c.offsetHeight;
        c.style.height=0
       
      }
      c.style.zIndex=z; 
      z++; 
      c.style.overflow='visible';
      
      if (!c.hasIframeHack) {
        if (c.innerHTML != '') {
          iframeHack(c);
        }
      }      
            
/*      
			if(c.mh==c.offsetHeight) {
        c.style.overflow='visible';
      }
			else{
        c.style.zIndex=z; 
        z++; 
        c.style.overflow='visible';        
      }
*/      
		}else{ 
      p.className=p.className.replace(a,''); 
    }
    
	}
	function sl(c,f){
		var h=c.offsetHeight;
		if((h<=0 && f!=1)||(h>=c.mh && f==1)){
			if(f==1){
        c.style.overflow='visible';
      }
			clearInterval(c.t); 
      return
		}

    var d=(f==1)?Math.ceil((c.mh)/1):Math.ceil(h/1), o=h/c.mh;
		c.style.height=h+(d*f)+'px'
	}
	return{dd:dd}
}();
