﻿<ControllerBehavior>
	<TurnOnNextButton>
		<SetButton button="Next" buttonEnabled="true" state="blink" />
	</TurnOnNextButton>
	<TurnOffNextButton>
		<SetButton button="Next" buttonEnabled="false" state="off" />
	</TurnOffNextButton>
	<TurnOffPreviousButton>
		<SetButton button="Previous" buttonEnabled="false" state="off" />
	</TurnOffPreviousButton>
	<ExamSubmitButtonClicked>
		<ExamSubmitButtonClicked />
		<MarkPageComplete />
		<!--StoreParameters /-->
   		<!--GoToNextPage/-->
	</ExamSubmitButtonClicked>
	<ExamNextButtonClicked>
		<ExamNextButtonClicked />
	</ExamNextButtonClicked>
	<ExamPreviousButtonClicked>
		<ExamPreviousButtonClicked />
	</ExamPreviousButtonClicked>
	<ExamRetakeButtonClicked>
		<!--GoToPreviousPage/-->
		<GoToPage pageIdx="0" />
	</ExamRetakeButtonClicked>
	<ExamRefresh>
		<!--TestMessage TMessage="ExamRefresh"/-->
		<ExamRefresh />
	</ExamRefresh>
	<ExamPreviousButton>
   	    <SetButton button="Previous" buttonEnabled="false" state="off" />
	</ExamPreviousButton>
	<!-- The above part copied from DLETP_AACS controllerbehavior.xml -->


	<ModuleReplaced>
		<ExecuteNamedActionSet setName="ModuleLoadedActions" />
		<If condition="IfModuleHasBeenVisited">
		    <IfTrueActions>
				<If condition="IfTargetPageSpecified">
					<IfTrueActions>
						<GoToTargetPage />
					</IfTrueActions>
					<IfFalseActions>
						<GoToLastPageVisited/>
					</IfFalseActions>
				</If>
 		    </IfTrueActions>
		    <IfFalseActions>
				<GoToFirstPage/>
		    </IfFalseActions>
		</If>
	</ModuleReplaced>
  <ModuleLoaded>
    <If condition="IfCourseHasBeenVisited">
      <IfTrueActions>
        <!--<If condition="IfCourseIsComplete">-->
		 <If condition="IfModuleIsComplete">
           <IfTrueActions>
		   	   <!--PlayIntro /-->
               <!--GoToFirstPage /-->
               <!--GoToMainMenu /-->
				<GoToLastVisitedModuleAndPage />
           </IfTrueActions>
           <IfFalseActions>
<TestMessage TMessage ="IfModuleIsComplete:False" />
              <!--GoToLastPageVisited /-->
			  <GoToLastVisitedModuleAndPage />
			  <!--PlayIntro /-->
           </IfFalseActions>
        </If>
        <ExecuteNamedActionSet setName="ModuleLoadedActions" />
      </IfTrueActions>
      <IfFalseActions>
        <ExecuteNamedActionSet setName="ModuleLoadedActions" />
<TestMessage TMessage ="IfCourseHasBeenVisited:False" />
        <!--GoToFirstPage /-->
        <GoToMainMenu />
        <MarkModuleVisited />
        <StoreParameters />
      </IfFalseActions>
    </If>
  </ModuleLoaded>
	<ModuleLoadedActions>
		<InitializeInterface/>
		<LoadBackground />
		<MarkModuleVisited />
		<!--StoreParameters /-->
	</ModuleLoadedActions>
	<LaunchIntro />
	<PageStartPlaying>
		<RemoveExtLinksButton/>
		<If condition="IfKnowledgeCheckPage">
			<IfTrueActions>
				<ResetKnowledgeCheck/>
