$(document).ready(function(){
	$("#top_nav a img").hover(
		function()
		{
			$(this).css("margin-top","-42px");
		},
		function()
		{
			$(this).css("margin-top","0px");
		}
	);
	$("form input[type='image']").hover(
		function()
		{
			$(this).attr("src", $(this).attr("src").replace("OFF","ON"));
		},
		function()
		{
			$(this).attr("src", $(this).attr("src").replace("ON","OFF"));
		}
	);

	$("#top_nav form input[type='image']").click(function(event){
		if($(this).attr("src").indexOf('Web')!=-1)
		{
			event.preventDefault();
			window.open("http://search.live.com/results.aspx?q="+$(this).parent().children("input[type='text']").val());
		}
	});

	$(".signup form").submit(function(event){
		event.preventDefault();
		$(".signup h4").html("");
		var user_email = $(".signup form input").attr("value");
		$(".signup h4").load("/tosh.0/wp-content/themes/tosh/subscribe.php", {email:user_email});
	});
	
	// Comments set up.
	if ($("#commentform")) {
		var textVal = $("#comment").val();
		var nameVal = $("#author").val();
		
		if (textVal == "" || textVal == "Add a comment...") {
			$("#comment").val("Add a comment...");
			$("#comment").css("color", "#cccccc");
		}
		if (nameVal == "" || nameVal == "Name") {
			$("#author").val("Name");
			$("#author").css("color", "#cccccc");
		}
		
		$("#author").click(function() {
			$(this).css("color", "#000000");
			if ($(this).val() == "Name") $(this).val("");
		});
		$("#comment").click(function() {
			$(this).css("color", "#000000");
			if ($(this).val() == "Add a comment...") $(this).val("");
		});
		$("#comment").focus(function() {
			$(this).css("color", "#000000");
			if ($(this).val() == "Add a comment...") $(this).val("");
		});
	
	}
});
