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


	var hasMetaData = <%= hasSlideMetaData() %>;
	var hasNavigationHelpTips = <%= isVariableValueEqual( 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 = '<%= getIconSetPath(imageDirectory) %>/pause.gif';
	var playIconUrl = '<%= getIconSetPath(imageDirectory) %>/play.gif';

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

		var exp = new Date();
		// add 60 minutes as slide-show cookie timeout if Cyclic Show is not enabled. 24 hours otherwise :-)
		var expMin = <%= isVariableValueEqual( 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()
	{
		<ja:if test="<%= isVariableValueEqual( USER_VAR_INCLUDE_SAVE_PROTECTION, imageDirectory, true ) %>">
			initSaveProtection();
		</ja:if>

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

		initPageShadow();

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

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