var MooPix = new Class({
    initialize: function(type, format){
		// You must supply your own API key to use Flickr Services
		//this.fApiKey		= '92437448ff6c6cf6e8bfee2549fdee63';
		this.fApiKey		= 'f7d69f0a53e6f01856cbb56d4cfcee3d';
		

		// You'll probably want to leave these alone
		this.fBaseUrl		= 'http://www.flickr.com/services/';
		this.fType			= (!type)?'rest':type;
		this.fFormat		= (!format)?'json':format;
		this.fArgs			= {};
    },
	setFlickrUrl: function(args){
		// Be sure to pass api key and request format in arguments
		this.fArgs.api_key = this.fApiKey;
	    this.fArgs.format = this.fFormat;
	
		// Combine args in this call with those in the object instance already
		Object.extend(this.fArgs, args);
		
		// Build final, signed URL
		this.fUrl = this.fBaseUrl+this.fType+'/?'+Object.toQueryString(this.fArgs);
		return this.fUrl;
	},
	callFlickrUrl: function(args){
		// Create script element and append to DOM
		var script = new Element('script');
		script.setProperties({type: 'text/javascript', src: this.setFlickrUrl(args)});
		//$('shw').innerHTML+=(this.setFlickrUrl(args))+"<br/>";
		script.injectInside($E('head'));
	}
});
