var $j = jQuery.noConflict();

$j(document).ready(function(){
	// Default values for comments
	$j("#commentform #author").defaultValue("Name");
	$j("#commentform #email").defaultValue("Email (Optional)");
	$j("#commentform #url").defaultValue("URL (Optional)");
	$j("#commentform #comment").defaultValue("Comments");
});


$j.fn.defaultValue = function(text){
    return this.each(function(){
		//Make sure we're dealing with text-based form fields
		if(this.type != 'text' && this.type != 'password' && this.type != 'textarea')
			return;
		//Store field reference
		var fld_current=this;
		//Set value initially if none are specified
        if(this.value=='') {
			this.value=text;
		} else {
			//Other value exists - ignore
			return;
		}
		//Remove values on focus
		$j(this).focus(function() {
			if(this.value==text || this.value=='')
				this.value='';
		});
		//Place values back on blur
		$j(this).blur(function() {
			if(this.value==text || this.value=='')
				this.value=text;
		});
		//Capture parent form submission
		//Remove field values that are still default
		$j(this).parents("form").each(function() {
			//Bind parent form submit
			$j(this).submit(function() {
				if(fld_current.value==text) {
					fld_current.value='';
				}
			});
		});
    });
};