/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.image.Badge"],["require","dijit._Widget"],["require","dijit._Templated"],["require","dojo.fx.easing"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.image.Badge"]){_4._hasResource["dojox.image.Badge"]=true;_4.provide("dojox.image.Badge");_4.experimental("dojox.image.Badge");_4.require("dijit._Widget");_4.require("dijit._Templated");_4.require("dojo.fx.easing");_4.declare("dojox.image.Badge",[_5._Widget,_5._Templated],{baseClass:"dojoxBadge",templateString:"<div class=\"dojoxBadge\" dojoAttachPoint=\"containerNode\"></div>",children:"div.dojoxBadgeImage",rows:4,cols:5,cellSize:50,cellMargin:1,delay:2000,threads:1,easing:"dojo.fx.easing.backOut",startup:function(){if(this._started){return;}if(_4.isString(this.easing)){this.easing=_4.getObject(this.easing);}this.inherited(arguments);this._init();},_init:function(){var _7=0,_8=this.cellSize;_4.style(this.domNode,{width:_8*this.cols+"px",height:_8*this.rows+"px"});this._nl=_4.query(this.children,this.containerNode).forEach(function(n,_9){var _a=_9%this.cols,t=_7*_8,l=_a*_8,m=this.cellMargin*2;_4.style(n,{top:t+"px",left:l+"px",width:_8-m+"px",height:_8-m+"px"});if(_a==this.cols-1){_7++;}_4.addClass(n,this.baseClass+"Image");},this);var l=this._nl.length;while(this.threads--){var s=Math.floor(Math.random()*l);setTimeout(_4.hitch(this,"_enbiggen",{target:this._nl[s]}),this.delay*this.threads);}},_getCell:function(n){var _b=this._nl.indexOf(n);if(_b>=0){var _c=_b%this.cols;var _d=Math.floor(_b/this.cols);return {x:_c,y:_d,n:this._nl[_b],io:_b};}else{return undefined;}},_getImage:function(){return "url('')";},_enbiggen:function(e){var _e=this._getCell(e.target||e);if(_e){var m=this.cellMargin,_f=(this.cellSize*2)-(m*2),_10={height:_f,width:_f};var _11=function(){return Math.round(Math.random());};if(_e.x==this.cols-1||(_e.x>0&&_11())){_10.left=this.cellSize*(_e.x-m);}if(_e.y==this.rows-1||(_e.y>0&&_11())){_10.top=this.cellSize*(_e.y-m);}var bc=this.baseClass;_4.addClass(_e.n,bc+"Top");_4.addClass(_e.n,bc+"Seen");_4.animateProperty({node:_e.n,properties:_10,onEnd:_4.hitch(this,"_loadUnder",_e,_10),easing:this.easing}).play();}},_loadUnder:function(_12,_13){var idx=_12.io;var _14=[];var _15=(_13.left>=0);var _16=(_13.top>=0);var c=this.cols,e=idx+(_15?-1:1),f=idx+(_16?-c:c),g=(_16?(_15?e-c:f+1):(_15?f-1:e+c)),bc=this.baseClass;_4.forEach([e,f,g],function(x){var n=this._nl[x];if(n){if(_4.hasClass(n,bc+"Seen")){_4.removeClass(n,bc+"Seen");}}},this);setTimeout(_4.hitch(this,"_disenbiggen",_12,_13),this.delay*1.25);},_disenbiggen:function(_17,_18){if(_18.top>=0){_18.top+=this.cellSize;}if(_18.left>=0){_18.left+=this.cellSize;}var _19=this.cellSize-(this.cellMargin*2);_4.animateProperty({node:_17.n,properties:_4.mixin(_18,{width:_19,height:_19}),onEnd:_4.hitch(this,"_cycle",_17,_18)}).play(5);},_cycle:function(_1a,_1b){var bc=this.baseClass;_4.removeClass(_1a.n,bc+"Top");var ns=this._nl.filter(function(n){return !_4.hasClass(n,bc+"Seen");});var c=ns[Math.floor(Math.random()*ns.length)];setTimeout(_4.hitch(this,"_enbiggen",{target:c}),this.delay/2);}});}}};});