$(document).ready(function() {
	// Default input text replace
	$("input[type=text],textarea").each(function() {
		$(this).attr("default", $(this).attr("value"));

		$(this).focus(function() {
			if ($(this).attr("value") == $(this).attr("default")) {
				$(this).attr("value", "");
			}
		}).blur(function() {
			if ($(this).attr("value") == "") {
				$(this).attr("value", $(this).attr("default"));
			}
		});
	});
	// BG Tag Show
	$('#bg-tag').click(function(){
   		var w = $(this).outerWidth();
		$(this).animate({ right: -w}, 200, 
			function(){
				$('#bg-tag-expanded').animate({right:0}, 200);
			});
   		return false;
   });
   // BG Tag Hide
   $('#btn-close').click(function(){
   		$('#bg-tag-expanded').animate({right: -225}, 200,
   			function(){
   				$('#bg-tag').animate({right: 0}, 200);
   				$('.h').fadeIn('fast');
   			});
   		return false;
   });
   // Hide all content
   $('#view-bg').click(function(){
   		var t = $(this).text();
   		if(t == 'See the Full Background') {
   			$(this).text('Show the Full Site');
   		} else {
   			$(this).text('See the Full Background');
   		}
   		$('.h').toggle();
   		return false;
   });
   // Search button submit
   $('#btn-search').click(function(){
   		$('form#search').submit();
   		return false;
   });
});
