/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0pr2
*/
YUI.add("dom-screen",function(E){var N="offsetTop",W="documentElement",M="compatMode",D="offsetLeft",a="offsetParent",P="position",U="fixed",c="relative",O="left",S="top",b="scrollLeft",X="scrollTop",Z="BackCompat",R="medium",Q="height",H="width",F="borderLeftWidth",G="borderTopWidth",C="getBoundingClientRect",B="getComputedStyle",d=/^t(?:able|d|h)$/i;E.mix(E.DOM,{winHeight:function(e){var Y=E.DOM._getWinSize(e)[Q];return Y;},winWidth:function(e){var Y=E.DOM._getWinSize(e)[H];return Y;},docHeight:function(e){var Y=E.DOM._getDocSize(e)[Q];return Math.max(Y,E.DOM._getWinSize(e)[Q]);},docWidth:function(e){var Y=E.DOM._getDocSize(e)[H];return Math.max(Y,E.DOM._getWinSize(e)[H]);},docScrollX:function(Y){var e=E.DOM._getDoc();return Math.max(e[W][b],e.body[b]);},docScrollY:function(Y){var e=E.DOM._getDoc();return Math.max(e[W][X],e.body[X]);},getXY:function(){if(document[W][C]){return function(g){if(!g){return false;}var h=E.DOM.docScrollX(g),e=E.DOM.docScrollY(g),i=g[C](),m=E.DOM._getDoc(g),n=[Math.floor(i[O]),Math.floor(i[S])];if(E.UA.ie){var l=2,k=2,j=m[M],Y=E.DOM[B](m[W],F),f=E.DOM[B](m[W],G);if(E.UA.ie===6){if(j!==Z){l=0;k=0;}}if((j==Z)){if(Y!==R){l=parseInt(Y,10);}if(f!==R){k=parseInt(f,10);}}n[0]-=l;n[1]-=k;}if((e||h)){n[0]+=h;n[1]+=e;}n[0]=Math.floor(n[0]);n[1]=Math.floor(n[1]);return n;};}else{return function(e){var g=[e[D],e[N]],Y=e,i=((E.UA.gecko||(E.UA.webkit>519))?true:false);while((Y=Y[a])){g[0]+=Y[D];g[1]+=Y[N];if(i){g=E.DOM._calcBorders(Y,g);}}if(E.DOM.getStyle(e,P)!=U){Y=e;var f,h;while((Y=Y.parentNode)){f=Y[X];h=Y[b];if(E.UA.gecko&&(E.DOM.getStyle(Y,"overflow")!=="visible")){g=E.DOM._calcBorders(Y,g);}if(f||h){g[0]-=h;g[1]-=f;}}g[0]+=E.DOM.docScrollX(e);g[1]+=E.DOM.docScrollY(e);}else{if(E.UA.opera){g[0]-=E.DOM.docScrollX(e);g[1]-=E.DOM.docScrollY(e);}else{if(E.UA.webkit||E.UA.gecko){g[0]+=E.DOM.docScrollX(e);g[1]+=E.DOM.docScrollY(e);}}}g[0]=Math.floor(g[0]);g[1]=Math.floor(g[1]);return g;};}}(),getX:function(Y){return E.DOM.getXY(Y)[0];},getY:function(Y){return E.DOM.getXY(Y)[1];},setXY:function(e,h,k){var j=E.DOM.getStyle(e,P),f=E.DOM.setStyle,i=[parseInt(E.DOM[B](e,O),10),parseInt(E.DOM[B](e,S),10)];if(j=="static"){j=c;f(e,P,j);}var g=E.DOM.getXY(e);if(g===false){return false;}if(isNaN(i[0])){i[0]=(j==c)?0:e[D];}if(isNaN(i[1])){i[1]=(j==c)?0:e[N];}if(h[0]!==null){f(e,O,h[0]-g[0]+i[0]+"px");}if(h[1]!==null){f(e,S,h[1]-g[1]+i[1]+"px");}if(!k){var Y=E.DOM.getXY(e);if((h[0]!==null&&Y[0]!=h[0])||(h[1]!==null&&Y[1]!=h[1])){E.DOM.setXY(e,h,true);}}},setX:function(e,Y){return E.DOM.setXY(e,[Y,null]);},setY:function(Y,e){return E.DOM.setXY(Y,[null,e]);},_calcBorders:function(f,g){var e=parseInt(E.DOM[B](f,G),10)||0,Y=parseInt(E.DOM[B](f,F),10)||0;if(E.UA.gecko){if(d.test(f.tagName)){e=0;Y=0;}}g[0]+=Y;g[1]+=e;return g;},_getWinSize:function(g){var j=E.DOM._getDoc(),i=j.defaultView||j.parentWindow,k=j[M],f=i.innerHeight,e=i.innerWidth,Y=j[W];if(k&&!E.UA.opera){if(k!="CSS1Compat"){Y=j.body;}f=Y.clientHeight;e=Y.clientWidth;}return{height:f,width:e};},_getDocSize:function(e){var f=E.DOM._getDoc(),Y=f[W];if(f[M]!="CSS1Compat"){Y=f.body;}return{height:Y.scrollHeight,width:Y.scrollWidth};}});var J="offsetWidth",A="offsetHeight",S="top",K="right",I="bottom",O="left",T="tagName";var L=function(g,f){var i=Math.max(g[S],f[S]),j=Math.min(g[K],f[K]),Y=Math.min(g[I],f[I]),e=Math.max(g[O],f[O]),h={};h[S]=i;h[K]=j;h[I]=Y;h[O]=e;return h;};var V=V||E.DOM;E.mix(V,{region:function(f){var Y=V.getXY(f),e=false;if(Y){e={"0":Y[0],"1":Y[1],top:Y[1],right:Y[0]+f[J],bottom:Y[1]+f[A],left:Y[0],height:f[A],width:f[J]};}return e;},intersect:function(f,Y,h){var e=h||V.region(f),g={};var j=Y;if(j[T]){g=V.region(j);}else{if(E.Lang.isObject(Y)){g=Y;}else{return false;}}var i=L(g,e);return{top:i[S],right:i[K],bottom:i[I],left:i[O],area:((i[I]-i[S])*(i[K]-i[O])),yoff:((i[I]-i[S])),xoff:(i[K]-i[O]),inRegion:V.inRegion(f,Y,false,h)};},inRegion:function(g,Y,e,i){var h={},f=i||V.region(g);var k=Y;if(k[T]){h=V.region(k);}else{if(E.Lang.isObject(Y)){h=Y;}else{return false;}}if(e){return(f[O]>=h[O]&&f[K]<=h[K]&&f[S]>=h[S]&&f[I]<=h[I]);}else{var j=L(h,f);if(j[I]>=j[S]&&j[K]>=j[O]){return true;}else{return false;}}},inViewportRegion:function(e,Y,f){return V.inRegion(e,V.viewportRegion(e),Y,f);},viewportRegion:function(e){e=e||E.config.doc.documentElement;var Y={};Y[S]=V.docScrollY(e);Y[K]=V.winWidth(e)+V.docScrollX(e);Y[I]=(V.docScrollY(e)+V.winHeight(e));Y[O]=V.docScrollX(e);return Y;}});},"3.0.0pr2",{skinnable:false,requires:["dom-base","dom-style"]});