/**
 * 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
                      ){

    //strURL += "?acashe=" + Math.random();
    
    this.Width          = nWidth;
    this.Height         = nHeight;
    this.MovieURL       = strURL;
    this.MovieBGColor   = strBGColor;
    this.MovieID        = strID;
//    this.DEBUG          = bDebug;

    
//    if (this.DEBUG) {
//    	this.MovieURL += "&acashe=" + 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 + "\">"
        + "<param name=\"quality\" value=\"high\">"
        + "<param name=\"bgcolor\" value=\"" + strBGColor + "\">"
        + "<embed src=\"" + strURL + "\" quality=\"high\" width=\"" + nWidth + "\" height=\"" + nHeight + "\" name=\"" + strID + "\" allowScriptAccess=\"always\" type=\"" + CPresentation.OBJECT_TYPE + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" swLiveConnect=\"true\"></embed>"
        + "</object>";

//    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 + "\">"
//        + "<param name=\"quality\" value=\"high\">"
//        + "<param name=\"bgcolor\" value=\"" + strBGColor + "\">"
//        + "<embed src=\"" + strURL + "\" quality=\"high\" 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) {
	if (window[this.MovieID] == undefined) {
            return document[this.MovieID];
	} else {
            return window[this.MovieID];
	}
    } else {
        alert(document[this.MovieID]);
        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);
}


