function play_story (new_story)
{
	var ele_in;
	var ele_out;
	var idx_in;
	var idx_out;
	
	var old_story;
	
	var container = document.getElementById ('story_container');
			
	total_story = container.total_story;
	old_story = container.active_story;
	
	if (old_story)
	{
		if ((ele_in = document.getElementById ('story' + new_story)) &&
			(ele_out= document.getElementById ('story' + old_story)))
		{
			fade_out (ele_out.id);
			fade_in (ele_in.id);
			
			idx_in = document.getElementById ('index' + new_story);
			idx_out = document.getElementById ('index' + old_story);
			
			idx_in.className = "player_index_active";
			idx_out.className = "player_index";
			
		}
	}
	else
	{
		if (ele_in = document.getElementById ('story' + new_story))
		{
			fade_in (ele_in.id);
			
			idx_in = document.getElementById ('index' + new_story);				
			idx_in.className = "player_index_active";
			
			if (total_story > 1)
			{
			    story_playing = window.setInterval ("advance_story(1);", 9000);
			    container.playing = story_playing;
			}
		}
	}
	
	container.active_story = new_story;
}

function advance_story (advance)
{
	var container = document.getElementById ('story_container');

	total_story = container.total_story;
	old_story = container.active_story;
	
	old_story += advance;

	if (old_story > total_story)
	{
		old_story = 1;
	}
	if (old_story < 1)
	{
		old_story = total_story;
	}
	
	
	play_story (old_story);
}
	
function play_pause ()
{
	var container = document.getElementById ('story_container');
	
	if (container.playing != 0)
	{
		clearInterval (container.playing);
		
		var play_pause = document.getElementById ('play_pause');
		play_pause.innerHTML = "<img src='_img/rotator/controls_play.gif' border='0' alt='Play' />";
		container.playing = 0;
	} 
	else
	{
		container.playing = window.setInterval ("advance_story(1);", 10000);	

		var play_pause = document.getElementById ('play_pause');
		play_pause.innerHTML = "<img src='_img/rotator/controls_pause.gif' border='0' alt='Pause' />";
	} 
}