(function(){
	
	var base_image_url = ['01.sm-img.com'],
	    base_image_url_cache = {};

	var ImageAPI = function()
	{
		var self = this;

		self.get_base_image_url = function(suffix, use_skin)
		{
			var image_domain,
			    image_uri,
			    skin_string = ''

			if (typeof use_skin == 'undefined')
				use_skin = true

			if (typeof suffix == 'undefined')
				suffix = ''

			// Cache URLs so that we don't load the same image from multiple URLs when this is called on events
			if (typeof base_image_url_cache[suffix] == 'undefined')
			{
				image_domain = base_image_url[Math.floor(Math.random()*base_image_url.length)]
				base_image_url_cache[suffix] = image_domain
			}
			else
			{
				image_domain = base_image_url_cache[suffix]
			}

			suffix = suffix.replace(/^\//, '')

			if (use_skin == true)
				skin_string = 'skin/blue/'

			image_uri = 'https://' + image_domain + '/' + skin_string + suffix

			return image_uri
		};

	};

	// If we don't have a different ImageAPI method, set this one up in the global namespace.
	window.image_api = window.image_api || (new ImageAPI());

})();


