$(document).ready(function(){
	labelFormLogin();
});
// Label Form
function labelFormLogin(){
	// All inputs that we modifies comes here.
	inputs = new Array();
	$("label[for!='']").each(function(){
	  label = $(this);
	  $(this).next("input#" + label.attr("for")).each(function(){
		inputs[inputs.length] = this;
		// create a memory data on the input that hold the label
		$(this).data("label", label.html());
		// Setup the label on the input
		if($(this).val() == "")
		  $(this).val($(this).data("label"));
	  });
	  // empty the label
	  label.empty();
	});
	
	// Walk on the modified inputs list
	for(i = 0; i < inputs.length; i++){
	  // When the input receive the focus, we remove the value
	  // if it is igual the label
	  $(inputs[i]).focus(function(){
		if($(this).val() == $(this).data("label"))
		  $(this).val("");
	  });
	  // When the input lost the focus, we check if the value
	  // is empty and then fill with the label.
	  $(inputs[i]).blur(function(){
		if($(this).val() == "")
		  $(this).val($(this).data("label"));
	  });
	}
}
function validaForm() {
	if ($('#frm_nome').val() == '') {
		alert('Por favor, preencha seu nome.');
		$('#frm_nome').focus();
		return false;
	}
	if ($('#frm_ddd').val() == '') {
		alert('Por favor, preencha o ddd do seu telefone.');
		$('#frm_ddd').focus();
		return false;
	}
	if ($('#frm_telefone').val() == '') {
		alert('Por favor, preencha o número do seu telefone.');
		$('#frm_telefone').focus();
		return false;
	}
	if ($('#frm_email').val() == '') {
		alert('Por favor, preencha seu e-mail.');		
		$('#frm_email').focus();
		return false;
	}
}
