﻿/*********************************************************
** embedFlash() Function                                **
** By: Hans J.J. Prins                                  **
** Description: Function used for rendering flash to    **
** the browser via javascript.                          **
** Additional info: You may use, modify, distribute,    **
** sell and dislike this code without any limitations.  **
** You do not have to keep this message if you decide   **
** to use this function. If you have any remarks or     **
** found any bugs, please mail me at:                   **
** public@telamedia.com                                 **
*********************************************************/

function embedFlash(source, width, height, flashVersion, protocol, movieID, play, loop, menu, quality, scale, align, wmode, bgColor, base, flashVars, swLiveConnect, extraObjectParams, extraEmbedParams) {
    if (source == "" || width == "" || height == "" || flashVersion == "") {
        document.writeln('You need to atleast specify the source, width, height and flashVersion');
    } else {
        if (protocol == "") { protocol = "http"; }
        if (play == "") { play = "true"; }
        if (loop == "") { loop = "true"; }
        if (menu == "") { menu = "true"; }
        if (quality == "") { quality = "high"; }
        if (scale == "") { scale = "showall"; }
        if (wmode == "") { wmode = "window"; }
        if (swLiveConnect == "") { swLiveConnect = "false"; }
        document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="' + protocol + '://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + flashVersion + '" width="' + width + '" height="' + height + '" align="' + align + '" id="' + movieID + '" ' + extraObjectParams + '>');
        document.writeln('<param name="movie" VALUE="' + source + '">');
        document.writeln('<param name="play" VALUE="' + play + '">');
        document.writeln('<param name="loop" VALUE="' + loop + '">');
        document.writeln('<param name="menu" VALUE="' + menu + '">');
        document.writeln('<param name="quality" VALUE="' + quality + '">');
        document.writeln('<param name="scale" VALUE="' + scale + '">');
        document.writeln('<param name="wmode" VALUE="' + wmode + '">');
        document.writeln('<param name="bgColor" VALUE="' + bgColor + '">');
        document.writeln('<param name="base" VALUE="' + base + '">');
        document.writeln('<param name="flashVars" VALUE="' + flashVars + '">');
        document.writeln('<embed src="' + source + '" play="' + play + '" loop="' + loop + '" menu="' + menu + '" quality="' + quality + '" scale="' + scale + '" align="' + align + '" wmode="' + wmode + '" bgColor="' + bgColor + '" base="' + base + '" flashVars="' + flashVars + '" width="' + width + '" height="' + height + '" name="' + movieID + '" swLiveConnect="' + swLiveConnect + '" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer" ' + extraEmbedParams + '></embed>');
        document.writeln('</object>');
    }
}