<TestMessage TMessage ="IfKnowledgeCheckPage:True" />
				<DisableAllControls />
			</IfTrueActions>
			<IfFalseActions>
			</IfFalseActions>
		</If>
		<CollapseTopicsMap />
		<UpdatePagePlaying />
		<CacheVisitedState />
        <LoadPageFunctions/>
		<SetPopupButtonsState buttonsEnabled="false" />
		<MarkPageVisited />
		<MarkModuleVisited />
		<StoreParameters />
    	<If condition="IfCurrentPageComplete">
		    <IfTrueActions>
				<SetButton button="Next" buttonEnabled="true" state="blink" />
		    </IfTrueActions>
		    <IfFalseActions>
		        <SetButton button="Next" buttonEnabled="true" state="on" />
		    </IfFalseActions>
		</If>
		<If condition="IfFirstPage">
			<IfTrueActions>
				<SetButton button="Previous" buttonEnabled="true" state="off" />
			</IfTrueActions>
			<IfFalseActions>
				<SetButton button="Previous" buttonEnabled="true" state="on" />
			</IfFalseActions>
		</If>
		<If condition="IfLastPage">
			<IfTrueActions>
				<!--SetButton button="Next" buttonEnabled="false" state="off" /-->
			</IfTrueActions>
			<IfFalseActions>
			</IfFalseActions>
		</If>
	</PageStartPlaying>
	<EmbeddedVideoStartPlaying>
		<StopPagePlaying/>
	</EmbeddedVideoStartPlaying>
	<EmbeddedVideoFinishedPlaying>
		<ContinuePagePlaying/>
	</EmbeddedVideoFinishedPlaying>
	<ContinueButtonClicked>
		<GoToEndOfEmbeddedVideo/>
		<ContinuePagePlaying/>
	</ContinueButtonClicked>
	<NextButtonClicked>
		<SetButton button="Next" buttonEnabled="true" state="off" />
		<ExecuteNamedActionSet setName="PerformCertificateCheck" />
		<MarkPageComplete />
		<StoreParameters />
		<If condition="IfLastPage">
			<IfTrueActions>
				<If condition="IfCourseIsComplete">
					<IfTrueActions>						
					</IfTrueActions>
					<IfFalseActions>
						<GoToMainMenu />
					</IfFalseActions>
				</If>				
			</IfTrueActions>
			<IfFalseActions>
				<GoToNextPage/>
			</IfFalseActions>
		</If>
	</NextButtonClicked>
	<PreviousButtonClicked>
		<If condition="IfFirstPage">
			<IfTrueActions>
<!--			<GoToMainMenu /> -->
			</IfTrueActions>
			<IfFalseActions>
				 <GoToPreviousPage/>
			</IfFalseActions>
		</If>
	</PreviousButtonClicked>
	<ExternalLinkClicked>
		<OpenExternalResource/>
	</ExternalLinkClicked>

	<ExternalLinkClicked2>
		<OpenExternalResource2/>
	</ExternalLinkClicked2>

	<CourseMapLinkClicked>
		<GoToCourseMapLink />
	</CourseMapLinkClicked>
	<TopicButtonClicked>
		<GoToTopic />
	</TopicButtonClicked>
	<PauseButtonClicked>
		<PausePlayback/>
		<!--SuspendInterface/-->
	</PauseButtonClicked>

	<ResumeButtonClicked>
		<ResumeInterface/>
	</ResumeButtonClicked>

	<LinkClicked>
		<GoToLink />
	</LinkClicked>
<!-- Course Map -->
	<PageLinkClicked>
		<GoToPageLink />
	</PageLinkClicked>
	<PopupClicked>
	    <OpenPopupPage/>
		<MarkPopupVisited/>
	</PopupClicked>
	<PopupClosed>
		<ClosePopupPage />
		<If condition="IfAllPopupsVisited">
			<IfTrueActions>
				<SetButton button="Next" buttonEnabled="true" state="blink" />										
			</IfTrueActions>
			<IfFalseActions>										
			</IfFalseActions>
		</If>							
	</PopupClosed>
	<PopupStartPlaying>
		<UpdatePagePlaying />
		<CacheVisitedState />
		<LoadPageFunctions/>
