YAHOO.util.Dom=function(){var b=navigator.userAgent.toLowerCase();var c=(b.indexOf("opera")>-1);var h=(b.indexOf("safari")>-1);var d=(window.ActiveXObject);var e=0;var f=YAHOO.util;var a={};var i=function(k){var l=function(n){var m=/(-[a-z])/i.exec(n);return n.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase())};while(k.indexOf("-")>-1){k=l(k)}return k};var g=function(m){if(m.indexOf("-")>-1){return m}var n="";for(var l=0,k=m.length;l<k;++l){if(m.charAt(l)==m.charAt(l).toUpperCase()){n=n+"-"+m.charAt(l).toLowerCase()
}else{n=n+m.charAt(l)}}return n};var j=function(k){a[k]={camel:i(k),hyphen:g(k)}};return{get:function(m){if(!m){return null}if(typeof m!="string"&&!(m instanceof Array)){return m}if(typeof m=="string"){return document.getElementById(m)}else{var n=[];for(var l=0,k=m.length;l<k;++l){n[n.length]=f.Dom.get(m[l])}return n}return null},getStyle:function(k,m){var l=function(p){var s=null;var o=document.defaultView;if(!a[m]){j(m)}var n=a[m]["camel"];var r=a[m]["hyphen"];if(m=="opacity"&&p.filters){s=1;try{s=p.filters.item("DXImageTransform.Microsoft.Alpha").opacity/100
}catch(t){try{s=p.filters.item("alpha").opacity/100}catch(t){}}}else{if(p.style[n]){s=p.style[n]}else{if(d&&p.currentStyle&&p.currentStyle[n]){s=p.currentStyle[n]}else{if(o&&o.getComputedStyle){var q=o.getComputedStyle(p,"");if(q&&q.getPropertyValue(r)){s=q.getPropertyValue(r)}}}}}return s};return f.Dom.batch(k,l,f.Dom,true)},setStyle:function(l,n,o){if(!a[n]){j(n)}var k=a[n]["camel"];var m=function(p){switch(n){case"opacity":if(d&&typeof p.style.filter=="string"){p.style.filter="alpha(opacity="+o*100+")";if(!p.currentStyle||!p.currentStyle.hasLayout){p.style.zoom=1
}}else{p.style.opacity=o;p.style["-moz-opacity"]=o;p.style["-khtml-opacity"]=o}break;default:p.style[k]=o}};f.Dom.batch(l,m,f.Dom,true)},getXY:function(k){var l=function(n){if(n.offsetParent===null||this.getStyle(n,"display")=="none"){return false}var m=null;var s=[];var o;if(n.getBoundingClientRect){o=n.getBoundingClientRect();var q=document;if(!this.inDocument(n)&&parent.document!=document){q=parent.document;if(!this.isAncestor(q.documentElement,n)){return false}}var p=Math.max(q.documentElement.scrollTop,q.body.scrollTop);
var r=Math.max(q.documentElement.scrollLeft,q.body.scrollLeft);return[o.left+r,o.top+p]}else{s=[n.offsetLeft,n.offsetTop];m=n.offsetParent;if(m!=n){while(m){s[0]+=m.offsetLeft;s[1]+=m.offsetTop;m=m.offsetParent}}if(h&&this.getStyle(n,"position")=="absolute"){s[0]-=document.body.offsetLeft;s[1]-=document.body.offsetTop}}if(n.parentNode){m=n.parentNode}else{m=null}while(m&&m.tagName.toUpperCase()!="BODY"&&m.tagName.toUpperCase()!="HTML"){if(f.Dom.getStyle(m,"display")!="inline"){s[0]-=m.scrollLeft;s[1]-=m.scrollTop
}if(m.parentNode){m=m.parentNode}else{m=null}}return s};return f.Dom.batch(k,l,f.Dom,true)},getX:function(k){var l=function(m){return f.Dom.getXY(m)[0]};return f.Dom.batch(k,l,f.Dom,true)},getY:function(k){var l=function(m){return f.Dom.getXY(m)[1]};return f.Dom.batch(k,l,f.Dom,true)},setXY:function(k,n,m){var l=function(q){var p=this.getStyle(q,"position");if(p=="static"){this.setStyle(q,"position","relative");p="relative"}var s=this.getXY(q);if(s===false){return false}var r=[parseInt(this.getStyle(q,"left"),10),parseInt(this.getStyle(q,"top"),10)];
if(isNaN(r[0])){r[0]=(p=="relative")?0:q.offsetLeft}if(isNaN(r[1])){r[1]=(p=="relative")?0:q.offsetTop}if(n[0]!==null){q.style.left=n[0]-s[0]+r[0]+"px"}if(n[1]!==null){q.style.top=n[1]-s[1]+r[1]+"px"}var o=this.getXY(q);if(!m&&(o[0]!=n[0]||o[1]!=n[1])){this.setXY(q,n,true)}};f.Dom.batch(k,l,f.Dom,true)},setX:function(l,k){f.Dom.setXY(l,[k,null])},setY:function(k,l){f.Dom.setXY(k,[null,l])},getRegion:function(k){var l=function(m){var n=new YAHOO.util.Region.getRegion(m);return n};return f.Dom.batch(k,l,f.Dom,true)
},getClientWidth:function(){return f.Dom.getViewportWidth()},getClientHeight:function(){return f.Dom.getViewportHeight()},getElementsByClassName:function(m,k,l){var n=function(o){return f.Dom.hasClass(o,m)};return f.Dom.getElementsBy(n,k,l)},hasClass:function(m,l){var k=new RegExp("(?:^|\\s+)"+l+"(?:\\s+|$)");var n=function(o){return k.test(o.className)};return f.Dom.batch(m,n,f.Dom,true)},addClass:function(l,k){var m=function(n){if(this.hasClass(n,k)){return}n.className=[n.className,k].join(" ")};f.Dom.batch(l,m,f.Dom,true)
},removeClass:function(m,l){var k=new RegExp("(?:^|\\s+)"+l+"(?:\\s+|$)","g");var n=function(o){if(!this.hasClass(o,l)){return}var p=o.className;o.className=p.replace(k," ");if(this.hasClass(o,l)){this.removeClass(o,l)}};f.Dom.batch(m,n,f.Dom,true)},replaceClass:function(n,l,k){if(l===k){return false}var m=new RegExp("(?:^|\\s+)"+l+"(?:\\s+|$)","g");var o=function(p){if(!this.hasClass(p,l)){this.addClass(p,k);return}p.className=p.className.replace(m," "+k+" ");if(this.hasClass(p,l)){this.replaceClass(p,l,k)}};
f.Dom.batch(n,o,f.Dom,true)},generateId:function(k,m){m=m||"yui-gen";k=k||{};var l=function(n){if(n){n=f.Dom.get(n)}else{n={}}if(!n.id){n.id=m+e++}return n.id};return f.Dom.batch(k,l,f.Dom,true)},isAncestor:function(l,m){l=f.Dom.get(l);if(!l||!m){return false}var k=function(o){if(l.contains&&!h){return l.contains(o)}else{if(l.compareDocumentPosition){return !!(l.compareDocumentPosition(o)&16)}else{var n=o.parentNode;while(n){if(n==l){return true}else{if(!n.tagName||n.tagName.toUpperCase()=="HTML"){return false
}}n=n.parentNode}return false}}};return f.Dom.batch(m,k,f.Dom,true)},inDocument:function(k){var l=function(m){return this.isAncestor(document.documentElement,m)};return f.Dom.batch(k,l,f.Dom,true)},getElementsBy:function(q,l,m){l=l||"*";m=f.Dom.get(m)||document;var n=[];var p=m.getElementsByTagName(l);if(!p.length&&(l=="*"&&m.all)){p=m.all}for(var o=0,k=p.length;o<k;++o){if(q(p[o])){n[n.length]=p[o]}}return n},batch:function(p,k,n,m){var l=p;p=f.Dom.get(p);var t=(m)?n:window;if(!p||p.tagName||!p.length){if(!p){return false
}return k.call(t,p,n)}var r=[];for(var q=0,s=p.length;q<s;++q){if(!p[q]){l=l[q]}r[r.length]=k.call(t,p[q],n)}return r},getDocumentHeight:function(){var l=-1,q=-1,p=-1;var m=parseInt(f.Dom.getStyle(document.body,"marginTop"),10);var o=parseInt(f.Dom.getStyle(document.body,"marginBottom"),10);var n=document.compatMode;if((n||d)&&!c){switch(n){case"CSS1Compat":l=((window.innerHeight&&window.scrollMaxY)?window.innerHeight+window.scrollMaxY:-1);q=[document.documentElement.clientHeight,self.innerHeight||-1].sort(function(s,r){return(s-r)
})[1];p=document.body.offsetHeight+m+o;break;default:l=document.body.scrollHeight;p=document.body.clientHeight}}else{l=document.documentElement.scrollHeight;q=self.innerHeight;p=document.documentElement.clientHeight}var k=[l,q,p].sort(function(s,r){return(s-r)});return k[2]},getDocumentWidth:function(){var n=-1,k=-1,m=-1;var p=parseInt(f.Dom.getStyle(document.body,"marginRight"),10);var o=parseInt(f.Dom.getStyle(document.body,"marginLeft"),10);var q=document.compatMode;if(q||d){switch(q){case"CSS1Compat":n=document.documentElement.clientWidth;
k=document.body.offsetWidth+o+p;break;default:k=document.body.clientWidth;n=document.body.scrollWidth;break}}else{n=document.documentElement.clientWidth;k=document.body.offsetWidth+o+p}var l=Math.max(n,k);return l},getViewportHeight:function(){var k=-1;var l=document.compatMode;if((l||d)&&!c){switch(l){case"CSS1Compat":k=document.documentElement.clientHeight;break;default:k=document.body.clientHeight}}else{k=self.innerHeight}return k},getViewportWidth:function(){var k=-1;var l=document.compatMode;if(l||d){switch(l){case"CSS1Compat":k=document.documentElement.clientWidth;
break;default:k=document.body.clientWidth}}else{k=self.innerWidth}return k}}}();YAHOO.util.Region=function(d,e,a,c){this.top=d;this[1]=d;this.right=e;this.bottom=a;this.left=c;this[0]=c};YAHOO.util.Region.prototype.contains=function(a){return(a.left>=this.left&&a.right<=this.right&&a.top>=this.top&&a.bottom<=this.bottom)};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left))};YAHOO.util.Region.prototype.intersect=function(f){var d=Math.max(this.top,f.top);var e=Math.min(this.right,f.right);
var a=Math.min(this.bottom,f.bottom);var c=Math.max(this.left,f.left);if(a>=d&&e>=c){return new YAHOO.util.Region(d,e,a,c)}else{return null}};YAHOO.util.Region.prototype.union=function(f){var d=Math.min(this.top,f.top);var e=Math.max(this.right,f.right);var a=Math.max(this.bottom,f.bottom);var c=Math.min(this.left,f.left);return new YAHOO.util.Region(d,e,a,c)};YAHOO.util.Region.prototype.toString=function(){return("Region {top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}")
};YAHOO.util.Region.getRegion=function(e){var g=YAHOO.util.Dom.getXY(e);var d=g[1];var f=g[0]+e.offsetWidth;var a=g[1]+e.offsetHeight;var c=g[0];return new YAHOO.util.Region(d,f,a,c)};YAHOO.util.Point=function(a,b){if(a instanceof Array){b=a[1];a=a[0]}this.x=this.right=this.left=this[0]=a;this.y=this.top=this.bottom=this[1]=b};YAHOO.util.Point.prototype=new YAHOO.util.Region();
