YAHOO.util.Dom=function(){
var ua=navigator.userAgent.toLowerCase();
var _2=(ua.indexOf("opera")>-1);
var _3=(ua.indexOf("safari")>-1);
var _4=(window.ActiveXObject);
var _5=0;
var _6=YAHOO.util;
var _7={};
var _8=function(_9){
var _a=function(_b){
var _c=/(-[a-z])/i.exec(_b);
return _b.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());
};
while(_9.indexOf("-")>-1){
_9=_a(_9);
}
return _9;
};
var _d=function(_e){
if(_e.indexOf("-")>-1){
return _e;
}
var _f="";
for(var i=0,len=_e.length;i<len;++i){
if(_e.charAt(i)==_e.charAt(i).toUpperCase()){
_f=_f+"-"+_e.charAt(i).toLowerCase();
}else{
_f=_f+_e.charAt(i);
}
}
return _f;
};
var _12=function(_13){
_7[_13]={camel:_8(_13),hyphen:_d(_13)};
};
return {get:function(el){
if(!el){
return null;
}
if(typeof el!="string"&&!(el instanceof Array)){
return el;
}
if(typeof el=="string"){
return document.getElementById(el);
}else{
var _15=[];
for(var i=0,len=el.length;i<len;++i){
_15[_15.length]=_6.Dom.get(el[i]);
}
return _15;
}
return null;
},getStyle:function(el,_19){
var f=function(el){
var _1c=null;
var dv=document.defaultView;
if(!_7[_19]){
_12(_19);
}
var _1e=_7[_19]["camel"];
var _1f=_7[_19]["hyphen"];
if(_19=="opacity"&&el.filters){
_1c=1;
try{
_1c=el.filters.item("DXImageTransform.Microsoft.Alpha").opacity/100;
}
catch(e){
try{
_1c=el.filters.item("alpha").opacity/100;
}
catch(e){
}
}
}else{
if(el.style[_1e]){
_1c=el.style[_1e];
}else{
if(_4&&el.currentStyle&&el.currentStyle[_1e]){
_1c=el.currentStyle[_1e];
}else{
if(dv&&dv.getComputedStyle){
var _20=dv.getComputedStyle(el,"");
if(_20&&_20.getPropertyValue(_1f)){
_1c=_20.getPropertyValue(_1f);
}
}
}
}
}
return _1c;
};
return _6.Dom.batch(el,f,_6.Dom,true);
},setStyle:function(el,_22,val){
if(!_7[_22]){
_12(_22);
}
var _24=_7[_22]["camel"];
var f=function(el){
switch(_22){
case "opacity":
if(_4&&typeof el.style.filter=="string"){
el.style.filter="alpha(opacity="+val*100+")";
if(!el.currentStyle||!el.currentStyle.hasLayout){
el.style.zoom=1;
}
}else{
el.style.opacity=val;
el.style["-moz-opacity"]=val;
el.style["-khtml-opacity"]=val;
}
break;
default:
el.style[_24]=val;
}
};
_6.Dom.batch(el,f,_6.Dom,true);
},getXY:function(el){
var f=function(el){
if(el.offsetParent===null||this.getStyle(el,"display")=="none"){
return false;
}
var _2a=null;
var pos=[];
var box;
if(el.getBoundingClientRect){
box=el.getBoundingClientRect();
var doc=document;
if(!this.inDocument(el)&&parent.document!=document){
doc=parent.document;
if(!this.isAncestor(doc.documentElement,el)){
return false;
}
}
var _2e=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);
var _2f=Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);
return [box.left+_2f,box.top+_2e];
}else{
pos=[el.offsetLeft,el.offsetTop];
_2a=el.offsetParent;
if(_2a!=el){
while(_2a){
pos[0]+=_2a.offsetLeft;
pos[1]+=_2a.offsetTop;
_2a=_2a.offsetParent;
}
}
if(_3&&this.getStyle(el,"position")=="absolute"){
pos[0]-=document.body.offsetLeft;
pos[1]-=document.body.offsetTop;
}
}
if(el.parentNode){
_2a=el.parentNode;
}else{
_2a=null;
}
while(_2a&&_2a.tagName.toUpperCase()!="BODY"&&_2a.tagName.toUpperCase()!="HTML"){
if(_6.Dom.getStyle(_2a,"display")!="inline"){
pos[0]-=_2a.scrollLeft;
pos[1]-=_2a.scrollTop;
}
if(_2a.parentNode){
_2a=_2a.parentNode;
}else{
_2a=null;
}
}
return pos;
};
return _6.Dom.batch(el,f,_6.Dom,true);
},getX:function(el){
var f=function(el){
return _6.Dom.getXY(el)[0];
};
return _6.Dom.batch(el,f,_6.Dom,true);
},getY:function(el){
var f=function(el){
return _6.Dom.getXY(el)[1];
};
return _6.Dom.batch(el,f,_6.Dom,true);
},setXY:function(el,pos,_38){
var f=function(el){
var _3b=this.getStyle(el,"position");
if(_3b=="static"){
this.setStyle(el,"position","relative");
_3b="relative";
}
var _3c=this.getXY(el);
if(_3c===false){
return false;
}
var _3d=[parseInt(this.getStyle(el,"left"),10),parseInt(this.getStyle(el,"top"),10)];
if(isNaN(_3d[0])){
_3d[0]=(_3b=="relative")?0:el.offsetLeft;
}
if(isNaN(_3d[1])){
_3d[1]=(_3b=="relative")?0:el.offsetTop;
}
if(pos[0]!==null){
el.style.left=pos[0]-_3c[0]+_3d[0]+"px";
}
if(pos[1]!==null){
el.style.top=pos[1]-_3c[1]+_3d[1]+"px";
}
var _3e=this.getXY(el);
if(!_38&&(_3e[0]!=pos[0]||_3e[1]!=pos[1])){
this.setXY(el,pos,true);
}
};
_6.Dom.batch(el,f,_6.Dom,true);
},setX:function(el,x){
_6.Dom.setXY(el,[x,null]);
},setY:function(el,y){
_6.Dom.setXY(el,[null,y]);
},getRegion:function(el){
var f=function(el){
var _46=new YAHOO.util.Region.getRegion(el);
return _46;
};
return _6.Dom.batch(el,f,_6.Dom,true);
},getClientWidth:function(){
return _6.Dom.getViewportWidth();
},getClientHeight:function(){
return _6.Dom.getViewportHeight();
},getElementsByClassName:function(_47,tag,_49){
var _4a=function(el){
return _6.Dom.hasClass(el,_47);
};
return _6.Dom.getElementsBy(_4a,tag,_49);
},hasClass:function(el,_4d){
var re=new RegExp("(?:^|\\s+)"+_4d+"(?:\\s+|$)");
var f=function(el){
return re.test(el["className"]);
};
return _6.Dom.batch(el,f,_6.Dom,true);
},addClass:function(el,_52){
var f=function(el){
if(this.hasClass(el,_52)){
return;
}
el["className"]=[el["className"],_52].join(" ");
};
_6.Dom.batch(el,f,_6.Dom,true);
},removeClass:function(el,_56){
var re=new RegExp("(?:^|\\s+)"+_56+"(?:\\s+|$)","g");
var f=function(el){
if(!this.hasClass(el,_56)){
return;
}
var c=el["className"];
el["className"]=c.replace(re," ");
if(this.hasClass(el,_56)){
this.removeClass(el,_56);
}
};
_6.Dom.batch(el,f,_6.Dom,true);
},replaceClass:function(el,_5c,_5d){
if(_5c===_5d){
return false;
}
var re=new RegExp("(?:^|\\s+)"+_5c+"(?:\\s+|$)","g");
var f=function(el){
if(!this.hasClass(el,_5c)){
this.addClass(el,_5d);
return;
}
el["className"]=el["className"].replace(re," "+_5d+" ");
if(this.hasClass(el,_5c)){
this.replaceClass(el,_5c,_5d);
}
};
_6.Dom.batch(el,f,_6.Dom,true);
},generateId:function(el,_62){
_62=_62||"yui-gen";
el=el||{};
var f=function(el){
if(el){
el=_6.Dom.get(el);
}else{
el={};
}
if(!el.id){
el.id=_62+_5++;
}
return el.id;
};
return _6.Dom.batch(el,f,_6.Dom,true);
},isAncestor:function(_65,_66){
_65=_6.Dom.get(_65);
if(!_65||!_66){
return false;
}
var f=function(_68){
if(_65.contains&&!_3){
return _65.contains(_68);
}else{
if(_65.compareDocumentPosition){
return !!(_65.compareDocumentPosition(_68)&16);
}else{
var _69=_68.parentNode;
while(_69){
if(_69==_65){
return true;
}else{
if(!_69.tagName||_69.tagName.toUpperCase()=="HTML"){
return false;
}
}
_69=_69.parentNode;
}
return false;
}
}
};
return _6.Dom.batch(_66,f,_6.Dom,true);
},inDocument:function(el){
var f=function(el){
return this.isAncestor(document.documentElement,el);
};
return _6.Dom.batch(el,f,_6.Dom,true);
},getElementsBy:function(_6d,tag,_6f){
tag=tag||"*";
_6f=_6.Dom.get(_6f)||document;
var _70=[];
var _71=_6f.getElementsByTagName(tag);
if(!_71.length&&(tag=="*"&&_6f.all)){
_71=_6f.all;
}
for(var i=0,len=_71.length;i<len;++i){
if(_6d(_71[i])){
_70[_70.length]=_71[i];
}
}
return _70;
},batch:function(el,_75,o,_77){
var id=el;
el=_6.Dom.get(el);
var _79=(_77)?o:window;
if(!el||el.tagName||!el.length){
if(!el){
return false;
}
return _75.call(_79,el,o);
}
var _7a=[];
for(var i=0,len=el.length;i<len;++i){
if(!el[i]){
id=id[i];
}
_7a[_7a.length]=_75.call(_79,el[i],o);
}
return _7a;
},getDocumentHeight:function(){
var _7d=-1,_7e=-1,_7f=-1;
var _80=parseInt(_6.Dom.getStyle(document.body,"marginTop"),10);
var _81=parseInt(_6.Dom.getStyle(document.body,"marginBottom"),10);
var _82=document.compatMode;
if((_82||_4)&&!_2){
switch(_82){
case "CSS1Compat":
_7d=((window.innerHeight&&window.scrollMaxY)?window.innerHeight+window.scrollMaxY:-1);
_7e=[document.documentElement.clientHeight,self.innerHeight||-1].sort(function(a,b){
return (a-b);
})[1];
_7f=document.body.offsetHeight+_80+_81;
break;
default:
_7d=document.body.scrollHeight;
_7f=document.body.clientHeight;
}
}else{
_7d=document.documentElement.scrollHeight;
_7e=self.innerHeight;
_7f=document.documentElement.clientHeight;
}
var h=[_7d,_7e,_7f].sort(function(a,b){
return (a-b);
});
return h[2];
},getDocumentWidth:function(){
var _88=-1,_89=-1,_8a=-1;
var _8b=parseInt(_6.Dom.getStyle(document.body,"marginRight"),10);
var _8c=parseInt(_6.Dom.getStyle(document.body,"marginLeft"),10);
var _8d=document.compatMode;
if(_8d||_4){
switch(_8d){
case "CSS1Compat":
_88=document.documentElement.clientWidth;
_89=document.body.offsetWidth+_8c+_8b;
break;
default:
_89=document.body.clientWidth;
_88=document.body.scrollWidth;
break;
}
}else{
_88=document.documentElement.clientWidth;
_89=document.body.offsetWidth+_8c+_8b;
}
var w=Math.max(_88,_89);
return w;
},getViewportHeight:function(){
var _8f=-1;
var _90=document.compatMode;
if((_90||_4)&&!_2){
switch(_90){
case "CSS1Compat":
_8f=document.documentElement.clientHeight;
break;
default:
_8f=document.body.clientHeight;
}
}else{
_8f=self.innerHeight;
}
return _8f;
},getViewportWidth:function(){
var _91=-1;
var _92=document.compatMode;
if(_92||_4){
switch(_92){
case "CSS1Compat":
_91=document.documentElement.clientWidth;
break;
default:
_91=document.body.clientWidth;
}
}else{
_91=self.innerWidth;
}
return _91;
}};
}();
YAHOO.util.Region=function(t,r,b,l){
this.top=t;
this[1]=t;
this.right=r;
this.bottom=b;
this.left=l;
this[0]=l;
};
YAHOO.util.Region.prototype.contains=function(_97){
return (_97.left>=this.left&&_97.right<=this.right&&_97.top>=this.top&&_97.bottom<=this.bottom);
};
YAHOO.util.Region.prototype.getArea=function(){
return ((this.bottom-this.top)*(this.right-this.left));
};
YAHOO.util.Region.prototype.intersect=function(_98){
var t=Math.max(this.top,_98.top);
var r=Math.min(this.right,_98.right);
var b=Math.min(this.bottom,_98.bottom);
var l=Math.max(this.left,_98.left);
if(b>=t&&r>=l){
return new YAHOO.util.Region(t,r,b,l);
}else{
return null;
}
};
YAHOO.util.Region.prototype.union=function(_9d){
var t=Math.min(this.top,_9d.top);
var r=Math.max(this.right,_9d.right);
var b=Math.max(this.bottom,_9d.bottom);
var l=Math.min(this.left,_9d.left);
return new YAHOO.util.Region(t,r,b,l);
};
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(el){
var p=YAHOO.util.Dom.getXY(el);
var t=p[1];
var r=p[0]+el.offsetWidth;
var b=p[1]+el.offsetHeight;
var l=p[0];
return new YAHOO.util.Region(t,r,b,l);
};
YAHOO.util.Point=function(x,y){
if(x instanceof Array){
y=x[1];
x=x[0];
}
this.x=this.right=this.left=this[0]=x;
this.y=this.top=this.bottom=this[1]=y;
};
YAHOO.util.Point.prototype=new YAHOO.util.Region();
