<!-- MERLIN CONTROL FOR REGISTRATION PAGE
var Merlin;
var iSpotCounter;
var MerlinAdjPct;
var VQO;
var VQH;
MerlinAdjPct = 1
VQO = 275
VQH = 450


function LoadMerlin() {
	AgentControl.Connected = true;
	AgentControl.Characters.Load("Merlin", "merlin.acs");
	Merlin = AgentControl.Characters.Character("Merlin");
	Merlin.LanguageID = 0x0409;
	Merlin.Show();
	
	i=0;
	setTimeout("alertMsg()",4000);  //give it 4 seconds then begin execution

	//for(i=0; i<aSpotInfo.length;i++)
	//	alertMsg(i);

	//Merlin.Play("RestPose");
}

function resetMerlin() {
	Merlin.Stop();
	Merlin.Play("RestPose");
	Merlin.MoveTo(645,465);
	Merlin.Show();
}

function alertMsg() {
	var TitleStatement;
	var Description;
	var PosX;
	var PosY;
	var MerX;
	var MerY;
	var ScrollY;
	var HeaderHeight;
	var MsgString;
	var TimeoutPause;

	HeaderHeight = 220;

	//If the spot is not visible, skip it
	if (aSpotInfo[i]['Visible'] == 'N')
		{    if (i < (aSpotInfo.length - 1))
			{TimeoutPause = 1;
			 i++;
			 setTimeout("alertMsg()",TimeoutPause);
			}
		}
	else
	    {
		TitleStatement = aSpotInfo[i]['Title'];   //'The Name of This Spot is' + aSpotInfo[i]['Title']
		Description = aSpotInfo[i]['Description'];   
	
		PosX = aSpotInfo[i]['Left']
		PosY = aSpotInfo[i]['Top']

		// sometimes we scroll the screen
		// VQH = Vertical Quadrant Height
		// VQO = Vertical Quadrand Offset
		ScrollY = parseInt((PosY / VQH)) * VQO;
		if (ScrollY > 0)
			ScrollY = ScrollY + 100;  //adjust for header being gone

		ScrollQuadrant(0, ScrollY);

	
		MerY = aSpotInfo[i]['Top']
		MerX = aSpotInfo[i]['Left']

		MsgString = i + ':  TOP: ' + aSpotInfo[i]['Top']  + ' Left: ' + aSpotInfo[i]['Left']
		//alert(MsgString);

		MsgString = 'ScrollY is ' + ScrollY    //'Current X is ' + PosX  + ' Y: ' + PosY
		//alert(MsgString);

		//MerlinAdjPct = prompt(MsgString, MerlinAdjPct )

		MerX = MerX + 25
		MerY = MerY + HeaderHeight - ScrollY 

		Merlin.MoveTo(MerX, MerY );
		if (i < (aSpotInfo.length - 1))
		    {	TimeoutPause = (Description.length * 125) ;
			i++		
			//alert(TimeoutPause);
			//Minimum Pause is 4 seconds

			if (TimeoutPause < 10000)
				TimeoutPause = 10000;

			//alert(TimeoutPause);
			setTimeout("alertMsg()",TimeoutPause);
		    }
		Merlin.Speak(TitleStatement);
		Merlin.Play("GestureRight");
		Merlin.Speak(Description);
	}
}

function ScrollQuadrant(NewX, NewY)   {

	window.scrollTo(NewX, NewY)
	//alert(window.screenTop);

}


function alertMsgZip() {
	Merlin.Play("Confused");
	Merlin.Speak("Please enter a 5 or 9 digit Zip Code.");
	Merlin.Play("Think");
	Merlin.Think("A valid Zip Code appears as 12345 or 12345-1234.");
	Merlin.Play("RestPose");
}

function alertMsgPhone() {
	Merlin.Play("Confused");
	Merlin.Speak("Please enter a valid 10 digit Phone Number.");
	Merlin.Play("Think");
	Merlin.Think("A valid Phone Number appears as 555-555-1212.");
	Merlin.Play("RestPose");
}

function alertMsgEmail() {
	Merlin.Play("Confused");
	Merlin.Speak("The E-Mail Address entered is not valid.");
	Merlin.Play("Think");
	Merlin.Think("A valid E-Mail Address appears as name@domain.com.");
	Merlin.Play("RestPose");
}

function alertMsgAge() {
	Merlin.Play("Decline");
	Merlin.Speak("A valid Age must be entered.");
	if (document.frmAnswers.txtAge.value <= 20) {
		Merlin.Play("Alert");
		Merlin.Speak("You must be at least 21 years of age to play.");
	}
	else if (document.frmAnswers.txtAge.value >= 101) {
		Merlin.Play("Explain");
		Merlin.Speak("The Age entered must not exceed 100.");
	}
	Merlin.Play("RestPose");
}

