function swapRandomImages() {
	
	toappear = largeimages[Math.round(largeimages.length * Math.random())];
	
	Effect.Fade(nowappearing, { queue: 'start' });
	Effect.Appear(toappear, { queue: 'end' });
	
	var temp = nowappearing;
	nowappearing = toappear;
	toappear = temp;
}

/**
  *	Don't forget about Event.toggle for the menus!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  *
  **/

var largeimages = new Array();
var nowappearing;
var toappear;
var pe;

Event.observe(window, 'load', 
	function () 
	{ 
		largeimages = $$('div#content img.largeimage');
		nowappearing = largeimages[Math.round(largeimages.length * Math.random())];
		Effect.Appear(nowappearing, { queue: 'start' });
		pe = new PeriodicalExecuter(swapRandomImages, 5);
		
		/**
		  *	Setup the onclick events that fire off whenever someone clicks on a thumbnail image
		  * and it blows up into the larger image onscreen subsequently stopping the random image swap
		  */
		$$('div#content ul#imagelist li a img').each( 
									function (e) 
									{ 
										e.parentNode.href="#";  // zero out the img's parent 'a' tag's href
										
										Event.observe(e, 'click', 
											function () 
											{
												pe.currentlyExecuting = true;  // stop the random swapping
																				// of images 
												Effect.Fade(nowappearing, { queue: 'start' }); 
												
												largeimages.each( 
													function(image) {
														if(image.src == e.src)
														{
															Effect.Appear(image, { queue: 'end' });
															nowappearing = image;
															return;
														}
													} );
											}); 
									} 
								);
								
								
		$$('h2 a').each(
				function(e)
				{
					e.href="#"; // zero out the href so we can do javascript menu expansion
					
					Event.observe(e, 'click', 
						function () 
						{
							$$('#sidemenu div ul.submenu').each(
									function(e)
									{
										Effect.BlindUp(e, {duration: 0.5, queue: 'start'});
									}
								);
								
							var submenu = e.parentNode.parentNode.getElementsByTagName("ul")[0];
							Effect.toggle(submenu, 'blind', {duration: 0.5, queue: 'end'});
						}); 
				}
			);
	}
	);