﻿var nr = 0;

function createFlash(file, wdth, hght, bgnd, wmode, qlty, idName, target, fVars, altImg) {
    if (obj_setFlash = document.getElementById(target)) {
        fVars = fVars.replace(/amp;/, '');
        idName = idName ? idName : target + "_flash" + (nr++);
        objTag = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='" + wdth + "' height='" + hght + "' id='" + idName + "'>";
        objTag2 = "<object data='" + file + "' type='application/x-shockwave-flash' width='" + wdth + "' height='" + hght + "' id='" + idName + "'>";

        paramTag = "<param name='movie' value='" + file + "'>"
		+ "<param name='bgcolor' value='" + (bgnd ? bgnd : "#000000") + "'>"
		+ "<param name='wmode' value='" + (wmode ? wmode : "window") + "'>"
		+ "<param name='quality' value='" + (qlty ? qlty : "high") + "'>"
		+ "<param name='scale' value='noscale'>"
		+ "<param name='menu' value='false'>"
		+ "<param name='allowScriptAccess' value='always'>"
		+ "<param name='swliveconnect' value='true'>"
		+ (fVars ? "<param name='FlashVars' value='" + fVars + (altImg ? "&altImg=" + altImg : "") + "'>" : "")
		+ (altImg ? "<img src='" + altImg + "' alt='" + idName + "' title=''>" : idName)
		+ "</object>";

        if (typeof HTMLElement != "undefined") {
            if (topImage = document.getElementById('signImage')) obj_setFlash.removeChild(topImage);
            obj = document.createElement("object");
            obj.setAttribute("data", file);
            obj.setAttribute("type", "application/x-shockwave-flash");
            obj.setAttribute("width", wdth);
            obj.setAttribute("height", hght);
            obj.setAttribute("id", idName);
            par = document.createElement("param");
            par.setAttribute("name", "bgcolor");
            par.setAttribute("value", bgnd ? bgnd : "#000000");
            obj.appendChild(par);
            par = document.createElement("param");
            par.setAttribute("name", "wmode");
            par.setAttribute("value", wmode ? wmode : "window");
            obj.appendChild(par);
            par = document.createElement("param");
            par.setAttribute("name", "quality");
            par.setAttribute("value", qlty ? qlty : "high");
            obj.appendChild(par);
            par = document.createElement("param");
            par.setAttribute("name", "scale");
            par.setAttribute("value", "noscale");
            obj.appendChild(par);
            par = document.createElement("param");
            par.setAttribute("name", "menu");
            par.setAttribute("value", "false");
            obj.appendChild(par);
            par = document.createElement("param");
            par.setAttribute("name", "allowScriptAccess");
            par.setAttribute("value", "always");
            obj.appendChild(par);
            par = document.createElement("param");
            par.setAttribute("name", "swliveconnect");
            par.setAttribute("value", "true");
            obj.appendChild(par);
            if (fVars) {
                par = document.createElement("param");
                par.setAttribute("name", "FlashVars");
                par.setAttribute("value", fVars + (altImg ? "&altImg=" + altImg : ""));
                obj.appendChild(par);
            }
            if (altImg) {
                par = document.createElement("img");
                par.setAttribute("src", altImg);
                par.setAttribute("alt", idName);
                par.setAttribute("title", "");
                obj.appendChild(par);
            }
            else {
                par = document.createTextNode(idName);
                obj.appendChild(par);
            }
            return obj_setFlash.appendChild(obj);
        }
        else if (document.all && !window.opera) {
            obj_setFlash.insertAdjacentHTML('beforeEnd', objTag + paramTag);
        }
        else {
            obj_setFlash.write(objTag + paramTag2);
        }
    }
}

