function EnvioForm(){
	if(DatosValidar()){
		jQuery("#frm_contacto").ajaxSubmit({
			dataType:'json',
			target: "#result",
			success: function(resp) {
				$("#carga_loader").hide();
				_divresultado = jQuery("#resultado_envio");    
				_divfomulario = jQuery("#div_formulario");
				if (resp.envio == 'ok' ){
					_divfomulario.hide();
					_divresultado.text(contacto_resultado_ok);
					_divresultado.addClass("mensaje_ok");        
					_divresultado.show();
				}
				if (resp.envio == 'error'){
					_divresultado.text(contacto_resultado_error);
					_divresultado.addClass("mensaje_error");
					_divresultado.show();
				}
			}
		});
	}
}
function DatosValidar() {
	var _errores = "";
	// Class Requerido
	$(".requerido").each(function(){
		if (jQuery.trim($(this).val())==""){
			_auxerror = "»"+_camporequerido+" "+$(this).attr("titulovalidador");
			_errores+="<br>"+_auxerror;
			$(this).attr("title",_auxerror);
			$(this).addClass("tooltip_error");
		}
	});
	//Class E-mail
	$(".email").each(function(){
		var RegExPattern = /[\w-\.]{3,}@([\w-]{2,}\.)*([\w-]{2,}\.)[\w-]{2,4}/;
		if(!$(this).val().match(RegExPattern)){
			_auxerror = "»"+_campomail+" "+$(this).attr("titulovalidador");
			_errores += "<br>"+_auxerror;
			$(this).attr("title",_auxerror);
			$(this).addClass("tooltip_error");
		}
	});
	// Class Checkedo
	$(".chekeado").each(function(){
		if(!$(this).attr("checked")){
			_auxerror = "»"+_campochecked+" "+$(this).attr("titulovalidador");
			_errores += "<br>"+_auxerror;
			$(this).attr("title",_auxerror);
			$(this).addClass("tooltip_error");
		}
	});
	MostrarErrores(_errores);
	if (_errores == "") {
		_resultado = true
	} else {
		_resultado = false;
	}	
	return _resultado;
}
function MostrarErrores(errores) {
	MostrarErroresTooltip();
	if ($.trim(errores) != '') {
		errores = '<span class="tituloerror">'+_titulovalidaciones+': </span>'+errores;
		$("#div_validaciones").html(errores);
		$("#div_validaciones").slideDown();
	} else {
		$("#div_validaciones").hide();
	}
}
function MostrarErroresTooltip(){
	jQuery('.tooltip_error').tooltip({
		track: true,
		delay: 0, 
		showURL: false, 
		showBody: " - ", 
		fade: 250				   
	});
}

function HabilitarBoton(){
	$("#boton_enviar").attr("disabled",false);
}
