function displayDS3(divID, playerType, sessionID, promotionID, durationTrackID) {
	//create container div
	displayNoFlashMsg(divID);
	
	//init parameters
	var swfWidth, swfHeight;		
	var flashvars = {
					sessionID: sessionID, durationTrackID: durationTrackID, promotionID: promotionID,
					htmlVars: "yes", embedded: "yes", 					
					PlayerType: "DS3-ES"
				};
	var params = {allowScriptAccess: "always", menu: "false", bgcolor: "#FFFFFF"};
	var attributes = {id: "swfPlayer", name: "swfPlayer"};

	switch (playerType) {
		case "DS3-ES":
			swfWidth = 520;
			swfHeight = 486;
			break;
	}
	document.getElementById(divID).style.width = swfWidth;
	document.getElementById(divID).style.height = swfHeight;
	
	
	promotionID = (promotionID == undefined) ? -1 : promotionID;
	durationTrackID = (durationTrackID == undefined) ? -1 : durationTrackID;
	
	//load swf
	swfobject.embedSWF("DemoStage3.swf", divID, swfWidth, swfHeight, "9.0.0", "expressInstall.swf", flashvars, params, attributes);	
}

function displayNoFlashMsg(divID) {	
	var msg = 
	'<table width="100%" height="100%"><tr><td valign="middle" align="center">'
	+ 'You need at least flash player version 9 to use DemoStage3.<br>'
	+ '<a href="http://www.macromedia.com/go/getflash/">Please upgrade.</a>'
	+ '<br><br>'
	+ 'Thank you.';
	+ '</td></tr></table>';
	
	document.getElementById(divID).innerHTML = msg;
}

function launch(sessionId, playerType) {
		//mimimum expressInstall size: 214x137
		var initialW = 250;
		var initialH = 200;
		var x = (screen.width/2)-initialW/2;
		var y = (screen.height/2)-initialH/2;
		
		var params = "toolbar=no,resizable=no,width=" + initialW + ",height=" + initialH + ",top=" + y + ",left=" + x + " ";
		var winURL = 'DS3_popup.html?sessionId='+sessionId;	
		if (playerType != undefined) winURL += '&playerType=' + playerType;
		window.open(winURL,'DemoStage3',params);
	}
