/*
	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.data.FlickrStore"],["require","dojo.data.util.simpleFetch"],["require","dojo.io.script"],["require","dojo.date.stamp"],["require","dojo.AdapterRegistry"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.data.FlickrStore"]){_4._hasResource["dojox.data.FlickrStore"]=true;_4.provide("dojox.data.FlickrStore");_4.require("dojo.data.util.simpleFetch");_4.require("dojo.io.script");_4.require("dojo.date.stamp");_4.require("dojo.AdapterRegistry");_4.declare("dojox.data.FlickrStore",null,{constructor:function(_7){if(_7&&_7.label){this.label=_7.label;}if(_7&&"urlPreventCache" in _7){this.urlPreventCache=_7.urlPreventCache?true:false;}},_storeRef:"_S",label:"title",urlPreventCache:true,_assertIsItem:function(_8){if(!this.isItem(_8)){throw new Error("dojox.data.FlickrStore: a function was passed an item argument that was not an item");}},_assertIsAttribute:function(_9){if(typeof _9!=="string"){throw new Error("dojox.data.FlickrStore: a function was passed an attribute argument that was not an attribute name string");}},getFeatures:function(){return {"dojo.data.api.Read":true};},getValue:function(_a,_b,_c){var _d=this.getValues(_a,_b);if(_d&&_d.length>0){return _d[0];}return _c;},getAttributes:function(_e){return ["title","description","author","datePublished","dateTaken","imageUrl","imageUrlSmall","imageUrlMedium","tags","link"];},hasAttribute:function(_f,_10){var v=this.getValue(_f,_10);if(v||v===""||v===false){return true;}return false;},isItemLoaded:function(_11){return this.isItem(_11);},loadItem:function(_12){},getLabel:function(_13){return this.getValue(_13,this.label);},getLabelAttributes:function(_14){return [this.label];},containsValue:function(_15,_16,_17){var _18=this.getValues(_15,_16);for(var i=0;i<_18.length;i++){if(_18[i]===_17){return true;}}return false;},getValues:function(_19,_1a){this._assertIsItem(_19);this._assertIsAttribute(_1a);var u=_4.hitch(this,"_unescapeHtml");var s=_4.hitch(_4.date.stamp,"fromISOString");switch(_1a){case "title":return [u(_19.title)];case "author":return [u(_19.author)];case "datePublished":return [s(_19.published)];case "dateTaken":return [s(_19.date_taken)];case "imageUrlSmall":return [_19.media.m.replace(/_m\./,"_s.")];case "imageUrl":return [_19.media.m.replace(/_m\./,".")];case "imageUrlMedium":return [_19.media.m];case "link":return [_19.link];case "tags":return _19.tags.split(" ");case "description":return [u(_19.description)];default:return [];}},isItem:function(_1b){if(_1b&&_1b[this._storeRef]===this){return true;}return false;},close:function(_1c){},_fetchItems:function(_1d,_1e,_1f){var rq=_1d.query=_1d.query||{};var _20={format:"json",tagmode:"any"};_4.forEach(["tags","tagmode","lang","id","ids"],function(i){if(rq[i]){_20[i]=rq[i];}});_20.id=rq.id||rq.userid||rq.groupid;if(rq.userids){_20.ids=rq.userids;}var _21=null;var _22={url:_6.data.FlickrStore.urlRegistry.match(_1d),preventCache:this.urlPreventCache,content:_20};var _23=_4.hitch(this,function(_24){if(!!_21){_4.disconnect(_21);}_1e(this._processFlickrData(_24),_1d);});_21=_4.connect("jsonFlickrFeed",_23);var _25=_4.io.script.get(_22);_25.addErrback(function(_26){_4.disconnect(_21);_1f(_26,_1d);});},_processFlickrData:function(_27){var _28=[];if(_27.items){_28=_27.items;for(var i=0;i<_27.items.length;i++){var _29=_27.items[i];_29[this._storeRef]=this;}}return _28;},_unescapeHtml:function(str){return str.replace(/&amp;/gm,"&").replace(/&lt;/gm,"<").replace(/&gt;/gm,">").replace(/&quot;/gm,"\"").replace(/&#39;/gm,"'");}});_4.extend(_6.data.FlickrStore,_4.data.util.simpleFetch);var _2a="http://api.flickr.com/services/feeds/";var reg=_6.data.FlickrStore.urlRegistry=new _4.AdapterRegistry(true);reg.register("group pool",function(_2b){return !!_2b.query["groupid"];},_2a+"groups_pool.gne");reg.register("default",function(_2c){return true;},_2a+"photos_public.gne");if(!_2d){var _2d=function(_2e){};}}}};});