/*********************************************************************************/
/**										**/
/**		Montagem:	Hudson Marinho (http://balaioideias.com.br/)	**/
/**		Contato: 	hudson@balaioideias.com.br			**/
/**		Ano:		Junho/2011				**/
/**										**/
/*********************************************************************************/


/* all functions
.....................................*/



function validaForm(fobj){
	var total = 0;
		total = fobj.elements.length;
	var params = "";
	for (i = 0; i <= (fobj.elements.length-1); i++){
		if (fobj.elements[i].alt != 'NO' && fobj.elements[i].id != 'NO' && fobj.elements[i].type != 'submit' && fobj.elements[i].type != 'reset' && fobj.elements[i].type != 'button'){
			if (fobj.elements[i].value == "" || fobj.elements[i].value == 'Seu nome' || fobj.elements[i].value == 'Seu e-mail' || fobj.elements[i].value == 'Nome' || fobj.elements[i].value == 'E-mail'){
				alert("Preencha o campo "+fobj.elements[i].title);
				fobj.elements[i].focus();
				return false;
			}
		}
	}
}

function submitAlert(form){
	$.ajax({
	type: "POST",
	url: $(form).attr('action'),
	data: $(form).serialize(),
	success: function(msg){
		alert( msg );
		$(form)[0].reset();
	}
	});
	return false;
}

// JavaScript Document
function ValidaEmail(email,id){
  var txt = email;
  if ((txt.length != 0) && ((txt.indexOf("@") < 1) || (txt.indexOf('.') < 7)))
  {
	alert('Email incorreto');
	$(id).val('');
	$(id).focus();
	return 'erro';
	//obj.focus();
  }else{
	return 'ok'; 
  }
}
