var ImageFrame = Class.create
({
	initialize: function(frameID, className, image, fadeTime, sibling, insertMode)
	{
		this.frameID = frameID;
		this.className = className + ' enhanced';
		this.image = image;
		this.fadeTime = fadeTime;
		this.sibling = sibling;
		this.insertMode = insertMode;
	},
	
	setupFrame: function()
	{
		var domSibling = $(this.sibling);
		var frameID = 'frame' + this.frameID;
		var style = (this.insertMode == null) ? ' style="background-image: url(\'' + this.image + '\');"' : '';
		
		var frameHTML = '<div id="' + frameID + '" class="' + this.className + '"' + style + '>';
		if (this.insertMode == 1)
		{
			var imageID = 'image' + this.frameID;
			frameHTML += '<img id="' + imageID + '" src="' + this.image + '" alt="The Chair Set furniture image." />';
		}
		frameHTML += '</div>';

		domSibling.insert({ after: frameHTML });

		this.frame = $(frameID);
		this.frame.style.zIndex = -1;
		this.frame.setStyle({ opacity: 0 });
	},

	displayDone: function(frame)
	{
		frameController();
	},
	
	getFrameElement: function()
	{
		return this.frame;
	},
		
	displayFrame: function()
	{
		this.frame.style.zIndex = 1;
		fadeThis(this.frame, 0, 1, this.fadeTime, this.displayDone);
	},

	resetLayer: function()
	{
		this.frame.style.zIndex = 0;
	},

	resetFrame: function()
	{
		this.frame.style.zIndex = -1;
		this.frame.setStyle({opacity : 0});
	}
});