/* -------------------------------------------------------------------------- */
/** 
 *    @fileoverview
 *       flashGenerator.
 *
 *    @version rev005.2008-03-26
 */
/* -------------------------------------------------------------------------- */

if (typeof(BA) != "object") {
	/* --------------- Constructor : BAEnvironment --------------- */
	/**
	 * constructor of 'BA' global single object.
	 * @class common settings and environment variables set.
	 * @constructor
	 */
	function BAEnvironment() {
		/** document
		    @type Document @const @private */
		var d  = document;
		/** navigator.userAgent
		    @type String @const @private */
		var ua = navigator.userAgent;

		/** associative array of browser distinction results.
		    @type Object @const  */
		this.ua = {};
		this.ua.isGecko      = /Gecko\//    .test(ua);
		this.ua.isSafari     = /AppleWebKit/.test(ua);
		this.ua.isOpera      = Boolean(window.opera);
		this.ua.isIE         = (d.all && !this.ua.isGecko && !this.ua.isSafari && !this.ua.isOpera);
		this.ua.isMac        = /Mac/.test(ua);
		this.ua.isWin        = /Win/.test(ua);
		this.ua.isWinIE      = (this.ua.isWin && this.ua.isIE);
		this.ua.isMacIE      = (this.ua.isMac && this.ua.isIE);
		this.ua.revision     = (this.ua.isIE    ) ? parseFloat(ua.match(/MSIE ([\d\.]+)/)[1])         :
		                       (this.ua.isGecko ) ? parseFloat(ua.match(/; rv:([\d\.]+)/)[1])         :
		                       (this.ua.isSafari) ? parseFloat(ua.match(/AppleWebKit\/([\d\.]+)/)[1]) :
		                       (this.ua.isOpera ) ? parseFloat(ua.match(/Opera.([\d\.]+)/)[1])        :
		                                            0;
	}
	var BA = new BAEnvironment;

	/* --------------- Function : BAAddOnload --------------- */
	/**
	 * add func to window.onload functions stack.
	 * @param {Function} func     function/method (required)
	 * @see _addEventListener
	 */
	function BAAddOnload(func) {
		var target = (BA.ua.isGecko || BA.ua.isOpera) ? document           : window;
		var type   = (BA.ua.isGecko)                  ? 'DOMContentLoaded' : 'load';
		_addEventListener(target, type, func);
	}
}
/* ----- _addEventListener() ----- */
/**
 * cross-browser-integrated addEventListener().
 * @param {Node}     node      target node
 * @param {String}   type      event type (required)
 * @param {Function} listener  function or method as event listener (required)
 * @param {Object}   aThis     the object that will be a global object ('this') in the event listener function
 */
function _addEventListener(node, type, listener, aThis){
	var _window = (BA.ua.isGecko || BA.ua.isOpera) ? document : window;
	if (node.addEventListenerBA) {
		node.addEventListenerBA(type, listener, aThis);
	} else {
		var _func = (aThis) ? function(){listener.apply(aThis, arguments)} : listener;
		if (node.addEventListener) {
			var _removeListener = function(){
				node.removeEventListener(type, _func, false);
				_window.removeEventListener("unload", arguments.callee, false);
			}
			node.addEventListener(type, _func, false);
			_window.addEventListener("unload", _removeListener, false);
		} else if (node.attachEvent) {
			var _removeListener = function(){
				node.detachEvent("on" + type, _func);
				_window.detachEvent("onunload", arguments.callee);
			}
			node.attachEvent("on" + type, _func);
			_window.attachEvent("onunload", _removeListener);
		} else {
			var _exists = node["on" + type];
			var _listener = (_exists) ? function(){ _exists(); _func(); } : _func;
			node["on" + type] = _listener;
		}
	}
}


/* -------------------- Constructor : objectGenerator -------------------- */
/**
 * construct objectGenerator object.
 * @class objectGenerator
 * @param {Object} config
 * @constructor
 */