<!-- REVIIST VERIFY THIS IS WHAT WE WANT -->
		<SetPopupButtonsState buttonsEnabled="true" />
		<MarkPopupVisited />
	</PopupStartPlaying>
	<PopupFinshedPlaying>
		<UpdatePageFinished />
		<RestoreVisitedState />
		<SetPopupButtonsState buttonsEnabled="true" />
		<MarkPopupComplete />
		<MakeCloseButtonBlink />
	</PopupFinshedPlaying>
	<GlossaryButtonClicked>
		<DisplayGlossary/>
		<SuspendInterface/>
	</GlossaryButtonClicked>
	<MainMenuButtonClicked>
		<GoToMainMenu />
		<SuspendInterface/>
	</MainMenuButtonClicked>
	<ReplayButtonClicked>
		<RestoreVisitedState />
		<ReplayPage/>
	</ReplayButtonClicked>
	<ResourcesButtonClicked>
		<DisplayResources/>
		<SuspendInterface/>
	</ResourcesButtonClicked>
	<TopicsButtonClicked>
		<DisplayTopics/>
		<SuspendInterface/>
	</TopicsButtonClicked>
	<CourseMapButtonClicked>
		<DisplayCourseMap />
		<SuspendInterface/>
	</CourseMapButtonClicked>
	<ExitButtonClicked>
		<ConfirmExit />
		<SuspendInterface />
	</ExitButtonClicked>
	<ExitConfirmationClicked>
		<!--StoreParameters /-->
		<CloseWindow />
		<UnloadSpecial2 resume="no" />
		<ExitSCO closeWindow="true"/>
	</ExitConfirmationClicked>
	<ExitCancelClicked>
		<CancelExit />
		<ResumeInterface/>
	</ExitCancelClicked>
	<IdleLimitExceeded>
		<DisplayIdleLimit/>
		<SuspendInterface/>
	</IdleLimitExceeded>
	<SpecialFeatureUnloaded>
<TestMessage TMessage ="UnloadSpecial" />
		<UnloadSpecial resume="maybe" />
		<ResumeInterface/>
	</SpecialFeatureUnloaded>
	<PageFinishedPlaying>

		<CreatExtLinks />
		
		<SetPopupButtonsState buttonsEnabled="true" />
		<UpdatePageFinished />
		<RestoreVisitedState />
		<If condition="IfLastPage">
			<IfTrueActions>
				<MarkPageComplete />
				<StoreParameters />
				<!--SetButton button="Next" buttonEnabled="false" state="off" /-->
			</IfTrueActions>
			<IfFalseActions>
			</IfFalseActions>
		</If>
		<If condition="IfKnowledgeCheckPage">
			<IfTrueActions>
				<EnableAllControls />
			</IfTrueActions>
			<IfFalseActions>
				<If condition="IfAllPopupsVisited">
					<IfTrueActions>
						<If condition="IfPageTypeEquals" pageType="Normal">
							<IfTrueActions>
								<MarkPageComplete />
								<StoreParameters />
								<If condition="IfCourseIsComplete">
									<IfTrueActions>
										<!-- disable next button -->
										<TestMessage TMessage="Controllerbehavior.xml PageFinishedPlaying SetButton Next off"/>
										<SetButton button="Next" buttonEnabled="false" state="off" />
										<SetButton button="Next" buttonEnabled="false" state="off" />
										<SetSCOCompletionStatus complete="true" />
										<SetSCOSuccessStatus success="true" />										
									</IfTrueActions>										
									<IfFalseActions>
										<TestMessage TMessage="Controllerbehavior.xml PageFinishedPlaying SetButton Next off"/>
										<SetButton button="Next" buttonEnabled="true" state="blink" />
										<!-- Michael call one more to make sure it's blink -->
      									<SetButton button="Next" buttonEnabled="true" state="blink" />
									</IfFalseActions>
								</If>
								<!--
								<If condition="IfLastPage">
									<IfTrueActions>
										<SetButton button="Next" buttonEnabled="true" state="blink" />
										<SetButton button="Next" buttonEnabled="true" state="blink" />
									</IfTrueActions>
									<IfFalseActions>
										<TestMessage TMessage="Controllerbehavior.xml SetButton Next blink"/>
										<SetButton button="Next" buttonEnabled="true" state="blink" />
										<SetButton button="Next" buttonEnabled="true" state="blink" />
									</IfFalseActions>
								</If> 
								-->
							</IfTrueActions>
							<IfFalseActions>
							</IfFalseActions>
						</If>
				 	</IfTrueActions>
					<IfFalseActions>
					</IfFalseActions>
				</If>
			</IfFalseActions>
		</If>
		<ExecuteNamedActionSet setName="PerformCertificateCheck" />
	</PageFinishedPlaying>
	<PrintComplete>
		<ResumeInterface/>
		<!--PrintClose/-->		
	</PrintComplete>
	<AllPopupVisited>
		<MarkPageComplete />
		<StoreParameters />
		<SetButton button="Next" buttonEnabled="true" state="blink" />
	</AllPopupVisited>
	<PageCompleted/>
	<EnteredSection/>
	<DepartedSection/>
	<SectionCompleted/>
	<ModuleStarted/>
	<EnteredModule/>
	<DepartedModule>
		<StoreProgress/>
	</DepartedModule>
