///	<summary>Class ProductScroller<br>
///	Adds methods/properties specific to a <c>Scroller</c> of <c>Product</c> items</summary>
///	<extends>Scroller</extends>
function ProductScroller() {
	
	// ===================
	// Protected Variables
	// ===================
	
	this.name = "productScroller";		// Name of html element id to write scroller to
	this.anchorClass = "";				// Class name of anchor tag
	this.statusBar = "";				// Default status bar text
	this.demoButton = null;				// Demo button image
	this.productLink = "";			// Href for product link
	this.defaultImageType = "fp_thumb";		// Default image type to display
	
	// =================
	// Protected Methods
	// =================
	
	///	<summary>Generates the html for a generic <c>ProductScroller</c> cell.</summary>
	/// <param name="i"><c>int</c> index of the <c>items</c> array.</param>
	/// <returns><c>string</c> of cell html</returns>
	this.GetCellHtml = function(i) {
		var html = "";
		var product = this.items[i];
		var mainImages = product.GetMedia(this.defaultImageType);
		var mainImg = mainImages[0];
		var mainImgHtml = (mainImg != null) ? mainImg.CreateFPImage().html : "";
		
		html += "<td id=\"" + this.name + "cell" + i + "\" align=\"center\" valign=\"top\" width=\"" + this.cellWidth + "\">" +
					"<a href=\"" + this.productLink + product.GetId() + "\" class=\"" + this.anchorClass + "\">" +
						mainImgHtml + "<br>" +
						Scroller.GetSpacer(1, 5).html + "<br>" +
						product.GetName() + "<br>" +
					"</a>" +
				"</td>";
		
		return html;
	}
	
	// ==============
	// Public Methods
	// ==============
	
	///	<summary>Sets the class of the product link.</summary>
	/// <param name="value"><c>string</c> css class name for the a tag.</param>
	this.SetAnchorClass = function(value) {
		this.anchorClass = value;
	}
	
	///	<summary>Sets the default value of the status bar</summary>
	/// <param name="value"><c>string</c> default status bar value.</param>
	this.SetStatusBar = function(value) {
		this.statusBar = value;
	}
	
	///	<summary>Sets the value of product links</summary>
	/// <param name="value"><c>string</c> product link.</param>
	///	<remarks>id is auto-appended to this value</remarks>
	this.SetProductLink = function(value) {
		this.productLink = value;
	}
	
	///	<summary>Sets the starting product for display</summary>
	/// <param name="value"><c>string</c> id/sku of product to begin display.</param>
	this.SetInitialProduct = function(value) {
		var i = 0;
		var propertyGetter = (!isNaN(parseInt(value))) ? "GetId();" : "GetSku();";		// Sets the function name used for value lookup
		var prodProperty = null;														// Property found by evaluating the above function name
		
				// Loop all products in items array
		for (; i < this.items.length; i++) {
			prodProperty = eval("this.items[i]." + propertyGetter);
					// If match is found, set starting index of ProductScroller and exit
			if (prodProperty == value) {
				this.SetInitialItem(i);
				break;
			}
		}
	}
	
	///	<summary>Sets the image for a demo button.</summary>
	/// <param name="img"><c>FPImage</c> object.</param>
	this.SetDemoButton = function(img) {
		this.demoButton = img;
	}
	
}
ProductScroller.prototype = new Scroller();
ProductScroller.prototype.constructor = ProductScroller;