//	<summary>Class EImage<br>
///	Adds additional properties so that we can render an images html.</summary>
///	<extends>Image class</extends>
///	<remarks>Auto-preloads images b/c <c>src</c> is set through constructor</remarks>
function FPImage(imgName, imgSrc, imgClass, imgWidth, imgHeight, imgAlt, imgBorder, imgUseOnmouseover, imgLink) {
	// =============================================
	// Public properties inherited from Image object
	// =============================================
	name = imgName;
	src = imgSrc;
	link = imgLink;
	this.source = imgSrc;		// Added as a result of the inherited Image object's src property not functioning correctly during the ThumbnailScroller image swaps in NS 7.1
		
	// =================
	// Public properties
	// =================
	this.className = (imgClass != null) ? imgClass : "";
	this.width = (!isNaN(imgWidth)) ? imgWidth : 0;
	this.height = (!isNaN(imgHeight)) ? imgHeight : 0;
	this.alt = (imgAlt != null) ? imgAlt : "";
	this.caption = imgAlt;
	this.useOnmouseover = (imgUseOnmouseover == true || imgUseOnmouseover == false) ? imgUseOnmouseover : false;
	this.onmouseover = this.useMouseover ? src.substring(1, src.indexOf(".gif")) + "-over.gif" : src;
	this.border = (isNaN(imgBorder) || (imgBorder == null)) ? 0 : imgBorder;
	this.html = "";
	this.src = src;

	///	<summary>Sets the html used for rendering the image</summary>
	this.SetHtml = function() {
		var html = "";
		
		html = "<img name=\"" + name + "\" " +
				"id=\"" + name + "\" " +
				"class=\"" + this.className + "\" " +
				"src=\"" + src + "\" " +
				"width=\"" + this.width + "\" " +
				"height=\"" + this.height + "\" " +
				"alt=\"" + this.alt.replace("'", "\'") + "\" " +
				"border=\"" + this.border + "\" ";
		if (this.useOnmouseover) {
			html += "onmouseover=\"FPImage.Swap('" + name + "', '" + this.onmouseover + "'); return true;\" " +
					"onmouseout=\"FPImage.Swap('" + name + "', '" + src + "'); return true;\"";
			}
		
		html += ">";
		
		html = (link != null && link.length > 0) ? "<a href=\"" + link + "\">" + html + "</a>" : html
		
		this.html = html;
	}
	
	this.SetHtml();
}
FPImage.prototype = new Image();
FPImage.prototype.constructor = FPImage;

///	<summary>Swaps out images for mouseover effects</summary>
/// <param name="arguments"><c>array</c> image name/src pairs.</param>
FPImage.Swap = function() {
	if (document.images) {
				// Loop all images passed in
		for (var i=0; i<arguments.length; i+=2) {
			document[arguments[i]].src = arguments[i+1];
		}
	}
}