function objectGenerator(config) {
	/** node
	    @type Node */
	this.node       = null;
	/** required version
	    @type String */
	this.version    = "0";
	/** required plugin version
	    @type String */
	this.required   = "0";
	/** url of movie file
	    @type String */
	this.src        = "";
	/** id attribute
	    @type String */
	this.id         = "object";
	/** name attribute
	    @type String */
	this.name       = "object";
	/** class attribute
	    @type String */
	this.className  = "object";
	/** class attribute width alternate content
	    @type String */
	this.alternate  = "object-alternate";
	/** width
	    @type String */
	this.width      = "100%";
	/** height
	    @type String */
	this.height     = "100%";
	/** mime type
	    @type String @const @private */
	this.type       = "";
	/** classid attribute
	    @type String @const @private */
	this.classid    = "";
	/** param elements settings
	    @type Object */
	this.params     = {};

	if (typeof(config) == "object") {
		this.setConfig(config);
	}
}
objectGenerator.prototype = {
	/** initialize
	 *  @param {Object} config
	 *  @type Object
	 */
	setConfig : function(config){
		for (var i in config) {
			var value = config[i];
			switch (i) {
				case "required" :
					this.setRequired(value);
					break;
				case "src" :
					this.setSrc(value);
					break;
				case "id" :
					this.setId(value);
					break;
				case "name" :
					this.setName(value);
					break;
				case "className" :
					this.setClassName(value);
					break;
				case "width" :
					this.setWidth(value);
					break;
				case "height" :
					this.setHeight(value);
					break;
				case "type" :
					this.setType(value);
					break;
				case "classid" :
					this.setClassid(value);
					break;
				case "codebase" :
					this.setCodebase(value);
					break;
				default :
					this.setParam(i, value);
					break;
			}
		}
	},
	/**
	 * set plugin version
	 * @param {String} version     plugin version
	 */
	setVersion : function(version) {
		this.version = new String(version);
	},
	/**
	 * get plugin version
	 * @returns plugin version
	 * @type String
	 */
	getVersion : function() {
		return this.version;
	},
	/**
	 * set required plugin version
	 * @param {String} version     required plugin version
	 */
	setRequired : function(required) {
		this.required = new String(required);
	},
	/**
	 * get required plugin version
	 * @returns required plugin version
	 * @type String
	 */
	getRequired : function() {
		return this.required;
	},
	/**
	 * set src
	 * @param {String} src     filepath
	 */
	setSrc : function(src) {
		this.src = src;
	},
	/**
	 * get src
	 * @returns src
	 * @type String
	 */
	getSrc : function() {
		return this.src;
	},
	/**
	 * set id
	 * @param {String} id     id
	 */
	setId : function(id) {
		this.id = id;
	},
	/**
	 * get id
	 * @returns required id
	 * @type String
	 */
	getId : function() {
		return this.id;
	},
	/**
	 * set idname
	 * @param {String} name     name
	 */
	setName : function(name) {
		this.name = name;
	},
	/**
	 * get name
	 * @returns required name
	 * @type String
	 */
	getName : function() {
		return this.name;
	},
	/**
	 * set className
	 * @param {String} className     className
	 */
	setClassName : function(className) {
		this.className = className;
	},
	/**
	 * get className
	 * @returns className
	 * @type String
	 */
	getClassName : function() {
		return this.className;
	},
	/**
	 * set width
	 * @param {String} width     width
	 */
	setWidth : function(width) {
		this.width = width;
	},
	/**
	 * get width
	 * @returns width
	 * @type String
	 */
	getWidth : function() {
		return this.width.toString();
	},
	/**
	 * set height
	 * @param {String} height     height
	 */
	setHeight : function(height) {
		this.height = height;
	},
	/**
	 * get height
	 * @returns height
	 * @type String
	 */
	getHeight : function() {
		return this.height.toString();
	},
	/**
	 * set classid
	 * @param {String} classid     classid
	 */
	setClassid : function(classid) {
		this.classid = classid;
	},
	/**
	 * get classid
	 * @returns classid
	 * @type String
	 */
	getClassid : function() {
		return this.classid;
	},
	/**
	 * set codebase
	 * @param {String} codebase     codebase
	 */
	setCodebase : function(codebase) {
		this.codebase = codebase;
	},
	/**
	 * get codebase
	 * @returns codebase
	 * @type String
	 */
	getCodebase : function() {
		return this.codebase;
	},
	/**
	 * set type
	 * @param {String} type     type
	 */
	setType : function(type) {
		this.type = type;
	},
	/**
	 * get type
	 * @returns type
	 * @type String
	 */
	getType : function() {
		return this.type;
	},
	/**
	 * set param element setting
	 * @param {String} name     name attribute
	 * @param {String} value    value attribute
	 */
	setParam : function(name, value) {
		this.params[name] = value;
	},
	/**
	 * get param element value
	 * @param {String} name     name attribute
	 * @returns value
	 * @type String
	 */
	getParam : function(name) {
		return this.params[name] || "";
	},
	/**
	 * detect flash enabled or disabled
	 * @returns enabled(true) / disabled(false)
	 * @type Boolean
	 */
	isEnabled : function() {
		var required = (this.getRequired()).split(".");
		var pluginVersion = (this.getVersion()).split(".");
		for (var i = 0, n = required.length; i < n; i++) {
			if (!required[i])      required[i] = 0;
			if (!pluginVersion[i]) pluginVersion[i] = 0;
			if (parseInt(pluginVersion[i]) > parseInt(required[i])) {
				return true;
			} else if (parseInt(pluginVersion[i]) < parseInt(required[i])) {
				return false;
			}
		}
		return true;
	},
	/**
	 * create object element
	 * @returns object element
	 * @type Object
	 */
	createElement : function() {
		if (!this.isEnabled()) {
			return null;
		}

		var _this = this;
		function _createElement(name) {
			return (document.createElementBA) ? document.createElementBA(name) : document.createElement(name);
		}
		function _createParam(name) {
			if (!name || _this.getParam(name) == "") return null;
			var param = _createElement("param");
			param.setAttribute("name",  name);
			param.setAttribute("value", _this.getParam(name));
			return param;
		}

		var element = _createElement("object");

		var paramWithAttribute = (BA.ua.isMacIE || (BA.ua.isGecko && BA.ua.revision <= 0.9));
		if (!paramWithAttribute) {
			for (var i in this.params) {
				var param = _createParam(i);
				if (param) {
					element.appendChild(param);
				}
			}
		}

		if (this.getSrc()) {
			if (!BA.ua.isWinIE || this.getType() != "application/x-shockwave-flash") {
				element.setAttribute("data", this.getSrc());
			} else {
				var param = _createElement("param");
				param.setAttribute("name",  "movie");
				param.setAttribute("value", this.getSrc());
				element.appendChild(param);
			}
		}

		if (this.getClassName()) {
			var attr = (BA.ua.isIE) ? "className" : "class";
			element.setAttribute(attr,  this.getClassName());
		}
		if (this.getId())     element.setAttribute("id",     this.getId());
		if (this.getName())   element.setAttribute("name",   this.getName());
		if (this.getWidth())  element.setAttribute("width",  this.getWidth());
		if (this.getHeight()) element.setAttribute("height", this.getHeight());
		if (!BA.ua.isWinIE && this.getType()) element.setAttribute("type", this.getType());

		if (paramWithAttribute) {
			for (var i in this.params) {
				var value = this.getParam(i);
				if (value != "") {
					element.setAttribute(i, this.getParam(i));
				}
			}
		}

		return this.ongenerate(element);
	},
	/**
	 * create object element tag
	 * @returns tag string
	 * @type String
	 */
	toString : function() {
		if (!this.isEnabled()) {
			return "";
		}

		var element = "<object";
		if (this.getId())        element += " id=\""     + this.getId()        + "\"";
		if (this.getName())      element += " name=\""   + this.getName()      + "\"";
		if (this.getClassName()) element += " class=\""  + this.getClassName() + "\"";
		if (this.getWidth())     element += " width=\""  + this.getWidth()     + "\"";
		if (this.getHeight())    element += " height=\"" + this.getHeight()    + "\"";
		if (this.getType())      element += " type=\""   + this.getType()      + "\"";
		if (this.getSrc())       element += " data=\""   + this.getSrc()       + "\"";

		var paramWithAttribute = (BA.ua.isMacIE || (BA.ua.isGecko && BA.ua.revision <= 0.9));
		if (paramWithAttribute) {
			for (var i in this.params) {
				var value = this.getParam(i);
				if (value != "") {
					element += " " + i + "=\"" + value + "\"";
				}
			}
		}

		if (BA.ua.isWinIE) {
			if (this.getClassid())  element += " classid=\""  + this.getClassid()  + "\"";
			if (this.getCodebase()) element += " codebase=\"" + this.getCodebase() + "\"";
		}
		element += ">";

		if (!paramWithAttribute) {
			var _this = this;
			function _createParam(name) {
				if (!name || _this.getParam(name) == "") return "";
				return "<param name=\"" + name + "\" value=\"" + _this.getParam(name) + "\"></param>";
			}

			for (var i in this.params) {
				element += _createParam(i);
			}
		}

		element += "</object>";

		return this.ongenerate(element);
	},
	/**
	 * objectElement append to target Node
	 */
	appendTo : function(node, config) {
		if (!this.isEnabled()) {
			return;
		}

		if (typeof(config) == "object") {
			this.setConfig(config);
		}

		this.node = this.createElement();
		node.appendChild(this.node);
		if (BA.ua.isWinIE) {
			if (this.getType())     this.node.setAttribute("type",     this.getType());
			if (this.getClassid())  this.node.setAttribute("classid",  this.getClassid());
			if (this.getCodebase()) this.node.setAttribute("codebase", this.getCodebase());
			if (this.node && (typeof(this.node.setActive) == "object" || typeof(this.node.setActive) == "function")) {
				this.node.setActive();
			}
		}
		this.onappend();
	},
	/**
	 * write tag string
	 */
	write : function(config) {
		if (!this.isEnabled()) {
			return;
		}

		if (typeof(config) == "object") {
			this.setConfig(config);
		}

		document.write(this.toString());
		if (this.getId()) {
			this.node = document.getElementById(this.getId());
		} else {
			var objects = document.getElementsByTagName("object");
			this.node = objects[objects.length - 1];
		}
		if (BA.ua.isWinIE) {
			if (this.node && (typeof(this.node.setActive) == "object" || typeof(this.node.setActive) == "function")) {
				this.node.setActive();
			}
		}

		this.onwrite();
	},
	/**
	 * call after toString() / createElement()
	 */
	ongenerate : function(element) {
		return element;
	},
	/**
	 * call after appendTo()
	 */
	onappnd : function() {
	},
	/**
	 * call after write()
	 */
	onwrite : function() {
	}
}



