	<%	
		////
		//// Setup variables for slide (common ones)
		////
	%>


	var hasMetaData = <%= absSlideModel.hasSlideMetaData() %>;
	var hasNavigationHelpTips = <%= absSlideModel.isVariableValueEqual( Constants.USER_VAR_INCLUDE_NAVIGATION_HELP_TIPS, imageDirectory, true ); %>;

	<%   /*Used for page shadow*/   %>
	var emptyIconUrl = '$resPath/empty.gif';


	<%   /*Used at save protection feature*/   %>
	var saveProtectionMessage = '$text.alert-save-protection';


	<%   /*Slide show*/   %>
	var pauseIconUrl = '<%= absSlideModel.getIconSetPath(imageDirectory) %>/pause.gif';
	var playIconUrl = '<%= absSlideModel.getIconSetPath(imageDirectory) %>/play.gif';

	<ja:if test="<%= absSlideModel.isVariableValueEqual( Constants.USER_VAR_INCLUDE_SLIDE_SHOW, imageDirectory, true ) %>">
		var timerID = "";
		var isSlideShow = true;
		var seconds = <%= absSlideModel.getSlideShowDelay() %>;

		var exp = new Date();
		// add 60 minutes as slide-show cookie timeout if Cyclic Show is not enabled. 24 hours otherwise :-)
		var expMin = <%= absSlideModel.isVariableValueEqual( Constants.USER_VAR_CYCLIC_SLIDE_SHOW, imageDirectory, true ) ? 24*60 : 60 %>;

		exp.setTime(exp.getTime() + (expMin*60*1000));
	</ja:if>
	<ja:else>
		var isSlideShow = false;
	</ja:else>

	function pageSetup()
	{
		setupActiveElementHandler();

		<ja:if test="<%= absSlideModel.isVariableValueEqual( Constants.USER_VAR_INCLUDE_SAVE_PROTECTION, imageDirectory, true ) %>">
			initSaveProtection();
		</ja:if>

		<ja:if test="<%= absSlideModel.isVariableValueEqual( Constants.USER_VAR_INCLUDE_SLIDE_SHOW, imageDirectory, true ) %>">
			<ja:if test="<%= absSlideModel.isSlideShowValidForCurrentSlide() %>">
				setSlideShowStatus( getCookie('slideShowOn')!=null );
			</ja:if>
			<ja:else>
				dontSlides(exp);
			</ja:else>
		</ja:if>
		
		<% /*For keyboard support*/ %>
		<ja:if test="<%= absSlideModel.isVariableValueEqual( Constants.USER_VAR_INCLUDE_KEYBOARD_SUPPORT, imageDirectory, true ) %>">
			initKeyboard();
		</ja:if>

		initPageShadow();

		<ja:if test="<%= absSlideModel.isVariableValueEqual( Constants.USER_VAR_PREFETCH_SIBLING_SLIDES, imageDirectory, true ) %>">
			doSlidesPreloading();
		</ja:if>

		<ja:if test="<%= absSlideModel.isSlideShowValidForCurrentSlide() %>">
			safeAddOnload( startSlideShowCountDown );
		</ja:if>
	}

	<ja:if test="<%= absSlideModel.isSlideShowValidForCurrentSlide() %>">
		function startSlideShowCountDown()
		{
			if( getCookie('slideShowOn')!=null )
				timerID = setTimeout('nextPage()', seconds * 1000);
		}
	</ja:if>
