/* TinyDropDown js, open source drop down menu taken from:
 * http://www.leigeber.com/2008/04/sliding-javascript-dropdown-menu/
 * */

var menu=function(){
        var t=15,zIndex=50,heightChangeFraction=3,cssStyle;
        function droplist(menuObj){
		this.menuObj=menuObj; 
		this.menuEntries=[]; 
		this.dropMenus=[]
	}
        droplist.prototype.init=function(p,newCssStyle){
                cssStyle=newCssStyle; 
		var w=document.getElementById(p), 
			dropMenus=w.getElementsByTagName('ul'), 
			numMenus=dropMenus.length, 
			i=0;
                for(i;i<numMenus;i++){
                        var menuEntry=dropMenus[i].parentNode; this.menuEntries[i]=menuEntry; this.dropMenus[i]=dropMenus[i];
                        menuEntry.onmouseover=new Function(this.menuObj+'.st('+i+',true)');
                        menuEntry.onmouseout=new Function(this.menuObj+'.st('+i+')');
                }
        }

        droplist.prototype.st=function(x,isOn){
                var cDropMenu=this.dropMenus[x], h=this.menuEntries[x], p=h.getElementsByTagName('a')[0];
                clearInterval(cDropMenu.t); cDropMenu.style.overflow='hidden';
                if(isOn){
                        p.className+=' '+cssStyle;
                        if(!cDropMenu.mh){cDropMenu.style.display='block'; cDropMenu.style.height=''; cDropMenu.mh=cDropMenu.offsetHeight; cDropMenu.style.height=0}
                        if(cDropMenu.mh==cDropMenu.offsetHeight){cDropMenu.style.overflow='visible'}
                        else{cDropMenu.style.zIndex=zIndex; zIndex++; cDropMenu.t=setInterval(function(){sl(cDropMenu,1)},t)}
                }else{
p.className=p.className.replace(cssStyle,''); cDropMenu.t=setInterval(function(){sl(cDropMenu,-1)},t)}
        }

        function sl(c,isOn){
                var h=c.offsetHeight;
                if((h<=0&&isOn!=1)||(h>=c.mh&&isOn==1)){
                        if(isOn==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}
                        clearInterval(c.t); return
                }
                var d=(isOn==1)?Math.ceil((c.mh-h)/heightChangeFraction):Math.ceil(h/heightChangeFraction), o=h/c.mh;
                c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
                c.style.height=h+(d*isOn)+'px'
        }


        return{droplist:droplist}
}();


