//////////////////////////////////////////////////////
// Common functions //////////////////////////////////
//////////////////////////////////////////////////////

utils = {
	
	// Set right text in to the flash player detection screen in case of no flash player is installed
	flashPlayerDetection : function (){
		// Get and write the needed and detected flash player version to screen
		var playerVersion = swfobject.getFlashPlayerVersion();
		var userVersion = playerVersion.major + "." + playerVersion.minor + "." +playerVersion.release;
		var requiredVersionHolder = document.getElementById("requiredFlashVersion");
		var detectedVersionHolder = document.getElementById("detectedFlashVersion");
		// Writing detected and required versions
		requiredVersionHolder.innerHTML = configParams.neededFlashPlayerVersion;
		detectedVersionHolder.innerHTML = userVersion;                                  
	}
	
	//Window Open function for main index page to open lessons 
	,windowOpen : function (fname,nWidth,nHeight){ 
		var attr = "left=" + ((screen.width-nWidth)/2-5) + ",top=" + ((screen.height-nHeight)/2-29) + ","+
		"resizable=0,width=" + nWidth + ",height=" + nHeight + ",menubar=0, scrollbars=0";
		var theWindow=window.open(fname,"name", attr)
		theWindow.focus();
	}
	
	//Special switch for Access contents to show additional informations about chapter exercises
	,isHelpDisplayed: false
	
	//Special function for Access contents to show additional informations about chapter exercises
	,toggleInfo : function (elementId, link){	
	    if(!this.isHelpDisplayed){
	       document.getElementById(elementId).style.display="block";
	       link.innerHTML = "schlie&szlig;en";
	       this.isHelpDisplayed = true;
	    }else{
	       document.getElementById(elementId).style.display="none";
	       link.innerHTML = "&ouml;ffnen";
	       this.isHelpDisplayed = false;
	   }
	}
}

// Be sure object is present
utils = window.utils || {};