ILR.namespace("SlideShow");

if( !ILR.SlideShow.Slide ) {
	/**
	 * Slide is a javascript object that represents a slide in a slide show.
	 * @namespace ILR
	 * @class Slide
	 * @constructor
	 * @param {Object} options the default associative array of values for the slide
	 */
	ILR.SlideShow.Slide = function(options) {
		this.init(options);
	};
	
	ILR.SlideShow.Slide.prototype = {
		/**
		 * Class's constructor
		 * @property constructor
		 * @type Function
		 */
		constructor: ILR.Slide,
		
		/**
		 * A random number used to make sure caching does not screw images up.
		 * @property _RAND
		 * @type Integer
		 * @private
		 */
		_RAND: 0,
	
		/**
		 * Unique identifier
		 * @property id
		 * @type String
		 */
		id: null,
		
		/**
		 * Unique identifier of slide show
		 * @property parentId
		 * @type String
		 */
		parentId: null,
		
		/**
		 * File name of image (not full path)
		 * @property link
		 * @type String
		 */
		link: null,
		
		/**
		 * Slide title
		 * @property title
		 * @type String
		 */
		title: null,
		
		/**
		 * Description of slide
		 * @property description
		 * @type String
		 */
		description: null,
		
		/**
		 * Photographer of the slide
		 * @property author
		 * @type String
		 */
		author: null,
		
		/**
		 * Date slide image was taken
		 * @property date
		 * @type String
		 */
		date: null,
		
		/**
		 * Initializes attributes for the slide.
		 * @method init
		 * @param {Object} options the default associative array of values for the slide
		 */
		init:function(options) {
			apply(this, options);
			
			this._RAND = Math.random();
		},
		
		/**
		 * Get the full image URL for a given view.
		 * @method getImageLink
		 * @param {String} view which image view to use (original, view, thumbnail)
		 * @return {String} URL pointing to the image in the specified view
		 */
		getImageLink:function(view) {
			return "/slideshows/" + this.parentId + "/" + view + "/" + this.link + "?rand=" + this._RAND;
		}
	}
}