// EmbedFlashActiveXObject.js
function FlashDetectActiveXObject(uniqueID, movieURL, salign, quality, bgcolor, allowscriptaccess, 
                                  width, height, align, classID, codeBase, swliveconnect,
                                  mediaType, pluginsPage, flashVars, autoPlay, autoLoop,
                                  showMenu, movieScale, windowMode, useDeviceFonts, movieBaseURL){
    this.uniqueID = uniqueID;
    
    this.movieURL = movieURL;
    this.salign = salign;
    this.quality = quality;
    this.bgcolor = bgcolor;
    this.allowscriptaccess = allowscriptaccess;
    this.width = width;
    this.height = height;
    this.align = align;
    this.classID = classID;
    this.codeBase = codeBase;
    this.swliveconnect = swliveconnect;
    this.mediaType = mediaType;
    this.pluginsPage = pluginsPage;    
    
    //Optional params
    this.flashVars = flashVars;
    this.autoPlay = autoPlay;
    this.autoLoop = autoLoop;
    this.showMenu = showMenu;
    this.movieScale = movieScale;
    this.windowMode = windowMode;
    this.useDeviceFonts = useDeviceFonts; 
    this.movieBaseURL = movieBaseURL;
}

function RenderFlashObject(){    
    var flashVarsString = "";    
    var flashVarsStringFinal = "";
    if(this.flashVars.length > 0){
        for(var i = 0; i < flashVars.length; i++){
            flashVarsString = flashVarsString + (flashVars[i].variableName + "=" + flashVars[i].variableValue + "&");
        }
        flashVarsStringFinal= flashVarsString.substring(0,flashVarsString.length-1);
    } 
    
    with (this){
        document.write('<object classid="' + classID + '"');
        document.write(' codebase="' + codeBase + '"');
        document.write(' id="' + uniqueID + '"width="' + width + '" height="' + height + '" align="' + align + '">');
        document.write('<param name="movie" value="' + movieURL + '" /> ');
        if(flashVars.length > 0){            
            document.write('<param name="FlashVars" value="' + flashVarsStringFinal + '" />');
        }
        document.write('<param name="play" value="' + autoPlay + '" /> ');
        document.write('<param name="loop" value="' + autoLoop + '" /> ');
        document.write('<param name="menu" value="' + showMenu + '" /> ');
        document.write('<param name="scale" value="' + movieScale + '" /> ');
        document.write('<param name="wmode" value="' + windowMode + '" /> ');
        document.write('<param name="devicefont" value="' + useDeviceFonts + '"/> ');
        document.write('<param name="base" value="' + movieBaseURL + '" /> ');        
        
        document.write('<param name="salign" value="' + salign + '" /> ');
        document.write('<param name="quality" value="' + quality + '" /> ');
        document.write('<param name="bgcolor" value="' + bgcolor + '" /> ');
        document.write('<param name="allowscriptaccess" value="' + allowscriptaccess + '" /> ');
        document.write(' <embed src="' + movieURL + '" ');
        if(flashVars.length > 0){            
            document.write(' FlashVars="' + flashVarsStringFinal + '" ');
        }
        document.write(' name="' + uniqueID + '" ');
        document.write(' play="' + autoPlay + '" ');
        document.write(' loop="' + autoLoop + '" ');
        document.write(' menu="' + showMenu + '" ');
        document.write(' scale="' + movieScale + '" ');
        document.write(' wmode="' + windowMode + '" ');
        document.write(' devicefont="' + useDeviceFonts + '" ');
        document.write(' base="' + movieBaseURL + '" ');
        
        document.write(' salign="' + salign + '" ');
        document.write(' quality="' + quality + '" ');
        document.write(' bgcolor="' + bgcolor + '" ');
        document.write(' allowScriptAccess="' + allowscriptaccess + '" ');
        document.write(' swliveconnect="' + swliveconnect + '" width="'+width+'" height="'+height+'" name="'+uniqueID+'" align="'+align+'" ');
        document.write(' type="'+mediaType+'" pluginspage="'+pluginsPage+'">');
        document.write(' </embed>');
        document.write(' </object>');        
    }
}

FlashDetectActiveXObject.prototype.RenderFlashObject=RenderFlashObject;

function FlashMovieVariable(variableName, variableValue){
    this.variableName = variableName;
    this.variableValue = variableValue;
}