function slideSwitch() {
	
	var active = $('.slideshow div.active');
	var next = active.next('div').length ? active.next('div') : $('.slideshow div:first');
	
	if (active.length == 0) {
		active = $('.slideshow div:last');
	}
	
	active.addClass('last-active');
	next.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0}, 1000, function() {
		active.removeClass('active last-active');
	});
}



/* onload starts here */
/**********************/

$(function() {
	
	// pick random beginning slide
	var slides = $('.slideshow').children('div').length;
	var randomSlide = Math.ceil(Math.random() * slides);
	$('.slideshow').children('div:nth-child(' + randomSlide + ')').addClass('active');
	
	// set slideshow interval
    setInterval("slideSwitch()", 5000);
	
	var $sfLi = $('ul#nav li');
	
	$sfLi.hover(function(){
		$(this).addClass('sfhover');
	}, function() {
		$(this).removeClass('sfhover');
	});
	
	$("#donation input[value=Submit]").click(function()
	{
		var $qty=$("#qty");
		
		if ((!$qty.val()) || isNaN($qty.val())) {
			alert("Please enter a valid donation amount.");
			return false;
		}
	});
	
});
