﻿

function getFlashMovieObject(movieName) {
    if (window.document[movieName]) {
        return window.document[movieName];
    }
    if (navigator.appName.indexOf("Microsoft Internet") == -1) {
        if (document.embeds && document.embeds[movieName])
            return document.embeds[movieName];
    }
    else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
    {
        return document.getElementById(movieName);
    }
}

function StopFlashMovie(mname) {
    var flashMovie = getFlashMovieObject(mname);
    flashMovie.StopPlay();
}

function PlayFlashMovie(mname) {
    var flashMovie = getFlashMovieObject(mname);
    flashMovie.Play();
    //embed.nativeProperty.anotherNativeMethod();
}

function RewindFlashMovie(mname) {
    var flashMovie = getFlashMovieObject(mname);
    flashMovie.Rewind();
}

function changeFlashMovie(movieName) {

    var innerHtml = "<div id='closeDiv' style='position: absolute; left: 600px; top:1px;'>";
    innerHtml += "<a href='#' style='color: red; text-decoration: none; font-size: x-small' onclick='MM_showHideLayers('swfDiv','','hide'); return false;'>";
    innerHtml += "close [X]</a>";
    innerHtml += "</div>";
    innerHtml += "<object id='swfObject' type='application/x-shockwave-flash' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'";
    innerHtml += "width='515' height='392'>";
    innerHtml += "<param name='movie' value='flash/" + movieName + "' />";
    innerHtml += "<param name='quality' value='high' />";
    innerHtml += "<param name='wmode' value='opaque' />";
    innerHtml += "<param name='swfversion' value='6.0.65.0' />";
    innerHtml += "<param name='expressinstall' value='Scripts/expressInstall.swf' />";
    innerHtml += "<!--[if !IE]>-->";
    innerHtml += "<object type='application/x-shockwave-flash' name='swfObject' data='flash/" + movieName + "'";
    innerHtml += "width='515' height='392'>";
    innerHtml += "<!--<![endif]-->";
    innerHtml += "<param name='quality' value='high' />";
    innerHtml += "<param name='wmode' value='opaque' />";
    innerHtml += "<param name='swfversion' value='6.0.65.0' />";
    innerHtml += "<param name='expressinstall' value='Scripts/expressInstall.swf' />";
    innerHtml += "<div>";
    innerHtml += "<h4>";
    innerHtml += "Content on this page requires a newer version of Adobe Flash Player.</h4>";
    innerHtml += "<p>";
    innerHtml += "<a href='http://www.adobe.com/go/getflashplayer'>";
    innerHtml += "<img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif'";
    innerHtml += "alt='Get Adobe Flash player' width='112' height='33' /></a></p>";
    innerHtml += "</div>";
    innerHtml += "<!--[if !IE]>-->";
    innerHtml += "</object>";
    innerHtml += "<!--<![endif]-->";
    innerHtml += "</object>";

    document.getElementById('swfDiv').innerHTML = innerHtml;
    document.getElementById('closeDiv').onclick = function () { MM_showHideLayers('swfDiv', '', 'hide'); return false; }
    MM_showHideLayers('swfDiv', '', 'show');
    RewindFlashMovie('swfObject');
    PlayFlashMovie('swfObject');

}

function MM_showHideLayers() { //v9.0
    var i, p, v, obj, args = MM_showHideLayers.arguments;
    for (i = 0; i < (args.length - 2); i += 3)
        with (document) if (getElementById && ((obj = getElementById(args[i])) != null)) {
            v = args[i + 2];
            if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' : v; }
            obj.visibility = v;
        }
}

function MM_showHideLayers() { //v9.0
    var i, p, v, obj, args = MM_showHideLayers.arguments;
    for (i = 0; i < (args.length - 2); i += 3)
        with (document) if (getElementById && ((obj = getElementById(args[i])) != null)) {
            v = args[i + 2];
            if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' : v; }
            obj.visibility = v;
        }
}

