//keep track of which slide we're on
var g_this_slide = 0;		//start at first slide

//keep track of slide names
var g_frame_name_content = null;
var g_frame_name_nav = null;

//keep track of content
var g_slide_content = new Array();



/* -----------------------------------------------------------------------
BEGIN Setup
----------------------------------------------------------------------- */


/* -----------------------------------------------------------------------
Function:	SETUP_SLIDE_CONTENT

call this function to add a page to the content "rotation"
----------------------------------------------------------------------- */
function add_slide( page_name )
		{
		slides_length = g_slide_content.length;
		
		//add new slide
		g_slide_content[ slides_length ] = page_name;
		
		return true;
		}
		
		
/* -----------------------------------------------------------------------
Function: CURRENT_SLIDE

RETURNS:
		number of current slide
----------------------------------------------------------------------- */
function current_slide()
		{
		//need to add one because arrays start at 0
		return g_this_slide + 1;
		}

		
/* -----------------------------------------------------------------------
Function:	SETUP_FRAME_NAMES

setup slide names so we can target the specific slide
INPUT:
		content_frame:	name of content frame
		nav_frame:			name of navigation frame
----------------------------------------------------------------------- */
function setup_frame_names( content_frame , nav_frame )
		{
		g_frame_name_content 	= content_frame;
		g_frame_name_nav 			= nav_frame;
		}		
		
		
/* -----------------------------------------------------------------------
Function: CURRENT_SLIDE

RETURNS:
		number of slides total
----------------------------------------------------------------------- */
function total_slides()
		{	
		if ( g_slide_content.length )
				{
				//don't need to subtract one because arrays start at 0
				return g_slide_content.length;
				}
		else
				{
				return 0;
				}
		}		
		
/* -----------------------------------------------------------------------
END Setup
----------------------------------------------------------------------- */		


/* -----------------------------------------------------------------------
BEGIN Navigation Commands
----------------------------------------------------------------------- */		

/* -----------------------------------------------------------------------
Function:	DISPLAY_SLIDE

move content slide to new content
INTPUT:
		direction: 
----------------------------------------------------------------------- */
function display_slide( which_slide )
		{
		//make sure slide names have been defined
		if ( !frame_names_defined() )
				{
				return false;
				}		

		//check that you CAN go to that slide
		if ( 0 <= which_slide && which_slide < g_slide_content.length )
				{
				g_this_slide = which_slide;
				
				var frame = "parent." + g_frame_name_content + ".location";
				
				parent.frames[ g_frame_name_content ].location = g_slide_content[ g_this_slide ];
				}

		return true;				
		}

		
//go to beginning slide
function display_slide_begin()
		{
		display_slide( 0 );
		}
		
//go to end slide
function display_slide_end()
		{
		display_slide( g_slide_content.length - 1 );
		}		
		
//go to previous slide
function display_slide_back()
		{
		display_slide( g_this_slide - 1 );
		}
		
		
//go to next slide
function display_slide_next()
		{
		display_slide( g_this_slide + 1 );
		}		

/* -----------------------------------------------------------------------
END Navigation Commands
----------------------------------------------------------------------- */		
		
		
		
		
		
/* -----------------------------------------------------------------------
BEGIN Private functions and data
----------------------------------------------------------------------- */

/* -----------------------------------------------------------------------
Function:	FRAME_NAMES_DEFINED

Make sure slide names have been defined
----------------------------------------------------------------------- */
function frame_names_defined()
		{
		if ( g_frame_name_content == null || g_frame_name_nav == null )
				{
				alert( 'Please call setup_frame_names.' );
				return false;
				}
		else
				{
				return true;
				}
		}		
				
/* -----------------------------------------------------------------------
END Private Functions and data
----------------------------------------------------------------------- */
				