/**
 * Fotolia images list
 *
 * @copyright (c) 2004-2008, SWsoft
 */
var FotoliaSearchFormImageList = Class.create();
FotoliaSearchFormImageList.prototype = {

	/**
	 * Selected image id
	 *
	 * @var string
	 * @access private
	 */
	_selectedImageId: null,

	/**
	 * Image list
	 *
	 * @var Array
	 * @access private
	 */
	_imageList: null,

	/**
	 * Object constructor
	 *
	 * @access public
	 * @param string
	 * @return void
	 */
	initialize: function(selectedImageId) {
		this._selectedImageId = selectedImageId;
		this._imageList = new Array();
	},

	/**
	 * Registers image in the list
	 *
	 * @access public
	 * @param string
	 * @return void
	 */
	registerImage: function(imageId) {
		var imageObject = new FotoliaSearchFormImage(this, imageId);
		if (imageId == this._selectedImageId) {
			imageObject.select();
		}
		this._imageList.push(imageObject);
	},

	/**
	 * Selects image in the list
	 *
	 * @access public
	 * @param string
	 * @return void
	 */
	select: function(imageId) {
		for (var i = 0; i < this._imageList.length; i++) {
			if (this._imageList[i].imageId == imageId) {
				this._imageList[i].select();
				this._selectedImageId = imageId;
			} else {
				this._imageList[i].unSelect();
			}
		}
	},

	/**
	 * Returns selecte image id
	 *
	 * @access public
	 * @return string
	 */
	getSelectedImageId: function() {
		return this._selectedImageId;
	}
}