/*
	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.widget.SortList"],["require","dijit.layout._LayoutWidget"],["require","dijit._Templated"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.widget.SortList"]){_4._hasResource["dojox.widget.SortList"]=true;_4.provide("dojox.widget.SortList");_4.experimental("dojox.widget.SortList");_4.require("dijit.layout._LayoutWidget");_4.require("dijit._Templated");_4.declare("dojox.widget.SortList",[_5.layout._LayoutWidget,_5._Templated],{title:"",heading:"",descending:true,selected:null,sortable:true,store:"",key:"name",baseClass:"dojoxSortList",templateString:_4.cache("dojox.widget","SortList/SortList.html","<div class=\"sortList\" id=\"${id}\">\r\n\t\t<div class=\"sortListTitle\" dojoAttachPoint=\"titleNode\">\r\n\t\t<div class=\"dijitInline sortListIcon\">&thinsp;</div>\r\n\t\t<span dojoAttachPoint=\"focusNode\">${title}</span>\r\n\t\t</div>\r\n\t\t<div class=\"sortListBodyWrapper\" dojoAttachEvent=\"onmouseover: _set, onmouseout: _unset, onclick:_handleClick\" dojoAttachPoint=\"bodyWrapper\">\r\n\t\t<ul dojoAttachPoint=\"containerNode\" class=\"sortListBody\"></ul>\r\n\t</div>\r\n</div>\r\n"),_addItem:function(_7){_4.create("li",{innerHTML:this.store.getValue(_7,this.key).replace(/</g,"&lt;")},this.containerNode);},postCreate:function(){if(this.store){this.store=_4.getObject(this.store);var _8={onItem:_4.hitch(this,"_addItem"),onComplete:_4.hitch(this,"onSort")};this.store.fetch(_8);}else{this.onSort();}this.inherited(arguments);},startup:function(){this.inherited(arguments);if(this.heading){this.setTitle(this.heading);this.title=this.heading;}setTimeout(_4.hitch(this,"resize"),5);if(this.sortable){this.connect(this.titleNode,"onclick","onSort");}},resize:function(){this.inherited(arguments);var _9=((this._contentBox.h)-(_4.style(this.titleNode,"height")))-10;this.bodyWrapper.style.height=Math.abs(_9)+"px";},onSort:function(e){var _a=_4.query("li",this.domNode);if(this.sortable){this.descending=!this.descending;_4.addClass(this.titleNode,((this.descending)?"sortListDesc":"sortListAsc"));_4.removeClass(this.titleNode,((this.descending)?"sortListAsc":"sortListDesc"));_a.sort(this._sorter);if(this.descending){_a.reverse();}}var i=0;_4.forEach(_a,function(_b){_4[(i++)%2===0?"addClass":"removeClass"](_b,"sortListItemOdd");this.containerNode.appendChild(_b);},this);},_set:function(e){if(e.target!==this.bodyWrapper){_4.addClass(e.target,"sortListItemHover");}},_unset:function(e){_4.removeClass(e.target,"sortListItemHover");},_handleClick:function(e){_4.toggleClass(e.target,"sortListItemSelected");e.target.focus();this._updateValues(e.target.innerHTML);},_updateValues:function(){this._selected=_4.query("li.sortListItemSelected",this.containerNode);this.selected=[];_4.forEach(this._selected,function(_c){this.selected.push(_c.innerHTML);},this);this.onChanged(arguments);},_sorter:function(a,b){var _d=a.innerHTML;var _e=b.innerHTML;if(_d>_e){return 1;}if(_d<_e){return -1;}return 0;},setTitle:function(_f){this.focusNode.innerHTML=this.title=_f;},onChanged:function(){}});}}};});