$(document).ready(function() {
	// validate signup form on keyup and submit
	var validator = $("#IndiqueForm").validate({
		rules: {
			nome: {
				required: true,
				notEqualToTitle: true
			},
			email: {
				required: true,
				email: true,
				notEqualToTitle: true
			},
			amigo_nome: {
				required: true,
				notEqualToTitle: true
			},
			amigo_email: {
				required: true,
				email: true,
				notEqualToTitle: true
			}
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			if ( element.is(":radio") )
				error.appendTo( element.parent().next().next() );
			else if ( element.is(":checkbox") )
				error.appendTo ( element.next() );
			else
				error.appendTo( element.parent().next() );
		},
		// specifying a submitHandler prevents the default submit, good for the demo
		submitHandler: function() {
			var CampoNome = document.getElementById('IndiqueForm').nome.value;
			var CampoEmail = document.getElementById('IndiqueForm').email.value;
			var CampoANome = document.getElementById('IndiqueForm').amigo_nome.value;
			var CampoAEmail = document.getElementById('IndiqueForm').amigo_email.value;
			ajaxFunction("class/indique.php","","retornoSendIndique","&nome=" + CampoNome + "&email=" + CampoEmail + "&amigo_nome=" + CampoANome + "&amigo_email=" + CampoAEmail);
			return false;
		},
		// set this class to error-labels to indicate valid fields
		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
	});
	
});

