function writeFlash(file, width, height, extras, idname) {
    if (flashinstalled == 2) {
        
        //determine if it uses transparency
        var trans1 = "";
        var trans2 = "";
        if (extras.indexOf("trans") > -1) {
            trans1 = "<param name='wmode' value='transparent' />\n";
            trans2 = "wmode='transparent'";
        }

        if (extras.indexOf("opaque") > -1) {
            trans1 = "<param name='wmode' value='opaque' />\n";
            trans2 = "wmode='opaque'";
        }

        //determine if Scripting Access is needed
		var allowscript1 = ""
		var allowscript2 = ""
        if (extras.indexOf("allowscriptaccess") > -1) {
            allowscript1 = "<param name='allowScriptAccess' value='sameDomain' />\n";
            allowscript2 = "allowscriptaccess='sameDomain'";
        }

        // determine if background color needs to be set
        var bgcolor1 = "";
        var bgcolor2 = "";
        var hexvalue = "";
        if (extras.indexOf("bgcolor:") > -1) {
            hexvalue = extras.substring(extras.indexOf("bgcolor:") + 8, extras.indexOf("bgcolor:") + 14);
            bgcolor1 = "<param name='bgcolor' value='" + hexvalue + "' />\n";
            bgcolor2 = " bgcolor='" + hexvalue + "'";
        }

        // determine if looping needs to be set
        var loop1 = "";
        var loop2 = "";
        var loopvalue = "";
        if (extras.indexOf("loop:") > -1) {
            loopvalue = extras.substring(extras.indexOf("loop:") + 5, extras.indexOf("loop:") + 6);
            if (loopvalue == "t") {
                loopvalue = "true";
            }
            if (loopvalue == "f") {
                loopvalue = "false";
            }

            loop1 = "<param name='loop' value=" + loopvalue + " />\n";
            loop2 = " loop='" + loopvalue + "'";
        }
		
		//determine if the object tag gets an id and the embed tag gets a name
        var idname1 = "";
        var idname2 = "";
		if (idname != "" && idname != null && idname != undefined){
		    idname1 = " id='" + idname + "' ";
		    idname2 = " name='" + idname + "' ";
		}
		
		
        document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0'" + idname1 + "width='" + width + "' height='" + height + "' />\n");
        document.write(allowscript1);
        document.write("<param name='movie' value='" + file + "' /><param name='scale' value='noscale' /><param name='salign' value='t' />\n");
        document.write(trans1);
        document.write(bgcolor1);
        document.write(loop1);
        document.write("<embed src='" + file + "' " + idname2 + " quality='high' scale='noscale' salign='t' " + allowscript2 + trans2 + bgcolor2 + loop2 + " width='" + width + "' height='" + height + "' align='top' play='true' loop='false' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'>\n");
        document.write("</embed>\n</object>");

    }
}

// detect if Flash is installed
/*
2: Flash installed 
1: Flash not installed 
0: Unknown if Flash is installed 
*/

var flashinstalled = 0;
var flashversion = 0;
MSDetect = "false";
if (navigator.plugins && navigator.plugins.length) {
    x = navigator.plugins["Shockwave Flash"];
    if (x) {
        flashinstalled = 2;
        if (x.description) {
            y = x.description;
            flashversion = y.substring(y.indexOf("Shockwave Flash") + 16, y.indexOf("."))
            flashversion = parseInt(flashversion)
        }
    }
    else
        flashinstalled = 1;
    if (navigator.plugins["Shockwave Flash 2.0"]) {
        flashinstalled = 2;
        flashversion = 2;
    }
}
else if (navigator.mimeTypes && navigator.mimeTypes.length) {
    x = navigator.mimeTypes['application/x-shockwave-flash'];
    if (x && x.enabledPlugin)
        flashinstalled = 2;
    else
        flashinstalled = 1;

}
else
    MSDetect = "true";

// write vb script for IE detection
document.writeln('<script type="text/vbscript">\n');
document.writeln('on error resume next\n');
document.writeln('dim i\n');
document.writeln('If MSDetect = "true" Then\n');
document.writeln('	For i = 2 to 12\n');
document.writeln('		If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then\n');
document.writeln('\n');
document.writeln('		Else\n');
document.writeln('			flashinstalled = 2\n');
document.writeln('			flashversion = i\n');
document.writeln('		End If\n');
document.writeln('	Next\n');
document.writeln('End If\n');
document.writeln('If flashinstalled = 0 Then\n');
document.writeln('	flashinstalled = 1\n');
document.writeln('End If\n');
document.writeln('</script>\n');

