/*
 *  Name    : MooSmug
 *  Version : 0.1
 *  Author  : Jens Boje (azarai@codeboje.de)
              http://codeboje.de/contact/

    This code is highly based on MooPix (http://www.moopix.org/) and therefor uses the same licence

 *  This work is licensed under a Creative Commons License Attribution-ShareAlike 2.0
 *  http://creativecommons.org/licenses/by-sa/2.0/
 *  Associated frameworks copyright their respective owners
*/


// -----------------------------------------------------------------------------------
//
// This page coded by Scott Upton
// http://www.uptonic.com | http://www.couloir.org
//
// This work is licensed under a Creative Commons License
// Attribution-ShareAlike 2.0
// http://creativecommons.org/licenses/by-sa/2.0/
//
// Associated frameworks copyright their respective owners
//
//
// REQUIRES: Mootools 1.1 or higher
//
// -----------------------------------------------------------------------------------
// --- version date: 06/10/2007 ------------------------------------------------------


/* MooPix Class
------------------------------------------------------------*/

var MooSmug = new Class({
    initialize: function(){
		// You must supply your own API key to use Flickr Services
		this.fApiKey		= '5PWp93tfq5TMoKnz9FBzo5nGG2IahVOx';

		// You'll probably want to leave these alone
		this.fBaseUrl		= 'http://api.smugmug.com/services/api/json/1.2.1/';
		this.fArgs		= {};
    },
	setSmugmugUrl: function(args){
		// Be sure to pass api key and request format in arguments
		this.fArgs.APIKey = this.fApiKey;
		this.fArgs.JSONCallback= 'jsonSmugmugApi'

		// 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+'?'+Object.toQueryString(this.fArgs);
		return this.fUrl;
	},
	callSmugmug: function(args){
		// Create script element and append to DOM
		var script = new Element('script');
		script.setProperties({type: 'text/javascript', src: this.setSmugmugUrl(args)});
		script.injectInside($E('head'));
	}
});