/* -------------------- Constructor : flashGenerator -------------------- */
/**
 * construct flashGenerator object.
 * @class flashGenerator
 * @param {Object} config
 * @constructor
 */
function flashGenerator(config) {
	/** node
	    @type Node */
	this.node       = null;
	/** required plugin version
	    @type String */
	this.required   = "0";
	/** url of movie file
	    @type String */
	this.src        = "";
	/** id attribute
	    @type String */
	this.id         = "flash";
	/** name attribute
	    @type String */
	this.name       = "flash";
	/** class attribute
	    @type String */
	this.className  = "flash";
	/** class attribute width alternate content
	    @type String */
	this.alternate  = "flash-alternate";
	/** width
	    @type String */
	this.width      = "100%";
	/** height
	    @type String */
	this.height     = "100%";
	/** width
	    @type String */
	this.minWidth   = "";
	/** height
	    @type String */
	this.minHeight  = "";
	/** full-screen mode flag
	    @type Boolean */
	this.fullScreen = false;
	/** param elements settings
	    @type Object */
	this.params     = {};

	if (typeof(config) == "object") {
		this.setConfig(config);
	}
}
flashGenerator.prototype = new objectGenerator;
/** mime type
    @type String @const @private */
flashGenerator.prototype.type = "application/x-shockwave-flash";
/** installed plugin version
    @type String @const @private */
