/*
Copyright 2012, KISSY UI Library v1.30rc
MIT Licensed
build time: Jul 11 21:25
*/
KISSY.add("switchable/accordion/aria",function(f,e,j,l,m,i){function k(a){var c=null;f.each(this.triggers,function(g){if(g==a||e.contains(g,a))c=g});return c}function b(a){var c=null;f.each(this.panels,function(g){if(g==a||e.contains(g,a))c=g});return c}function h(a){var c=k.call(this,a);c||(a=b.call(this,a),c=this.triggers[f.indexOf(a,this.panels)]);return c}function d(a){switch(a.keyCode){case w:case q:a.ctrlKey&&!a.altKey&&!a.shiftKey&&a.halt();break;case v:a.ctrlKey&&!a.altKey&&a.halt()}}function a(a){var b=
a.target,e=this.triggers,d=!a.ctrlKey&&!a.shiftKey&&!a.altKey,u=a.ctrlKey&&!a.shiftKey&&!a.altKey;switch(a.keyCode){case z:case A:if((b=k.call(this,b))&&d)this.switchTo(f.indexOf(b,this.triggers)),a.halt();break;case p:case t:if(b=k.call(this,b))r.call(this,b),a.halt();break;case o:case x:if(b=k.call(this,b))g.call(this,b),a.halt();break;case q:u&&(a.halt(),b=h.call(this,b),g.call(this,b));break;case w:u&&(a.halt(),b=h.call(this,b),r.call(this,b));break;case n:d&&(h.call(this,b),c.call(this,0,!0),
a.halt());break;case s:d&&(h.call(this,b),c.call(this,e.length-1,!0),a.halt());break;case v:a.ctrlKey&&!a.altKey&&(a.halt(),b=h.call(this,b),a.shiftKey?r.call(this,b):g.call(this,b))}}function c(a,c){var g=this.triggers,b=g[a];f.each(g,function(a){a!==b&&(y(a,"-1"),e.removeClass(a,"ks-switchable-select"),a.setAttribute("aria-selected","false"))});c&&b.focus();y(b,"0");e.addClass(b,"ks-switchable-select");b.setAttribute("aria-selected","true")}function r(a){var g=this.triggers,a=f.indexOf(a,g);c.call(this,
0==a?g.length-1:a-1,!0)}function g(a){var g=this.triggers,a=f.indexOf(a,g);c.call(this,a==g.length-1?0:a+1,!0)}function u(a){var g=!(!a.originalEvent.target&&!a.originalEvent.srcElement),a=a.currentIndex,b=this.panels,r=this.triggers,e=r[a],d=b[a];this.config.multiple||(f.each(b,function(a){a!==d&&a.setAttribute("aria-hidden","true")}),f.each(r,function(a){a!==e&&a.setAttribute("aria-hidden","true")}));b=d.getAttribute("aria-hidden");d.setAttribute("aria-hidden","false"==b?"true":"false");e.setAttribute("aria-expanded",
"false"==b?"false":"true");c.call(this,a,g)}var w=33,q=34,s=35,n=36,p=37,t=38,o=39,x=40,v=9,A=32,z=13;f.mix(m.Config,{aria:!0});i.addPlugin({name:"aria",init:function(c){if(c.config.aria){var g=c.container,b=c.activeIndex;e.attr(g,"aria-multiselectable",c.config.multiple?"true":"false");c.nav&&e.attr(c.nav,"role","tablist");var r=c.triggers,h=c.panels,v=0;f.each(h,function(a){a.id||(a.id=f.guid("ks-accordion-tab-panel"))});f.each(r,function(a){a.id||(a.id=f.guid("ks-accordion-tab"))});f.each(r,function(a){a.setAttribute("role",
"tab");a.setAttribute("aria-expanded",b==v?"true":"false");a.setAttribute("aria-selected",b==v?"true":"false");a.setAttribute("aria-controls",h[v].id);y(a,b==v?"0":"-1");v++});v=0;f.each(h,function(a){var c=r[v];a.setAttribute("role","tabpanel");a.setAttribute("aria-hidden",b==v?"false":"true");a.setAttribute("aria-labelledby",c.id);v++});c.on("switch",u,c);j.on(g,"keydown",a,c);j.on(g,"keypress",d,c)}}},m);var y=l.setTabIndex},{requires:["dom","event","../aria","./base","../base"]});
KISSY.add("switchable/accordion/base",function(f,e,j){function l(e,f){if(!(this instanceof l))return new l(e,f);l.superclass.constructor.apply(this,arguments)}f.extend(l,j,{_switchTrigger:function(f,i){var k=this.config;k.multiple?e.toggleClass(i,k.activeTriggerCls):l.superclass._switchTrigger.apply(this,arguments)},_triggerIsValid:function(e){return this.config.multiple||l.superclass._triggerIsValid.call(this,e)},_switchView:function(f,i,k){var b=this.config,h=this._getFromToPanels().toPanels;b.multiple?
(e.toggle(h),this._fireOnSwitch(i),k&&k.call(this)):l.superclass._switchView.apply(this,arguments)}});l.Config={markupType:1,triggerType:"click",multiple:!1};return l},{requires:["dom","../base"]});
KISSY.add("switchable/aria",function(f,e,j,l){function m(){this.stop&&this.stop()}function i(){this.start&&this.start()}l.addPlugin({name:"aria",init:function(b){if(b.config.aria){var e=b.container;j.on(e,"focusin",m,b);j.on(e,"focusout",i,b)}}});var k=["a","input","button","object"];return{setTabIndex:function(b,h){b.tabIndex=h;f.each(e.query("*",b),function(b){var a=b.nodeName.toLowerCase();f.inArray(a,k)&&(e.hasAttr(b,"oriTabIndex")||e.attr(b,"oriTabIndex",b.tabIndex),b.tabIndex=-1!=h?e.attr(b,
"oriTabIndex"):h)})}}},{requires:["dom","event","./base"]});
KISSY.add("switchable/autoplay",function(f,e,j,l,m){var i=f.Env.host,k=function(b){var h=e.scrollTop(),d=e.viewportHeight(),a=e.offset(b),b=e.height(b);return a.top>h&&a.top+b<h+d};f.mix(l.Config,{pauseOnScroll:!1,autoplay:!1,interval:5,pauseOnHover:!0});l.addPlugin({name:"autoplay",init:function(b){function e(){c=f.later(function(){b.paused||b.next()},a,!0)}var d=b.config,a=1E3*d.interval,c;if(d.autoplay&&(d.pauseOnScroll&&(b.__scrollDetect=f.buffer(function(){b[k(b.container)?"start":"stop"]()},
200),j.on(i,"scroll",b.__scrollDetect)),e(),b.stop=function(){if(c){c.cancel();c=m}b.paused=true},b.start=function(){if(c){c.cancel();c=m}b.paused=false;e()},d.pauseOnHover))j.on(b.container,"mouseenter",b.stop,b),j.on(b.container,"mouseleave",b.start,b)},destroy:function(b){b.__scrollDetect&&j.remove(i,"scroll",b.__scrollDetect)}});return l},{requires:["dom","event","./base"]});
KISSY.add("switchable/base",function(f,e,j,l){function m(a,c){c=c||{};"markupType"in c||(c.panelCls?c.markupType=1:c.panels&&(c.markupType=2));for(var b=this.constructor;b;)c=f.merge(b.Config,c),b=b.superclass?b.superclass.constructor:null;this.container=e.get(a);this.config=c;this.activeIndex=c.activeIndex;var g;-1<this.activeIndex||("number"==typeof c.switchTo?g=c.switchTo:this.activeIndex=0);this._init();this._initPlugins();this.fire(h);g!==l&&this.switchTo(g)}function i(a){var c={};c.type=a.type;
c.target=a.target;return{originalEvent:c}}var k=f.makeArray,b=j.Target,h="init",d="remove";m.getDomEvent=i;m.addPlugin=function(a,c){for(var c=c||m,b=a.priority=a.priority||0,g=0,e=c.Plugins=c.Plugins||[];g<e.length&&!(e[g].priority<b);g++);e.splice(g,0,a)};m.Config={markupType:0,navCls:"ks-switchable-nav",contentCls:"ks-switchable-content",triggerCls:"ks-switchable-trigger",panelCls:"ks-switchable-panel",triggers:[],panels:[],hasTriggers:!0,triggerType:"mouse",delay:0.1,activeIndex:-1,activeTriggerCls:"ks-active",
switchTo:l,steps:1,viewSize:[]};f.augment(m,b,{_initPlugins:function(){for(var a=this,c=[],b=a.constructor;b;)b.Plugins&&c.push.apply(c,[].concat(b.Plugins).reverse()),b=b.superclass?b.superclass.constructor:null;c.reverse();f.each(c,function(c){c.init&&c.init(a)})},_init:function(){var a=this.config;this._parseMarkup();a.hasTriggers&&this._bindTriggers();this._bindPanels()},_parseMarkup:function(){var a=this.container,c=this.config,b,g,d=[],h=[];switch(c.markupType){case 0:(b=e.get("."+c.navCls,
a))&&(d=e.children(b));g=e.get("."+c.contentCls,a);h=e.children(g);break;case 1:d=e.query("."+c.triggerCls,a);h=e.query("."+c.panelCls,a);break;case 2:d=c.triggers,h=c.panels}this.length=Math.ceil(h.length/c.steps);this.nav=b||c.hasTriggers&&d[0]&&d[0].parentNode;if(c.hasTriggers&&(!this.nav||0==d.length))d=this._generateTriggersMarkup(this.length);this.triggers=k(d);this.panels=k(h);this.content=g||h[0].parentNode},_generateTriggersMarkup:function(a){var c=this.config,b=this.nav||e.create("<ul>"),
g,d;b.className=c.navCls;for(d=0;d<a;d++)g=e.create("<li>"),d===this.activeIndex&&(g.className=c.activeTriggerCls),g.innerHTML=d+1,b.appendChild(g);this.container.appendChild(b);this.nav=b;return e.children(b)},_bindTriggers:function(){var a=this,c=a.config,b=f.one(a.nav);f.each(a.triggers,function(b){a._initTrigger(b)});b.delegate("click",".ks-switchable-trigger-internal",function(b){var c=a._getTriggerIndex(b.currentTarget);a._onFocusTrigger(c,b)});"mouse"===c.triggerType&&b.delegate("mouseenter",
".ks-switchable-trigger-internal",function(b){var c=a._getTriggerIndex(b.currentTarget);a._onMouseEnterTrigger(c,b)}).delegate("mouseleave",".ks-switchable-trigger-internal",function(){a._onMouseLeaveTrigger()})},_initTrigger:function(a){e.addClass(a,"ks-switchable-trigger-internal")},_bindPanels:function(){var a=this;f.each(a.panels,function(b){a._initPanel(b)})},_initPanel:function(a){e.addClass(a,"ks-switchable-panel-internal")},_onFocusTrigger:function(a,b){this._triggerIsValid(a)&&(this._cancelSwitchTimer(),
this.switchTo(a,l,i(b)))},_onMouseEnterTrigger:function(a,b){var e=this;if(e._triggerIsValid(a)){var g=i(b);e.switchTimer=f.later(function(){e.switchTo(a,l,g)},1E3*e.config.delay)}},_onMouseLeaveTrigger:function(){this._cancelSwitchTimer()},_triggerIsValid:function(a){return this.activeIndex!==a},_cancelSwitchTimer:function(){this.switchTimer&&(this.switchTimer.cancel(),this.switchTimer=l)},_getTriggerIndex:function(a){return f.indexOf(a,this.triggers)},_resetLength:function(){this.length=this._getLength()},
_getLength:function(a){var b=this.config;a===l&&(a=this.panels.length);return Math.ceil(a/b.steps)},_afterAdd:function(a,b,e){this._resetLength();a=this._getLength(a+1)-1;1==this.config.steps&&this.activeIndex>=a&&(this.activeIndex+=1);var g=this.activeIndex;this.activeIndex=-1;this.switchTo(g);b?this.switchTo(a,l,l,e):e()},add:function(a){var b=a.callback||f.noop,d=this.nav,g=this.content,h=a.trigger,i=a.panel,l=a.active,k=this.panels.length,a=null!=a.index?a.index:k,j=this.triggers,p=this.panels,
m=this.length,o=null,o=null,a=Math.max(0,Math.min(a,k)),k=p[a]||null;p.splice(a,0,i);g.insertBefore(i,k);1==this.config.steps?(o=j[a],d.insertBefore(h,o),j.splice(a,0,h)):(o=this._getLength(),o!=m&&(e.append(h,d),j.push(h)));this._initPanel(i);this._initTrigger(h);this._afterAdd(a,l,b);this.fire("add",{index:a,trigger:h,panel:i})},remove:function(a){function b(){t&&(e.remove(t),m.splice(j,1));if(p){e.remove(p);for(var a=0;a<n.length;a++)if(n[a]==p){g.triggers.splice(a,1);break}}g._resetLength();g.fire(d,
{index:j,trigger:p,panel:t})}var h=a.callback||f.noop,g=this,i=g.config.steps,k=g.length,j,m=g.panels;j="index"in a?a.index:a.panel;var a=g._getLength(m.length-1),n=g.triggers,p=null,t=null;if(m.length&&(j=f.isNumber(j)?Math.max(0,Math.min(j,m.length-1)):f.indexOf(j,m),p=1==i?n[j]:a!==k?n[k-1]:null,t=m[j],!1!==g.fire("beforeRemove",{index:j,panel:t,trigger:p})))if(0==a)b(),h();else{var o=g.activeIndex;1<i?o==a?g.switchTo(o-1,l,l,function(){b();h()}):(b(),g.activeIndex=-1,g.switchTo(o,l,l,function(){h()})):
o==j?g.switchTo(0<o?o-1:o+1,l,l,function(){b();0==o&&(g.activeIndex=0);h()}):(o>j&&(o--,g.activeIndex=o),b(),h())}},switchTo:function(a,b,e,g){var d=this,h=d.config,f=d.activeIndex,i=d.triggers;if(!d._triggerIsValid(a)||!1===d.fire("beforeSwitch",{fromIndex:f,toIndex:a}))return d;d.fromIndex=f;h.hasTriggers&&d._switchTrigger(i[f]||null,i[a]);b===l&&(b=a>f?"forward":"backward");d.activeIndex=a;d._switchView(b,e,function(){g&&g.call(d)});return d},_switchTrigger:function(a,b){var d=this.config.activeTriggerCls;
a&&e.removeClass(a,d);e.addClass(b,d)},_getFromToPanels:function(){var a=this.fromIndex,b;b=this.config.steps;var e=this.panels,g=this.activeIndex,a=-1<a?e.slice(a*b,(a+1)*b):null;b=e.slice(g*b,(g+1)*b);return{fromPanels:a,toPanels:b}},_switchView:function(a,b,d){var g=this,h=g._getFromToPanels(),a=h.fromPanels,h=h.toPanels;a&&e.css(a,"display","none");e.css(h,"display","block");setTimeout(function(){g._fireOnSwitch(b)},0);d&&d.call(this)},_fireOnSwitch:function(a){this.fire("switch",f.merge(a,{fromIndex:this.fromIndex,
currentIndex:this.activeIndex}))},prev:function(a){this.switchTo((this.activeIndex-1+this.length)%this.length,"backward",a)},next:function(a){this.switchTo((this.activeIndex+1)%this.length,"forward",a)},destroy:function(a){for(var b=this,d=b.constructor;d;)f.each(d.Plugins,function(a){a.destroy&&a.destroy(b)}),d=d.superclass?d.superclass.constructor:null;a?j.remove(b.container):e.remove(b.container);b.nav=null;b.content=null;b.container=null;b.triggers=[];b.panels=[];b.detach()}});return m},{requires:["dom",
"event"]});
KISSY.add("switchable/carousel/aria",function(f,e,j,l,m,i){function k(a){var b=a.currentIndex,c=this.activeIndex,d=this.panels,g=d[b*this.config.steps],e=this.triggers,b=e[b];if((a=!(!a.originalEvent.target&&!a.originalEvent.srcElement))||-1==c)f.each(e,function(a){n(a,-1)}),f.each(d,function(a){n(a,-1)}),b&&n(b,0),n(g,0),a&&g.focus()}function b(a){var b=null;f.each(this.triggers,function(c){if(c==a||e.contains(c,a))return b=c,!1});return b}function h(a){var c=a.target;switch(a.keyCode){case w:case u:if(c=b.call(this,
c)){var d=e.next(c),h=this.triggers;d||(d=h[0]);n(c,-1);d&&(n(d,0),d.focus());a.halt()}break;case g:case r:if(c=b.call(this,c))d=e.prev(c),h=this.triggers,d||(d=h[h.length-1]),n(c,-1),d&&(n(d,0),d.focus()),a.halt();break;case s:case q:if(c=b.call(this,c))this.switchTo(f.indexOf(c,this.triggers),void 0,p),a.halt()}}function d(a){var b=null;f.each(this.panels,function(c){if(c==a||e.contains(c,a))return b=c,!1});return b}function a(a,b){var c=f.indexOf(a,this.panels),d=this.config.steps,g=Math.floor(c/
d);return g==this.activeIndex?1:0==c%d||c%d==d-1?(this.switchTo(g,b,p),0):1}function c(b){var c=b.target;switch(b.keyCode){case w:case u:if(c=d.call(this,c)){var h=e.next(c),f=this.panels;h||(h=f[0]);n(c,-1);n(h,0);a.call(this,h,t)&&h.focus();b.halt()}break;case g:case r:if(c=d.call(this,c))h=e.prev(c),f=this.panels,h||(h=f[f.length-1]),n(c,-1),n(h,0),a.call(this,h,o)&&h.focus(),b.halt();break;case s:case q:if(c=d.call(this,c))this.fire("itemSelected",{item:c}),b.halt()}}var r=37,g=38,u=39,w=40,q=
32,s=13,n=l.setTabIndex,p={originalEvent:{target:1}},t="forward",o="backward";f.mix(m.Config,{aria:!1});i.addPlugin({name:"aria",init:function(a){if(a.config.aria){var b=a.triggers,d=a.panels,g=a.content,e=a.activeIndex;g.id||(g.id=f.guid("ks-switchbale-content"));g.setAttribute("role","listbox");var i=0;f.each(b,function(a){n(a,e==i?"0":"-1");a.setAttribute("role","button");a.setAttribute("aria-controls",g.id);i++});i=0;f.each(d,function(a){n(a,"-1");a.setAttribute("role","option");i++});a.on("switch",
k,a);if(b=a.nav)j.on(b,"keydown",h,a);j.on(g,"keydown",c,a);b=a.prevBtn;d=a.nextBtn;b&&(n(b,0),b.setAttribute("role","button"),j.on(b,"keydown",function(b){if(b.keyCode==s||b.keyCode==q){a.prev(p);b.preventDefault()}}));d&&(n(d,0),d.setAttribute("role","button"),j.on(d,"keydown",function(b){if(b.keyCode==s||b.keyCode==q){a.next(p);b.preventDefault()}}))}}},m)},{requires:["dom","event","../aria","./base","../base"]});
KISSY.add("switchable/carousel/base",function(f,e,j,l){function m(b,d){if(!(this instanceof m))return new m(b,d);m.superclass.constructor.apply(this,arguments)}var i="prevBtn",k="nextBtn",b={originalEvent:{target:1}};m.Config={circular:!0,prevBtnCls:"ks-switchable-prev-btn",nextBtnCls:"ks-switchable-next-btn",disableBtnCls:"ks-switchable-disable-btn"};f.extend(m,l,{_init:function(){function h(a){e.removeClass([d[i],d[k]],c);0==a&&e.addClass(d[i],c);a==d.length-1&&e.addClass(d[k],c)}var d=this;m.superclass._init.call(d);
var a=d.config,c=a.disableBtnCls;f.each(["prev","next"],function(c){var g=d[c+"Btn"]=e.get("."+a[c+"BtnCls"],d.container);j.on(g,"mousedown",function(g){g.preventDefault();g=d.activeIndex;if("prev"==c&&(0!=g||a.circular))d[c](b);if("next"==c&&(g!=d.length-1||a.circular))d[c](b)})});a.circular||(d.on("added removed",function(){h(d.activeIndex)}),d.on("switch",function(a){h(a.currentIndex)}));j.delegate(d.content,"click",".ks-switchable-panel-internal",function(a){d.fire("itemSelected",{item:a.currentTarget})})}});
return m},{requires:["dom","event","../base"]});
KISSY.add("switchable/circular",function(f,e,j,l){function m(b,h){var d=this,a=d.fromIndex,c=d.config,f=d.length,g="scrollx"===c.scrollType,l=g?"left":"top",m=d.activeIndex,q=d.viewSize[g?0:1],g=-q*m,s=d.panels,n=d.config.steps,p={},t,o="backward"===h;t=o&&0===a&&m===f-1||!o&&a===f-1&&0===m;d.anim&&(d.anim.stop(),"relative"==s[a*n].style.position&&k.call(d,s,a,l,q,1));t&&(g=i.call(d,s,m,l,q));p[l]=g+"px";-1<a?d.anim=(new j(d.content,p,c.duration,c.easing,function(){t&&k.call(d,s,m,l,q,1);d.anim=void 0;
b&&b()})).run():(e.css(d.content,p),b&&b())}function i(b,h,d,a){var c=this.config.steps,f=this.length,b=b.slice(h*c,(h+1)*c);e.css(b,"position","relative");e.css(b,d,(h?-1:1)*a*f);return h?a:-a*f}function k(b,h,d,a,c){var f=this.config.steps,g=this.length,b=b.slice(h*f,(h+1)*f);e.css(b,"position","");e.css(b,d,"");c&&e.css(this.content,d,h?-a*(g-1):"")}f.mix(l.Config,{circular:!1});l.adjustPosition=i;l.resetPosition=k;l.addPlugin({name:"circular",init:function(b){var b=b.config,e=b.effect;if(b.circular&&
("scrollx"===e||"scrolly"===e))b.scrollType=e,b.effect=m}})},{requires:["dom","anim","./base","./effect"]});
KISSY.add("switchable/effect",function(f,e,j,l,m,i){var k;f.mix(m.Config,{effect:"none",duration:0.5,easing:"easeNone"});m.Effects={none:function(b){var h=this._getFromToPanels(),d=h.fromPanels,h=h.toPanels;d&&e.css(d,"display","none");e.css(h,"display","block");b&&b()},fade:function(b){var h=this,d=h._getFromToPanels(),a=d.fromPanels,c=h.config,f=a?a[0]:null,g=d.toPanels[0];h.anim&&(h.anim.stop(),e.css(h.anim.fromEl,{zIndex:1,opacity:0}),e.css(h.anim.toEl,"zIndex",9));e.css(g,"opacity",1);f?(h.anim=
(new l(f,{opacity:0},c.duration,c.easing,function(){h.anim=i;e.css(g,"z-index",9);e.css(f,"z-index",1);b&&b()})).run(),h.anim.toEl=g,h.anim.fromEl=f):(e.css(g,"z-index",9),b&&b())},scroll:function(b,h,d){var a=this,h=a.fromIndex,c=a.config,f="scrollx"===c.effect,g={};g[f?"left":"top"]=-(a.viewSize[f?0:1]*a.activeIndex)+"px";a.anim&&a.anim.stop();d||-1<h?a.anim=(new l(a.content,g,c.duration,c.easing,function(){a.anim=i;b&&b()})).run():(e.css(a.content,g),b&&b())}};k=m.Effects;k.scrollx=k.scrolly=k.scroll;
m.addPlugin({priority:10,name:"effect",init:function(b){var h=b.config,d=h.effect,a=b.panels,c=b.content,i=h.steps,g=a[0],l=b.activeIndex;if("none"!==d)switch(e.css(a,"display","block"),d){case "scrollx":case "scrolly":e.css(c,"position","absolute");"static"==e.css(c.parentNode,"position")&&e.css(c.parentNode,"position","relative");"scrollx"===d&&(e.css(a,"float","left"),e.width(c,"9999px"));b.viewSize=[h.viewSize[0]||g&&g.offsetWidth*i,h.viewSize[1]||g&&g.offsetHeight*i];break;case "fade":var j=
l*i,m=j+i-1,k;f.each(a,function(a,b){k=b>=j&&b<=m;e.css(a,{opacity:k?1:0,position:"absolute",zIndex:k?9:1})})}}});f.augment(m,{_switchView:function(b,e,d){var a=this,c=a.config.effect;(f.isFunction(c)?c:k[c]).call(a,function(){a._fireOnSwitch(e);d&&d.call(a)},b)}});return m},{requires:["dom","event","anim","./base"]});
KISSY.add("switchable/lazyload",function(f,e,j){var l="beforeSwitch",m="img",i="textarea",k={};k[m]="lazyImgAttribute";k[i]="lazyTextareaClass";f.mix(j.Config,{lazyImgAttribute:"data-ks-lazyload-custom",lazyTextareaClass:"ks-datalazyload-custom",lazyDataType:i});j.addPlugin({name:"lazyload",init:function(b){function h(g){var f=a.steps,g=g.toIndex*f;d.loadCustomLazyData(b.panels.slice(g,g+f),c,j);a:{var k,q,s;if(g=(f=c===m)?"img":c===i?"textarea":""){g=e.query(g,b.container);k=0;for(s=g.length;k<s;k++)if(q=
g[k],f?e.attr(q,j):e.hasClass(q,j)){f=!1;break a}}f=!0}f&&b.detach(l,h)}var d=f.require("datalazyload"),a=b.config,c,j;"img-src"===a.lazyDataType&&(a.lazyDataType=m);"area-data"===a.lazyDataType&&(a.lazyDataType=i);c=a.lazyDataType;j=a[k[c]];if(d&&c&&j)b.on(l,h)}});return j},{requires:["dom","./base"]});
KISSY.add("switchable/seamless",function(f,e,j){j.addPlugin({name:"seamless",priority:5,init:function(f){var j=f.config,i=f.panels,k=f.container,b=j.effect;if(1==j.steps&&i.length&&j.circular){var h=1,d,a,c,k=[e.width(k),e.height(k)],r;"scrollx"==b?(a="left",h=Math.floor(k[0]/(d=i[0].offsetWidth))):"scrolly"==b&&(a="top",h=Math.floor(k[1]/(d=i[0].offsetHeight)));h<=j.steps||(r=d*i.length,c=i.length-h+1,f.on("beforeSwitch",function(b){b=b.toIndex;if(b>=c){b=Math.abs(b-c);e.css(i[b],"position","relative");
e.css(i[b],a,r)}else if(!b){e.css(i[h-1],{position:"relative"});e.css(i[h-1],a,r)}}),f.on("switch",function(b){if(b.currentIndex==0)for(b=1;b<h;b++){e.css(i[b],{position:""});e.css(i[b],a,"")}}))}}})},{requires:["dom","./base"]});KISSY.add("switchable/slide/base",function(f,e){function j(e,f){if(!(this instanceof j))return new j(e,f);j.superclass.constructor.apply(this,arguments)}j.Config={autoplay:!0,circular:!0};f.extend(j,e);return j},{requires:["../base"]});
KISSY.add("switchable",function(f,e,j,l,m,i,k,b,h,d,a,c,r){f.mix(e,{Accordion:l,Carousel:k,Slide:c,Tabs:r,Aria:j});return f.Switchable=e},{requires:"switchable/base,switchable/aria,switchable/accordion/base,switchable/accordion/aria,switchable/autoplay,switchable/carousel/base,switchable/carousel/aria,switchable/circular,switchable/effect,switchable/lazyload,switchable/slide/base,switchable/tabs/base,switchable/tabs/aria,switchable/seamless".split(",")});
KISSY.add("switchable/tabs/aria",function(f,e,j,l,m,i){function k(a){var b=null;f.each(this.triggers,function(c){if(c==a||e.contains(c,a))b=c});return b}function b(b){switch(b.keyCode){case a:case c:b.ctrlKey&&!b.altKey&&!b.shiftKey&&b.halt();break;case q:b.ctrlKey&&!b.altKey&&b.halt()}}function h(b){var d=b.target,e=b.ctrlKey&&!b.shiftKey&&!b.altKey;switch(b.keyCode){case r:case g:k.call(this,d)&&(this.prev(n(b)),b.halt());break;case u:case w:k.call(this,d)&&(this.next(n(b)),b.halt());break;case c:e&&
(b.halt(),this.next(n(b)));break;case a:e&&(b.halt(),this.prev(n(b)));break;case q:b.ctrlKey&&!b.altKey&&(b.halt(),b.shiftKey?this.prev(n(b)):this.next(n(b)))}}function d(a){var b=!(!a.originalEvent.target&&!a.originalEvent.srcElement),c=a.fromIndex,d=a.currentIndex;if(c!=d){var a=this.triggers[c],e=this.triggers[d],c=this.panels[c],d=this.panels[d];a&&s(a,"-1");s(e,"0");b&&e.focus();c&&c.setAttribute("aria-hidden","true");d.setAttribute("aria-hidden","false")}}var a=33,c=34,r=37,g=38,u=39,w=40,q=
9;f.mix(i.Config,{aria:!0});l.addPlugin({name:"aria",init:function(a){function c(a){a.setAttribute("role","tab");s(a,"-1");a.id||(a.id=f.guid("ks-switchable"))}function g(a,b){a.setAttribute("role","tabpanel");a.setAttribute("aria-hidden","true");a.setAttribute("aria-labelledby",b.id)}if(a.config.aria){var i=a.triggers,k=a.activeIndex,l=a.panels,m=a.container;a.nav&&e.attr(a.nav,"role","tablist");var n=0;f.each(i,c);a.on("added",function(a){var b;c(b=a.trigger);g(a.panel,b)});n=0;f.each(l,function(a){g(a,
i[n]);n++});-1<k&&(s(i[k],"0"),l[k].setAttribute("aria-hidden","false"));a.on("switch",d,a);j.on(m,"keydown",h,a);j.on(m,"keypress",b,a)}}},i);var s=m.setTabIndex,n=l.getDomEvent},{requires:["dom","event","../base","../aria","./base"]});KISSY.add("switchable/tabs/base",function(f,e){function j(e,f){if(!(this instanceof j))return new j(e,f);j.superclass.constructor.call(this,e,f);return 0}f.extend(j,e);j.Config={};return j},{requires:["../base"]});
KISSY.add("switchable/touch",function(f,e,j,l,m){f.mix(l.Config,{mouseAsTouch:!1});l.addPlugin({priority:5,name:"touch",init:function(i){var k=i.config,b=k.scrollType||k.effect;if("scrolly"==b||"scrollx"==b){var h=i.content,d=i.container,a,c=k.mouseAsTouch,r,g=0,u=0,w={},q={},s="left",n,p;"scrolly"==b&&(s="top");var t=function(){if("relative"!=i.panels[i.activeIndex].style.position){i.stop&&i.stop();u=1;w=e.offset(h);var a=e.offset(d);a.bottom=a.top+d.offsetHeight;a.right=a.left+d.offsetWidth;q=a}},
o=function(c){if(u){var d=-1!=c.type.indexOf("touch")?c.originalEvent.changedTouches[0]:c,f={};"scrolly"==b?(p=i.viewSize[1],n=d.pageY-r,f.top=w.top+n,d=d.pageY>=q.top&&d.pageY<=q.bottom):(p=i.viewSize[0],n=d.pageX-a,f.left=w.left+n,d=d.pageX>=q.left&&d.pageX<=q.right);if(g||3<Math.abs(n))(-1!=c.type.indexOf("touch")&&c.preventDefault(),i.anim&&(i.anim.stop(),i.anim=m),d)?(g||(g=1,k.circular&&(c=i.activeIndex,d=i.length-1,c==d?l.adjustPosition.call(i,i.panels,0,s,p):0==c&&l.adjustPosition.call(i,
i.panels,d,s,p))),e.offset(h,f)):x()}},x=function(){if(g){u=g=0;var a=i.activeIndex,c=i.length-1;if(!k.circular&&(0>n&&a==c||0<n&&0==a))l.Effects[b].call(i,m,m,!0);else{if(!(0>n&&a==c)&&!(0<n&&0==a)&&(0==a||a==c))l.resetPosition.call(i,i.panels,0==a?c:0,s,p);i[0>n?"next":"prev"]();i.start&&i.start()}}};j.on(h,"touchstart",function(b){t();a=b.pageX;r=b.pageY});j.on(h,"touchmove",o);j.on(h,"touchend",x);c&&!("ontouchstart"in f.Env.host.document.documentElement)&&f.use("dd",function(b,c){var d=new c.Draggable({node:h});
d.on("dragstart",function(){t();a=d.startMousePos.left;r=d.startMousePos.top});d.on("drag",o);d.on("dragend",x);i.__touchDD=d})}},destroy:function(e){var f;(f=e.__touchDD)&&f.destroy()}})},{requires:["dom","event","./base"]});
