/* �����������ͷ�� www.datouwang.com */ function getstyle(obj, attr){ return obj.currentstyle?obj.currentstyle[attr]:getcomputedstyle(obj, false)[attr]; } window.onload = function(){ var obox = document.getelementbyid('honor-block'); var obg = document.getelementbyid('bg'); var obot = document.getelementbyid('bottom'); var abli = obot.getelementsbytagname('li'); var oframe = document.getelementbyid('frame'); var ali = obox.getelementsbytagname('li'); var aimg = obox.getelementsbytagname('img'); var i = inow = 0; for(i=0;i'; var oimg = oframe.getelementsbytagname('img')[0]; var iwidth = oimg.width; var iheight = oimg.height; var ileft = parseint((document.body.clientwidth / 2) - (iwidth /2)); var itop = parseint((document.body.clientheight / 2) - (iheight /2) - 50); with(oimg.style){height = width = '100%';} startmove(oframe, {opacity:100, left:ileft, top:itop, width:iwidth, height:iheight}); obg.style.display = 'block'; obot.style.display = 'block'; inow = this.index + 1; }; } document.onmousedown = function(){ return false }; abli[0].onclick = function(){ inow--; if(inow == 0)inow = ali.length; oframe.innerhtml = ''; }; abli[1].onclick = function(){ oframe.style.cursor = 'move'; oframe.onmousedown = function(e){ var oevent = e || event; var x = oevent.clientx - oframe.offsetleft; var y = oevent.clienty - oframe.offsettop; document.onmousemove = function(e){ var oevent = e || event; var l = oevent.clientx - x; var t = oevent.clienty - y; if(l < 0){ l = 0; }else if(l > document.body.clientwidth - oframe.offsetwidth){ l = document.body.clientwidth - oframe.offsetwidth } if(t < 0){ t = 0; }else if(t > document.body.clientheight - oframe.offsetheight){ t = document.body.clientheight - oframe.offsetheight; } oframe.style.left = l + 'px'; oframe.style.top = t + 'px'; oframe.style.margin = 0; return false; } document.onmouseup = function(){ document.onmouseup = null; document.onmousemove = null; }; return false; }; }; abli[2].onclick = function(){ inow++; if(inow > ali.length)inow = 1; oframe.innerhtml = ''; }; abli[3].onclick = function(){ startmove(oframe, {opacity:0, left:aimg[inow-1].offsetleft, top:aimg[inow-1].offsettop, width:150, height:100}, function(){ oframe.style.display = 'none'; obg.style.display = 'none'; obot.style.display = 'none'; oframe.onmousedown = null; oframe.style.cursor = 'auto'; }); }; }; function startmove(obj, json, onend){ clearinterval(obj.timer); obj.timer=setinterval(function (){ domove(obj, json, onend); }, 30); } function domove(obj, json, onend){ var attr=''; var bstop=true; for(attr in json){ var icur=0; if(attr=='opacity'){ icur=parseint(parsefloat(getstyle(obj, attr))*100); }else{ icur=parseint(getstyle(obj, attr)); } var ispeed=(json[attr]-icur)/5; ispeed=ispeed>0?math.ceil(ispeed):math.floor(ispeed); if(json[attr]!=icur){ bstop=false; } if(attr=='opacity'){ obj.style.filter='alpha(opacity:'+(icur+ispeed)+')'; obj.style.opacity=(icur+ispeed)/100; }else{ obj.style[attr]=icur+ispeed+'px'; } } if(bstop){ clearinterval(obj.timer); if(onend){ onend(); } } $(".close").click(function(){ $("#bottom").css("display","none"); $("#bg").css("display","none"); $("#frame").css("display","none"); }) }