
$(function(){
	$('input[title]').each(function() {
		if ($(this).val() === "") {
			$(this).val($(this).attr('title'));
		}
		$(this).focus(function() {
			if ($(this).val() == $(this).attr('title')) {
				$(this).val('').addClass('focused');
		}
		$(this).blur(function() {
			if ($(this).val() === '') {
				$(this).val($(this).attr('title')).removeClass('focused');
			}
		});
	});
});
$("#freeform").validate({
	rules: {
		fname: "required",
		email: {
			required: true,
			email: true
		},
		message: "required",
		subject: "required",
		captcha: "required"
	},
	messages : {
		name: "What's your name again?",
		email: {
			required: "I need an email address in order for me to contact you.",
			email: "Your email address must be in the format of yourname@gmail.com"
		},
		subject: "Please just choose a subject real quick!",
		message: "At least say I miss you Juliano!",
		captcha: "You need to enter the words that appear on image above."
	}
});
});


/*
$(document).ready(function(){
           //Bind ajaxForm to the FreeForm 
		$('#contact-form').ajaxForm(
		  {  	
		  		target:"#hiddenDIV",     //set response to go into hidden div    
		  		beforeSubmit:function()  //before sending submit, give user notification...
		  {
		     	$("#msg").html("Sending your form...");
		     	$("#msg").css({border:"1px solid #a00", backgroundColor:"#fdd"});
		  },
		   		success:function(rtn) 
		   		
		   	{	if(rtn=="success")
		  	
			  	{
			      	$("#contact-form").resetForm();
			      	$("#msg").html("Thank you for your comment.");
			    }
			    else {
			        //there was an erro, so grab the UL in the content ID, 
			        //inside the hidden DIV, and put it into the Message Notification
			      $("#msg").html($("#hiddenDIV #content ul").html() );
				  $("#hiddenDIV").empty(); 		      
			     }
		   } 
	});
});

*/


