var labelToggle = function(l) {
	var el = $('#' + l);
	if (el.length != 0) {
		el.focus(function(){
			if ($(this).val() == $(this).attr('title')) $(this).val('');
		});
		el.blur(function(){
			if ($(this).val() == '') $(this).val($(this).attr('title'));
		});
	}		
};

$(document).ready(function(){
	labelToggle('s');
	var f = $('#commentform');
	var t = null;
	if (f.length != 0) {
		f.find('input').each(function(){
			if ($(this).attr('type') == 'text') {
				labelToggle($(this).attr('id'));
			}
		});
		f.find('textarea').each(function(){
			labelToggle($(this).attr('id'));
		});
	}

	/*-- search form validation --*/
	$('#searchsubmit').click(function(){
		if($('#s').val() == $('#s').attr('title')) {
			$('#s').focus();
			return false;
		}
	});

});
