String.prototype.format=function(){for(var t=this,i,n=0;n<arguments.length;n++)i=new RegExp("\\{"+n+"\\}","gi"),t=t.replace(i,arguments[n]);return t},Box={defaults:{returnName:null},create:function(n){n=$extend(Box.defaults,n);var t=new Element("table",{"class":"box "+n["class"],border:0,cellspacing:0,cellpadding:0});return t.set("html","<tr><td class='t l cnr'>&nbsp;</td><td class='t c horz'>&nbsp;</td><td class='t r cnr'>&nbsp;</td></tr><tr><td class='c l vert'>&nbsp;</td><td class='c center'>&nbsp;</td><td class='c r vert'>&nbsp;</td></tr><tr><td class='b l cnr'>&nbsp;</td><td class='b c horz'>&nbsp;</td><td class='b r cnr'>&nbsp;</td></tr>"),n.returnName?t.getElements(n.returnName)[0]:t},createDivs:function(n){n=$extend(Box.defaults,n);var t=new Element("div",{"class":"box "+n["class"],border:0,cellspacing:0,cellpadding:0});return t.set("html","<div class='t l cnr'>&nbsp;</div><div class='t c horz'>&nbsp;</div><div class='t r cnr'>&nbsp;</div><div class='c l vert'>&nbsp;</div><div class='c center'>&nbsp;</div><div class='c r vert'>&nbsp;</div><div class='b l cnr'>&nbsp;</div><div class='b c horz'>&nbsp;</div><div class='b r cnr'>&nbsp;</div>"),n.returnName?t.getElements(n.returnName)[0]:t}},Utilities={expandMargin:function(n){return $type(n)=="number"?{left:n,top:n,right:n,bottom:n}:n},find:function(n){if($type(n)=="array")return n;var t=$$(n);return t.length==0?null:t[0]},scrollIntoView:function(n,t){var i,f,r,u;t=$extend({mode:"window",animate:!0,margin:Utilities.expandMargin(5),scrollFx:{fx:Fx.Transitions.Quad.easeInOut,duration:1500}},t),n=Utilities.find(n),$type(n)!="array"&&(n=[n]),i={left:65535,top:65535,right:0,bottom:0},n.each(function(n){var t=n.getPosition({relativeTo:document}),r;t.x<i.left&&(i.left=t.x),t.y<i.top&&(i.top=t.y),r=n.getComputedSize(),t.x=t.x+r.totalWidth,t.y=t.y+r.totalHeight,t.x>i.right&&(i.right=t.x),t.y>i.bottom&&(i.bottom=t.y)}),t.margin=Utilities.expandMargin(t.margin),i.left-=t.margin.left,i.top-=t.margin.top,i.right+=t.margin.right,i.bottom+=t.margin.bottom,f=document.getWindow().getSize();switch(t.mode){case"window":r=document.getWindow().getScrollTop(),i.bottom>r+f.y&&(r=i.bottom-f.y),i.top<r&&(r=i.top),document.getWindow().getScrollTop()!=r&&(u=new Fx.Scroll(document,t.scrollFx),t.animate?u.start(document.getWindow().getScrollLeft(),r):u.setPostion(r))}},getParent:function(n,t){n=$$(n),n.length&&(n=n[0]),elements=$$(t);if(!elements.length)return null;while(n){if(elements.indexOf(n)>=0)return n;n=n.getParent()}return null}},Intergration={isNamespaceDefined:function(n){for(var i="",r=n.split("."),t=0;t<r.length;t++){i?i+="."+r[t]:i=r[t];if(eval("(typeof({0}) == 'undefined')".format(i)))return!1}return!0}}
