$(function() {
	$("input#message").val("Enter a short message").css('color','#999');
	$("body").append('<div id="bigPhoto"><img src="resources/toni.jpg" alt="Click to close"/></div>');
	$("a#photo").hover(function(){
	    $("a#photo img").filter(":not(:animated)").fadeOut();
	}, function() {
	    $("a#photo img").fadeIn();
	});
	$("a#photo, a#photo img").bind("click", function(e){
		e.preventDefault();
		$("div#bigPhoto").fadeIn("quick");
	});
	$("div#bigPhoto img").bind("click", function(e){
		$("div#bigPhoto").fadeOut("quick");
	});
	$("h1").bind("click", function(){
		$(this).filter(":not(:animated)").animate({left: '+=20'},150).animate({left: '-=50'},100).animate({left: '+=30'},80).animate({left: '+=5'},30).animate({left: '-=10'},50).animate({left: '+=5'},30);
	});
	$("input#message").bind("focus", function(e){
		if($(this).val()=="Enter a short message")
			$(this).val("").css("color","#000");
	});
	$("form").bind("submit", function(e){
		e.preventDefault();
		send=$("form input:last").val();
		$("form input:last").attr("disabled","disabled").val("Sending...");
		$.post($(this).attr("action"), $(this).serialize(), function(response){
			if(response) {
				box=$("input#message");
				box.fadeTo(100, 0.01, function(e) {
					box.val("Thank You!");
					box.attr("disabled","disabled");
					box.fadeTo(2000, 1);
					$("form input:last").fadeOut(2000);
				});
			} else {
				alert("Sorry, failed to send message. Try emailing me instead.");
			}
		});
	});
});
