function ulRotator (id, delay, transition)
	{
	// ulRotator written by Aaron Gough http://aarongough.com
	// under contract for Walden http://waldendesign.com and ALT software http://altsoftware.com
	
	// this script requires jQuery 1.2.1 or higher
	
	// this function rotates the displayed elements in the unordered list so that 2 elements are visible at any time
	// it animates the transition between displayed elements using the jQuery 'animate' function
	this.rotate = function ( closure ) 
		{
		if( closure )
			{
			return (function() {thisObj.rotate();});		
			}
		if( this.id == "" )
			{
			return;	
			}
		// this section of code is a fix for the windows version of firefox which has a bug that causes uneven firing of a setInterval timer
		clearInterval( this.interval );
		this.interval = setInterval( this.rotate( true ) , this.delay);
		
		ulItems = jQuery("#" + this.id + " li");
		ulItems.slice( this.index, this.index + 2 ).animate({left: "-" + this.width + "px", opacity: 'hide'}, this.transition);
		this.index += 2;
		if( this.index >= ulItems.length ) 
			{
			this.index = 0;	
			}
		ulItems.slice( this.index, this.index + 2 ).css('left',this.width).animate({left: 0, opacity: 'show'}, this.transition);
		}
		
	// this function pauses the rotation of the unordered list, it is activated when the the mouse is over the UL that is
	// assigned to this object. The first few lines of code return an anonymous function that calls this function in it's proper scope
	// and allows it to be used as an event handler
	this.mouseOver = function ( closure )
		{
		if( closure )
			{
			return (function() {thisObj.mouseOver();});		
			}	
		clearInterval( this.interval );
		}
		
	// this function resumes the rotation of the unordered list, it is activated when the the mouse leaves the UL that is
	// assigned to this object. The first few lines of code return an anonymous function that calls this function in it's proper scope
	// and allows it to be used as an event handler
	this.mouseOut = function ( closure )
		{
		if( closure )
			{
			return (function() {thisObj.mouseOut();});		
			}
		this.interval = setInterval( this.rotate( true ) , this.delay);
		}
	
	// here we have the constructor code for the object, it sets default values for any parameters that weren't supplied, and perform various
	// other tasks needed for the initalization of this individual object	
	if( !id ) 
		{
		return;	
		}
	this.id = id;
	this.delay = (delay) ? delay : 8000;
	this.transition = (transition) ? transition : 2000;
	this.width = jQuery("#" + this.id).width();
	this.index = 0;
	var thisObj = this;
	
	ulItems = jQuery("#" + this.id + " li");
	
	// here we work out how tall the UL needs to be to contain it's tallest pair of LI elements
	largest = 0;
	for( x = 0, ulLength = ulItems.length; x < ulLength; x += 2)
		{
		if( ( ulItems.slice(x, x + 1).height() + ulItems.slice(x + 1, x + 2).height() ) > largest )
			{
			largest = ( ulItems.slice(x, x + 1).height() + ulItems.slice(x + 1, x + 2).height() );
			}
		}
	// then we adjust the parent UL's height to prevent any accidental overflow
	this.ulHeight = largest + 20;
	jQuery("#" + this.id).height( this.ulHeight );
	
	jQuery("#" + this.id).css("position", "relative");
	ulItems.css("position", "absolute");
	
	// now we need to adjust the top position of each individual LI element. if it is an even number element ( including 0 ) then we align 
	// the top to 0px, else we align it to the height of the preceeding element + 10px
	lastElementHeight = 0;
	for( x = 0, ulLength = ulItems.length; x < ulLength; x++)
		{
		if( ( x % 2) ==  0 )
			{
			ulItems.slice(x, x + 1).css( "top", 0 );
			lastElementHeight = ulItems.slice(x, x + 1).height();
			}
		else
			{
			ulItems.slice(x, x + 1).css( "top", lastElementHeight + 10 );	
			}
		}
	
	// now we hide all the line elements except for the first two in preparation for the first animated transition
	ulItems.slice( this.index + 2 ).hide();
	
	// now we need to attach two event handlers that make the rotation stop when the mouse is over the list and resume when it leaves
	jQuery("#" + this.id).hover( this.mouseOver(true), this.mouseOut(true) );
	
	// and finally we set-up the timer for the rotation
	this.interval = setInterval( this.rotate( true ) , this.delay);
	
	}

function alt_site_menu_init()
	{
	// here we check that the jQuery object is loaded as we will need it for the effects on the sidebar. If it's not then we will simply 
	// do nothing.. the site will still look fine and function perfectly ( the beauty of unobtrusive javascript! )
	if( typeof(jQuery) == "function" )
		{
		// seeing as the jQuery object is present we will now use it to scroll the news and events items in 2 at a time
		// we will create 2 new instances of the ulRotator object and assign them to the news and events ULs
		newsRotator = new ulRotator( "whats_new_ul" );
		eventsRotator = new ulRotator( "events_ul" );
		}
	}
	
function fixPageHeight()
	{
	// now we need a quick script to make sure that the footer of the text section of the site
	// lines up with the footer
	pageFooter = jQuery("#page_footer");
	textWrapper = jQuery("#text_wrapper");
	var textHeight =  pageFooter.height() - 320;
	textWrapper.height( textHeight );	
	}
	
// here we detect whether or not the jQuery object is present and loaded, if it is we use it to add the document.ready event handler
// if it is not then nothing bad will happen... either way.. relax!
if( typeof(jQuery) == "function" )
	{
	jQuery(document).ready( alt_site_menu_init );
	}
	
window.onload = function()
	{
	setTimeout( fixPageHeight, 200 );
	};