flashGenerator.prototype.version = (function(){
	var _version = "0";
	var _plugin  = null;
	var _type    = flashGenerator.prototype.getType();
	if (navigator.mimeTypes && navigator.mimeTypes[_type]) {
		_plugin = navigator.mimeTypes[_type].enabledPlugin;
		if (_plugin) {
			var _versionStrings = _plugin.description.match(/(\d+(\.\d+)*) +r(\d+)/);
			if (_versionStrings) {
				_version = _versionStrings[1] + "." + ((_versionStrings.length >= 4) ? _versionStrings[3] : 0);
			}
		}
	} else if (typeof(ActiveXObject) == "object" || typeof(ActiveXObject) == "function") {
		try {
			var _flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			if (_flash) {
				var _versionStrings = _flash.GetVariable("$version").match(/(\d+(\,\d+)+)/);
				if (_versionStrings) {
					_version = _versionStrings[1].replace(/,/g, ".");
				}
			}
		} catch(e) {}
	}
	return _version;
}());
/** initialize
 *  @param {Object} config
 *  @type Object
 */
flashGenerator.prototype.setConfig = function(config){
	for (var i in config) {
		var value = config[i];
		switch (i) {
			case "required" :
				this.setRequired(value);
				break;
			case "src" :
				this.setSrc(value);
				break;
			case "id" :
				this.setId(value);
				break;
			case "name" :
				this.setName(value);
				break;
			case "className" :
				this.setClassName(value);
				break;
			case "alternate" :
				this.setAlternate(value);
				break;
			case "width" :
				this.setWidth(value);
				break;
			case "height" :
				this.setHeight(value);
				break;
			case "minWidth" :
				this.setMinWidth(value);
				break;
			case "minHeight" :
				this.setMinHeight(value);
				break;
			case "fullScreen" :
				this.setFullScreen(value);
				break;
			case "type" :
				this.setType(value);
				break;
			case "classid" :
				this.setClassid(value);
				break;
			case "codebase" :
				this.setCodebase(value);
				break;
			default :
				this.setParam(i, value);
				break;
		}
	}
}
/**
 * set minimum width
 * @param {String} minWidth     minWidth
 */