function notRequired() {
	Merlin.Play("Pleased");
	Merlin.Speak(document.merlinForm.sayWhat.value);
	Merlin.Play("RestPose");
}

function welcomePlayer() {
	Merlin.Play("Announce");
	Merlin.Speak("Hear Ye Hear Ye. I would like to welcome "+document.merlinForm.theFirstName.value+" to Oneida Casino's Pigskin Pix.");
	Merlin.Play("RestPose");
}

function idle1() {
	Merlin.Play("GestureRight");
	Merlin.Speak(document.merlinForm.sayWhat.value);
	Merlin.Play("RestPose");
}
function idleFilled1() {
	Merlin.Play("GestureUp");
	Merlin.Speak(document.merlinForm.sayWhat.value);
	Merlin.Play("RestPose");
}
function idle2() {
	Merlin.MoveTo(5,140);
	Merlin.Play("GestureLeft");
	Merlin.Speak("Enter your "+document.merlinForm.whatField.value+" into this field.");
	Merlin.MoveTo(30,425);
	Merlin.Play("GestureLeft");
	Merlin.Speak("Touch the letters on the keypad to enter your "+document.merlinForm.whatField.value+".");
	Merlin.Hide();
	Merlin.MoveTo(645,465);
	Merlin.Show();
	Merlin.Play("RestPose");
}
function idleFilled2() {
	Merlin.MoveTo(640,140);
	Merlin.Play("GestureRight");
	Merlin.Speak("If have finished entering your "+document.merlinForm.whatField.value+", press this button.");
	Merlin.Hide();
	Merlin.MoveTo(645,465);
	Merlin.Show();
	Merlin.Play("RestPose");
}
function idle3() {
	Merlin.Play("Explain");
	Merlin.Speak(document.merlinForm.sayWhat.value);
	Merlin.Play("RestPose");
	Merlin.Play("Idle1_4");
	Merlin.Play("Idle3_2");
}
function idle4() {
	Merlin.Stop();
	Merlin.Play("Idle3_1");
	Merlin.Play("GetAttention");
	Merlin.Play("GetAttentionContinued");
	Merlin.Play("GetAttentionContinued");
	Merlin.Play("GetAttentionContinued");
	Merlin.Play("GetAttentionContinued");
	Merlin.Play("Uncertain");
	Merlin.Speak("Hello?");
	Merlin.Play("Alert");
	Merlin.Speak("Perhaps this is a bit confusing for you.");
	Merlin.Play("Explain");
	Merlin.Speak("If I were you, I would get some help from a casino representative.");
	Merlin.Play("Acknowledge");
	Merlin.Play("Thinking");
}
function idle5() {
	Merlin.Stop();
	Merlin.Play("Sad");
	Merlin.Speak("If the screen is not touched soon, I will have to reset the kiosk.");
	Merlin.Play("RestPose");
}

