var ddspeed = 10; var ddtimer = 15; function ddmenu(id,d) { var h = document.getelementbyid(id + '-ddheader'); var c = document.getelementbyid(id + '-ddcontent'); clearinterval(c.timer); if(d == 1) { cleartimeout(h.timer); if(c.maxh && c.maxh <= c.offsetheight) { return; } else if(!c.maxh) { c.style.top = '-' + c.offsetheight + 'px'; c.style.display = 'block'; c.style.height = 'auto'; c.maxh = c.offsetheight; c.style.height = '0px'; } c.timer = setinterval(function(){ddslide(c,1)},ddtimer); } else { h.timer = settimeout(function(){ddcollapse(c)},50); } } function ddcollapse(c){ c.timer = setinterval(function(){ddslide(c,-1)},ddtimer); } function cancelhide(id){ var h = document.getelementbyid(id + '-ddheader'); var c = document.getelementbyid(id + '-ddcontent'); cleartimeout(h.timer); clearinterval(c.timer); if(c.offsetheight < c.maxh){ c.timer = setinterval(function(){ddslide(c,1)},ddtimer); } } function ddslide(c,d){ var currh = c.offsetheight; var dist; if(d == 1){ dist = (math.round((c.maxh - currh) / ddspeed)); }else{ dist = (math.round(currh / ddspeed)); } if(dist <= 1 && d == 1){ dist = 1; } c.style.top = parseint(c.style.top.replace('px','')) - parseint(dist * d) + 'px'; c.style.height = currh + (dist * d) + 'px'; if(getos()=="msie") { c.style.opacity = currh / c.maxh; c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')'; } if(getos()=="firefox") { c.style.opacity = currh / c.maxh; c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')'; } if(getos()=="chrome") { c.style.opacity = currh / c.maxh; c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')'; } if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){ clearinterval(c.timer); } } function getos() { var osobject = ""; if(navigator.useragent.indexof("msie")>0) { return "msie"; } if(isfirefox=navigator.useragent.indexof("firefox")>0){ return "firefox"; } if(ischrome=navigator.useragent.indexof("chrome")>0){ return "chrome"; } if(issafari=navigator.useragent.indexof("safari")>0) { return "safari"; } if(iscamino=navigator.useragent.indexof("camino")>0){ return "camino"; } if(ismozilla=navigator.useragent.indexof("gecko/")>0){ return "gecko"; } }