function miaovaddevent(oele, seventname, fnhandler) { if(oele.attachevent) { oele.attachevent('on'+seventname, fnhandler); } else { oele.addeventlistener(seventname, fnhandler, false); } } window.onload = function() { var odiv = document.getelementbyid('miaov_float_layer'); var obtnmin = document.getelementbyid('btn_min'); var obtnclose = document.getelementbyid('btn_close'); var odivcontent = odiv.getelementsbytagname('div')[0]; var imaxheight = 0; var isie6 = window.navigator.useragent.match(/msie 6/ig) && !window.navigator.useragent.match(/msie 7|8/ig); odiv.style.display = 'block'; imaxheight = odivcontent.offsetheight; if (isie6) { odiv.style.position = 'absolute'; repositionabsolute(); miaovaddevent(window, 'scroll', repositionabsolute); miaovaddevent(window, 'resize', repositionabsolute); } else { odiv.style.position = 'fixed'; repositionfixed(); miaovaddevent(window, 'resize', repositionfixed); } obtnmin.timer = null; obtnmin.ismax = true; obtnmin.onclick = function() { startmove ( odivcontent, (this.ismax = !this.ismax) ? imaxheight : 0, function() { obtnmin.classname = obtnmin.classname == 'min' ? 'max' : 'min'; } ); }; obtnclose.onclick = function() { odiv.style.display = 'none'; odiv.innerhtml = ""; }; }; function startmove(obj, itarget, fncallbackend) { if(obj.timer) { clearinterval(obj.timer); } obj.timer=setinterval ( function () { domove(obj, itarget, fncallbackend); },30 ); } function domove(obj, itarget, fncallbackend) { var ispeed=(itarget-obj.offsetheight)/8; if(obj.offsetheight==itarget) { clearinterval(obj.timer); obj.timer=null; if(fncallbackend) { fncallbackend(); } } else { ispeed=ispeed>0?math.ceil(ispeed):math.floor(ispeed); obj.style.height=obj.offsetheight+ispeed+'px'; ((window.navigator.useragent.match(/msie 6/ig) && window.navigator.useragent.match(/msie 6/ig).length==2)?repositionabsolute:repositionfixed)() } } function repositionabsolute() { var odiv=document.getelementbyid('miaov_float_layer'); var left=document.body.scrollleft||document.documentelement.scrollleft; var top=document.body.scrolltop||document.documentelement.scrolltop; var width=document.documentelement.clientwidth; var height=document.documentelement.clientheight; odiv.style.left=left+width-odiv.offsetwidth+'px'; odiv.style.top=top+height-odiv.offsetheight+'px'; } function repositionfixed() { var odiv=document.getelementbyid('miaov_float_layer'); var width=document.documentelement.clientwidth; var height=document.documentelement.clientheight; odiv.style.left=width-odiv.offsetwidth+'px'; odiv.style.top=height-odiv.offsetheight+'px'; }