function pageHelp() {
	if (QuestionIndex == 0) {
		pageHelp2()
	}
	else if (QuestionIndex == 1) {
		pageHelp2()
	}
	else if (QuestionIndex == 2) {
		pageHelp2()
	}
	else if (QuestionIndex == 3) {
		if (document.merlinForm.currentField.value == "") {
			document.timerForm.numberShown.value="-51";
			Merlin.Play("Explain");
			Merlin.Speak("The Additional Address Information field is not required.");
			Merlin.Play("RestPose");
			Merlin.Speak("It is for addresses that require an extra line between the Street and the City, State, and Zip Code.");
			Merlin.Play("GestureRight");
			Merlin.Speak("If you require this line, use the keypad to enter your Additional Address Information.");
			Merlin.Play("Explain");
			Merlin.Speak("If you make a mistake, touch the 'DEL' button in the upper right corner of the keypad.");
			Merlin.MoveTo(640,140);
			Merlin.Play("GestureRight");
			Merlin.Speak("If you do not need to enter any information here, touch the 'Next' button.");
			Merlin.Play("RestPose");
			Merlin.Speak("This will take you to the next form field.");
			Merlin.MoveTo(645,465);
			Merlin.Play("Suggest");
			Merlin.Speak("If you still need help, find a casino representative.");
			Merlin.Play("RestPose");
		}
		else {
			document.timerForm.numberShown.value="-19";
			Merlin.Play("Greet");
			Merlin.Speak("I am at your service.");
			Merlin.MoveTo(640,140);
			Merlin.Play("GestureRight");
			Merlin.Speak("If you have finished entering your "+document.merlinForm.whatField.value+", touch the 'Next' button.");
			Merlin.Play("RestPose");
			Merlin.Speak("This will take you to the next form field.");
			Merlin.MoveTo(645,465);
			Merlin.Play("RestPose");
		}
	}
	else if (QuestionIndex == 4) {
		pageHelp2()
	}
	else if (QuestionIndex == 5) {
		pageHelp2()
	}
	else if (QuestionIndex == 6) {
		pageHelp2()
	}
	else if (QuestionIndex == 7) {
		pageHelp2()
	}
	else if (QuestionIndex == 8) {
		if (document.merlinForm.currentField.value == "") {
			document.timerForm.numberShown.value="-51";
			Merlin.Play("Explain");
			Merlin.Speak("The E-Mail Address field is not required.");
			Merlin.Play("RestPose");
			Merlin.Speak("However, I recommend that you enter your E-Mail Address so that you can receive updates from Oneida Casino about Pigskin Pix.");
			Merlin.Play("GestureRight");
			Merlin.Speak("If you require this line, use the keypad to enter your E-Mail Address.");
			Merlin.Play("Explain");
			Merlin.Speak("If you make a mistake, touch the 'DEL' button in the upper right corner of the keypad.");
			Merlin.MoveTo(640,140);
			Merlin.Play("GestureRight");
			Merlin.Speak("If you do not need to enter any information here, touch the 'Next' button.");
			Merlin.Play("RestPose");
			Merlin.Speak("This will take you to the next form field.");
			Merlin.MoveTo(645,465);
			Merlin.Play("Suggest");
			Merlin.Speak("If you still need help, find a casino representative.");
			Merlin.Play("RestPose");
		}
		else {
			document.timerForm.numberShown.value="-19";
			Merlin.Play("Greet");
			Merlin.Speak("I am at your service.");
			Merlin.MoveTo(640,140);
			Merlin.Play("GestureRight");
			Merlin.Speak("If you have finished entering your "+document.merlinForm.whatField.value+", touch the 'Next' button.");
			Merlin.Play("RestPose");
			Merlin.Speak("This will take you to the next form field.");
			Merlin.MoveTo(645,465);
			Merlin.Play("RestPose");
		}
	}
	else if (QuestionIndex == 9) {
			if (document.merlinForm.currentField.value == "") {
			document.timerForm.numberShown.value="-40";
			Merlin.Play("Think");
			Merlin.Speak("Ahh...it seems that you need help.");
			Merlin.MoveTo(30,425);
			Merlin.Play("Search");
			Merlin.Speak("I see that you need to enter your "+document.merlinForm.whatField.value+".");
			Merlin.Play("GestureLeft");
			Merlin.Speak("Type in your "+document.merlinForm.whatField.value+" by touching the numbers on this keypad.");
			Merlin.Play("Explain");
			Merlin.Speak("If you make a mistake, touch the 'DEL' button in the upper right corner of the keypad.");
			Merlin.Play("Suggest");
			Merlin.Speak("If you still need help, find a casino representative.");
			Merlin.MoveTo(645,465);
			Merlin.Play("RestPose");
		}
		else {
			document.timerForm.numberShown.value="-19";
			Merlin.Play("Greet");
			Merlin.Speak("I am at your service.");
			Merlin.MoveTo(640,140);
			Merlin.Play("GestureRight");
			Merlin.Speak("If you have finished entering your "+document.merlinForm.whatField.value+", touch the 'Finish' button.");
			Merlin.Play("RestPose");
			Merlin.Speak("From here you will be able to verify the information you have entered.");
			Merlin.MoveTo(645,465);
			Merlin.Play("RestPose");
		}
	}
}

function pageHelp2() {
	if (document.merlinForm.currentField.value == "") {
		document.timerForm.numberShown.value="-40";
		Merlin.Play("Think");
		Merlin.Speak("Ahh...it seems that you need help.");
		Merlin.MoveTo(30,425);
		Merlin.Play("Search");
		Merlin.Speak("I see that you need to enter your "+document.merlinForm.whatField.value+".");
		Merlin.Play("GestureLeft");
		Merlin.Speak("Type in your "+document.merlinForm.whatField.value+" by touching the letters on this keypad.");
		Merlin.Play("Explain");
		Merlin.Speak("If you make a mistake, touch the 'DEL' button in the upper right corner of the keypad.");
		Merlin.Play("Suggest");
		Merlin.Speak("If you still need help, find a casino representative.");
		Merlin.MoveTo(645,465);
		Merlin.Play("RestPose");
	}
	else {
		document.timerForm.numberShown.value="-19";
		Merlin.Play("Greet");
		Merlin.Speak("I am at your service.");
		Merlin.MoveTo(640,140);
		Merlin.Play("GestureRight");
		Merlin.Speak("If you have finished entering your "+document.merlinForm.whatField.value+", touch the 'Next' button.");
		Merlin.Play("RestPose");
		Merlin.Speak("This will take you to the next form field.");
		Merlin.MoveTo(645,465);
		Merlin.Play("RestPose");
	}
}

// -->
