function preload(arrayOfImages) {
    $(arrayOfImages).each(function(){
    	$('body').append('<img id="preload"/>');
    	newImg = $('img#preload');
    	newImg.css('display', 'none');
    	newImg.attr('src', this);
    });
}

$(document).ready(function(){

	$('ul').each(function(){
		$(this).find('li:first').addClass('first');
		$(this).find('li:last').addClass('last');
	});

	// preload layout images
	preload([
	    '/images/design/tab_over.png',
	    '/images/design/bullets2.png'
	]);

	// shifter hover effect
	$('ul#shifter > li:not(.selected)').hover(
		function() {
			$(this).addClass('hovered');
		},
		function() {
			$(this).removeClass('hovered');
		}
	)

	/*
	// reverse topmenu items, so they show up left to right
	// add display: none to #topmenu in css when using this
	var topMenu = new Array();
	$('ul#topmenu > li').each(function(){
		topMenu.push($(this).html());
	});
	topMenu.reverse();
	$('ul#topmenu').html('');
	for (var i in topMenu) {
		itemContent = topMenu[i];
		$('ul#topmenu').append('<li>' + itemContent + '</li>');
	}
	$('ul#topmenu > li:last').addClass('first');
	$('ul#topmenu').show();
	*/

	$("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true);

	/* Home selection list */
	$('ul.homeOptions li').live('mouseover', function() {
		$(this).parent().find('li').removeClass('active');
		$(this).addClass('active');
	});
	$('ul.homeOptions li.active').live('click', function() {
		var link = $(this).find('a').attr('href');
		window.location = link;
	});


});