flashGenerator.prototype.setMinWidth = function(minWidth) {
	this.minWidth = new String(minWidth);
}
/**
 * get minimum width
 * @returns minWidth
 * @type String
 */
flashGenerator.prototype.getMinWidth = function() {
	return this.minWidth;
}
/**
 * set minimum height
 * @param {String} minHeight     minHeight
 */
flashGenerator.prototype.setMinHeight = function(minHeight) {
	this.minHeight = new String(minHeight);
}
/**
 * get minimum height
 * @returns minHeight
 * @type String
 */
flashGenerator.prototype.getMinHeight = function() {
	return this.minHeight;
}
/**
 * set className of alternate content
 * @param {String} alternate     className of alternate content
 */
flashGenerator.prototype.setAlternate = function(alternate) {
	this.alternate = alternate;
}
/**
 * get className of alternate content
 * @returns alternate className of alternate content
 * @type String
 */
flashGenerator.prototype.getAlternate = function() {
	return this.alternate;
}
/**
 * set fullScreen mode flag
 * @param {String} fullScreen     fullScreen mode flag
 */
flashGenerator.prototype.setFullScreen = function(fullScreen) {
	if (typeof(fullScreen) == "boolean") {
		this.fullScreen = fullScreen;
	} else if (typeof(fullScreen) == "string") {
		this.fullScreen = (fullScreen == "true");
	} else {
		this.fullScreen = (!!fullScreen);
	}
}
/**
 * get fullScreen mode flag
 * @returns fullScreen mode flag
 * @type Boolean
 */
