$(document).ready(function(){
	
	$('#home-slideshow').cycle()

	$("#mailing-list-signup input").focus(function() {
		if ($(this).val() == $(this).attr("alt")) {
			$(this).val('');
		}
	});
	
	$("#mailing-list-signup input").blur(function() { 
		if ($(this).val() == '') {
			$(this).val($(this).attr("alt"));
		}
	});
	
	$("img.image_item").each(function() {
	    var img_class = $(this).attr('class');
	    var img_caption = ($(this).attr('alt') != undefined) ? $(this).attr('alt') : '';
	    var imagespan = $('<span/>').attr('class', img_class).css('display', 'block');
	    $(this).removeAttr('class').wrap(imagespan);
	    $('<span class="image_caption">'+img_caption+'</span>').insertAfter(this);
	});

	$("a[rel*='colorbox']").colorbox();

	getTweets();

});

function getTweets() {
	$("#footer-tweets").hide("slow");
	$("#footer-tweets").load("/tweets.php?username="+twitter_username, '', callback);
}

function callback() {
	$("#footer-tweets").show("slow");
	setTimeout("getTweets();", 100000);
}
