//Debug activator
var c_debug = ' ';

//Flags for instructions while already active
var b_sliding = 0;
var b_continue_about = 0;
var b_continue_jewelry = 0;
var b_continue_left = 0;
var b_continue_right = 0;
var b_continue_up = 0;

//Constants to define the website areas.
var c_home = 0;
var c_about = 1;
var c_signature = 2;
var c_collectors = 3;
var c_kelly = 4;
var c_portfolio = 5;

//Variable to identify the website areas.
var area = 0;
var area_list;
var area_index = 0;
var area_total = 0;

//Variable to define the timeout.
var c_waittime = 20;

//Variable to identify the window width.
var window_width = 0;
var c_mobile_width = 500;

//Page lists for the website areas.
var about_index = 0;
var about_total = 5;
var about_list = new Array("KellyAlexandra.html",
                           "Press.html",
                           "MakeAWish.html",
                           "Friends.html",
                           "Cover-2.html");
var signature_index = 0;
var signature_total = 9;
var signature_list = new Array(
                           "Kelly-Model.html",
                           "Ebony-Copper.html",
                           "Paisley-Decoupage.html",
                           "Andrea.html",
                           "ChineseDeco.html",
                           "Venetian-Crystal.html",
                           "Masterpiece.html",
                           "Helen.html",
                           "Kathryn.html"
                           );
var collectors_index = 0;
var collectors_total = 7;
var collectors_list = new Array( 
                           "Venetian.html",
                           "MoonEarrings.html",
                           "Wedding.html",
                           "Coral.html",
                           "CherryAmber.html",
                           "BlueSkull.html",
                           "American-Heart-Assn.html"
                           );
var kelly_index = 0;
var kelly_total = 9;
var kelly_list = new Array( 
                           "Spring08.html",
                           "Triple-Geode.html",
                           "Allison.html",
                           "Cody.html",
                           "Candice.html",
                           "FacetedAfrican.html",
                           "MilagrosEarrings.html",
                           "Earrings.html",
                           "MilagrosNecklace.html"
                           );
var portfolio_index = 0;
var portfolio_total = 27;
var portfolio_list = new Array(
                           "Kelly-Model.html",
                           "Spring08.html",
                           "VenetianEarrings.html",
                           "Ebony-Copper.html",
                           "Sugar-Beads.html",
                           "Paisley-Decoupage.html",
                           "Venetian.html",
                           "MoonEarrings.html",
                           "Andrea.html",
                           "Triple-Geode.html",
                           "Allison.html",
                           "Cody.html",
                           "Wedding.html",
                           "Candice.html",
                           "ChineseDeco.html",
                           "Coral.html",
                           "CherryAmber.html",
                           "FacetedAfrican.html",
                           "BlueSkull.html",
                           "MilagrosEarrings.html",
                           "Earrings.html",
                           "Venetian-Crystal.html",
                           "Masterpiece.html",
                           "MilagrosNecklace.html",
                           "Helen.html",
                           "American-Heart-Assn.html",
                           "Kathryn.html");
var slide_index = 0;
var slide_total = 31;
var slide_list = new Array("Cover.html", 
                           "KellyAlexandra.html",
                           "MakeAWish.html",
                           "Press.html",
                           "Kelly-Model.html",
                           "Spring08.html",
                           "Ebony-Copper.html",
                           "Paisley-Decoupage.html",
                           "Venetian.html",
                           "MoonEarrings.html",
                           "Andrea.html",
                           "Triple-Geode.html",
                           "Allison.html",
                           "Cody.html",
                           "Wedding.html",
                           "Candice.html",
                           "ChineseDeco.html",
                           "Coral.html",
                           "CherryAmber.html",
                           "FacetedAfrican.html",
                           "BlueSkull.html",
                           "MilagrosEarrings.html",
                           "Earrings.html",
                           "Venetian-Crystal.html",
                           "Masterpiece.html",
                           "MilagrosNecklace.html",
                           "Helen.html",
                           "American-Heart-Assn.html",
                           "Kathryn.html",
                           "Friends.html",
                           "Cover-2.html");

