Element.extend({setPosition:function(i){i=$merge({relativeTo:document.body,position:"center",edge:false,offset:{x:0,y:0},smoothMove:false,effectOptions:{},returnPos:false},i);this.setStyle("position","absolute");var h=$(i.relativeTo)||document.body;var g=(h==document.body)?window.getScrollTop():h.getTop();if(g<0){g=0}var c=(h==document.body)?window.getScrollLeft():h.getLeft();if(c<0){c=0}var d=this.getDimensions({computeSize:true});var f;var a=i.offset.y.toInt();var b=i.offset.x.toInt();switch(i.position){case"upperLeft":f={x:(c+b),y:(g+a)};break;case"upperRight":f={x:(c+b+h.offsetWidth),y:(g+a)};break;case"bottomLeft":f={x:(c+b),y:(g+a+h.offsetHeight)};break;case"bottomRight":f={y:(c+b+h.offsetWidth),x:(g+a+h.offsetHeight)};break;default:f={x:c+(((h==document.body)?window.getWidth():h.offsetWidth)/2)+b,y:g+(((h==document.body)?window.getHeight():h.offsetHeight)/2)+a};i.edge="center";break}if(i.edge){var e;switch(i.edge){case"upperLeft":e={x:0,y:0};break;case"upperRight":e={x:-d.x-d.computedRight-d.computedLeft,y:0};break;case"bottomLeft":e={x:0,y:-d.y-d.computedTop-d.computedBottom};break;case"bottomRight":e={x:-d.x-d.computedRight-d.computedLeft,y:-d.y-d.computedTop-d.computedBottom};break;default:e={x:-(d.x/2),y:-(d.y/2)};break}f.x=f.x+e.x;f.y=f.y+e.y}f={left:((f.x>=0)?f.x:0).toInt()+"px",top:((f.y>=0)?f.y:0).toInt()+"px"};if(i.returnPos){return f}if(i.smoothMove&&this.effects){this.effects(i.effectOptions).start(f)}else{this.setStyles(f)}return this}});
