/*
	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.simpleFetch"],["require","dojo.data.util.sorter"]],defineResource:function(_1){if(!_1._hasResource["dojo.data.util.simpleFetch"]){_1._hasResource["dojo.data.util.simpleFetch"]=true;_1.provide("dojo.data.util.simpleFetch");_1.require("dojo.data.util.sorter");_1.data.util.simpleFetch.fetch=function(_2){_2=_2||{};if(!_2.store){_2.store=this;}var _3=this;var _4=function(_5,_6){if(_6.onError){var _7=_6.scope||_1.global;_6.onError.call(_7,_5,_6);}};var _8=function(_9,_a){var _b=_a.abort||null;var _c=false;var _d=_a.start?_a.start:0;var _e=_a.count?(_d+_a.count):_9.length;_a.abort=function(){_c=true;if(_b){_b.call(_a);}};var _f=_a.scope||_1.global;if(!_a.store){_a.store=_3;}if(_a.onBegin){_a.onBegin.call(_f,_9.length,_a);}if(_a.sort){_9.sort(_1.data.util.sorter.createSortFunction(_a.sort,_3));}if(_a.onItem){for(var i=_d;(i<_9.length)&&(i<_e);++i){var _11=_9[i];if(!_c){_a.onItem.call(_f,_11,_a);}}}if(_a.onComplete&&!_c){var _12=null;if(!_a.onItem){_12=_9.slice(_d,_e);}_a.onComplete.call(_f,_12,_a);}};this._fetchItems(_2,_8,_4);return _2;};}}});