var FlashObject = function() {
	this.flashVars = new Array();
}

FlashObject.prototype.setSwfFile = function(value) {
	this.swfFile = value;
}

FlashObject.prototype.setSwfID = function(value) {
	this.swfID = value;
}

FlashObject.prototype.setWidth = function(value) {
	this.width = value;
}

FlashObject.prototype.setHeight = function(value) {
	this.height = value;
}

FlashObject.prototype.setColor = function(value) {
	this.color = value;
}

FlashObject.prototype.addFlashVar = function(name, value) {
	this.flashVars.push({name:name, value:value});
}

FlashObject.prototype.checkParams = function() {
	if (this.swfFile && this.swfID && this.width && this.height && this.color) {
		return true;	
	} else {
		return false;	
	}
}

FlashObject.prototype.createEmbedString = function() {
	var fileString = this.swfFile;
	for (var i = 0; i < this.flashVars.length; i++) {
		if (i == 0) {
			fileString += "?";
		}
		fileString += this.flashVars[i].name + "=" + this.flashVars[i].value;
		if (i < this.flashVars.length - 1) {
			fileString += "&amp;";
		}
	}
	var mySwf = '';
	mySwf += '<object type="application/x-shockwave-flash" ';
	mySwf += 'data="' + fileString + '" ';
	mySwf += 'width="' + this.width + '" ';
	mySwf += 'height="' + this.height + '" ';
	mySwf += 'id="' + this.swfID + '">';
	mySwf += '<param name="movie" value="' + fileString + '" />';
	mySwf += '<param name="wmode" value="opaque" />';
	mySwf += '<param name="allowScriptAccess" value="sameDomain" />';
	mySwf += '<param name="menu" value="true" />';
	mySwf += '<param name="quality" value="high" />';
	mySwf += '<param name="salign" value="lt" />';
	mySwf += '<param name="bgcolor" value="' + this.color + '" />';
	mySwf += '</object>';
	return mySwf;
}

FlashObject.prototype.attachSwfToDiv = function(divID) {
	if (this.checkParams()) {
		var getID = document.getElementById(divID);
		if (getID) {
			getID.innerHTML = this.createEmbedString();
		}
	}
}

FlashObject.prototype.writeSwfToHtml = function() {
	if (this.checkParams()) {
		document.write(this.createEmbedString());
	}
}

FlashObject.prototype.setFocusToSwf = function() {
	var getID = document.getElementById(this.swfID);
	if (getID) {
		getID.focus();
	}
}


