//	-----------------------
//  CLX SCORM Communicator
//  by Andy Haeberli
//  www.crealogix.com
//  vs. 0.1  2003-11-25
// 	----------------------
//
//	---------------------------
//  clx_scorm_communicator_init
//	---------------------------
	function clx_scorm_communicator_init() {
  		if (scorm_communicationInit == false) {
			LMSInitialize();
			if (LMSGetValue('cmi.core.lesson_status') == 'not attempted') {
    			// erster Aufruf des LO
   				LMSSetValue('cmi.core.lesson_status', 'incomplete');
  			}
			return true;
		}
	}

//	---------------------------
// 	clx_scorm_communicator_getUserData
//	---------------------------
	function clx_scorm_communicator_getUserData() {
		if (scorm_communicationInit == true) {
  			var tStudent_ID = LMSGetValue('cmi.core.student_id');
  			var tStudent_Name = LMSGetValue('cmi.core.student_name');
  			var tLesson_Location = LMSGetValue('cmi.core.lesson_location');
			var tLesson_Status = LMSGetValue('cmi.core.lesson_status');
	  		var tScore = LMSGetValue('cmi.core.score.raw');
  			var tTime = LMSGetValue('cmi.core.total_time');
  			var tSuspend_Data = LMSGetValue('cmi.suspend_data');
			// Parameter String
			var tStrParam  = '&scorm_communicationError=0';
				tStrParam += '&scorm_communicationStudent_ID='+tStudent_ID;
				tStrParam += '&scorm_communicationStudent_Name='+tStudent_Name;
				tStrParam += '&scorm_communicationLesson_Location='+tLesson_Location;
				tStrParam += '&scorm_communicationLesson_Status='+tLesson_Status;
				tStrParam += '&scorm_communicationScore='+tScore;
				tStrParam += '&scorm_communicationTime='+tTime;
				tStrParam += '&scorm_communicationSuspend_Data='+tSuspend_Data;
			return tStrParam;
		}
	}
//	---------------------------
// 	clx_scorm_communicator_setUserData
//	---------------------------
	function clx_scorm_communicator_setUserData(tLocation, tStatus, tScore, tTime, tData) {
  		if (scorm_communicationInit == true) {
   			LMSSetValue('cmi.core.lesson_location', tLocation);
			LMSSetValue('cmi.core.lesson_status', tStatus);
    		LMSSetValue('cmi.core.score.raw', tScore);
    		LMSSetValue('cmi.core.session_time', tTime);
    		LMSSetValue('cmi.suspend_data', tData);
		}
  	}
//	---------------------------
//	clx_scorm_communicator_exitUserData
//	---------------------------
	function clx_scorm_communicator_connectionExit() {
  		if (scorm_communicationInit == true) {
			LMSSetValue('cmi.core.exit', 'logout');
			LMSCommit();
    		LMSFinish();
			scorm_communicationInit = false;
		}
	}
	
