/**
 * Class to envoke presentation menu commands from DHTML
 * @version 1.0
 * @author RedManf
 */

/**
 * Constructor
 * @param strPresName Name of presentation object
 */  
function CPresentation(nWidth,
                       nHeight,
                       strURL,
                       strBGColor,
                       strID,
                       bDebug){
    
    this.Width          = nWidth;
    this.Height         = nHeight;
    this.MovieURL       = strURL;
    this.MovieBGColor   = strBGColor;
    this.MovieID        = strID;

    var strAntiCashe = (bDebug) ? "&acashe=" + String(Math.random) : "";
    
    /* Create Flash Object in html page */    
    var strObject = 
        "<object classid=\"" + CPresentation.OBJECT_CLS_ID + "\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"" + nWidth + "\" height=\"" + nHeight + "\" id=\"" + strID + "\">"
        + "<param name=\"allowScriptAccess\" value=\"always\">"
        + "<param name=\"movie\" value=\"" + strURL + strAntiCashe + "\">"
        + "<param name=\"quality\" value=\"high\">"
	+ "<param name=\"allowFullScreen\" value=\"true\" >"
        + "<param name=\"bgcolor\" value=\"" + strBGColor + "\">"
        + "<embed src=\"" + strURL + strAntiCashe + "\" quality=\"high\" allowFullScreen=\"true\" bgcolor=\"" + strBGColor + "\" width=\"" + nWidth + "\" height=\"" + nHeight + "\" name=\"" + strID + "\" align=\"middle\" allowScriptAccess=\"always\" type=\"" + CPresentation.OBJECT_TYPE + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" swLiveConnect=\"true\"></embed>"
        + "</object>";
        
    document.write(strObject);    
};

/* Class Constants (Static members) */
CPresentation.OBJECT_CLS_ID  = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
CPresentation.OBJECT_TYPE    = "application/x-shockwave-flash";
CPresentation.VAR_NAME       = "JSGate";

/**
* This utility method resolves the string movieName to a Flash object reference based on browser type
* @returns MovieObject
*/ 
CPresentation.prototype.getMovie = function() {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[this.MovieID];
    } else {
        return document[this.MovieID];
    }
}

/**
* Sends event to flash object
* 
* @param strCommand basically is a flash function name
* @param strValue basicaly is a flash function parameter
*/
CPresentation.prototype.callFlash = function(strCommand, strValue){
    var strToFlash = strCommand + "~sp_hsalf~" + strValue;
    var objFlash = this.getMovie();
    
    objFlash.SetVariable(CPresentation.VAR_NAME, strToFlash);
}

/* Object Creation */
var objPresentation = new CPresentation(
    objectWidth,
    objectHeight,
    objectURL,
    objectBG,
    objectID,
    objectDebug
);