//Load the window.  Adjust for mobile devices.
onload = function()
{
	if (c_debug == 'onload') alert("Onload");
	
	window_width = f_clientWidth();
	
	if (window_width > c_mobile_width)
	{
		//parent.document.getElementById('VERTICAL').setAttribute('rows', '85,2*', 0);
		//parent.document.getElementById('HEADER').setAttribute('cols', '1*,250', 0);
		//parent.document.getElementById('MAIN-BODY').setAttribute('cols', '150,2*', 0);
	}
}

//Determine the width of the window
function f_clientWidth()
{
	return f_filterResults
	(
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}

function f_filterResults(n_win, n_docel, n_body)
{
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

//Finish the movement to the left.  Reset the window frames and load the next
//slides to the left.
function Finish_Left()
{
	//Assign the frames
	var left_frame = parent.frames["PAGELEFT"];
	var right_frame = parent.frames["PAGERIGHT"];
	var temp_frame = parent.frames["PAGETEMP"];
	var right_thumb_right = parent.frames["NEXTRIGHT"];
	
	//c_debug = 'Finish_Left';

	//Move forward one position.
	var index = Set_Index(Get_Index() + 1);
	if (c_debug == 'Finish_Left') 
		alert('Finish_Left - Index: ' + index);

	//Get the new source for the right frame.
	var slide_new = Get_Slide(index + 1);
	if (c_debug == 'Finish_Left') 
		alert('Finish_Left - Right Slide: ' + slide_new);
	var next_src = 'Slides/' + slide_new;
	if (c_debug == 'Finish_Left') 
		alert('Finish_Left - Right Frame: ' + next_src);
	
	//Get the new source for the right thumb.
	var thumb_new = Get_Slide(index + 2);
	var next_thumb = 'Thumbs/' + thumb_new;
	if (c_debug == 'Finish_Left') alert('Finish_Left - Next Thumb: ' + next_thumb);
		
	//Hide the Right hidden window and re-display the center window
	if (c_debug == 'Finish_Left') alert('Finish_Left - Change back to active window.');
	width_string = '15%, 0%, 70%, 0%, 0%, 15%';
	parent.document.getElementById('FLIPBOOK').setAttribute('cols', width_string, 0);
	if (c_debug == 'Finish_Left') alert('Finish_Left - Reset Page: ' + width_string);

	//Reset the thumb frames
	width_string = '0%, 100%, 0%';
	parent.document.getElementById('LEFTTHUMB').setAttribute('cols', width_string, 0);
	parent.document.getElementById('RIGHTTHUMB').setAttribute('cols', width_string, 0);
	if (c_debug == 'Finish_Left') alert('Finish_Left - Reset Thumbs: ' + width_string);
		
	//Load the previous window's source into the Left hidden window
	left_frame.window.location = temp_frame.window.location;
	if (c_debug == 'Finish_Left') alert('Finish_Left - Left Frame: ' + temp_frame.window.location);
		
	//Load the next window to the right into the right hidden window
	right_frame.window.location = next_src;
	if (c_debug == 'Finish_Left') alert('Finish_Left - Right Frame: ' + next_src);
		
	//Hidden thumb to the right of the right thumb gets the next thumb to the right
	right_thumb_right.window.location = next_thumb;
	if (c_debug == 'Finish_Left') alert('Finish_Left - Right thumb right: ' + next_thumb);

	//Finish processing the scroll.
	Finish_Scroll();
}

function Finish_Right()
{
	//Assign the frames
	var left_frame = parent.frames["PAGELEFT"];
	var right_frame = parent.frames["PAGERIGHT"];
	var temp_frame = parent.frames["PAGETEMP"];
	var left_thumb_left = parent.frames["PREVIOUSLEFT"];

	//c_debug = 'Finish_Right';

	//Move back one position.
	var index = Set_Index(Get_Index() - 1);
	if (c_debug == 'Finish_Right') alert("Finish_Right - Index: " + index);

	//Get the new source for the left frame.
	var slide_new = Get_Slide(index - 1);
	var next_src = 'Slides/' + slide_new;
	
	//Get the new source for the left thumb.
	var thumb_new = Get_Slide(index - 2);
	var next_thumb = 'Thumbs/' + thumb_new;
	
	//Hide the Left hidden window and re-display the center window
	if (c_debug == 'Slide_Right') alert('Finish_Right - Change back to active window.');
	width_string = '15%, 0%, 70%, 0%, 0%, 15%';
	parent.document.getElementById('FLIPBOOK').setAttribute('cols', width_string, 0);

	//Reset the thumb frames
	width_string = '0%, 100%, 0%';
	parent.document.getElementById('LEFTTHUMB').setAttribute('cols', width_string, 0);
	parent.document.getElementById('RIGHTTHUMB').setAttribute('cols', width_string, 0);
		
	//Load the previous window's source into the right hidden window
	right_frame.window.location = temp_frame.window.location;
	if (c_debug == 'Finish_Right') alert('Finish_Right - Right Frame: ' + temp_frame.window.location);

	//Load the next window to the left into the left hidden window
	left_frame.window.location = next_src;
	if (c_debug == 'Finish_Right') alert('Finish_Right - Next Frame: ' + next_src);
	
	//Hidden thumb to the left of the left thumb gets the next thumb to the left
	left_thumb_left.window.location = next_thumb;

	//Finish processing the scroll.
	Finish_Scroll();
}

//Finish processing the scroll and scroll again if necessary.
function Finish_Scroll()
{
	var callback_function = '';
	
	//Turn off the scrolling flag.
	b_sliding = 0;
	
	//Set up the next scroll if needed.
	if (b_continue_left)
	{
		b_continue_left = 0;
		callback_function = 'Scroll_Left()';
		setTimeout(callback_function, c_waittime);		
	}
	else if (b_continue_right)
	{
		b_continue_right = 0;
		callback_function = 'Scroll_Right()';
		setTimeout(callback_function, c_waittime);		
	}
	else if (b_continue_up)
	{
		b_continue_up = 0;
		show_menu();
	}
	else if (b_continue_about)
	{
		b_continue_about = 0;
		show_slides(c_about);
	}
	else if (b_continue_jewelry)
	{
		b_continue_jewelry = 0;
		show_slides(c_portfolio);
	}
}

//Get_Index returns the index of the current slide in the area.
function Get_Index()
{
	if (c_debug == 'Get_Index') alert("Get_Index: " + area_index);
	
	return area_index;
}

//Get_Slide returns the specified slide in the area.
//If the specified slide is outside the area, Get_Slide returns the first or last
//slide, depending on the whether the specified slide is greater than or less than the area.
function Get_Slide(index)
{
	//c_debug = "Get_Slide";
	
	//if (c_debug == 'Get_Slide') alert("Get_Slide");
	
	if (index < 0)
		index = area_total + index;
	if (index >= area_total)
		index = index - area_total;
  if (c_debug == 'Get_Slide') alert ('Get_Slide - Area: ' + area + ' index: ' + index + ' slide: ' + area_list[index]);
  return area_list[index];
}

//Callback function to perform movement to the slide show frame.
function Menu_Show(n_loopcounter)
{
	var total_time = 100;
	var top_end = 100;
	var height_string = "";
	var callback_function = "";
	
	//c_debug = "Menu_Show";
	
	//Save the current index.
	Save_Index();
	
	//Slide the menu down.
	if (n_loopcounter <= top_end)
	{
		//Set the new width
		height_string = (n_loopcounter) + '%,' + (100 - (n_loopcounter)) + '%';
		parent.document.getElementById('MAINMENU').setAttribute('rows', height_string, 0);			
		if (c_debug == 'Menu_Show') alert(height_string);


		//Restart the timer that will slide the slides window over the menu window.
		n_loopcounter = n_loopcounter + 1;
		callback_function = "Menu_Show(" + n_loopcounter + ")";
		setTimeout(callback_function, c_waittime);
	}
	
	//Finish the scrolling.
	Finish_Scroll();
}

//Load the pages for the selected area.
function Load_Pages()
{
	//Assign the frames
	var active_frame = parent.frames["ACTIVE"];
	var right_frame = parent.frames["PAGERIGHT"];
	var left_frame = parent.frames["PAGELEFT"];
	var temp_frame = parent.frames["PAGETEMP"];
	var left_thumb_left = parent.frames["PREVIOUSLEFT"];
	var left_thumb_active = parent.frames["SCROLLLEFT"];
	var left_thumb_right = parent.frames["NEXTLEFT"];
	var right_thumb_left = parent.frames["PREVIOUSRIGHT"];
	var right_thumb_active = parent.frames["SCROLLRIGHT"];
	var right_thumb_right = parent.frames["NEXTRIGHT"];
	
	//Assign the slide names
	var index = Get_Index();
	var slide_active = Get_Slide(index);
	var slide_left = Get_Slide(index - 1);
	var slide_left_prev = Get_Slide(index - 2);
	var slide_right = Get_Slide(index + 1);
	var slide_right_next = Get_Slide(index + 2);
	
	//Assign the directories
	var slides_directory = '../Slides/';
	var thumbs_directory = '../Thumbs/';

	//c_debug = "Load_Pages";

	//Set the center page and matching scroll thumbs
	if (c_debug == 'Load_Pages') alert("Load_Pages - " + slides_directory + slide_active);
	active_frame.window.location = slides_directory + slide_active;
	left_thumb_right.window.location = thumbs_directory + slide_active;
	right_thumb_left.window.location = thumbs_directory + slide_active;
	
	//Set the left thumbnail and off-left page
	left_thumb_active.window.location = thumbs_directory + slide_left;
	left_frame.window.location = slides_directory + slide_left;
	
	//Set the right thumbnail and off-right page
	right_thumb_active.window.location = thumbs_directory + slide_right;
	right_frame.window.location = slides_directory + slide_right;
	
	//Set the off-left thumbnail
	left_thumb_left.window.location = thumbs_directory + slide_left_prev;
	
	//Set the off-right thumbnail
	right_thumb_right.window.location = thumbs_directory + slide_right_next;
	
}

//Next_Slide moves to the next slide in the area.
//If the beginning of the list is reached, it loops back to the end of the list.
function Next_Slide()
{
	alert("Next_Slide");
}

//Previous_Slide moves to the previous slide in the area.
//If the end of the list is reached, it loops back to the top of the list.
function Previous_Slide()
{
	alert("Previous_Slide");
}

//Save the previous index value so it can be used if the area is opened again.
function Save_Index()
{
	//Save the current area index with its area's list.
	if (parent.area == c_home) 
		parent.slide_index = Get_Index();
		
	if (parent.area == c_about)
		parent.about_index = Get_Index();
		
	if (parent.area == c_portfolio)
		parent.portfolio_index = Get_Index();
}

//Scroll to the Left
function Scroll_Left()
{
	var n_loopcounter = 1;
	var callback_function = "Slide_Right(1)";
	
	if (c_debug == 'Scroll_Left') alert("Scroll Left");
	
	//Set up the next scroll if already scrolling.
	if (b_sliding)
	{
		//Cancel any active continue right if left is selected.
		if (b_continue_right) 
		{
			b_continue_right = 0;
		}
		else
		{
			b_continue_left = 1;
		}
		return;
	}
	
	//Turn on the already scrolling flag.
	b_sliding = 1;

	//Start the timer that will slide the left window over the active window.
	setTimeout(callback_function, c_waittime);
}

//Scroll to the right
function Scroll_Right()
{
	var n_loopcounter = 1;
	var callback_function = "Slide_Left(1)";
	
	if (c_debug == 'Scroll_Right') alert("Scroll Right");

	//Set up the next scroll if already scrolling.
	if (b_sliding)
	{
		//Cancel any active continue left if right is selected.
		if (b_continue_left) 
		{
			b_continue_left = 0;
		}
		else
		{
			b_continue_right = 1;
		}
		return;
	}
	
	//Turn on the already scrolling flag.
	b_sliding = 1;

	//Start the timer that will slide the left window over the active window.
	setTimeout(callback_function, c_waittime);
}

function scroll_slide(self_name)
{
	if (c_debug == 'scroll_slide') alert('scroll_slide(' + self_name + ')');
	
	//If the parent name is SCROLLRIGHT then scroll to the right.
	if ((self_name == 'SCROLLRIGHT') || (self_name == 'BOTTOMRIGHT'))
	{
		//Scroll to the Right
  	if (c_debug == 'scroll_slide') alert('Scrolling to the Right');
		top.Scroll_Right();
	}
	
	//If the parent name is SCROLLLEFT then scroll to the left.
	if ((self_name == 'SCROLLLEFT') || (self_name == 'BOTTOMLEFT'))
	{
		//Scroll to the Left
  	if (c_debug == 'scroll_slide') alert('Scrolling to the Left');
		top.Scroll_Left();
	}
}

//Set_Area changes the area of the website.
//This function must be called from a frame.
function Set_Area(newarea, layer)
{
	var slides_prefix = "Slides/";
	var thumbs_prefix = "./";
	
	if (c_debug == 'Set_Area') alert("Set_Area " + newarea);

	//Don't do anything if the area is already set.
	if (parent.area == newarea) 
	{
		if (c_debug == 'Set_Area') alert("No area change");
		
		return parent.area;
	}

	if (c_debug == 'Set_Area') alert("Area change");
	
 	//Set the area to the specified area.
	parent.area = newarea;
		
	//Set the filename prefixes based on the layer the frame source is in.
	if (layer == 1)
	{
		slides_prefix = "./";
		thumbs_prefix = "../";
	}
	
	//Home area
	if (parent.area == c_home)
	{
		if (c_debug == 'Set_Area') alert ("Home Area");
		
		//Set the area variables to the slides list values.
		parent.area_list = parent.slide_list;
		Set_Index(parent.slide_index);
		parent.area_total = parent.slide_total;

		if (c_debug == 'Set_Area') alert ("Home Area Complete");
	}
	
	//About area
	if (parent.area == c_about)
	{
		if (c_debug == 'Set_Area') alert ("About Area");

		//Set the area variables to the about list values.
		parent.area_list = parent.about_list;
		Set_Index(parent.about_index);
		parent.area_total = parent.about_total;

		if (c_debug == 'Set_Area') alert ("About Area Complete");
	}
	
	//Portfolio area
	if (parent.area == c_portfolio)
	{
		if (c_debug == 'Set_Area') alert ("Portfolio Area");
		
		//Set the area variables to the portfolio list values.
		parent.area_list = parent.portfolio_list;
		Set_Index(parent.portfolio_index);
		parent.area_total = parent.portfolio_total;

		if (c_debug == 'Set_Area') alert ("Portfolio Area Complete");
	}
	
	return area;
}

//Set_Index moves to the index-specified slide in the area.
//If the end of the list is reached, it loops back to the top of the list.
//If the top of the list is surpassed, it loops to the end of the list.
function Set_Index(new_index)
{
	//c_debug = "Set_Index";
	
	//if (c_debug == 'Set_Index') alert("Set_Index: " + new_index);
	
   area_index = new_index;
  if (area_index < 0) 
    area_index = area_total - 1;
  if (area_index >= area_total) 
    area_index = area_index - area_total;
  if (c_debug == 'Set_Index') alert ('Set_Index - Area ' + area + ' slide ' + area_index + ' ' + area_list[area_index]);
  return area_index;
}

//Slide the menu page over the slides pages.
function show_menu()
{
	var callback_function = "Menu_Show(1)";
	
	//c_debug = "show_menu";
	
	//Set up the next scroll if already scrolling.
	if (b_sliding)
	{
		//alert ('b_sliding = 1');
		
		//Cancel any active continue right if left is selected.
		if (b_continue_about || b_continue_jewelry) 
		{
			b_continue_about = 0;
			b_continue_jewelry = 0;
		}
		else
		{
			b_continue_up = 0;
		}
		//alert ('done');
		return;
	}
	
	//Turn on the already scrolling flag.
	b_sliding = 1;
	
	//Save the index of the slideshow.
	Save_Index();
	
	//Load the starting pages for the slideshow.
	if (c_debug == 'show_menu') alert("show_menu");

	//Start the timer that will slide the left window over the active window.
	setTimeout(callback_function, c_waittime);
}

//Slide the slides pages over the menu page.
function show_slides(area)
{
	var callback_function = "Slide_Show(1)";
	//c_debug = "show_slides";
	
	//Set up the next scroll if already scrolling.
	if (b_sliding)
	{
		//Cancel any active continue up if slides are selected.
		if (b_continue_up) 
		{
			b_continue_up = 0;
		}
		else
		{
			b_continue_about = 0;
			b_continue_jewelry = 0;
		}
		return;
	}
	
	//Turn on the already scrolling flag.
	b_sliding = 1;
	
	//Set the area of the slideshow.
	Set_Area(area, 1);
	
	//Load the starting pages for the slideshow.
	Load_Pages();
	
	if (c_debug == 'show_slides') alert("show_slides");

	//Start the timer that will slide the left window over the active window.
	setTimeout(callback_function, c_waittime);

	//Finish the scrolling.
	Finish_Scroll();
}

//Slide the window to the left.
function Slide_Left(n_loopcounter)
{
	var active_frame = parent.frames["ACTIVE"];
	var right_frame = parent.frames["PAGERIGHT"];
	var left_frame = parent.frames["PAGELEFT"];
	var temp_frame = parent.frames["PAGETEMP"];
	var left_thumb_left = parent.frames["PREVIOUSLEFT"];
	var left_thumb_active = parent.frames["SCROLLLEFT"];
	var left_thumb_right = parent.frames["NEXTLEFT"];
	var right_thumb_left = parent.frames["PREVIOUSRIGHT"];
	var right_thumb_active = parent.frames["SCROLLRIGHT"];
	var right_thumb_right = parent.frames["NEXTRIGHT"];
	var right_width = 0;
	var right_src = "";
	var active_width = 70;
	var total_time = 90;
	var left_end = 20;
	var right_start = 70;
	var main_start = 10;
	var main_end = 80;
	var active_src = "";
	var next_src = "";
	var width_string = "";
	var callback_function = "";
	
	//Turn off scrolling on the active frame to keep scroll bars from showing up.
	active_frame.scrolling=0;

	//Slide the right hidden window over the center window
	if (n_loopcounter <= total_time) 
	{
  	//if (c_debug == 'Slide_Left') alert(n_loopcounter);
  	
		//Slide the Right thumbnail.
		if (n_loopcounter <= left_end)
		{
			//Set the new width
			width_string = '0%, ' + (100 - (n_loopcounter * 5)) + '%,' + (n_loopcounter * 5) + '%';
			parent.document.getElementById('RIGHTTHUMB').setAttribute('cols', width_string, 0);			
		}

		//Slide the Left thumbnail.
		if (n_loopcounter > right_start)
		{
			//Set the new width
			width_string = '0%, ' + (100 - ((n_loopcounter - right_start) * 5)) + '%, ' + ((n_loopcounter - right_start) * 5) + '%';
			parent.document.getElementById('LEFTTHUMB').setAttribute('cols', width_string, 0);			
		}
		
		//Slide the Middle window.
		if ((n_loopcounter > main_start) && (n_loopcounter <= main_end)) 
		{
			right_width = n_loopcounter;
			active_width = main_end - n_loopcounter;
			width_string = '15%, 0%, ' + active_width + '%, ' + right_width + '%, 0%, 15%';
			//width_string = '15%, ' + left_width + '%, ' + active_width + '%, 0%, 15%';
			//if (c_debug == 'Slide_Left') alert(width_string);
			
			//parent.document.body.cols = width_string;
			parent.document.getElementById('FLIPBOOK').setAttribute('cols', width_string, 0);
		}
			
		//Set up the next callback.
		n_loopcounter = n_loopcounter + 1;
		callback_function = 'Slide_Left(' + n_loopcounter + ')';
		
		//Restart the timer that will slide the left window over the active window.
		setTimeout(callback_function, c_waittime);
	}
	else 
	{
		//Turn scrolling back on for the active frame.
		active_frame.scrolling = 1;
		
		//Get the source of the right frame.
		right_src = right_frame.window.location;
		
		//Get the source of the active frame.
		active_src = active_frame.window.location;
		
		//Set the Center window source equal to the right hidden window's source.
		active_frame.window.location = right_src;
		if (c_debug == 'Slide_Left') alert('Active Frame: ' + right_src);
		
		//Move the Left thumb to the left
		//Set the hidden thumb to the left of the left thumb equal to the left thumb.
		left_thumb_left.window.location = left_thumb_active.window.location;
		if (c_debug == 'Slide_Left') alert('Left thumb left: ' + left_thumb_left.window.location);
		
		//Update the active thumb with the one that just slid over it.
		left_thumb_active.window.location = left_thumb_right.window.location;
		if (c_debug == 'Slide_Left') alert('Left thumb active: ' + left_thumb_active.window.location);

		//Move the Right thumb to the left
		//Move the previously active right thumb to the thumb to the right of the left active
		//and to the left of the right active.
		right_thumb_left.window.location = right_thumb_active.window.location;
		left_thumb_right.window.location = right_thumb_active.window.location;
		
		//Update the active thumb with the one that just slid over it.
		right_thumb_active.window.location = right_thumb_right.window.location;
		
		//Set up the temporary frame.
		temp_frame.window.location = active_src;
		
		//Set up the callback
		callback_function = "Finish_Left()";
		//c_debug = 'Slide_Left';
		if (c_debug == 'Slide_Left') alert('Slide_Left: ' + callback_function);

		//Restart the timer that will slide the left window over the active window.
		setTimeout(callback_function, c_waittime);
	}
}

//Slide the window to the right.
function Slide_Right(n_loopcounter)
{
	var active_frame = parent.frames["ACTIVE"];
	var left_frame = parent.frames["PAGELEFT"];
	var right_frame = parent.frames["PAGERIGHT"];
	var temp_frame = parent.frames["PAGETEMP"];
	var left_thumb_left = parent.frames["PREVIOUSLEFT"];
	var left_thumb_active = parent.frames["SCROLLLEFT"];
	var left_thumb_right = parent.frames["NEXTLEFT"];
	var right_thumb_left = parent.frames["PREVIOUSRIGHT"];
	var right_thumb_active = parent.frames["SCROLLRIGHT"];
	var right_thumb_right = parent.frames["NEXTRIGHT"];
	var left_width = 0;
	var left_src = "";
	var active_width = 70;
	var total_time = 90;
	var left_end = 20;
	var right_start = 70;
	var main_start = 10;
	var main_end = 80;
	var width_string = "";
	var callback_function = "";
	
	//Turn off scrolling on the active frame to keep scroll bars from showing up.
	active_frame.scrolling=0;

	//Slide the Left hidden window over the center window
	if (n_loopcounter <= total_time) 
	{
  	if (c_debug == 'Slide_Right-slider') alert(n_loopcounter);
  	
		//Slide the Left thumbnail.
		if (n_loopcounter <= left_end)
		{
			//Set the new width
			width_string = (n_loopcounter * 5) + '%, ' + (100 - (n_loopcounter * 5)) + '%, 0%';
			parent.document.getElementById('LEFTTHUMB').setAttribute('cols', width_string, 0);			
		}

		//Slide the Right thumbnail.
		if (n_loopcounter > right_start)
		{
			//Set the new width
			//width_string = '0%, ' + (100 - ((n_loopcounter - 50) * 5)) + '%, ' + ((n_loopcounter - 50) * 5) + '%';
			width_string = ((n_loopcounter - right_start) * 5) + '%, ' + (100 - ((n_loopcounter - right_start) * 5)) + '%, 0%';
			parent.document.getElementById('RIGHTTHUMB').setAttribute('cols', width_string, 0);			
		}
		
		//Slide the Middle window.
		if ((n_loopcounter > main_start) && (n_loopcounter <= main_end)) 
		{
			//Slide the active window.
			left_width = n_loopcounter - main_start;
			active_width = main_end - n_loopcounter;
			width_string = '15%, ' + left_width + '%, ' + active_width + '%, 0%, 0%, 15%';
			//if (c_debug == 'Slide_Right') alert(width_string);
			
			//parent.document.body.cols = width_string;
			parent.document.getElementById('FLIPBOOK').setAttribute('cols', width_string, 0);
		}
		
		//Set up the next callback.
		n_loopcounter = n_loopcounter + 1;
		callback_function = 'Slide_Right(' + n_loopcounter + ')';

		//Restart the timer that will slide the left window over the active window.
		setTimeout(callback_function, c_waittime);
	}
	else 
	{
		//Turn scrolling back on for the active frame.
		active_frame.scrolling = 1;
		
		//Get the source of the left frame.
		left_src = left_frame.window.location;
			
		//Get the source of the active frame.
		active_src = active_frame.window.location;
	
		//Set the Center window source equal to the Left hidden window's source.
		active_frame.window.location = left_src;
		if (c_debug == 'Slide_Right') alert('Active Frame: ' + left_src);
		
		//Move the Right thumb to the right
		//Set the hidden thumb to the right of the right thumb equal to the right thumb.
		right_thumb_right.window.location = right_thumb_active.window.location;
		if (c_debug == 'Slide_Right' == 'Thumbs') alert('Right thumb right: ' + right_thumb_right.window.location);
		
		//Update the active thumb with the one that just slid over it.
		right_thumb_active.window.location = right_thumb_left.window.location;

		//Move the Left thumb to the right
		//Move the previously active left thumb to the thumb to the right of the left active
		//and to the left of the right active.
		left_thumb_right.window.location = left_thumb_active.window.location;
		right_thumb_left.window.location = left_thumb_active.window.location;
		
		//Update the active thumb with the one that just slid over it.
		left_thumb_active.window.location = left_thumb_left.window.location;
		
		//Set up the temporary frame.
		temp_frame.window.location = active_src;
		
		//Set up the callback
		callback_function = "Finish_Right()";
		//c_debug = 'Slide_Right';
		if (c_debug == 'Slide_Right') alert('Slide_Right: ' + callback_function);

		//Restart the timer that will slide the left window over the active window.
		setTimeout(callback_function, c_waittime);
	}
}

//Callback function to perform movement to the slide show frame.
function Slide_Show(n_loopcounter)
{
	var total_time = 100;
	var bottom_end = 100;
	var height_string = "";
	var callback_function = "";
	
	//c_debug = "Slide_Show";
	
	//Slide the slides up.
	if (n_loopcounter <= bottom_end)
	{
		//Set the new width
		height_string = (100 - (n_loopcounter)) + '%,' + (n_loopcounter) + '%';
		parent.document.getElementById('MAINMENU').setAttribute('rows', height_string, 0);			
		if (c_debug == 'Slide_Show') alert(height_string);

		//Restart the timer that will slide the slides window over the menu window.
		n_loopcounter = n_loopcounter + 1;
		callback_function = "Slide_Show(" + n_loopcounter + ")";
		setTimeout(callback_function, c_waittime);
	}
}


