var U=0,L="L",O=true,Q=false,A="undefined",R="object",J="string",P="number",N="boolean",V=null,E="";var i,C=0,S=0,F=0,D=0,gPlayer=null,gDownlinkScormAPI=null;function GetWidth()
{
if(document.documentElement.clientWidth)return document.documentElement.clientWidth;return document.body.clientWidth}
function GetHeight()
{
if(document.documentElement.clientHeight)return document.documentElement.clientHeight;return document.body.clientHeight}
function DelayResize()
{
if(C){
clearTimeout(C)}
C=setTimeout("HandleResize()",50)}
function HandleResize(){
C=0;window.status+=GetWidth()+"x"+GetHeight()+" ";SetScreenLayout("")}
function Width()
{
return GetWidth()}
function Height()
{
return GetHeight()}
function CenterWidth(aValue,aMinValue){
var tResult=(Width()-parseInt(aValue,10))/2;if(arguments.length<2)aMinValue=null;if((aMinValue!==null)&&(tResult<aMinValue))tResult=aMinValue;return tResult}
function CenterHeight(aValue){
var tResult=(Height()-parseInt(aValue,10))/2;return tResult}
function SetSWF_LTWH(aName,aLeft,aTop,aWidth,aHeight)
{
tDIV=document.getElementById(aName+"_layer");if(document.all&&((aWidth===0)||(aHeight===0))){
tDIV.style.visibility="hidden";return}else{
tDIV.style.visibility=""}
if(aLeft!==null)tDIV.style.left=aLeft+"px";if(aTop!==null)tDIV.style.top=aTop+"px";var tDIV=document.getElementById(aName);try{
if(aWidth!==null)tDIV.width=aWidth;if(aHeight!==null)tDIV.height=aHeight}catch(e){
alert(e.message+" "+aWidth+" "+aHeight)}
}
function GetScreenLayout()
{
return D}
function SetFocusToContent()
{
var tLayoutDefinition=LAYOUT[D];if(typeof(tLayoutDefinition)==A){
return}
for(var i=0;i<tLayoutDefinition.elements.length;++i){
var tDisplay=tLayoutDefinition.elements[i];var tElem=ELEMENTS[tDisplay.name];if(typeof(tElem)=="undefined"){
continue}
if(tElem.disabled)continue;if(!tDisplay.focus)continue;var tDOMElem=document.getElementById(tDisplay.name);if(tDOMElem==null)continue;tDOMElem.focus();return}
}
function SetScreenLayout(aLayout)
{
if(aLayout=="")aLayout=D;var wmode='transparent';if(typeof(AWP_WMODE)!="undefined"){
wmode=AWP_WMODE}
D=aLayout;F++;var tLayoutDefinition=LAYOUT[aLayout];if(typeof(tLayoutDefinition)==A){
debugAlert(aLayout+" wurde nicht definiert!")}
if(typeof(tLayoutDefinition)==J){
SetScreenLayout(tLayoutDefinition);return}
for(var i=0;i<tLayoutDefinition.elements.length;++i){
var tDisplay=tLayoutDefinition.elements[i];var tElem=ELEMENTS[tDisplay.name];if(typeof(tElem)=="undefined"){
debugAlert(tDisplay.name+" wurde nicht definiert!");continue}
if(tElem.disabled)continue;var tLeft=eval(tDisplay.left);var tTop=eval(tDisplay.top);var tWidth=eval(tDisplay.width);var tHeight=eval(tDisplay.height);tElem.mLastLayoutChange=F;if(document.getElementById(tDisplay.name)!=null){
switch(tElem.type){
case "swf":
SetSWF_LTWH(tDisplay.name,tLeft,tTop,tWidth,tHeight);break;case "html":
var tIFRAME=document.getElementById(tDisplay.name);tIFRAME.style.left=tLeft+"px";tIFRAME.style.top=tTop+"px";tIFRAME.style.width=tWidth+"px";tIFRAME.style.height=tHeight+"px";break}
}else{
switch(tElem.type){
case "swf":
var tObjects=(typeof(tElem.objects)==A)?E:tElem.objects;var tParams=(typeof(tElem.parameters)==A)?E:tElem.parameters;var tHTML=gFlashToJSBinding.FlashObjectHTML(tDisplay.name,FormatPath(tElem.content),tWidth,tHeight,tParams,wmode,'.',tObjects);var tDiv=document.createElement("DIV");tDiv.className="SWF_CONTENT";tDiv.id=tDisplay.name+"_layer";tDiv.style.left=tLeft+"px";tDiv.style.top=tTop+"px";tDiv.style.position="absolute";tDiv.innerHTML=tHTML;document.body.appendChild(tDiv);break;case "html":
var tIFRAME=document.createElement("IFRAME");tIFRAME.className="HTML_CONTENT";tIFRAME.id=tDisplay.name;tIFRAME.style.left=tLeft+"px";tIFRAME.style.top=tTop+"px";tIFRAME.style.width=tWidth+"px";tIFRAME.style.height=tHeight+"px";tIFRAME.style.position="absolute";if(tIFRAME.addEventListener){
tIFRAME.addEventListener("load",IFRAME_LOADED,true)}else{
tIFRAME.attachEvent("onload",IFRAME_LOADED)}
tIFRAME.src=FormatPath(tElem.content);document.body.appendChild(tIFRAME);break}
}
}
for(var tKey in ELEMENTS){
if(ELEMENTS[tKey].mLastLayoutChange !=F){
if(!document.getElementById(tKey))continue;switch(ELEMENTS[tKey].type){
case "swf":
SetSWF_LTWH(tKey,null,null,null,0);break;case "html":
var tIFRAME=document.getElementById(tKey);tIFRAME.style.height="0px";break}
}
}
}
function CDownlinkScormAPI()
{
this.Initialize("");this.mAutoCommitTimer=0;this.mAudioLevel=100;this.mGlobalData={};this.mAbort=false;this.mGlobalData["cmi.student_preference.audio"]=100;this.mGlobalData["cmi.student_preference.text"]=1}
CDownlinkScormAPI.prototype.Initialize=function(aID,aValues)
{
this.mID=aID;this.mActive=false;this.mAbort=false;this.mData={};for(var tKey in aValues){
var tValue=aValues[tKey];if(tValue=='[type Function]')continue;this.mData[tKey.toLowerCase()]=tValue}
this.mData["SCOID"]=aID;for(var tKey in this.mGlobalData){
this.mData[tKey]=this.mGlobalData[tKey]}
this.mNeedsCommit=false}
CDownlinkScormAPI.prototype.SetAutoCommit=function()
{
if(this.mAutoCommitTimer !=0){
clearTimeout(this.mAutoCommitTimer)}
this.mAutoCommitTimer=setTimeout(this.THIS_STR+".LMSCommit()",100)}
CDownlinkScormAPI.prototype.LMSInitialize=function()
{
if(this.mActive)return false;this.mActive=true}
CDownlinkScormAPI.prototype.LMSFinish=function()
{
this.LMSCommit("");if(!this.mActive)return false;this.mActive=false;PlayerAPI.OnContentFinished(this.mData["SCOID"])}
CDownlinkScormAPI.prototype.LMSGetValue=function(aValue)
{
if(!this.mActive)return false;return this.mData[aValue]}
CDownlinkScormAPI.prototype.Abort=function()
{
this.mAbort=true}
CDownlinkScormAPI.prototype.LMSGetLastError=function(aDummy)
{
return "0"}
CDownlinkScormAPI.prototype.LMSGetDiagnostic=function(aDummy)
{
return ""}
CDownlinkScormAPI.prototype.LMSCommit=function(aDummy)
{
clearTimeout(this.mAutoCommitTimer);this.mAutoCommitTimer=0;if(!this.mActive)return false;if(!this.mNeedsCommit)return false;this.mNeedsCommit=false;if(!this.mAbort){
var tDatas=[];for(var tKey in this.mData){
tDatas.push(tKey+"="+this.mData[tKey])}
HOSTING_OBJECT.InvokeMethod("mmplayer_as","SetValues",this.mData,null,null)}
this.mData["player.execute_command"]="";this.mData["player.launch_sco"]=""}
CDownlinkScormAPI.prototype.LMSSetValue=function(aValue,aData)
{
if(!this.mActive)return false;if(aValue in this.mGlobalData){
this.mGlobalData[aValue]=aData}
this.mData[aValue]=aData;this.mNeedsCommit=true;this.SetAutoCommit()}
function IFRAME_LOADED(aElement)
{
if(PlayerAPI)PlayerAPI.LoadCompleted('scoarea')
}
function CPlayer()
{
this.mLoading=[];this.mFlashApplet=null;this.mWindows=[];MakeCallable('mmplayer_js',this,'')}
function abs_value(aValue,aMax){
if(aValue=="full")return aMax;if(typeof(aValue)=="string"){
var tChar=aValue.substr(aValue.length-1,1);if(tChar=="%"){
return Math.round(parseFloat(aValue)/100*aMax)}else if(tChar=="$"){
return aMax-parseInt(aValue)}else{
return parseInt(aValue)}
}else{
return aValue}
}
CPlayer.prototype.GetPreloaderInfo=function(aParams)
{
return{
LANGUAGE : CMIGetLanguage(),FILE : AWP_PATHS["PRELOADER_STRINGS"]
}
}
CPlayer.prototype.SetWindowParameters=function(aParams)
{
window.top.document.title=aParams["TITLE"]}
CPlayer.prototype.Execute=function(aParams)
{
var tParts=aParams["CMD"].split(";")
var tCommand=tParts[0].toLowerCase();if(tCommand=="glossary"){
CMIShowGlossaryEntry(tParts[2],tParts[1])}else if(tCommand=="close"){
CMIQuit()}else if(tCommand=="shellexecute"){
if(typeof(contentlauncher)!=A){
contentlauncher.properties.ShellExecute(tParts[1],"open")}else{
window.open(tParts[1])}
}else{
alert("An den Inhalten für diese Funktion wird noch gearbeitet.")}
}
CPlayer.prototype.SetFocusToContent=function(aParams)
{
SetFocusToContent()}
CPlayer.prototype.SetLayout=function(aParams)
{
SetScreenLayout(aParams["NAME"])}
CPlayer.prototype.SetStage=function(aParams)
{
this.Stage(aParams["NAME"],aParams["LEFT"],aParams["TOP"],aParams["WIDTH"],aParams["HEIGHT"])}
CPlayer.prototype.Stage=function(aStageName,aLeft,aTop,aWidth,aHeight)
{
return;var tWidth=(document.all)?document.body.clientWidth:window.innerWidth;var tHeight=(document.all)?document.body.clientHeight:window.innerHeight;aLeft=abs_value(aLeft,tWidth);aTop=abs_value(aTop,tHeight);aWidth=abs_value(aWidth,tWidth);aHeight=abs_value(aHeight,tHeight);var tElem=null;switch(aStageName){
case "default":
tElem=_E("awclient_flash");break;case "contentarea":
tElem=_E("scoarea");break}
if(!tElem)return;if(!isNaN(aLeft))tElem.style.left=aLeft+"px";if(!isNaN(aTop))tElem.style.top=aTop+"px";if(!isNaN(aWidth))tElem.style.width=aWidth+"px";if(!isNaN(aHeight))tElem.style.height=aHeight+"px"}
CPlayer.prototype.CloseFlash=function(aName)
{
this.mWindows[aName].close()}
CPlayer.prototype.OpenFlash=function(aName,aFlashMovie,aWidth,aHeight)
{
var tURL="openflash.html?DATA="+T(aFlashMovie);this.mWindows[aName]=window.open(tURL,aName,"width="+aWidth+",height="+aHeight);this.mWindows[aName].focus()}
CPlayer.prototype.ELEMENTS_defined=function(aKey)
{
if(typeof(ELEMENTS[aKey])!=A)
return 1;return 0}
CPlayer.prototype.Initialize=function(aParams)
{
var tFlash=_E("mmplayer");this.mFlashApplet=tFlash;var tResult={
PATHS :Encode(AWP_PATHS),LANGUAGE :CMIGetLanguage(),HAS_MMELG_PLAYER:this.ELEMENTS_defined('mmelgplayer'),HAS_QTI_PLAYER :this.ELEMENTS_defined('qtiplayer')
};return tResult}
CPlayer.prototype.TellFlash=function(aCommand,aWhat)
{
var tString="CMD="+aCommand;for(var tKey in aWhat){
tString+="&"+tKey+"="+aWhat[tKey]}
return;awclient_flash_setVariable("_root.gPlayer.DataFromHTML",tString)}
CPlayer.prototype.Print=function(aParams)
{
var tElem=window.frames["scoarea"];if(!tElem){
alert("scoarea is missing from player.html...");return}
tElem.focus();tElem.print()}
CPlayer.prototype.Run=function()
{
var tParams="?";if(typeof(PARAMS)!="undefined")
tParams+=PARAMS;tParams+="&"+location.search.substr(1);ELEMENTS['mmplayer'].content="metamanifestplayer.swf"+tParams;ELEMENTS['mmplayer'].objects='mmplayer_as';SetScreenLayout('preload')}
CPlayer.prototype.OnContentFinished=function(aSCOID)
{
var tElem=_E("scoarea");if(tElem){
tElem.src="about:blank";tElem.style.visibility="hidden"}
HOSTING_OBJECT.InvokeMethod("mmplayer_as","OnContentFinished",{"SCOID":aSCOID},null,null)}
CPlayer.prototype.LoadCompleted=function(aID)
{
if(this.mLoading[aID]!==true){
return}
this.mLoading[aID]=false;HOSTING_OBJECT.InvokeMethod("mmplayer_as","OnContentLoaded",{},null,null);setTimeout("document.getElementById('scoarea').style.visibility='visible'",10)}
CPlayer.prototype.UnloadContent=function(aParams)
{
if(typeof(OPENWINDOW_FLAGS)!=A){
this.mLoadingWnd.close();window.API.Abort()}else{
var tElem=_E("scoarea");if(!tElem){
alert("scoarea is missing from player.html...");return}
window.API.Abort();tElem.src=''}
}
CPlayer.prototype.LaunchContent=function(aParams)
{
var B=aParams["LESSONID"],I=Decode(aParams["RUNTIME_DATA"]),tURI=aParams["URI"],tOOB=aParams["OOB"];if(tOOB==1){
var tAPI=null;if(typeof(window["API_"+B])!=A){
tAPI=window["API_"+B];if(!tAPI.H.closed){
tAPI.H.focus();return}
}
tAPI=new CDownlinkScormAPI();window["API_"+B]=tAPI;tAPI.THIS_STR="window['API_"+B+"']";tAPI.Initialize(B,I);var tFlags="width=800,height=600"
if(typeof(OPENWINDOW_OOB_FLAGS)!=A){
tFlags=OPENWINDOW_OOB_FLAGS}
tAPI.WindowURI=tURI;tAPI.H=window.open("oobwindow.html?id="+B,"oob_"+B,tFlags)}else{
window.API.Initialize(B,I);if(typeof(OPENWINDOW_FLAGS)!=A){
this.mLoading["scoarea"]=true;this.mLoadingWnd=window.open(tURI,"content",OPENWINDOW_FLAGS);this.LoadCompleted("scoarea")}else{
var tElem=_E("scoarea");if(!tElem){
alert("scoarea is missing from player.html...");return}
this.mLoading["scoarea"]=true;tElem.src=tURI}
}
}
function InitPath()
{
if(typeof(AWP_PATHS)==A)AWP_PATHS={};if(typeof(AWP_PATHS["DESIGN"])==A)AWP_PATHS["DESIGN"]="$(MMPLAYER)/../";for(var tKey in AWP_PATHS){
AWP_PATHS[tKey]=FormatPath(AWP_PATHS[tKey])}
}
function FormatPath(aPath)
{
var K=beautifyPath(getURILocation()+"/../"),G=AWP_LANGUAGE,M=beautifyPath(AWP_PATHS["DESIGN"])
if(typeof(G)==A)G=E;return aPath
.replace(/\$\(MMPLAYER\)/g,K)
.replace(/\$\(LANG\)/g,G)
.replace(/\$\(DESIGN\)/g,M)}
function LOG(aString)
{
HOSTING_OBJECT.InvokeMethod("mmplayer_as","log",{text:aString},null,null)}
function LOG_FUNC(aClass,aMethod,aArguments)
{
var tString="";if(aClass!="")tString+=aClass+"::";tString+=aMethod;tString+="(";for(var i=0;i<aArguments.length;++i){
if(i>0)tString+=",";tString+="'";tString+=escape(aArguments[i]);tString+="'"}
tString+=")";LOG(tString)}
function CustomFunction_ContentSetLessonLocation(aLessonLocation)
{
HOSTING_OBJECT.InvokeMethod("mmplayer_as","LaunchContent",{scoid:aLessonLocation},null,null)}
function CustomFunction_APITypeNotFound(aAPITypeDetected,aAPI)
{
alert("detected api type:"+aAPITypeDetected+" but only "+aAPI+" is allowed!");return ""}
function CustomFunction_InitArguments(aArguments)
{
return;var tParams="?";if(typeof(PARAMS)!="undefined")
tParams+=PARAMS;tParams+="&"+location.search.substr(1);aArguments["DATA"]="metamanifestplayer.swf?"+tParams}
function SetWindowTitle(aTitle)
{
var tWnd=window;while((tWnd.parent !=null)&&(tWnd.parent !=tWnd)){
tWnd=tWnd.parent}
tWnd.document.title=aTitle}
function CustomFunction_WindowOnLoad()
{
gPlayer=new CPlayer();gDownlinkScormAPI=new CDownlinkScormAPI();gDownlinkScormAPI.THIS_STR="gDownlinkScormAPI";window.API=document.API=gDownlinkScormAPI;PlayerAPI=gPlayer;gFlashToJSBinding.RegisterCommand("showplayer",function(aArgs,aResult){});gPlayer.Run()}
function _E(aElem){return document.getElementById(aElem)};if(typeof(ELEMENTS)==A)var ELEMENTS=[];if(typeof(LAYOUT)==A)var LAYOUT=[];ELEMENTS['mmplayer']={type:'swf',content:'metamanifestplayer.swf'};ELEMENTS['scoarea']={type:'html',content:'about:blank'};if(typeof(LAYOUT['main'])==A){
LAYOUT['main']={
elements:[
{name: 'mmplayer',left:"0",top:"Height()-200",width:"Width()",height:"200"},{name: 'scoarea',left:"0",top:"0",width:"Width()",height:"Height()-200"}
]
}}
if(window.attachEvent){
window.attachEvent("onresize",DelayResize)}else{
window.addEventListener("resize",DelayResize,true)}
AWP_PARAMS+="&DATA=custom"
PlayerAPI=null;window.API=document.API=null;InitPath();AWP_JS_FILES.push(AWP_PATHS["DESIGN"]+"/layout.js");EXTERNAL=[];