function init(){
	var e = "jason";
	var u = "handcraftediron";
	var eh= document.getElementById("eh");
	eh.innerHTML = 'Email: <a href="mailto:'+e+'@'+u+'.com">'+e+'@'+u+'.com</a>';
	
	getPhotos();
}

function getPhotos()
{
	new fetchFlickrPix({
		method: 'flickr.photos.search',
		user_id: '98732030@N00',
		tags: 'portfolio',
		jsoncallback: 'initGallery'
		});
}

function initGallery(res)
{
	new geckoGalleryLite(res);
}


function fetchFlickrPix(args) {
	// Set the properties
	this.apiKey = "acc0692942a8b7d07dfb18f6de35ea3e";
	this.baseUrl = "http://www.flickr.com/services/rest/?";
	this.format = "json";
	this.args = args;

	// Create the script tag
    this.scriptTag = document.createElement("script");
    this.scriptTag.setAttribute("type", "text/javascript");
    this.scriptTag.setAttribute("src", this.buildRestUrl());
	
	// Append to head
	document.getElementsByTagName("head").item(0).appendChild(this.scriptTag);
}

fetchFlickrPix.prototype.buildRestUrl = function()
{
	// Add the extra args 
	this.args.api_key = this.apiKey;
	this.args.format = this.format;
	
	var queryString = [];
	for (var property in this.args) queryString.push(encodeURIComponent(property) + '=' + encodeURIComponent(this.args[property]));
	return this.baseUrl + queryString.join('&');
}
