//Global variables for paths:

//--------------------- SOUNDS & IMAGES -----------------------------------------
//Change it to the physical or relative paths for the sounds and images folders.
var soundPath = '../Sounds/'
var imagePath = '../images/'
var flashPath = ''

var soundHandlingPath = 'SoundHandlingFiles_fileServer\\'
var soundHandling_DR1Path = 'SoundHandlingFiles_fileServer\\'

var RecordingPATH = 'C:/QOL_RecordingFolder\\'
var RecordingPATH2 = 'C:\\QOL_RecordingFolder\\'

var pleaserunsyschkmsg  = "This activity requires the Q Sound Recorder. Please enter the System Check to install this component.";


//Change this path according to the client's path. It's for the recording files.
/*try
{
	var	fso	= new ActiveXObject("Scripting.FileSystemObject");
	var tfolder, TemporaryFolder = 2;
	tfolder = fso.GetSpecialFolder(TemporaryFolder);
	alert(tfolder)
	var RecordingPATH = tfolder + '/QOL_RecordingFolder\\'
	var RecordingPATH2 = tfolder + '/QOL_RecordingFolder\\'
}
	
catch(e)
{	
	return
}*/

//working paths for examples:
//var SoundSrc = 'file://Iisserver1\\D\\inetpub\\wwwroot\\ExerciseComponent_DHTML\\sounds\\'
//var ImageSrc = 'file://D://Materials_All_Q_Projects\\FromSourceSafe_General\\Logic_Tool\\XML_Files\\'

//--------------------------------------------------------------------------------

//Global variables to show the feedback. Use img, text, etc.
var RightAnswerFeedback = '<img src="../images/btn_RightAnswer.gif">'
var WrongAnswerFeedback = '<img src="../images/btn_WrongAnswer.gif">'

//Show NextAnswerIcon in TYP logic
var strNextAnswerIcon = '<img align="absbottom" src="../images/btnNextAnswer.gif" onMouseOver=this.src="../images/btnNextAnswer_Over.gif" onMouseOut=this.src="../images/btnNextAnswer.gif">&nbsp;&nbsp;'

//-------------LOCALIZATION--------------------------------------------------------

var userLanguage	= ""; //Localization language.
var defaultLanguage = "";//Default localization language.
var SecondDefaultLanguage = "English";//If the Default localization language doesn't exists.

//Global variables for the record, next, play buttons
var record_value			= "";
var play_value				= "";
var stop_play_value			= "";
var stop_record_value		= "";
var clear_value				= "";
var rightAnswer_value		= "";
var check_value				= "";
var instructions_value		= "";
var nextExercise_value		= "";
var previousExercise_value	= "";
var closeExercises			= "";
var closeInstructions		= "";

//---------------------------------------------------------------------------------

//If there is a BackgroundImage for the soundbutton, the value should't be shown, but the image can
//be replaced with a "stop" image.
var BackgroundImage_for_sound_btn = true

//Allow RighAnswer only after the user has clicked on Check.
var RighAnswerAfterCheck = true;

//Determines if the RightAnswerFeedback or WrongAnswerFeedback should be given when clicking on &quot;Check&quot;.
var showFeedacksOnCheck = true

//TRUE if there is a disabled image for the PLAY, STOP and RECORD buttons.
//If so, the SRC of the sound image  button will be replaced in adition to it becomes disabled.
var DisabledSoundImage = true;

var UserAnswerEngine = true; //Indicates if this project includes the UserAnswer engine.
//Note: if ClearUserWrongAnswersAfterCheck = true, then UserAnswerEngine must also be true.

var boolDisableDistractors = false; //Default is false -> Changing distractors or anything is always available. TRUE: nothing can move.

//ONLY after Check.
//Default is false: Clear clears all. The page is reloaded. true: It clears only wrong answers.
var ClearUserWrongAnswersAfterCheck = true;

var blRandomDistractors = false;
//------------------------FUNCTIONS-----------------------------------------

function enable_RightAnswer_Check_btns(num)
{
	if(num == 1)
	{
		if(document.all.RightAnswerDisabled)//right answer
			document.all.RightAnswerDisabled.style.visibility = 'visible'
		if(document.all.QCourse_ControlButton_5)//Check
			document.all.QCourse_ControlButton_5.style.visibility = 'visible'
			
		//For the ToolsComponent:
		if(document.all.RightAnswerDisabledTools)//right answer
			document.all.RightAnswerDisabledTools.style.visibility = 'visible'
		if(document.all.Check)//Check
			document.all.Check.style.visibility = 'visible'
	}		
	else if(num == 2)
	{
		if(document.all.QCourse_ControlButton_5)//Check
			document.all.QCourse_ControlButton_5.style.visibility = 'visible'
		
		//For the ToolsComponent:
		if(document.all.Check)//Check
			document.all.Check.style.visibility = 'visible'
	}	
}

/*-------------------------------------------------------------------	
	function initToolTips() and GetLocalizationToolTips(str,num)
	Description: These functions set loalization variables and set tooltips 
	with these values.
-------------------------------------------------------------------*/
function GetLocalizationToolTips(str,num)
{
	if(num == 1)
		component = "ExerciseComponent";
	else
		component = "ToolsComponent";
	
	localizatedItem = oLocalizationXml.selectSingleNode("//Translations/" + userLanguage + "/" + component + "/" + str)
	if(localizatedItem && localizatedItem.text != "")
		localizatedItemText = localizatedItem.text;
	else //If userLanguage doesn't exists.
	{
		localizatedItem = oLocalizationXml.selectSingleNode("//Translations/" + defaultLanguage + "/" + component + "/" + str);
		if(localizatedItem && localizatedItem.text != "")
			localizatedItemText = localizatedItem.text;
		else //If defaultLanguage doesn't exists.
		{
			localizatedItem = oLocalizationXml.selectSingleNode("//Translations/" + SecondDefaultLanguage + "/" + component + "/" + str);
			if(localizatedItem)
				localizatedItemText = localizatedItem.text;
			else //If even SecondDefaultLanguage doesn't exists.
				alert(str + " has no localization!")
		}
	}
		
	return localizatedItemText
}


