var octopve_callbackFunc = null;
var octopve_containerid = null;
var octopve_disableEula = false;

/** callback */
function octopve_spawnEula(callback, containerid) {
	//TODO if user does not have flash, just call callback(true)
	if(octopve_disableEula){
		callback(true);
		octopv_statSetStat('eulashowed',-1);
		return;
	}
	octopve_callbackFunc = callback;
	octopve_containerid = containerid
	
	var variant = (typeof octoshapeVariantEula == 'string')?octoshapeVariantEula:""; 

	var container = document.getElementById(octopve_containerid);
	if(container == null){
		octopve_callbackFunc(true);
		octopv_statSetStat('eulashowed',-1);
		return;
	}

  	var html  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
    html += ' id="octopveula" width="100%" height="100%"';
    html += ' codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">';
    html += ' <param name="movie" value="http://'+octopv_baseWebPath+'/plugin/autoinstall/octoeula'+variant+'.swf" />';
    html += ' <param name="wmode" value="transparent" />';
    html += ' <param name="AllowScriptAccess" value="always" />';
    html += ' <param name="FlashVars" value="containerId='+octopve_containerid+'" />';
    html += ' <embed src="http://'+octopv_baseWebPath+'/plugin/autoinstall/octoeula'+variant+'.swf"';
    html += ' width="100%" height="100%" name="octopveula"';
    html += ' AllowScriptAccess="always"';
    html += ' play="true" loop="false" wmode="transparent"';
    html += ' type="application/x-shockwave-flash" FlashVars="containerId='+octopve_containerid+'"';
    html += ' pluginspage="http://www.adobe.com/go/getflashplayer">';
    html += ' </embed></object>';

	octopv_statSetStat('eulashowed',0);
	container.innerHTML = html;
}

window.octopv_fileInitInstallerEula=true; 

