jQuery.noConflict();
jQuery(document).ready(function () {
	jQuery('#comment_form input, #comment_form textarea').each(function () {
		if (jQuery(this).val() == '') {
			jQuery(this).val(jQuery(this).attr('defaultvalue'));
		}
	}).focus(function () {
		jQuery(this).removeClass('inputerror');
		if (jQuery(this).val() == jQuery(this).attr('defaultvalue')) {
			jQuery(this).val('');
		}
	}).blur(function () {
		if (jQuery(this).val() == '') {
			jQuery(this).val(jQuery(this).attr('defaultvalue'));
		}
	});
	jQuery('#comment_form').submit(function () {
		jQuery('#submiterror').remove();
		var errors = 0;
		jQuery(this).find('textarea, input').each(function () {
			if (jQuery(this).val() == jQuery(this).attr('defaultvalue')) {
				jQuery(this).val('');
			}
			if (jQuery(this).hasClass('required') && jQuery(this).val() == '') {
				jQuery(this).addClass('inputerror');
				errors++;
			}
		});

		if (errors > 0) {
			jQuery(this).find('textarea, input').each(function () {
				if (jQuery(this).val() == '') {
					jQuery(this).val(jQuery(this).attr('defaultvalue'));
				}
			});
			jQuery(this).prepend('<div id="submiterror">Please complete the highlighted fields.</div>');
			return false;
		}
		return true;
	});
});
