function FlashObject(swf, id, classid, codebase, width, height, color, secureStream) 
{
	this.swf = swf;
	this.id = id;
	this.classid = classid;
	this.codebase = codebase;
	this.width = width;
	this.height = height;
	this.color = color;
	
	this.params = new Array();
	this.variables = new Array();
	this.flashVars = "";
	this.secureStream = secureStream ? "https" : "http";
	this.object_str = "";
}

FlashObject.prototype.addParam = function(name, value) {
	var tmpArray = new Array(2);
	tmpArray[0] = name;
	tmpArray[1] = value;
	this.params.push(tmpArray);
}

FlashObject.prototype.addVariable = function(name, value) {
	var tmpArray = new Array(2);
	tmpArray[0] = name;
	tmpArray[1] = value;
	this.variables.push(tmpArray);
}

FlashObject.prototype.build = function() {
	// Sammensætter objectet.
	this.object_str += "<object classid=\"" + this.classid + "\" codebase=\"" + this.codebase + "\" width=\"" + this.width + "\" height=\"" + this.height + "\" id=\"" + this.id + "\">\n";
	
	// indsætter standard param-tags
	this.object_str += "\t<param name=\"movie\" value=\"" + this.swf + "\" />\n";
	this.object_str += "\t<param name=\"bgcolor\" value=\"" + this.color + "\" />\n";
	
	// indsætter brugerens param-tags
	for (i=0; i<this.params.length; i++) {
		this.object_str += "\t<param name=\"" + this.params[i][0] + "\" value=\"" + this.params[i][1] + "\" />\n";
	}
	
	// her genereres flashVars strengen
	for (i=0; i<this.variables.length; i++) {
		this.flashVars += this.variables[i][0] + "=" + this.variables[i][1];
		if (i < this.variables.length - 1) {
			this.flashVars += "&";
		}
	}
	if (this.flashVars != "") {
		this.object_str += "\t<param name=\"flashvars\" value=\"" + this.flashVars + "\" />\n";
	}
	
	// embed-tag
	this.object_str += "\t<embed src=\"" + this.swf + "\" bgcolor=\"" + this.color + "\" width=\"" + this.width + "\" height=\"" + this.height + "\" name=\"" + this.id + "\" ";
	
	if (this.flashVars != "") {
		this.object_str += "flashvars=\"" + this.flashVars + "\" ";
	}
	
	for (i=0; i<this.params.length; i++) {
		this.object_str += this.params[i][0] + "=\"" + this.params[i][1] + "\" ";
	}
	
	this.object_str += "type=\"application/x-shockwave-flash\" pluginspage=\"" + this.secureStream + "://www.macromedia.com/go/getflashplayer\" />\n";
	
	
	this.object_str += "</object>";
	document.write(this.object_str);
}

function attachHandler(target, eventName, handler) {
	if (target.addEventListener)
	{ 
		target.addEventListener(eventName, handler, false);
  }
  else if (target.attachEvent)
  { 
  	target.attachEvent("on" + eventName, handler);
  }
}

rejseIdFocus = function () {
	var element = document.getElementById('travelhelper_txtTravelId');
	if (element) {
		document.getElementById('travelhelper_txtTravelId').focus();
	}
}

attachHandler(window, "load", rejseIdFocus);