/*
	Copyright (c) 2004-2007, The Dojo Foundation
	All Rights Reserved.

	Licensed under the Academic Free License version 2.1 or above OR the
	modified BSD license. For more information on Dojo licensing, see:

		http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing
*/


dojo._xdResourceLoaded({depends:[["provide","dojo.data.util.sorter"]],defineResource:function(_1){if(!_1._hasResource["dojo.data.util.sorter"]){_1._hasResource["dojo.data.util.sorter"]=true;_1.provide("dojo.data.util.sorter");_1.data.util.sorter.basicComparator=function(a,b){var _4=0;if(a>b||typeof a==="undefined"||a===null){_4=1;}else{if(a<b||typeof b==="undefined"||b===null){_4=-1;}}return _4;};_1.data.util.sorter.createSortFunction=function(_5,_6){var _7=[];function createSortFunction(_8,_9){return function(_a,_b){var a=_6.getValue(_a,_8);var b=_6.getValue(_b,_8);var _e=null;if(_6.comparatorMap){if(typeof _8!=="string"){_8=_6.getIdentity(_8);}_e=_6.comparatorMap[_8]||_1.data.util.sorter.basicComparator;}_e=_e||_1.data.util.sorter.basicComparator;return _9*_e(a,b);};};for(var i=0;i<_5.length;i++){sortAttribute=_5[i];if(sortAttribute.attribute){var _10=(sortAttribute.descending)?-1:1;_7.push(createSortFunction(sortAttribute.attribute,_10));}}return function(_11,_12){var i=0;while(i<_7.length){var ret=_7[i++](_11,_12);if(ret!==0){return ret;}}return 0;};};}}});