onload=function() {
	fwis_nav_in_motion = 0;
	setTimeout( 'fwis_nav_move()', 3000 ); 
	$('fwis_nav_mover').style.backgroundColor = 'white';
	$('fwis_nav_trigger').style.backgroundColor = 'white';
	}
var fwis_nav_in_motion = 1;

function fwis_nav_move() {
	if( fwis_nav_in_motion == 0 ) {
		fwis_nav_in_motion = 1;
		var x = ( $('fwis_nav_listage').style.left == '17px' ) ? -17 : 17;
		Effect.MoveBy( 'fwis_nav_listage', 0, x, { duration:.5, afterFinish:function() { fwis_nav_in_motion = 0; } } );
		}
	}

function show_detail( detail_id, thumb, view_type, view_id, direction ) {
	adjustHeight();
	$('detail_window').style.display = 'block'; 
	new Ajax.Updater(
		'detail_caption', 
		'/cerealboxes/cerealboxes.php?action=show_detail&view_type=' + view_type + 
				'&view_id=' + view_id + 
				'&direction=' + direction + 
				'&id=' + detail_id, 
			{			
			onComplete:function() { 
				if( document.all )
					z = document.documentElement.scrollTop;
				else z = window.pageYOffset;
				$('detail_caption').style.top = ( z + 80) + 'px';
				adjustHeight(); // again because the additional images might bump the height
				}
			} 
		);
	}

function adjustHeight() {
	var y;
	if( document.all ) { // stupid msie stupid
		y = document.documentElement.scrollHeight;
		if( document.documentElement.clientHeight > y ) // if the page is shorter than the window, use window height
			y = document.documentElement.clientHeight;
		}
	else {
		dimensions = Array( document.body.scrollHeight, 
							document.body.offsetHeight, 
							( window.innerHeight + window.scrollMaxY ) );
		dimensions.sort( function(a,b) { return b - a; } ); // reverse sort
		y = dimensions[0]; // largest value
		}
	y = y + 100;
	$('detail_background').style.height = y + 'px';
	}

function hide_detail() {
	$('detail_window').style.display = 'none';
	$('detail_caption').innerHTML = '';
	}
