//>>built
define("demos/skew/src/Image",["dojo","dijit","dojox","dojo/require!dojo/parser,dijit/_Widget,dijit/_Templated,dijit/focus,dojo/fx,dojo/fx/easing"],function(_1,_2,_3){_1.provide("demos.skew.src.Image");_1.require("dojo.parser");_1.require("dijit._Widget");_1.require("dijit._Templated");_1.require("dijit.focus");_1.require("dojo.fx");_1.require("dojo.fx.easing");_1.declare("image.Skewed",[_2._Widget,_2._Templated],{imgUrl:"",filterUrl:"imageReflect.php",selected:"",value:"",reflectSpacing:5,angle:25,templateString:"<div class=\"anImage\"><div dojoAttachPoint=\"holder\" class=\"imageInner\">"+"<img dojoAttachPoint=\"leftImage\" class=\"imageNodeLeft\" src=\"${imgUrl}\" alt=\"${value}\" />"+"<img dojoAttachPoint=\"imageNode\" class=\"imageNodeCenter\" src=\"${imgUrl}\" alt=\"${value}\" />"+"<img dojoAttachPoint=\"rightImage\" class=\"imageNodeRight\" src=\"${imgUrl}\" alt=\"${value}\" />"+"</div></div>",postCreate:function(){this.inherited(arguments);this.imageNode.src=this.filterUrl+"?greyscale=1&src="+this.imgUrl+"&spacing="+this.reflectSpacing;this.leftImage.src=this.filterUrl+"?greyscale=1&src="+this.imgUrl+"&skew=left&angle="+this.angle+"&spacing="+this.reflectSpacing;this.rightImage.src=this.filterUrl+"?greyscale=1&src="+this.imgUrl+"&skew=right&angle="+this.angle+"&spacing="+this.reflectSpacing;this.connect(this.domNode,"onfocus","center");},startup:function(){if(!this._started){this.inherited(arguments);if(this.selected){this.center();}}},center:function(e){var p=_2.getEnclosingWidget(this.domNode.parentNode);p._center(this.domNode);}});_1.declare("image.Container",[_2._Widget,_2._Templated],{loop:false,useWheel:true,useDrag:false,spacing:50,_spacing:50,visibleItems:15,offOpacity:0.75,easing:"dojo.fx.easing.easeOut",templateString:"<div tabIndex=\"0\"><div class=\"imageContainer\" dojoAttachPoint=\"containerWrapper,containerNode\">"+"</div></div>",postCreate:function(){this.inherited(arguments);this.threshold=(this.visibleItems+(this.visibleItems%2))/2;var _4=this.domNode;_1.style(this.containerWrapper,"position","relative");this.easing=(_1.isString(this.easing)?_1.getObject(this.easing):this.easing);if(_1.isIE){_1.style(this.containerNode,"overflow","hidden");}this.connect(_4,"onclick","_click");this.connect(_4,"onkeypress","_handleKey");if(this.useWheel){this.connect(_4,(!_1.isMozilla?"onmousewheel":"DOMMouseScroll"),"_scroll");}},startup:function(){if(this._started){return;}this.inherited(arguments);var _5=Math.floor(this._getChildren().length/2);this._center(this.nl[_5].firstChild);},_getChildren:function(){this.nl=_1.query(".anImage",this.domNode);return this.nl;},_click:function(e){if(!_1.isIE){_2.focus(this.domNode);}var n=e.target;if(n!==this.domNode&&n!==this.containerNode){this._center(n);}},resize:function(){this._size={w:this.domNode.clientWidth,h:this.domNode.clientHeight};if(_1.isIE){_1.marginBox(this.containerNode,_1.mixin(this._size,{t:0,l:0}));}if(this.selectedChild){this._center(this.selectedChild.domNode);}},_center:function(_6){var w=_2.getEnclosingWidget(_6);if(this._centering){this.selectedChild=w;return;}this._centering=true;var _7=[];var _8=null;if(this.selectedChild){_8=this.nl.indexOf(this.selectedChild.domNode);}this.selectedChild=w;var x=this.nl.indexOf(w.domNode);this[(x===_8?"onSelected":"onShow")](this.selectedChild);if(!this._size){this.resize();}var _9=Math.floor(this._size.w/2);var _a=10;var _b=this._spacing;var _c=this.threshold;var _d=this.nl.map(function(n,i){var _e=Math.abs(i-x);_1.style(n,"display",(Math.abs(i-x)>_c?"none":""));});this.nl.forEach(function(n,i){var _f=(i===x+1);var _10=(i===x-1);var _11={opacity:this.offOpacity,zIndex:69};var c;if(i>x){c="alignRight";_11.zIndex=_f?45:40-i;}else{if(i<x){c="alignLeft";_11.zIndex=_10?45:40;}else{c="alignCenter";_11.opacity=1;}}_1.style(n,_11);_1.forEach(["alignLeft","alignRight","alignCenter"],function(cl){_1.removeClass(n,cl);});_1.addClass(n,c);var _12=50;if(_8||_8===0){var d=i-x;var _13=(d===0?0:_b)*(d<0?-1:1);var lef=_9-_12+(d*this.spacing)+_13;_7.push(_1.animateProperty({duration:150,node:n,properties:{left:lef},delay:parseInt(_a),easing:this.easing}));_a+=(d<0?15:-15);}},this);this._anim&&this._anim.stop&&this._anim.stop();this._anim=_1.fx.combine(_7);this._anim.play();this._centering=false;},onShow:function(_14){},onSelected:function(_15){},_handleKey:function(e){var dk=_1.keys,cur=this.nl.indexOf(this.selectedChild.domNode||this.nl[0]),ni;switch(e.charOrCode){case dk.RIGHT_ARROW:ni=cur+1;if(ni>=this.nl.length){ni=(this.loop?0:cur);}if(ni!==cur){this._center(this.nl[ni]);}break;case dk.LEFT_ARROW:ni=cur-1;if(ni<0){ni=(this.loop?this.nl.length-1:cur);}if(ni!==cur){this._center(this.nl[ni]);}break;case dk.ENTER:this.onSelected(this.selectedChild);break;}},_scroll:function(e){_1.stopEvent(e);var _16=e[(!_1.isMozilla?"wheelDelta":"detail")]*(!_1.isMozilla?1:-1);this._handleKey({charOrCode:_1.keys[(_16>0?"LEFT_ARROW":"RIGHT_ARROW")]});}});});