/*------------------------------------------------------------------
FlashObject

Author: Eric Ingram

Description: Creates a Flash ActiveX object within the current
	document so that IE does not disable the Flash on load. Example:

	<script language="JavaScript">
	// Create a FlashObject.
	var flash_ex = new FlashObject();

	// Set the flash arguments for this object.
	flash_ex.movie = "my_movie.swf";
	flash_ex.src = "my_movie.swf?some_arguments=here";
	flash_ex.width = 600;
	flash_ex.height = 400;
	flash_ex.id = "my_movie_id";
	flash_ex.quality = "high";
	flash_ex.bgcolor = "#CCCCCC";
	flash_ex.align = "middle";
	...
	// Add any valid object tags like this...
	flash_ex.other_valid_tagname = "valid value";
	...

	// Write the flash object to the page.
	flash_ex.load();
	</script>
	<noscript>
	...Place original flash object tags here incase JS is disabled...
	</noscript>
------------------------------------------------------------------*/

function FlashObject () {

    // Initialize flash object properties: false = required, null = no default.
    this.movie = false;
    this.src = false;
    this.classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
    this.codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0";
    this.pluginspage = "http://www.macromedia.com/go/getflashplayer";
    this.type = "application/x-shockwave-flash";
    this.id = null;
    this.width = false;
    this.height = false;
    this.align = null;
    this.quality = "high";
    this.bgcolor = "#FFFFFF";
    this.allowScriptAccess = null;

	// Function to load and write flash object to the page.
    this.load = function () {

		var flash = "";

		var object_tag = "";
		var param_tag = "";
		var embed_tag = "";

        for (key in this) {

			// Check optional values.
			if (this[key] === null) {
				continue;
			}
			// Check required values.
			if (this[key] === false) {
				alert("Missing requiired Flash parameter: "+key);
			}

			// Switch over valid Object tags.
            switch (key) {
                case "classid":
                case "codebase":
                case "id":
                case "width":
                case "height":
                case "align":
				case "onafterupdate":
				case "onbeforeupdate":
				case "onblur":
				case "oncellchange":
				case "onclick":
				case "ondblClick":
				case "ondrag":
				case "ondragend":
				case "ondragenter":
				case "ondragleave":
				case "ondragover":
				case "ondrop":
				case "onfinish":
				case "onfocus":
				case "onhelp":
				case "onmousedown":
				case "onmouseup":
				case "onmouseover":
				case "onmousemove":
				case "onmouseout":
				case "onkeypress":
				case "onkeydown":
				case "onkeyup":
				case "onload":
				case "onlosecapture":
				case "onpropertychange":
				case "onreadystatechange":
				case "onrowsdelete":
				case "onrowenter":
				case "onrowexit":
				case "onrowsinserted":
				case "onstart":
				case "onscroll":
				case "onbeforeeditfocus":
				case "onactivate":
				case "onbeforedeactivate":
				case "ondeactivate":
                    object_tag += key+"='"+this[key]+"' ";
                    break;
            }

			// Switch over valid Param tags.
            switch (key) {
                case "movie":
				case "quality":
				case "bgcolor":
                case "allowScriptAccess":
				case "wmode":
                    param_tag += "<param name='"+key+"' value='"+this[key]+"' />\n";
                    break;
            }

			// Switch over valid Embed tags.
            switch (key) {
                case "src":
                case "pluginspage":
                case "type":
                case "width":
                case "height":
                case "align":
				case "quality":
				case "bgcolor":
				case "class":
				case "title":
				case "name":
				case "id":
				case "tabindex":
                case "allowScriptAccess":
				case "wmode":
                    embed_tag += key+"='"+this[key]+"' ";
                    break;
            }
        }

		// Create a string of the final flash object.
        flash += "<object "+object_tag+">\n";
        flash += param_tag;
        flash += "<embed "+embed_tag+"/>\n";
        flash += "</object>";

		// Write the flash object to the document.
        document.write(flash);
        return true;
    }
}