/*
Copyright 2010, KISSY UI Library v1.1.5
MIT Licensed
build time: Sep 19 17:41
*/
KISSY.add("dom",function(b,t){function o(l,s){return l&&l.nodeType===s}b.DOM={_isElementNode:function(l){return o(l,1)},_isKSNode:function(l){return b.Node&&o(l,b.Node.TYPE)},_getWin:function(l){return l&&"scrollTo"in l&&l.document?l:o(l,9)?l.defaultView||l.parentWindow:l===t?window:false},_nodeTypeIs:o}});
KISSY.add("selector",function(b,t){function o(a,c){var f,d,e=[],v;c=l(c);if(b.isString(a)){a=b.trim(a);if(x.test(a)){if(d=s(a.slice(1),c))e=[d]}else if(f=m.exec(a)){d=f[1];v=f[2];f=f[3];if(c=d?s(d,c):c)if(f)if(!d||a.indexOf(i)!==-1)e=g(f,v,c);else{if((d=s(d,c))&&w.hasClass(d,f))e=[d]}else if(v)e=z(v,c)}else if(b.ExternalSelector)return b.ExternalSelector(a,c);else k(a)}else if(a&&(a[p]||a[q]))e=a[p]?[a[p]()]:a[q]();else if(a&&(b.isArray(a)||a&&!a.nodeType&&a.item&&a!=window))e=a;else if(a)e=[a];if(e&&
!e.nodeType&&e.item&&e!=window)e=b.makeArray(e);e.each=function(y,h){return b.each(e,y,h)};return e}function l(a){if(a===t)a=j;else if(b.isString(a)&&x.test(a))a=s(a.slice(1),j);else if(a&&a.nodeType!==1&&a.nodeType!==9)a=null;return a}function s(a,c){if(c.nodeType!==9)c=c.ownerDocument;return c.getElementById(a)}function z(a,c){return c.getElementsByTagName(a)}function g(a,c,f){f=a=f.getElementsByClassName(a);var d=0,e=0,v=a.length,y;if(c&&c!==n){f=[];for(c=c.toUpperCase();d<v;++d){y=a[d];if(y.tagName===
c)f[e++]=y}}return f}function k(a){b.error("Unsupported selector: "+a)}var j=document,w=b.DOM,i=" ",n="*",p="getDOMNode",q=p+"s",x=/^#[\w-]+$/,m=/^(?:#([\w-]+))?\s*([\w-]+|\*)?\.?([\w-]+)?$/;(function(){var a=j.createElement("div");a.appendChild(j.createComment(""));if(a.getElementsByTagName(n).length>0)z=function(c,f){var d=f.getElementsByTagName(c);if(c===n){for(var e=[],v=0,y=0,h;h=d[v++];)if(h.nodeType===1)e[y++]=h;d=e}return d}})();j.getElementsByClassName||(g=j.querySelectorAll?function(a,c,
f){return f.querySelectorAll((c?c:"")+"."+a)}:function(a,c,f){c=f.getElementsByTagName(c||n);f=[];var d=0,e=0,v=c.length,y,h;for(a=i+a+i;d<v;++d){y=c[d];if((h=y.className)&&(i+h+i).indexOf(a)>-1)f[e++]=y}return f});b.query=o;b.get=function(a,c){return o(a,c)[0]||null};b.mix(w,{query:o,get:b.get,filter:function(a,c){var f=o(a),d,e,v,y=[];if(b.isString(c)&&(d=m.exec(c))&&!d[1]){e=d[2];v=d[3];c=function(h){return!(e&&h.tagName!==e.toUpperCase()||v&&!w.hasClass(h,v))}}if(b.isFunction(c))y=b.filter(f,
c);else if(c&&b.ExternalSelector)y=b.ExternalSelector._filter(a,c);else k(c);return y},test:function(a,c){var f=o(a);return w.filter(f,c).length===f.length}})});
KISSY.add("dom-data",function(b,t){var o=window,l=b.DOM,s="_ks_data_"+b.now(),z={},g={},k={EMBED:1,OBJECT:1,APPLET:1};b.mix(l,{data:function(j,w,i){if(b.isPlainObject(w))for(var n in w)l.data(j,n,w[n]);else if(i===t){j=b.get(j);var p;if(!(!j||k[j.nodeName])){if(j==o)j=g;p=(n=j&&j.nodeType)?z:j;j=p[n?j[s]:s];if(b.isString(w)&&j)return j[w];return j}}else b.query(j).each(function(q){if(!(!q||k[q.nodeName])){if(q==o)q=g;var x=z,m;if(q&&q.nodeType){if(!(m=q[s]))m=q[s]=b.guid()}else{m=s;x=q}if(w&&i!==
t){x[m]||(x[m]={});x[m][w]=i}}})},removeData:function(j,w){b.query(j).each(function(i){if(i){if(i==o)i=g;var n,p=z,q,x=i&&i.nodeType;if(x)n=i[s];else{p=i;n=s}if(n){q=p[n];if(w){if(q){delete q[w];b.isEmptyObject(q)&&l.removeData(i)}}else{if(x)i.removeAttribute&&i.removeAttribute(s);else try{delete i[s]}catch(m){}x&&delete p[n]}}}})}})});
KISSY.add("dom-class",function(b,t){function o(g,k,j,w){if(!(k=b.trim(k)))return w?false:t;g=b.query(g);var i=0,n=g.length;k=k.split(s);for(var p;i<n;i++){p=g[i];if(l._isElementNode(p)){p=j(p,k,k.length);if(p!==t)return p}}if(w)return false}var l=b.DOM,s=/[\.\s]\s*\.?/,z=/[\n\t]/g;b.mix(l,{hasClass:function(g,k){return o(g,k,function(j,w,i){if(j=j.className){j=" "+j+" ";for(var n=0,p=true;n<i;n++)if(j.indexOf(" "+w[n]+" ")<0){p=false;break}if(p)return true}},true)},addClass:function(g,k){o(g,k,function(j,
w,i){var n=j.className;if(n){var p=" "+n+" ";n=n;for(var q=0;q<i;q++)if(p.indexOf(" "+w[q]+" ")<0)n+=" "+w[q];j.className=b.trim(n)}else j.className=k})},removeClass:function(g,k){o(g,k,function(j,w,i){var n=j.className;if(n)if(i){n=(" "+n+" ").replace(z," ");for(var p=0,q;p<i;p++)for(q=" "+w[p]+" ";n.indexOf(q)>=0;)n=n.replace(q," ");j.className=b.trim(n)}else j.className=""})},replaceClass:function(g,k,j){l.removeClass(g,k);l.addClass(g,j)},toggleClass:function(g,k,j){var w=b.isBoolean(j),i;o(g,
k,function(n,p,q){for(var x=0,m;x<q;x++){m=p[x];i=w?!j:l.hasClass(n,m);l[i?"removeClass":"addClass"](n,m)}})}})});
KISSY.add("dom-attr",function(b,t){var o=b.UA,l=o.ie,s=l&&l<8,z=document.documentElement.textContent!==t?"textContent":"innerText",g=b.DOM,k=g._isElementNode,j=/href|src|style/,w=/href|src|colspan|rowspan/,i=/\r/g,n=/radio|checkbox/,p={readonly:"readOnly"},q={val:1,css:1,html:1,text:1,data:1,width:1,height:1,offset:1};s&&b.mix(p,{"for":"htmlFor","class":"className"});b.mix(g,{attr:function(x,m,a,c){if(b.isPlainObject(m)){c=a;for(var f in m)g.attr(x,f,m[f],c)}else if(m=b.trim(m)){m=m.toLowerCase();
if(c&&q[m])return g[m](x,a);m=p[m]||m;if(a===t){x=b.get(x);if(!k(x))return t;var d;j.test(m)||(d=x[m]);if(d===t)d=x.getAttribute(m);if(s)if(w.test(m))d=x.getAttribute(m,2);else if(m==="style")d=x.style.cssText;return d===null?t:d}b.each(b.query(x),function(e){if(k(e))if(m==="style")e.style.cssText=a;else{if(m==="checked")e[m]=!!a;e.setAttribute(m,""+a)}})}},removeAttr:function(x,m){b.each(b.query(x),function(a){if(k(a)){g.attr(a,m,"");a.removeAttribute(m)}})},val:function(x,m){if(m===t){var a=b.get(x);
if(!k(a))return t;if(a&&a.nodeName.toUpperCase()==="option".toUpperCase())return(a.attributes.value||{}).specified?a.value:a.text;if(a&&a.nodeName.toUpperCase()==="select".toUpperCase()){var c=a.selectedIndex,f=a.options;if(c<0)return null;else if(a.type==="select-one")return g.val(f[c]);a=[];for(var d=0,e=f.length;d<e;++d)f[d].selected&&a.push(g.val(f[d]));return a}if(o.webkit&&n.test(a.type))return a.getAttribute("value")===null?"on":a.value;return(a.value||"").replace(i,"")}b.each(b.query(x),function(v){if(v&&
v.nodeName.toUpperCase()==="select".toUpperCase()){if(b.isNumber(m))m+="";var y=b.makeArray(m),h=v.options,r;d=0;for(e=h.length;d<e;++d){r=h[d];r.selected=b.inArray(g.val(r),y)}if(!y.length)v.selectedIndex=-1}else if(k(v))v.value=m})},text:function(x,m){if(m===t){var a=b.get(x);if(k(a))return a[z]||"";else if(g._nodeTypeIs(a,3))return a.nodeValue}else b.each(b.query(x),function(c){if(k(c))c[z]=m;else if(g._nodeTypeIs(c,3))c.nodeValue=m})}})});
KISSY.add("dom-style",function(b,t){function o(a,c){var f=b.get(a),d=c===j?f.offsetWidth:f.offsetHeight;b.each(c===j?["Left","Right"]:["Top","Bottom"],function(e){d-=parseFloat(s._getComputedStyle(f,"padding"+e))||0;d-=parseFloat(s._getComputedStyle(f,"border"+e+"Width"))||0});return d}function l(a,c,f){var d=f;if(f===w&&n.test(c)){d=0;if(s.css(a,"position")==="absolute"){f=a[c==="left"?"offsetLeft":"offsetTop"];if(z.ie===8||z.opera)f-=i(s.css(a.offsetParent,"border-"+c+"-width"))||0;d=f-(i(s.css(a,
"margin-"+c))||0)}}return d}var s=b.DOM,z=b.UA,g=document,k=g.documentElement,j="width",w="auto",i=parseInt,n=/^left|top$/,p=/width|height|top|left|right|bottom|margin|padding/i,q=/-([a-z])/ig,x=function(a,c){return c.toUpperCase()},m={};b.mix(s,{_CUSTOM_STYLES:m,_getComputedStyle:function(a,c){var f="",d=a.ownerDocument;if(a.style)f=d.defaultView.getComputedStyle(a,null)[c];return f},css:function(a,c,f){if(b.isPlainObject(c))for(var d in c)s.css(a,d,c[d]);else{if(c.indexOf("-")>0)c=c.replace(q,x);
c=m[c]||c;if(f===t){a=b.get(a);d="";if(a&&a.style){d=c.get?c.get(a):a.style[c];if(d===""&&!c.get)d=l(a,c,s._getComputedStyle(a,c))}return d===t?"":d}else{if(f===null||f==="")f="";else if(!isNaN(new Number(f))&&p.test(c))f+="px";(c===j||c==="height")&&parseFloat(f)<0||b.each(b.query(a),function(e){if(e&&e.style){c.set?c.set(e,f):e.style[c]=f;if(f==="")e.style.cssText||e.removeAttribute("style")}})}}},width:function(a,c){if(c===t)return o(a,j);else s.css(a,j,c)},height:function(a,c){if(c===t)return o(a,
"height");else s.css(a,"height",c)},show:function(a){b.query(a).each(function(c){if(c)c.style.display=s.data(c,"display")||""})},hide:function(a){b.query(a).each(function(c){if(c){var f=c.style,d=f.display;if(d!=="none"){d&&s.data(c,"display",d);f.display="none"}}})},toggle:function(a){b.query(a).each(function(c){if(c)c.style.display==="none"?s.show(c):s.hide(c)})},addStyleSheet:function(a,c){var f;if(c)f=b.get("#"+c);if(!f){f=s.create("<style>",{id:c});b.get("head").appendChild(f);if(f.styleSheet)f.styleSheet.cssText=
a;else f.appendChild(g.createTextNode(a))}}});if(k.style.cssFloat!==t)m["float"]="cssFloat";else if(k.style.styleFloat!==t)m["float"]="styleFloat"});
KISSY.add("dom-style-ie",function(b,t){if(b.UA.ie){var o=b.DOM,l=document,s=l.documentElement,z=o._CUSTOM_STYLES,g=/^-?\d+(?:px)?$/i,k=/^-?\d/,j=/^width|height$/;try{if(s.style.opacity===t&&s.filters)z.opacity={get:function(i){var n=100;try{n=i.filters["DXImageTransform.Microsoft.Alpha"].opacity}catch(p){try{n=i.filters("alpha").opacity}catch(q){}}return n/100+""},set:function(i,n){var p=i.style,q=(i.currentStyle||0).filter||"";p.zoom=1;if(q)if(q=q.replace(/alpha\(opacity=.+\)/ig,""))q+=", ";p.filter=
q+"alpha(opacity="+n*100+")"}}}catch(w){}if(!(l.defaultView||{}).getComputedStyle&&s.currentStyle)o._getComputedStyle=function(i,n){var p=i.style,q=i.currentStyle[n];if(j.test(n))q=o[n](i)+"px";else if(!g.test(q)&&k.test(q)){var x=p.left,m=i.runtimeStyle.left;i.runtimeStyle.left=i.currentStyle.left;p.left=n==="fontSize"?"1em":q||0;q=p.pixelLeft+"px";p.left=x;i.runtimeStyle.left=m}return q}}});
KISSY.add("dom-offset",function(b,t){function o(d){var e=0,v=0,y=w(d[q]);if(d[f]){d=d[f]();e=d[x];v=d[m];if(s.mobile!=="apple"){e+=l[a](y);v+=l[c](y)}}return{left:e,top:v}}var l=b.DOM,s=b.UA,z=window,g=document,k=l._isElementNode,j=l._nodeTypeIs,w=l._getWin,i=g.compatMode==="CSS1Compat",n=Math.max,p=parseInt,q="ownerDocument",x="left",m="top",a="scrollLeft",c="scrollTop",f="getBoundingClientRect";b.mix(l,{offset:function(d,e){if(!(d=b.get(d))||!d[q])return null;if(e===t)return o(d);var v=d;if(l.css(v,
"position")==="static")v.style.position="relative";var y=o(v),h={},r,u;for(u in e){r=p(l.css(v,u),10)||0;h[u]=r+e[u]-y[u]}l.css(v,h)},scrollIntoView:function(d,e,v,y){if((d=b.get(d))&&d[q]){y=y===t?true:!!y;v=v===t?true:!!v;if(!e||e===z)return d.scrollIntoView(v);e=b.get(e);if(j(e,9))e=w(e);var h=e&&"scrollTo"in e&&e.document,r=l.offset(d),u=h?{left:l.scrollLeft(e),top:l.scrollTop(e)}:l.offset(e),A={left:r[x]-u[x],top:r[m]-u[m]};r=h?l.viewportHeight(e):e.clientHeight;u=h?l.viewportWidth(e):e.clientWidth;
var C=l[a](e),F=l[c](e),B=C+u,D=F+r,H=d.offsetHeight;d=d.offsetWidth;var G=A.left+C-(p(l.css(e,"borderLeftWidth"))||0);A=A.top+F-(p(l.css(e,"borderTopWidth"))||0);var I=G+d,K=A+H,E,J;if(H>r||A<F||v)E=A;else if(K>D)E=K-r;if(y)if(d>u||G<C||v)J=G;else if(I>B)J=I-u;if(h){if(E!==t||J!==t)e.scrollTo(J,E)}else{if(E!==t)e[c]=E;if(J!==t)e[a]=J}}}});b.each(["Left","Top"],function(d,e){var v="scroll"+d;l[v]=function(y){var h=0,r=w(y),u;if(r&&(u=r.document))h=r[e?"pageYOffset":"pageXOffset"]||u.documentElement[v]||
u.body[v];else if(k(y=b.get(y)))h=y[v];return h}});b.each(["Width","Height"],function(d){l["doc"+d]=function(e){e=e||g;return n(i?e.documentElement["scroll"+d]:e.body["scroll"+d],l["viewport"+d](e))};l["viewport"+d]=function(e){var v="inner"+d;e=w(e);var y=e.document;return v in e?e[v]:i?y.documentElement["client"+d]:y.body["client"+d]}})});
KISSY.add("dom-traversal",function(b,t){function o(g,k,j,w){if(!(g=b.get(g)))return null;if(k===t)k=1;var i=null,n,p;if(b.isNumber(k)&&k>=0){if(k===0)return g;n=0;p=k;k=function(){return++n===p}}for(;g=g[j];)if(z(g)&&(!k||s.test(g,k))&&(!w||w(g))){i=g;break}return i}function l(g,k,j){var w=[];var i=g=b.get(g);if(g&&j)i=g.parentNode;if(i){j=0;for(i=i.firstChild;i;i=i.nextSibling)if(z(i)&&i!==g&&(!k||s.test(i,k)))w[j++]=i}return w}var s=b.DOM,z=s._isElementNode;b.mix(s,{parent:function(g,k){return o(g,
k,"parentNode",function(j){return j.nodeType!=11})},next:function(g,k){return o(g,k,"nextSibling")},prev:function(g,k){return o(g,k,"previousSibling")},siblings:function(g,k){return l(g,k,true)},children:function(g,k){return l(g,k)},contains:function(g,k){var j=false;if((g=b.get(g))&&(k=b.get(k)))if(g.contains)return g.contains(k);else if(g.compareDocumentPosition)return!!(g.compareDocumentPosition(k)&16);else for(;!j&&(k=k.parentNode);)j=k==g;return j}})});
KISSY.add("dom-create",function(b,t){function o(h){var r=h.cloneNode(true);if(k.ie<8)r.innerHTML=h.innerHTML;return r}function l(h,r,u,A){if(u){var C=b.guid("ks-tmp-"),F=RegExp(x);r+='<span id="'+C+'"></span>';b.available(C,function(){var B=b.get("head"),D,H,G,I,K,E;for(F.lastIndex=0;D=F.exec(r);)if((G=(H=D[1])?H.match(a):false)&&G[2]){D=z.createElement("script");D.src=G[2];if((I=H.match(c))&&I[2])D.charset=I[2];D.async=true;B.appendChild(D)}else if((E=D[2])&&E.length>0)b.globalEval(E);(K=z.getElementById(C))&&
g.remove(K);b.isFunction(A)&&A()});s(h,r)}else{s(h,r);b.isFunction(A)&&A()}}function s(h,r){r=(r+"").replace(x,"");try{h.innerHTML=r}catch(u){for(;h.firstChild;)h.removeChild(h.firstChild);r&&h.appendChild(g.create(r))}}var z=document,g=b.DOM,k=b.UA,j=k.ie,w=g._nodeTypeIs,i=g._isElementNode,n=g._isKSNode,p=z.createElement("div"),q=/<(\w+)/,x=/<script([^>]*)>([\s\S]*?)<\/script>/ig,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,a=/\ssrc=(['"])(.*?)\1/i,c=/\scharset=(['"])(.*?)\1/i;b.mix(g,{create:function(h,r,u){if(w(h,
1)||w(h,3))return o(h);if(n(h))return o(h[0]);if(!(h=b.trim(h)))return null;var A=null;A=g._creators;var C,F="div",B;if(C=m.exec(h))A=(u||z).createElement(C[1]);else{if((C=q.exec(h))&&(B=C[1])&&b.isFunction(A[B=B.toLowerCase()]))F=B;h=A[F](h,u).childNodes;if(h.length===1)u=h[0].parentNode.removeChild(h[0]);else{h=h;B=u||z;u=null;if(h&&(h.push||h.item)&&h[0]){B=B||h[0].ownerDocument;u=B.createDocumentFragment();if(h.item)h=b.makeArray(h);B=0;for(A=h.length;B<A;B++)u.appendChild(h[B])}u=u}A=u}u=A;i(u)&&
b.isPlainObject(r)&&g.attr(u,r,true);return u},_creators:{div:function(h,r){var u=r?r.createElement("div"):p;u.innerHTML=h;return u}},html:function(h,r,u,A){if(r===t){h=b.get(h);if(i(h))return h.innerHTML}else b.each(b.query(h),function(C){i(C)&&l(C,r,u,A)})},remove:function(h){b.each(b.query(h),function(r){i(r)&&r.parentNode&&r.parentNode.removeChild(r)})}});if(k.gecko||j){var f=g._creators,d=g.create,e=/(?:\/(?:thead|tfoot|caption|col|colgroup)>)+\s*<tbody/,v={option:"select",td:"tr",tr:"tbody",
tbody:"table",col:"colgroup",legend:"fieldset"},y;for(y in v)(function(h){f[y]=function(r,u){return d("<"+h+">"+r+"</"+h+">",null,u)}})(v[y]);if(j){f.script=function(h,r){var u=r?r.createElement("div"):p;u.innerHTML="-"+h;u.removeChild(u.firstChild);return u};if(j<8)f.tbody=function(h,r){var u=d("<table>"+h+"</table>",null,r),A=u.children.tags("tbody")[0];u.children.length>1&&A&&!e.test(h)&&A.parentNode.removeChild(A);return u}}b.mix(f,{optgroup:f.option,th:f.td,thead:f.tbody,tfoot:f.tbody,caption:f.tbody,
colgroup:f.tbody})}});KISSY.add("dom-insertion",function(b){b.mix(b.DOM,{insertBefore:function(t,o){if((t=b.get(t))&&(o=b.get(o))&&o.parentNode)o.parentNode.insertBefore(t,o);return t},insertAfter:function(t,o){if((t=b.get(t))&&(o=b.get(o))&&o.parentNode)o.nextSibling?o.parentNode.insertBefore(t,o.nextSibling):o.parentNode.appendChild(t);return t}})});
