window.DWS=(function(){
var t="DWSTeam<lei>",v="1.0.1.20071224.1",g="getElementsByTagName",m="Module",u="indexOf",x="Class",y="script",z="_";
var B,E,F,L,P,W=window,D=document,N=navigator,S=D[g](y);
W.undefined=W.undefined;
S=S[S.length-1];
P=S.getAttribute("src").replace("dwsCore.js","");
B=(function(){
var a=N.userAgent.toLowerCase(),
b=(D.getElementById?true:false),
c=((a[u]("msie")!=-1) &&(a[u]("opera")==-1) &&(a[u]("omniweb")==-1)),
d=b &&(N.appName=="Netscape"),
e=a[u]("opera")!=-1,
f=a[u]("gecko") !=-1;
return{agt:a,isW3C:b,isIE:c,isFF:d,isNS6:d,isOP:e,isGecko:f};
})();
L=function(a,b){
var s=D[g](y);
a=a.toLowerCase();
if(!b){
for(var i=0;i<s.length;i++){if(s[i].src && s[i].src.toLowerCase()[u](a)>-1) return;}
}
var o=D.createElement(y);
o.type="text/javascript";
o.src=a;
var h=D[g]('head')[0];
h.appendChild(o);
};
E=function(a,b){
var c=z+a+m,d="$"+a;
if(!DWS[a]){
DWS[a]=function(){
return DWS[c];
};
}
if(!W[d]){
W[d]=function(){
return DWS[c][b]?DWS[c][b]():DWS[c];
};
}
if(!W[b]){
W[b]=function(arguments){
return DWS[c][b]?DWS[c][b](arguments):DWS[c];
};
}
return function(e,f){return DWS.extCore(e,f);};
};
F=function(a,b){
var c=z+a+x;
if(!DWS[a]){
DWS[a]=function(){
if(!DWS[c]) throw "DWS."+c+" isn't loaded";
return(new DWS[c](arguments));
};
}
return function(a,b){return DWS.extCls(a,b);};
};
return{Author:t,Version:v,Path:P,BV:B,extCore:E,extCls:F,incJS:L,$:function(a,b){return(DWS.DOM().$(a,b));}};
})();
DWS.require=function(){};
DWS.curry=function(f, n){
if(typeof n=='undefined') n=f.length,ME=this;
return function(){
if(arguments.length >=n){
return f.apply(this, arguments);
}else{
var a=[].slice.call(arguments,0);
return ME.curry(
function(){
return f.apply(this, a.concat([].slice.call(arguments,0)))
},
n-a.length
);
}
};
};
DWS.extCore("DOM")("XY")("Drag");
String.prototype.RA=function(a,b){
var raRegExp=new RegExp(a.replace(/([\(\)\[\]\{\}\^\$\+\-\*\?\.\"\'\|\/\\])/g,"\\$1"),"ig");
return this.replace(raRegExp,b);
};
String.prototype.replaceAll=function(a,b){
return this.RA(a,b);
};
String.prototype.camelize=function(s){
s=s || "-";
var A=this.split(s),L=A.length;
var S;
if(L==1)return A[0];
var R=this.indexOf(s)==0
? A[0].charAt(0).toUpperCase() + A[0].substring(1): A[0];
for(var i=1, length=L; i < length; i++){
S=A[i];
R +=S.charAt(0).toUpperCase() + S.substring(1);
}
return R;
};
String.prototype.unCamelize=function(s){
s=s || "-";
var str=this;
str=str.replace(/([A-Z])/g,s+"$1").toLowerCase();
return str;
};
String.prototype.toInt=function(){
var n=parseInt(this);
n=isNaN(parseInt(n)) ? 0: n;
return n;
};
String.prototype.toReg=function(){
return this.str.replace(/([\(\)\[\]\{\}\^\$\+\-\*\?\.\"\'\|\/\\])/g,"\\$1");
};
String.prototype.trim=function(){
var m=this.match(/^\s*(\S+(\s+\S+)*)\s*$/);
return(m==null) ? "": m[1];
};
Array.prototype.each=function(f){
for(var i=0,l=this.length;i<l;i++)f(this[i],i);
};
Array.prototype.any=function(f,b){
var B=false;
for(var i=0,l=this.length;i<l;i++){
if(f(this[i],i)){
B=true;
if(b) break;
}
}
return B;
};
Array.prototype.all=function(f,b){
var B=true;
for(var i=0,l=this.length;i<l;i++){
if(!f(this[i],i)){
B=false;
if(b) break;
}
}
return B;
};
Array.prototype.has=function(v){
for(var i=0,l=this.length;i<l;i++){
if(this[i]===v)return true;
}
return false;
};

DWS._DOMModule={
$:function(){
var a=arguments[0];
if(a){
a=typeof(a)=="string"?document.getElementById(a):a===this ? null:a;
}else{
a=this;
}
try{return a;} finally{a=null;}
},
isXMLDoc:function(el){
return el.tagName && el.ownerDocument && !el.ownerDocument.body;
},
isElement:function(el){
return(el && el.nodeType==1 && el.tagName !="!") ? el: null;
},
compareNamespace:function(el, NS){
return !NS ||(NS=="*") ||(el.scopeName==NS);
},
compareTagName:function(el, tag, NS){
if(tag=="*") return this.isElement(el);
if(!this.compareNamespace(el, NS)) return false;
if(!this.isXMLDoc(el)) tag=tag.toUpperCase();
return el.tagName==tag;
},
byTag:function(tag,p,ec){
tag=tag || "div";
if(!(p=this.$(p))) p=document;
p=p.getElementsByTagName(tag);
if(p && ec>0) p=this._DOM2Arr(p);
try{
return p;
} finally{
p=null;
}
},
byCSS:function(sc,attr,p,ret){
ret=ret || [];
attr=attr ||{};
var ME=this;
if(!(p=ME.$(p))) p=document.body;
var s=sc.trim();
s=s.split(" ");
if(s.length>1){
alert("暂不支持多级DOM获取");
}else{
s=s[0];
var o=null;
if(s.indexOf("#")>-1){
s=s.split("#")[1];
s=s.split(".")[0];
o=document.getElementById(s);
ret.has(o)?"":ret.push(ME.$(o,true));
}else if(s.indexOf(".")>-1){
s=s.split(".");
if(!s[0]){
s[0]="*";
}
o=ME.byTag(s[0],p,true);
o.each(function(ss){
if(ME.className.has(ss,s[1]) && !ret.has(ME.$(ss,true))){
ret.push(ss);
}
});
}else if(s){
o=ME.byTag(s,p,true);
o.each(function(ss){ret.has(ss)?"":ret.push(ME.$(ss,true));});
}
o=null;
}
s=[];
ret.each(function(ss){
ME.hasAttr(ss,attr)?s.push(ss):"";
});
ret=null;
try{
return s;
} finally{
s=null;
}
},
css:function(o,s,v){
var D=document,V="defaultView",T="style",C="currentStyle",S="getComputedStyle";
var sv=null;
if(!(o=this.$(o))) return null;
s=this._fixCSS(s);
if(typeof(v)!="undefined"){
s=(DWS.BV.isFF && s=="float") ? "cssFloat": s;
this.attr(o[T],s,v);
}else{
if(o[T][s]){
sv=o[T][s];
}else if(o[C]){
sv=o[C][s];
}else if(D[V] && D[V][S]){
sv=D[V][S](o,null).getPropertyValue(s);
}
sv=this._fixValue(o,s,sv);
}
try{
return sv;
} finally{
sv=null;
}
},
attr:function(el, name, value){
if(!(el=this.$(el))) return null;
var fix=this.isXMLDoc(el) ?{}: this._fixAttr();
if( name=="opacity" && DWS.BV.isIE){
if(value !=undefined){
el.zoom=1;
el.filter=el.filter.replace(/alpha\([^\)]*\)/gi,"") +( value==1 ? "":"alpha(opacity=" + value * 100 + ")" );
}else{
return(el.filter ? parseFloat(el.filter.match(/alpha\(opacity=(.*)\)/)[1] ) / 100: 1);
}
}
if( name=="opacity" && DWS.BV.isFF && value==1 ) value=0.9999;
if( fix[name] ){
if( value !=undefined ) el[fix[name]]=value;
return el[fix[name]];
}else if( value==undefined && DWS.BV.isIE && this.nodeName(el, "form") &&(name=="action" || name=="method") )
return el.getAttributeNode(name).nodeValue;
else if( el.tagName ){
if( value !=undefined ) el.setAttribute( name, value );
if( DWS.BV.isIE && /href|src/.test(name) && !this.isXMLDoc(el) )
return el.getAttribute( name, 2 );
return el.getAttribute(name);
}else{
name=name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();});
if( value !=undefined ) el[name]=value;
return el[name];
}
},
text:function(el){
return el.textContent || el.innerText || this._text(el);
},
hasAttr:function(o,attr){
var a=true;
var fix=this._fixAttr();
for(var x in attr){
if(fix[x]){
if(o[fix[x]]!=attr[x]){a=false;break;}
}else{
if(o[x]!=attr[x]){a=false;break;}
}
}
return a;
},
_DOM2Arr:function(o){
var r=[];
if(o.length){
for(var i=0; i<o.length;i++){r.push(o[i]);}
}else{
r=[o];
}
return r;
},
_fixAttr:function(){
return{
"for":"htmlFor",
"class":"className",
"float": DWS.BV.isIE ? "styleFloat":"cssFloat",
cssFloat: DWS.BV.isIE ? "styleFloat":"cssFloat",
innerHTML:"innerHTML",
className:"className",
value:"value",
disabled:"disabled",
checked:"checked",
readonly:"readOnly",
selected:"selected"
};
},
_text:function(el){
var s="", o, i;
for(i=0;(o=el.childNodes[i]); i++){
switch(o.nodeType){
case 1: s +=this._text(o); break;
case 3: s +=o.nodeValue; break;
}
}
return s;
},
_fixCSS:function(s){
if(DWS.BV.isIE || DWS.BV.isOP){
s=s=="float" ? "styleFloat": s.camelize();
}else{
s=s.unCamelize();
}
return s;
},
_fixValue:function(o,s,v){
if(v=="auto"){
if(s=="width"){
v=(o.clientWidth - this.css(o,"paddingLeft").toInt() - this.css(o,"paddingRight").toInt()) +"px";
/*@cc_on @*/
/*@if(@_jscript_version < 5.6){
v=o.offsetWidth + "px"
}
@end @*/
}else if(s=="height"){
v=(o.clientHeight - this.css(o,"paddingTop").toInt() - this.css(o,"paddingBottom").toInt()) +"px";
/*@cc_on @*/
/*@if(@_jscript_version < 5.6) v=o.offsetHeight + "px";
@end @*/
}
}
return v;
},
sameCSS:function(e1,e2,s){
var ME=this;
if(!(e1=this.$(e1))) return;
if(!(e2=this.$(e2))) return;
if(typeof(s)=="string"){
this.css(e1,s,this.css(e2,s));
}else if(typeof(s)=="object"){
s.each(function(v){
ME.sameCSS(e1,e2,v);
});
}else{
s=s.toString();
this.css(e1,s,this.css(e2,s));
}
},
CE:function(tag, attribs, styles, p,w){
var el=document.createElement(tag);
w=w || "last";
if(attribs) this.setAttr(el, attribs);
if(styles) this.setStyle(el, styles);
if(p) w.toLowerCase()=="first"?p.insertBefore(el,p.firstChild):p.appendChild(el);
try{
return el;
} finally{
el=null;
}
},
setAttr:function(el, attribs){
for(var x in attribs){
el[x]=attribs[x];
}
},
setStyle:function(el, styles){
for(var x in styles){
try{ el.style[x]=styles[x]; }
catch(e){}
}
},
insertBefore:function(newEl,tgEl){
if(!(newEl=this.$(newEl))) return;
if(!(tgEl=this.$(tgEl))) return;
var p=tgEl.parentNode;
p.insertBefore(newEl,tgEl);
},
insertAfter:function(newEl,tgEl){
if(!(newEl=this.$(newEl))) return;
if(!(tgEl=this.$(tgEl))) return;
var p=tgEl.parentNode;
if(p.lastChild==tgEl){
p.appendChild(newEl);
}else{
p.insertBefore(newEl,tgEl.nextSibling);
}
},
IA:function(oN,oT){
this.insertAfter(oN,oT);
},
IB:function(oN,oT){
this.insertBefore(oN,oT);
},
AC:function(c,p,w){
if(!(c=this.$(c))) return;
if(!(p=this.$(p))) p=document.body;
w=w || "last";
if(p) w.toLowerCase()=="first"?p.insertBefore(c,p.firstChild):p.appendChild(c);
},
incCSS:function(s){
var ME=this;
ME.CE(
"link",{type:"text/css",
rel:"stylesheet",
href:s,
media:"all"},{},
document.getElementsByTagName("head")[0]
);
return function(s){return ME.incCSS(s);};
}
};
DWS._DOMModule.className={
$:function(s){
return DWS._DOMModule.$(s);
},
has:function(el,c){
if(!(el=this.$(el))) return null;
el=el.className || " ";
el=" " + el + " ";
c=" " + c + " ";
return(el.indexOf(c)!=-1);
},
add:function(el,c){
if(!(el=this.$(el))) return;
if(this.has(el,c)){return;}
el.className=el.className+" "+c;
},
del:function(el,c){
if(!(el=this.$(el))) return;
var arr=el.className.split(" ");
for(var i=arr.length-1;i>=0;i--){
if(c==arr[i]) arr.splice(i,1);
}
el.className=arr.join(" ");
},
get:function(el){
if(!(el=this.$(el))) return null;
return el.className;
},
set:function(el,c){
if(!(el=this.$(el))) return;
el.className=c;
}
};

DWS._XYModule={
create:function(x, y){
return new DWS._XYClass(this, x, y);
},
origin:function(){
return this.create(0, 0);
},
topLeftPosition:function(el){
var dm=$DOM(),l=parseInt(dm.css(el, "left")),t=parseInt(dm.css(el, "top"));
l=isNaN(l) ? 0: l;
t=isNaN(t) ? 0: t;
return this.create(l, t);
},
bottomRightPosition:function(el){
return this.topLeftPosition(el).plus(this._size(el));
},
topLeftOffset:function(el){
var off=this._offset(el);
var OP=el.offsetParent;
while(OP){
off=off.plus(this._offset(OP));
OP=OP.offsetParent;
}
return off;
},
bottomRightOffset:function(el){
return this.topLeftOffset(el).plus(this.create(el.offsetWidth, el.offsetHeight));
},
bottomLeftOffset:function(el){
return this.topLeftOffset(el).plus(this.create(0, el.offsetHeight));
},
scrollOffset:function(){
var W=window,D=document,B="body",L="scrollLeft",T="scrollTop",E="documentElement",X="pageXOffset";
if(W[X]){
return this.create(W[X], W.pageYOffset);
}else if(D[E]){
return this.create(D[B][L] + D[E][L],D[B][T] + D[E][T]);
}else if(D[B][L] >=0){
return this.create(D[B][L], D[B][T]);
}else{
return this.create(0, 0);
}
},
clientSize:function(){
var W=window,D=document,B="body",E="documentElement",CW="clientWidth",CH="clientHeight",IW="innerWidth",IH="innerHeight",w=0,h=0;
if(W[IH] >=0){
w=W[IW];
h=W[IH];
}else if(D[E]){
w=D[E][CW];
h=D[E][CH];
}else if(D[B][CH] >=0){
w=D[B][CW];
h=D[B][CH];
}
return this.create(w,h);
},
pageSize:function(){
var W=window,D=document,B="body",E="documentElement",CW="clientWidth",CH="clientHeight",IW="innerWidth",IH="innerHeight",OW="offsetWidth",OH="offsetHeight",SW="scrollWidth",SH="scrollHeight";
var sX,sY,pW,pH,wW,wH;
if(W[IH] && W.scrollMaxY){
sX=D[B][SW];
sY=W[IH] + W.scrollMaxY;
}else if(D[B][SH] > D[B][OH]){
sX=D[B][SW];
sY=D[B][SH];
}else{
sX=D[B][OW];
sY=D[B][OH];
}
if(self[IH]){
wW=self[IW];
wH=self[IH];
}else if(D[E] && D[E][CH]){
wW=D[E][CW];
wH=D[E][CH];
}else if(D[B]){
wW=D[B][CW];
wH=D[B][CH];
}
pH=sY < wH ? wH: sY;
pW=sX < wW ? wW: sX;
return this.create(pW, pH);
},
mousePosition:function(e){
e=this._fixE(e);
return this.create(e.clientX, e.clientY);
},
mouseOffset:function(e){
e=this._fixE(e);
var X="pageX",C="clientX";
if(e[X] >=0 || e[X] < 0){
return this.create(e[X], e.pageY);
}else if(e[C] >=0 || e[C] < 0){
return this.mousePosition(e).plus(this.scrollOffset());
}else{
return null;
}
},
_fixE:function(e){
if(!e) e=window.event;
return e;
},
_size:function(el){
return this.create(el.offsetWidth, el.offsetHeight);
},
_offset:function(el){
return this.create(el.offsetLeft, el.offsetTop);
}
};
DWS._XYClass=function(XY, x, y){
this.XY=XY;
this.x=isNaN(x) ? 0: x;
this.y=isNaN(y) ? 0: y;
};
DWS._XYClass.prototype={
toString:function(){
return "(" + this.x + "," + this.y + ")";
},
plus:function(that){
return this.XY.create(this.x + that.x, this.y + that.y);
},
minus:function(that){
return this.XY.create(this.x - that.x, this.y - that.y);
},
min:function(that){
return this.XY.create(Math.min(this.x , that.x), Math.min(this.y , that.y));
},
max:function(that){
return this.XY.create(Math.max(this.x , that.x), Math.max(this.y , that.y));
},
distance:function(that){
return Math.sqrt(Math.pow(this.x - that.x, 2) + Math.pow(this.y - that.y, 2));
},
multiplier:function(n1,n2){
return this.XY.create(this.x*n1, this.y*n2);
},
constrainTo:function(one, two){
var min=one.min(two);
var max=one.max(two);
return this.max(min).min(max);
},
reposition:function(el){
el.style["top"]=this.y + "px";
el.style["left"]=this.x + "px";
}
};

DWS._DragModule={
obj: null,
zIndex: 999,
init:function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper){
o.onmousedown=DWS._DragModule.start;
o.hmode=bSwapHorzRef ? false: true ;
o.vmode=bSwapVertRef ? false: true ;
o.root=oRoot && oRoot !=null ? oRoot: o ;
if(o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left="0px";
if(o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top="0px";
if(!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right="0px";
if(!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom="0px";
o.minX=typeof minX !='undefined' ? minX: null;
o.minY=typeof minY !='undefined' ? minY: null;
o.maxX=typeof maxX !='undefined' ? maxX: null;
o.maxY=typeof maxY !='undefined' ? maxY: null;
o.xMapper=fXMapper ? fXMapper: null;
o.yMapper=fYMapper ? fYMapper: null;
o.root.onDragStart=new Function();
o.root.onDragEnd=new Function();
o.root.onDrag=new Function();
o.root.onmousedown=function(){
var drg=DWS._DragModule;
drg.focus(this);
};/**/
},
start:function(e){
var drg=DWS._DragModule;
var o=drg.obj=this;
e=drg.fixE(e);
var y=parseInt(o.vmode ? o.root.style.top: o.root.style.bottom);
var x=parseInt(o.hmode ? o.root.style.left: o.root.style.right );
o.root.onDragStart(x,y,o);
o.lastMouseX=e.clientX;
o.lastMouseY=e.clientY;
if(o.hmode){
if(o.minX !=null)    o.minMouseX=e.clientX - x + o.minX;
if(o.maxX !=null)    o.maxMouseX=o.minMouseX + o.maxX - o.minX;
}else{
if(o.minX !=null) o.maxMouseX=-o.minX + e.clientX + x;
if(o.maxX !=null) o.minMouseX=-o.maxX + e.clientX + x;
}
if(o.vmode){
if(o.minY !=null)    o.minMouseY=e.clientY - y + o.minY;
if(o.maxY !=null)    o.maxMouseY=o.minMouseY + o.maxY - o.minY;
}else{
if(o.minY !=null) o.maxMouseY=-o.minY + e.clientY + y;
if(o.maxY !=null) o.minMouseY=-o.maxY + e.clientY + y;
}
document.onmousemove=drg.drag;
document.onmouseup=drg.end;
drg=null;
return false;
},
focus:function(o){
var drg=DWS._DragModule;
if(o.style.zIndex<drg.zIndex){
drg.zIndex++;
o.style.zIndex=drg.zIndex;
}
},
drag:function(e){
var drg=DWS._DragModule;
e=drg.fixE(e);
var o=drg.obj;
var ey=e.clientY;
var ex=e.clientX;
var y=parseInt(o.vmode ? o.root.style.top: o.root.style.bottom);
var x=parseInt(o.hmode ? o.root.style.left: o.root.style.right );
var nx, ny;
if(o.minX !=null) ex=o.hmode ? Math.max(ex, o.minMouseX): Math.min(ex, o.maxMouseX);
if(o.maxX !=null) ex=o.hmode ? Math.min(ex, o.maxMouseX): Math.max(ex, o.minMouseX);
if(o.minY !=null) ey=o.vmode ? Math.max(ey, o.minMouseY): Math.min(ey, o.maxMouseY);
if(o.maxY !=null) ey=o.vmode ? Math.min(ey, o.maxMouseY): Math.max(ey, o.minMouseY);
nx=x +((ex - o.lastMouseX) *(o.hmode ? 1: -1));
ny=y +((ey - o.lastMouseY) *(o.vmode ? 1: -1));
if(o.xMapper){
nx=o.xMapper(y);
}else if(o.yMapper){
ny=o.yMapper(x);
}
drg.obj.root.style[o.hmode ? "left":"right"]=nx + "px";
drg.obj.root.style[o.vmode ? "top":"bottom"]=ny + "px";
drg.obj.lastMouseX=ex;
drg.obj.lastMouseY=ey;
drg.obj.root.onDrag(nx,ny,o);
drg=null;
return false;
},
end:function(){
var drg=DWS._DragModule;
document.onmousemove=null;
document.onmouseup=null;
drg.obj.root.onDragEnd(parseInt(drg.obj.root.style[drg.obj.hmode ? "left":"right"]),
parseInt(drg.obj.root.style[drg.obj.vmode ? "top":"bottom"]));
drg.obj=null;
drg=null;
},
fixE:function(e){
if(typeof e=='undefined') e=window.event;
if(typeof e.layerX=='undefined') e.layerX=e.offsetX;
if(typeof e.layerY=='undefined') e.layerY=e.offsetY;
return e;
}
};
