/**
 * smoothify.js
 * Purpose: Makes Forms More Appealing and Support Default Titling
 *
 * @author Geoff Guidetti
 * @version 0.9 12/22/10
 */


/* make this a function that you can just do smoothify(form) */
$(document).ready(function(){
	/* clear the title from the input on focus */
	$("input[type=text], textarea").focus(function(){
		if($(this).hasClass('unedited')){
			/* save the input title and mark it as having a value */
			var saveval = $(this).val();
			$(this).val('').removeClass('unedited').addClass('edited');
		}
	});
	/* when focus leaves the input, if it's empty add back the title */
	$("input[type=text], textarea").blur(function(){
		if($(this).val() == ""){
			var takebackval = $(this).attr("default");
			$(this).removeClass('edited').addClass('unedited').val(takebackval);
		}
	});
});

/* required fields... */
$(document).ready(function(){
	$("#refine").submit(function(){
		if($("#refine .required").hasClass("unedited")){
			$("#refine .required.unedited").addClass('error');
			$(".error").change(function(){
				$(this).removeClass('error');
			});
			return false;
		} else {
			$("#refine .unedited").val("");
			return true;
		}
	});
});
	
	//get to this later
	//$("#refine").validate();
