$(document).ready(function() {
	watermark($('#comment'), "Comment");
	watermark($('#author'), "Name (required)");
	watermark($('#email'), "E-Mail (will not be published) (required)");
	watermark($('#url'), "Website");
	
	$('button#submit').hover(
		function(){
			$(this).css({'cursor':'pointer'});
			$(this).html('<img src="/wp-content/themes/cuinsider/images/btn-add-comment-hover.png" />');
		},
		function(){
			$(this).html('<img src="/wp-content/themes/cuinsider/images/btn-add-comment.png" />');
		}
	);
	
	$('input#searchsubmit').hover(
		function(){
			$(this).css({
				'cursor':'pointer',
				'backgroundImage':'url(/wp-content/themes/cuinsider/images/btn-go-hover.png)'
			});
		},
		function(){
			$(this).css({
				'backgroundImage':'url(/wp-content/themes/cuinsider/images/btn-go.png)'
			});
		}
	);
});

function watermark(obj, text) {
	// set the watermark text
	$(obj).val(text);
	
	// clear on focus
	$(obj).focus(function() {
		if ($(obj).val() == text) {
			$(obj).val('');
		}
	});
	
	// restore on blur
	$(obj).blur(function() {
		if ($(obj).val() == '') {
			$(obj).val(text);
		}
	});
}