var place = 0;

function startup()
{
	var pic = path + img[0][0];
	
	story_display(pic);
	story_text(img[0][1]);
	preload();
}

function preload()
{
	var i = 0;
	
	preload_image_object = new Image();
	for (i = 0; i <= limit; i++) preload_image_object.src = path + img[i][0];
}

function story_display(place)
{
	$('.showy').hide();
	$('#lyr' + place).show();
	//$('body').css({backgroundImage: 'url(' + pic + ')', backgroundPosition: 'center center', backgroundRepeat: 'no-repeat'});
}

function do_next()
{
	place = (place + 1 > limit - 1) ? 0 : place + 1;
	story_display(place);
	//story_text(img[place][1]);
}

function do_prev()
{
	place = (place - 1 < 0) ? limit - 1 : place - 1;
	story_display(place);
	//story_text(img[place][1]);
}

function story_text(text)
{
	$('#the-text').html(text);
}