/********************************************************************
*	class - NoClickLoader
*********************************************************************/
function NoClickLoader () {
	this.paramNames = new Array();
	this.paramNamesIndex = 0;
	this.paramNameValueLookup = new Array();
	
	this.swfFilename = "";
	this.flashHeight = 0;
	this.flashWidth = 0;
	
	this.styleId = null;
	this.qualityLevel = "high";
	this.align = "middle";
	
	this.isDebug = false;
}

function addParam (name, value) { with (this)
	this.paramNames[paramNamesIndex] = name;
	this.paramNamesIndex++;
	this.paramNameValueLookup[name] = value;
}

function setSwfFilename (fileName) { with (this)
	this.swfFilename = fileName;
}

function setFlashHeight (height) { with (this)
	this.flashHeight = height;
}

function setFlashWidth (width) { with (this)
	this.flashWidth = width;
}

function setStyleId (id) { with (this)
	this.styleId = id;
}

function setIsDebug (debug) { with (this)
	this.isDebug = debug;
}

function setQualityLevel (ql) { with (this)
	this.qualityLevel = ql;
}

function setAlign (a) { with (this)
	this.align = a;
}

function toHtml () { with (this)
	// do not print HTML if SWF is not provided
	if (this.swfFilename == null) {
		return "no SWF file provided";
	}
	
	// create base object tag
	html = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\""+ this.flashWidth +"\" height=\""+ this.flashHeight +"\"";
	if (this.styleId != null) {
		html += " id=\""+ this.styleId +"\"";
	}
	html += " align=\""+ this.align +"\">";
	html += "<param name=\"movie\" value=\""+ this.swfFilename +"\" />";
	
	// add necessary parameters for object tag
	var name = "";
	var value = "";
	for (var i=0; i<this.paramNames.length; i++) {
		name = this.paramNames[i];
		value = this.paramNameValueLookup[name];
		html += "<param name=\""+ name +"\" value=\""+ value +"\" />";
	}
	
	// add embed tag as backup
	html += "<embed src=\""+ this.swfFilename +"\" quality=\""+ this.qualityLevel +"\" width=\""+ this.flashWidth +"\" height=\""+ this.flashHeight +"\"";
	if (this.styleId != null) {
		html += "name=\""+ this.styleId +"\" id=\""+ this.styleId +"\"";
	}
	html += " align=\""+ this.align +"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"";
	
	// add necessary parameters for embed tag
	for (var i=0; i<this.paramNames.length; i++) {
		name = this.paramNames[i];
		value = this.paramNameValueLookup[name];
		html += " "+ name +"=\""+ value +"\"";
	}
	
	html += "/>";
	html += "</object>";
	

	if (this.isDebug) {
		alert(html);
	}

	return html;
}

function loadFlash (flashId) { with (this)
	var flash_entry = document.getElementById(flashId);
	var html = this.toHtml();
	flash_entry.innerHTML = html;
}

NoClickLoader.prototype.addParam = addParam;
NoClickLoader.prototype.setSwfFilename = setSwfFilename;
NoClickLoader.prototype.setFlashWidth = setFlashWidth;
NoClickLoader.prototype.setFlashHeight = setFlashHeight;
NoClickLoader.prototype.setStyleId = setStyleId;
NoClickLoader.prototype.setIsDebug = setIsDebug;
NoClickLoader.prototype.setQualityLevel = setQualityLevel;
NoClickLoader.prototype.setAlign = setAlign;
NoClickLoader.prototype.toHtml = toHtml;
NoClickLoader.prototype.loadFlash = loadFlash;
/********************************************************************
*	end class
*********************************************************************/