function initToolTips(logic)
{
	//Init localization variables
	record_value			= GetLocalizationToolTips("Record",1)
	play_value				= GetLocalizationToolTips("Play",1)
	stop_play_value			= GetLocalizationToolTips("StopPlaying",1)
	stop_record_value		= GetLocalizationToolTips("StopRecording",1)
	if(logic == "SR1" || logic == "DR1")//Recording logics
		clear_value			= GetLocalizationToolTips("Delete",1)
	else
		clear_value			= GetLocalizationToolTips("Clear",1)
	rightAnswer_value		= GetLocalizationToolTips("RightAnswer",1)
	check_value				= GetLocalizationToolTips("Check",1)
	instructions_value		= GetLocalizationToolTips("Instructions",1)
	nextExercise_value		= GetLocalizationToolTips("NextExercise",1)
	previousExercise_value	= GetLocalizationToolTips("PreviousExercise",1)
	closeExercises_value	= GetLocalizationToolTips("CloseExercises",2)
	closeInstructions_value = GetLocalizationToolTips("CloseInstructions",1)

	if(document.all.clear)
		document.all.clear.alt					 = clear_value;
	if(document.all.RightAnswerDisabled)
		document.all.RightAnswerDisabled.alt = rightAnswer_value;
	if(document.all.QCourse_ControlButton_5)
		document.all.QCourse_ControlButton_5.alt = check_value;
	if(document.all.QCourse_ControlButton_1)
		document.all.QCourse_ControlButton_1.alt = instructions_value;
	if(document.all.instructionSelected)
		document.all.instructionSelected.alt	 = closeInstructions_value;
	if(document.all.instructionClose)
		document.all.instructionClose.alt		 = closeInstructions_value;	
	if(document.all.QCourse_Button_Next)
		document.all.QCourse_Button_Next.alt	 = nextExercise_value;
	if(document.all.QCourse_Button_Previous)
		document.all.QCourse_Button_Previous.alt = previousExercise_value;

	if(document.all.ClearTools)
		document.all.ClearTools.alt		= clear_value;
	if(document.all.RightAnswerDisabledTools)
		document.all.RightAnswerDisabledTools.alt	= rightAnswer_value;
	if(document.all.Check)
		document.all.Check.alt			= check_value;
	if(document.all.instruction)
		document.all.instruction.alt	= instructions_value;
	if(document.all.Next)
		document.all.Next.alt			= nextExercise_value;
	if(document.all.back)
		document.all.back.alt			= previousExercise_value;
	if(document.all.closeExercises)
		document.all.closeExercises.alt	= closeExercises_value;
	if(document.all.excerciseClose)
		document.all.excerciseClose.alt	= closeExercises_value;
}

/*-------------------------------------------------------------------	
	function ShowRightAnswerButton(num)
	Description: This function shows the Right Answer button after a "Check" or  or hides it 
	after a "Clear", only if "RighAnswerAfterCheck = true".
-------------------------------------------------------------------*/
function ShowRightAnswerButton(num)
{
	if(num == 1)
	{
		if(document.all.RightAnswerDisabled)
			document.all.RightAnswerDisabled.outerHTML = '<img style="" src="../../Images/QCourse_ControlButton_4_Normal.gif" alt="' + rightAnswer_value + '" width="27" height="23" class="QCourseHandCursor" id="QCourse_ControlButton_4" onClick="EventsHandler(2)" state="" onMouseDown="//GroupIt(this)" border="0" onMouseOver="OverIt(this)" onMouseOut="OutIt(this)">';
		
		//For the ToolsComponent:
		if(document.all.RightAnswerDisabledTools)
		document.all.RightAnswerDisabledTools.outerHTML = '<img style="" onClick="EventsHandler(2)" alt="' + rightAnswer_value + '" src="../images/QrightAnswer_Normal.gif" border="0" id="QrightAnswer" alias="QrightAnswer" onMouseOver="window.parent.parent.OverIt(this,2)" onMouseOut="window.parent.parent.OutIt(this,2)" onMouseDown="//window.parent.parent.GroupIt(this,2)" style="cursor:hand">'
	}
	else
	{
		if(document.all.QCourse_ControlButton_4)
			document.all.QCourse_ControlButton_4.outerHTML = '<img disabled style="visibility:hidden" src="../../Images/RightAnswerDisabled_Normal.gif" alt="' + rightAnswer_value + '" width="27" height="23" class="QCourseHandCursor" id="RightAnswerDisabled" onClick="EventsHandler(2)" state="" onMouseDown="//GroupIt(this)" border="0" onMouseOver="OverIt(this)" onMouseOut="OutIt(this)">';
		
		//For the ToolsComponent:
		if(document.all.QrightAnswer)
		document.all.QrightAnswer.outerHTML = '<img style="visibility:hidden" onClick="EventsHandler(2)" alt="' + rightAnswer_value + '" src="../images/RightAnswerDisabledTools_Normal.gif" border="0" id="RightAnswerDisabledTools" alias="RightAnswerDisabledTools" onMouseOver=window.parent.parent.OverIt(this,2) onMouseOut=window.parent.parent.OutIt(this,2) onMouseDown=//window.parent.parent.GroupIt(this,2) style="cursor:hand">';
	}
}