flashGenerator.prototype.getFullScreen = function() {
	return this.fullScreen;
}
/**
 * call after toString() / createElement()
 */
flashGenerator.prototype.ongenerate = function(element) {
	var _this = this;
	function _createElement(name) {
		return (document.createElementBA) ? document.createElementBA(name) : document.createElement(name);
	}
	function _createParamTag(name, value) {
		if (!name || value == "") return "";
		return "<param name=\"" + name + "\" value=\"" + value + "\"></param>";
	}
	function _createParamElement(name, value) {
		if (!name || value == "") return null;
		var param = _createElement("param");
		param.setAttribute("name",  name);
		param.setAttribute("value", value);
		return param;
	}

	var reviseFlag = false;
	if (BA.ua.isGecko) {
		var ua     = navigator.userAgent;
		var key    = 'rv:';
		var sRv    = ua.substr(ua.indexOf(key) + key.length, 4);
		var fRv    = BA.ua.revision;
		reviseFlag = (fRv > 1.4 && (fRv < 1.7 || sRv == "1.7a"));
	}
	var paramWithAttribute = (BA.ua.isMacIE || (BA.ua.isGecko && BA.ua.revision <= 0.9));

	if (typeof(element) == "string") {
		if (BA.ua.isWinIE && this.getSrc()) {
			element = element.replace(/ data="[^\"]+"/, "");
			element = element.replace("</object>", _createParamTag("movie", this.getSrc()) + "</object>");
		}
		if (BA.ua.isGecko) {
			if (!paramWithAttribute) {
				var align = element.match(/<param name="align" value="[^\"]+"><\/param>/);
				var scale = element.match(/<param name="scale" value="[^\"]+"><\/param>/);
				if (align && scale) {
					element = element.replace(/<param name="(align|scale)" value="[^\"]+"><\/param>/g, "");
					if (reviseFlag) {
						element = element.replace("</object>", align + scale + "</object>");
					} else {
						element = element.replace("</object>", scale + align + "</object>");
					}
				}
			} else {
				var align = element.match(/ align="[^\"]+"/);
				var scale = element.match(/ scale="[^\"]+"/);
				if (align && scale) {
					element = element.replace(/ (align|scale)="[^\"]+"/g, "");
					if (reviseFlag) {
						element = element.replace("<object", "<object" + align + scale);
					} else {
						element = element.replace("<object", "<object" + scale + align);
					}
				}
			}
		}
	} else {
		if (BA.ua.isGecko) {
			if (!paramWithAttribute) {
				var params = element.getElementsByTagName("param");
				var align = null;
				var scale = null;
				for (var i = 0, n = params.length; i < n; i++) {
					if (params[i].getAttribute("name") == "align") {
						align = params[i];
					} else if (params[i].getAttribute("name") == "scale") {
						scale = params[i];
					}
					if (align && scale) {
						break;
					}
				}
				if (align && scale) {
					element.removeChild(align);
					element.removeChild(scale);
					if (reviseFlag) {
						element.appendChild(align);
						element.appendChild(scale);
					} else {
						element.appendChild(scale);
						element.appendChild(align);
					}
				}
			} else {
				var align = element.getAttribute("align");
				var scale = element.getAttribute("scale");
				if (align && scale) {
					element.removeAttribute("align");
					element.removeAttribute("scale");
					if (reviseFlag) {
						element.setAttribute("align", align);
						element.setAttribute("scale", scale);
					} else {
						element.setAttribute("scale", scale);
						element.setAttribute("align", align);
					}
				}
			}
		}
	}
	return element;
}
/**
 * resize content to window size;
 */
