
var FlashVersion = '7.0.0.0';
var FlashCodebase = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=';
var FlashType = 'application/x-shockwave-flash';
var FlashPluginspage = 'http://www.macromedia.com/go/getflashplayer';

function FlashObject(src,id, classid) {
	
	var me = this;
	
	this.src = src;
	this.id = id;
	this.classid = classid;
	
	this.Attributes = null;
	this.Variables = null
	
	this.AddVariable = function(name, value) {
		if (me.Variables==null) {
			me.Variables = new Array()
		}
		me.Variables[me.Variables.length] = new Array(2);
		me.Variables[me.Variables.length-1][0] = name;
		me.Variables[me.Variables.length-1][1] = value;
	}
	this.AddAttribute = function(name, value) {
		if (me.Attributes==null) {
			me.Attributes = new Array()
		}
		me.Attributes[me.Attributes.length] = new Array(2);
		me.Attributes[me.Attributes.length-1][0] = name;
		me.Attributes[me.Attributes.length-1][1] = value;		
	}

	this.WriteFlash = function() {
	
		var i = 0;
		var strHTML='';
		strHTML +='<object ';
		
		//Object Attributes
		if (me.id != undefined) 		strHTML +='id="' + id + '" ';
		strHTML = 						strHTML +='codebase="' + FlashCodebase + FlashVersion + '" ';
		if (me.classid != undefined) 	strHTML +='classid="' + me.classid + '" ';

		if (me.Attributes != undefined) {
			for (i=0; i<me.Attributes.length; i++) {
				strHTML += me.Attributes[i][0] + '="' + me.Attributes[i][1] + '" ';
			}
		}		

		strHTML += '>';
		
		//Object Params
		if (me.src != undefined) {strHTML +='<param name="movie" value="' + src + '" ';
		if (me.Variables != undefined) {
			for (i=0; i<me.Variables.length; i++) {
				strHTML += '<param name="' + me.Variables[i][0] + '" value="' + me.Variables[i][1] + '"></param>';
			}		
		}
		
		//Embedd Attributes
		strHTML +='<embed ';
		if (me.id != undefined) 		strHTML +='name="' + id + '" ';
		if (me.src != undefined) 		strHTML +='src="' + src + '" ';
		
		strHTML +='type="' + FlashType + '" ';
		strHTML +='pluginspage="' + FlashPluginspage + '" ';
		
		if (me.Attributes != undefined) {
			for (i=0; i<me.Attributes.length; i++) {
				strHTML += me.Attributes[i][0] + '="' + me.Attributes[i][1] + '" ';
			}
		}
		if (me.Variables != undefined) {
			for (i=0; i<me.Variables.length; i++) {
				strHTML += me.Variables[i][0] + '="' + me.Variables[i][1] + '" ';
			}		
		}
		
		strHTML += '>';
		strHTML +='</embed>';

		strHTML +='</object>';
		document.write(strHTML);
		}
	}
}