<!-- This code pops up ther certificate upon course completion -->
	<ModuleComplete>
		<If condition="IfCourseIsComplete">
			<IfTrueActions>
				<!-- disable next button -->
				<TestMessage TMessage="Controllerbehavior.xml ModuleComplete SetButton Next off"/>
				<SetButton button="Next" buttonEnabled="false" state="off" />
				<SetSCOCompletionStatus complete="true" />
				<SetSCOSuccessStatus success="true"/>

				<If condition="IfThisAUEquals" name="GuidedTour">
					<IfTrueActions>
					</IfTrueActions>
					<IfFalseActions>
						<If condition="IfLinkParameterEquals" name="CertificateAwarded" value="1">
							<IfTrueActions>
							</IfTrueActions>
							<IfFalseActions>
								<!--SetLinkParameter name="CertificateAwarded" value="1" /-->
								<SetButton button="Next" buttonEnabled="false" state="off" />
								<PresentCertificate />
							</IfFalseActions>
						</If>
					</IfFalseActions>
				</If>
			</IfTrueActions>
			<IfFalseActions>
			</IfFalseActions>
		</If>
		<MarkModuleComplete />
		<!--StoreParameters /-->
	</ModuleComplete>
<!--
-->
	<IntroStarted>
		<LoadPageFunctions/>
		<SetLinkParameter name="IntroVisited" value="1" />
		<!--StoreParameters /-->
	</IntroStarted>
	<IntroFinished>
		<!-- Unload intro, otherwise, it plays on background if skip is clicked -->
		<UnloadSpecialPopup popupLvl="4" />
		<GoToFirstPage />
	</IntroFinished>
	<IdleLimitExceeded/>
	<ConnectionFault/>

    <ControlClicked>
      <If condition="IfKnowledgeCheckPage">
        <IfTrueActions>
          <CheckInputCompleteStatus />
        </IfTrueActions>
        <IfFalseActions> </IfFalseActions>
      </If>
    </ControlClicked>

    <!--  Knowledge Check Feedback related events -->
    <DoneButtonClicked>
      <EvaluateAndProvideFeedback />
      <!-- if only 1 question and no summary feedback then make forward blink -->
    </DoneButtonClicked>

    <PreviousFeedbackClicked>
      <FeedbackClosedWithPrevious />
    </PreviousFeedbackClicked>

<!--  NEW WAY:   -->
    <NextFeedbackClicked>
      <FeedbackClosedWithNext />
    </NextFeedbackClicked>

    <TryAgainClicked>
    	<FeedbackClosedWithTryAgain />
    </TryAgainClicked>

    <CloseFeedbackClicked>
      <FeedbackClosedWithDone />
      <SetButton button="Next" buttonEnabled="true" state="blink" />
      <SetPopupButtonsState buttonsEnabled="true" />
      <!-- Michael call one more to make sure it's blink -->
      <SetButton button="Next" buttonEnabled="true" state="blink" />
      <If condition="IfOnLastPageOfTopic">
          <IfTrueActions>
              <ExpandTopicsMap />
              <MarkPageComplete />
          </IfTrueActions>
          <IfFalseActions> </IfFalseActions>
      </If>
    </CloseFeedbackClicked>

    <ProvideSummaryFeedback />

    <UserEnteredText>
      <If condition="IfCurrentQuestionAnswered">
        <IfTrueActions>
          <GoToState name="doneButton_MC" state="on" btnEnabled="true" />
        </IfTrueActions>
        <IfFalseActions> </IfFalseActions>
      </If>
    </UserEnteredText>

    <PerformCertificateCheck>
<!--      <XMLDebug>Performing certificate check</XMLDebug> -->
      <If condition="IfAllModulePagesVisited">
        <IfTrueActions>
          <MarkModuleComplete />
          <ExecuteNamedActionSet setName="ModuleComplete" />
        </IfTrueActions>
        <IfFalseActions>
        </IfFalseActions>
      </If>
    </PerformCertificateCheck>

</ControllerBehavior>