flashGenerator.prototype.setMinSize = function() {
	if (this.getFullScreen()) {
		function _initWindowHeight(){
			if (typeof(document.readyState) == "string" && document.readyState != "complete") {
				return;
			} else {
				document.documentElement.style.height = "100%";
				if (document.body) {
					document.body.style.height = "100%";
				}
			}
		}
		if (!document.readyState || (typeof(document.readyState) == "string" && document.readyState == "complete")) {
			_initWindowHeight();
		} else {
			_addEventListener(document, "readystatechange", _initWindowHeight);
		}
	}

	var minWidth = this.getMinWidth();
	if (minWidth) {
		if (minWidth.indexOf("%") == -1) minWidth  = minWidth  + "px";
		this.node.style.minWidth = minWidth;
	}

	var minHeight = this.getMinHeight();
	if (minHeight) {
		if (minHeight.indexOf("%") == -1) minHeight = minHeight + "px";
		this.node.style.minHeight = minHeight;
	}

	function _setMinSize(){
		if (this.node) {
			try {
				var b = document.getElementsByTagName('body')[0];
				var isMacIE = BA.ua.isMacIE;
				var geom = {
					windowW : window.innerWidth  || (isMacIE ? b.scrollWidth  : document.documentElement.offsetWidth ),
					windowH : window.innerHeight || (isMacIE ? b.scrollHeight : document.documentElement.offsetHeight)
				}
			} catch (e) {
				return;
			}
			if (!geom.windowW) return;

			var width = "";
			var minWidth = this.getMinWidth();
			if (minWidth) {
				var currentWidth = this.getWidth();
				if (currentWidth.indexOf("%") != -1) {
					currentWidth = parseInt(geom.windowW * (parseInt(currentWidth.replace("%", "")) / 100));
					if (currentWidth < 1) {
						currentWidth = 1;
					}
				}
				if (minWidth && currentWidth <= minWidth) {
					width = minWidth;
				} else {
					width = this.getWidth();
				}
				if (width.indexOf("%") == -1) {
					width = width + "px";
				}
				this.node.style.width = width;
			}

			var height = "";
			var minHeight = this.getMinHeight();
			if (minHeight) {
				var currentHeight = this.getHeight();
				if (currentHeight.indexOf("%") != -1) {
					currentHeight = parseInt(geom.windowH * (parseInt(currentHeight.replace("%", "")) / 100));
					if (currentHeight < 1) {
						currentHeight = 1;
					}
				}
				if (minHeight && currentHeight <= minHeight) {
					height = minHeight;
				} else {
					height = (BA.ua.isGecko && BA.ua.revision <= 0.9) ? currentHeight : this.getHeight();
				}
				if (height.indexOf("%") == -1) {
					height = height + "px";
				}
				this.node.style.height = height;
			}
		}
	}

	if (!BA.ua.isGecko || (BA.ua.isGecko && BA.ua.revision <= 0.9)) {
		_setMinSize.apply(this);
		var target    = (BA.ua.isGecko || BA.ua.isOpera) ? document : window;
		var loadEvent = (BA.ua.isGecko) ? "DOMContentLoaded" : "load";
		_addEventListener(target, "resize",    _setMinSize, this);
		_addEventListener(target, "loadEvent", _setMinSize, this);
	}
}
/**
 * call after appendTo()
 */
flashGenerator.prototype.onappend = function() {
	if ((this.getMinWidth() || this.getMinHeight()) && this.node) {
		this.setMinSize();
	}
}
/**
 * call after write()
 */
flashGenerator.prototype.onwrite = function() {
	if ((this.getMinWidth() || this.getMinHeight()) && this.node) {
		this.setMinSize();
	}
}
/**
 * hide alternate content
 */
flashGenerator.prototype.hideAlternate = function() {
	if (this.isEnabled() && this.getAlternate()) {
		if (BA.ua.isGecko) {
			document.write('<style type="text/css" media="screen">.' + this.getAlternate() + ' { display: none  !important }</style>');
			document.write('<style type="text/css" media="screen">.' + this.getClassName() + ' { display: block !important }</style>');
			document.write('<style type="text/css" media="print">.'  + this.getClassName() + ' { display: none  !important }</style>');
		} else {
			document.write('<style type="text/css" media="all">.'    + this.getAlternate() + ' { display: none  !important }</style>');
			document.write('<style type="text/css" media="all">.'    + this.getClassName() + ' { display: block !important }</style>');
		}
	}
}


