/*-----------------------------------------------------------------------------*/
/* MB - 10/23/07 - Brightcove Wrapper / JavaScript support functions           */
/* Function: TiiBcLcDcTracker - Called by Brightcove Flash wrapper to notify   */ 
/* DoubleClick / DART that a Lightningcast ad was served                       */
/* Requirements: adsitename i.e. &adsitename=3745.mre needs to be passed to    */
/* the BC wrapper. If no adzone is specified the default value will be used    */
/*-----------------------------------------------------------------------------*/
function TiiBcLcDcTracker (omniAdSiteName,omniAdZone) {
	var defaultFlg = 'false';
	if (omniAdZone == 'default') {  
		omniAdZone = 'video_main_bc_lightningcast';
		defaultFlg = 'true';
	}    
	var bcLCDCTmpPixel = new Image();
	bcLCDCTmpPixel.src = 'http://ad.doubleclick.net/ad/'+omniAdSiteName+'/'+omniAdZone+';sz=1x1;ord='+Math.ceil(1+1E12*Math.random());
	return 'Tracking successful - adSiteName="'+omniAdSiteName+'" ,adZone="'+omniAdZone+ '" defaultFlg="'+defaultFlg+'"'; 
}    
	         
function TiiBrightcovePlayer() {
	this.cfg = new Array();
	//this.flashUrl = "http://dev-img4.realsimple.com/static/shared/swf/BrightcoveWrapper.swf";
	//this.flashUrl = "http://dev-img4.realsimple.com/static/swf/BrightcoveWrapperEndFrame.swf";
	//this.flashUrl =  "/shared/static/swf/BrightcoveWrapper.swf";
	//this.flashUrl =  "/static/swf/SPCBrightcoveWrapperV1_2_1.swf";
	this.flashUrl =  "/static/swf/SPCBrightcoveWrapperV1_2_3b.swf"; // MB - 2/05/09 Supports continuousplay
	this.bgcolor = "#ffffff";

	// Default cfg
	this.cfg["objectId"] = "bcVideoPlayer";
	this.cfg["divId"] = "";
	this.cfg["testmode"] = "";
	
	this.cfg["autostart"] = false;
	this.cfg["continuousplay"] = true;
	
	this.cfg["lctracking"] = "";
	this.cfg["adsitename"] = "";
	this.cfg["lcadzone"] = ""; 
	this.setParam = TiiBcSetParam;
	this.write = TiiBcWrite;
}

function TiiBcSetParam(key, value) {
	this.cfg[key] = value;
}

function TiiBcWrite() {
	var fo = new FlashObject(this.flashUrl, this.cfg["objectId"], this.cfg["width"], this.cfg["height"], 8, this.bgcolor);
	
	fo.addParam("allowScriptAccess", "always");
	fo.addParam("menu", "false");
	fo.addParam("quality", "high");
	fo.addParam("bgcolor", this.bgcolor);
	fo.addParam("loop", "false");
	fo.addParam("wmode", "opaque");

	fo.addVariable("account", this.cfg["account"]);
	fo.addVariable("channel", this.cfg["siteId"]);
	fo.addVariable("prop16", this.cfg["channel"]);

	fo.addVariable("playerwidth", this.cfg["width"]);
	fo.addVariable("playerheight", this.cfg["height"]);
	fo.addVariable("playerid", this.cfg["playerId"]);
	fo.addVariable("videoid", this.cfg["videoId"]);
	fo.addVariable("lineupid", this.cfg["lineupId"]);
	
	fo.addVariable("autostart", this.cfg["autostart"]);
	fo.addVariable("continuousplay", this.cfg["continuousplay"]);  // MB - added 2/05/09
	
	fo.addVariable("lctracking", this.cfg["lctracking"]); // MB - added 10/23/07
	fo.addVariable("adsitename", this.cfg["adsitename"]); // MB - added 10/23/07
	fo.addVariable("lcadzone", this.cfg["lcadzone"]);     // MB - added 10/23/07
	
	fo.addVariable("objectid", this.cfg["objectId"]);	
	fo.addVariable("adserverurl", this.cfg["adServerUrl"]);
	if (this.cfg["testmode"] != "") {
		fo.addVariable("testmode", this.cfg["testmode"]);	
	}
	
	fo.altTxt = "";

	if (this.cfg["divId"] != "") {
		fo.write(this.cfg["divId"]);
	} else {
		fo.write();
	}
}

 

