﻿// JScript File
var currentSamplePath = "";
var currentSampleImg = null;
function PlaySample(playerContainer, samplePath, sampleImg, AppPath) {

    var fScript = "";

    if (currentSamplePath == samplePath) {
        currentSamplePath = "";
        sampleImg.className = 'playBTN';
    }
    else {
        currentSamplePath = samplePath;

        if (currentSampleImg == null) {
            currentSampleImg = sampleImg;
        }

        currentSampleImg.className = 'playBTN';
        sampleImg.className = 'stopBTN';

        currentSampleImg = sampleImg;

        samplePath = samplePath.replace("[%mQoute%]", "\'");
        samplePath = samplePath.replace("\\", "/");
        samplePath = samplePath.replace("&", "%26");

        fScript += "<OBJECT codeBase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0'";
        fScript += "height='20' width='20' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' >";
        fScript += "<PARAM NAME='_cx' VALUE='26'>";
        fScript += "<PARAM NAME='_cy' VALUE='26'>";
        fScript += "<PARAM NAME='FlashVars' VALUE='hatem=" + samplePath + "'>";
        fScript += "<PARAM NAME='Movie' VALUE='" + AppPath + "media/test.swf'>";
        fScript += "<PARAM NAME='Src' VALUE='" + AppPath + "media/test.swf'>";
        fScript += "<PARAM NAME='WMode' VALUE='Window'>";
        fScript += "<PARAM NAME='Play' VALUE='1'>";
        fScript += "<param NAME='AutoStart' VALUE='1'>";
        fScript += "<PARAM NAME='Loop' VALUE='-1'>";
        fScript += "<PARAM NAME='Quality' VALUE='High'>";
        fScript += "<PARAM NAME='SAlign' VALUE=''>";
        fScript += "<PARAM NAME='Menu' VALUE='-1'>";
        fScript += "<PARAM NAME='Base' VALUE=''>";
        fScript += "<PARAM NAME='AllowScriptAccess' VALUE='always'>";
        fScript += "<PARAM NAME='Scale' VALUE='ShowAll'>";
        fScript += "<PARAM NAME='DeviceFont' VALUE='0'>";
        fScript += "<PARAM NAME='EmbedMovie' VALUE='0'>";
        fScript += "<PARAM NAME='BGColor' VALUE=''>";
        fScript += "<PARAM NAME='SWRemote' VALUE=''>";
        fScript += "<PARAM NAME='MovieData' VALUE=''>";
        fScript += "<PARAM NAME='SeamlessTabbing' VALUE='1'>";
        fScript += "<embed src='" + AppPath + "media/test.swf' FlashVars='hatem=" + samplePath + "\'\" WMode='Window' Play='1' AutoStart='1' Loop='-1' Quality='High' SAlign='' Menu='' Base='' AllowScriptAccess='always' Scale='ShowAll' DeviceFont='0' EmbedMovie='0'  SeamlessTabbing='1' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='0' height='0'> </embed>";
        fScript += "</OBJECT>";
        setTimeout(function() { ChangePlayBtn(sampleImg) }, 35000);
    }

    document.getElementById(playerContainer.replace("[%mQoute%]", "\'")).innerHTML = fScript;

}

function ChangePlayBtn(sampleImg) {
    sampleImg.className = 'playBTN';
    //$('#imgPlayPause').delay(35000).removeClass('stopBTN').addClass('playBTN');

}

