if(request.query.lang){ 
if(query.lang){ 
	_fetchItems: function(request, fetchHandler, errorHandler){		// summary: Fetch flickr items that match to a query		// request:		//	A request object		// fetchHandler:		//	A function to call for fetched items		// errorHandler:		//	A function to call on error		if(!request.query){			request.query={};		}				var primaryKey = [];		var secondaryKey = [];				//Generate a unique function to be called back		var callbackFn = "FlickrRestStoreCallback_" + this._id + "_" + (++this._requestCount);		//Build up the content to send the request for.		var content = {			format: "json",			method: "flickr.people.getPublicPhotos",			api_key: this._apikey,			jsoncallback: callbackFn		};		var isRest = false;		if(request.query.userid){			isRest = true;			content.user_id = request.query.userid;			primaryKey.push("userid"+request.query.userid);		}		if(request.query.apikey){			isRest = true;			content.api_key = request.query.apikey;			secondaryKey.push("api"+request.query.apikey);		}		if(request.query.page){			content.page = request.query.page;			secondaryKey.push("page" + content.page);		}else if(typeof(request.start) != "undefined" && request.start != null) {			if(!request.count){				request.count = 20;			}			var diff = request.start % request.count;			var start = request.start, count = request.count;			if(diff != 0) {				if(start < count / 2) {					count = start + count;					start = 0; 				} else {					start = Math.ceil(count / 2);					if(start != count / 2) {						count = (count / 2) + 1;					} else {						count /= 2;					}				}				request._realStart = request.start;				request._realCount = request.count;				request.start = start;				request.count = count;			} else {				request._realStart = request._realCount = null;			}						content.page = (start / count) + 1;			secondaryKey.push("page" + content.page);		}		if(request.count){			content.per_page = request.count;			secondaryKey.push("count" + request.count);		}				if(request.query.lang){			content.lang = request.query.lang;			secondaryKey.push("lang" + request.lang);		}		var url = this._flickrRestUrl;				if(request.query.set){		  content.method = "flickr.photosets.getPhotos";		  content.photoset_id = request.query.set; 		  requestKey.push("set" + request.query.set);		}				//Generate a unique key for this request, so the store can 		//detect duplicate requests.		primaryKey = primaryKey.join(".");		secondaryKey = secondaryKey.length > 0 ? "." + secondaryKey.join(".") : "";		var requestKey = primaryKey + secondaryKey;		var thisHandler = {	     		request: request,	     		fetchHandler: fetchHandler,	     		errorHandler: errorHandler	   	};	   		   	//If the request has already been made, but not yet completed,	   	//then add the callback handler to the list of handlers	   	//for this request, and finish.	   	if(this._handlers[requestKey]){	     		this._handlers[requestKey].push(thisHandler);	     		return;	   	}  		this._handlers[requestKey] = [thisHandler];  		//Linking this up to Flickr is a PAIN!  		var self = this;  		var handle = null;  		var getArgs = {			url: this._flickrRestUrl,			preventCache: true,			content: content		};		  		var doHandle = function(processedData, data, handler){			var onBegin = handler.request.onBegin;			handler.request.onBegin = null;			var maxPhotos;			var req = handler.request;						if(typeof(req._realStart) != undefined && req._realStart != null) {				req.start = req._realStart;				req.count = req._realCount;				req._realStart = req._realCount = null;			}			//If the request contains an onBegin method, the total number			//of photos must be calculated.			if(onBegin){				if(data && typeof(data.photos.perpage) != "undefined" && typeof(data.photos.pages) != "undefined"){						if(data.photos.perpage * data.photos.pages <= handler.request.start + handler.request.count){							//If the final page of results has been received, it is possible to 							//know exactly how many photos there are							maxPhotos = handler.request.start + data.photos.photo.length;                						}else{							//If the final page of results has not yet been received,							//it is not possible to tell exactly how many photos exist, so							//return the number of pages multiplied by the number of photos per page.							maxPhotos = data.photos.perpage * data.photos.pages;						}						self._maxPhotosPerUser[primaryKey] = maxPhotos;						onBegin(maxPhotos, handler.request);				} else if(self._maxPhotosPerUser[primaryKey]) {					onBegin(self._maxPhotosPerUser[primaryKey], handler.request);				}			}			//Call whatever functions the caller has defined on the request object, except for onBegin			handler.fetchHandler(processedData, handler.request);			if(onBegin){				//Replace the onBegin function, if it existed.				handler.request.onBegin = onBegin;			}		};				//Define a callback for the script that iterates through a list of 		//handlers for this piece of data.  Multiple requests can come into		//the store for the same data.		var myHandler = function(data){			//The handler should not be called more than once, so disconnect it.			//if(handle !== null){ dojo.disconnect(handle); }			if(data.stat != "ok"){				errorHandler(null, request);			}else{ //Process the items...				var handlers = self._handlers[requestKey];				if(!handlers){					console.log("FlickrRestStore: no handlers for data", data);					return;				}				self._handlers[requestKey] = null;				self._prevRequests[requestKey] = data;				//Process the data once.				var processedData = self._processFlickrData(data, request, primaryKey);				if(!self._prevRequestRanges[primaryKey]) {					self._prevRequestRanges[primaryKey] = [];				}				self._prevRequestRanges[primaryKey].push({					start: request.start,					end: request.start + data.photos.photo.length				});				//Iterate through the array of handlers, calling each one.				for(var i = 0; i < handlers.length; i++ ){					doHandle(processedData, data, handlers[i]);				}			}		};		var data = this._prevRequests[requestKey];				//If the data was previously retrieved, there is no need to fetch it again.		if(data){			this._handlers[requestKey] = null;			doHandle(this._cache[primaryKey], data, thisHandler);			return;		} else if(this._checkPrevRanges(primaryKey, request.start, request.count)) {			//If this range of data has already been retrieved, reuse it.			this._handlers[requestKey] = null;			doHandle(this._cache[primaryKey], null, thisHandler);			return;		}				dojo.global[callbackFn] = function(data){			myHandler(data);			//Clean up the function, it should never be called again			dojo.global[callbackFn] = null;		};						var deferred = dojo.io.script.get(getArgs);				//We only set up the errback, because the callback isn't ever really used because we have		//to link to the jsonFlickrFeed function....		deferred.addErrback(function(error){			dojo.disconnect(handle);			errorHandler(error, request);		});	},
5168	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5168/e21a8a28b442d71f172ca764405c66bb5070d9f3/FlickrRestStore.js/buggy/data/FlickrRestStore.js