function fntCargar_Pagina(strPagina){
	$("#divTexto").html("<img src='img/generales/cargador.gif' style='border:none;'>");
	
	$.ajax({
		type:"GET",
		url:"php/cisa.php",
		data:"pagina=" + strPagina,
		success: function(strMensaje){
			$("#divTexto").html(strMensaje);
		},
		error: function(objObjeto,strMensaje){
			$("#divTexto").html("<strong>Ocurri&oacute; un error:</strong>"
			+ strMensaje);
		}
	});
}

function trim(str){
	return str.replace(/(^[\s\xA0]+|[\s\xA0]+$)/g, '');
}

function fntContacto_Enviar(){
	var strNombre=trim($("#txtContacto_Nombre").val());
	var strEmpresa=trim($("#txtContacto_Empresa").val());
	var strTels=trim($("#txtContacto_Tels").val());
	var strCorreo=trim($("#txtContacto_Correo").val());
	var strDireccion=trim($("#txtContacto_Direccion").val());
	var strComentarios=trim($("#txtContacto_Comentarios").val());
	var divCapa=$("#divContacto_Ajax");
	divCapa.html("<img src='../img/generales/cargador.gif' style='border:none;'>");
	
	if(strNombre!="" && (strTels!="" || strCorreo!="") && strComentarios!=""){
		$.ajax({
			type:"GET",
			url:"../php/formularios.php",
			data:"formulario=contacto&nombre=" + strNombre + "&empresa=" + strEmpresa +
			"&tels=" + strTels + "&correo=" + strCorreo + "&direccion=" + strDireccion +
			"&comentarios=" + strComentarios,
			success: function(strMensaje){
				if(strMensaje=="."){
					divCapa.html("Su mensaje se envi&oacute; correctamente");
					fntContacto_Limpiar();
				}else{
					divCapa.html(strMensaje);
				}
			},
			error: function(objObjeto,strMensaje){
				divCapa.html("Error al intentar enviar su mensaje");
			}
		});
	}else{
		if(strNombre==""){
			divCapa.html("Por favor, digite su nombre");
		}else if(strTels=="" && strCorreo==""){
			divCapa.html("Por favor, digite un tel&eacute;fono o su e-mail");
		}else if(strComentarios==""){
			divCapa.html("Por favor, digite su comentario/sugerencia");
		}
	}
}

function fntContacto_Limpiar(){
	$("#txtContacto_Nombre").val("");
	$("#txtContacto_Empresa").val("");
	$("#txtContacto_Tels").val("");
	$("#txtContacto_Correo").val("");
	$("#txtContacto_Direccion").val("");
	$("#txtContacto_Comentarios").val("");
	//$("#divContacto_Ajax").html("");
}

function fntFranquicias_Enviar(){
	var strNombre=trim($("#txtFranquicias_Nombre").val());
	var strApellidos=trim($("#txtFranquicias_Apellidos").val());
	var strCedula=trim($("#txtFranquicias_Cedula").val());
	var strCorreo=trim($("#txtFranquicias_Correo").val());
	var strTels=trim($("#txtFranquicias_Tels").val());
	var strOcupacion=trim($("#txtFranquicias_Ocupacion").val());
	var strDireccion=trim($("#txtFranquicias_Direccion").val());
	var strProvincia=trim($("#txtFranquicias_Provincia").val());
	var strCanton=trim($("#txtFranquicias_Canton").val());
	var strLugar=trim($("#selFranquicias_Lugar").val());
	var strInteres=trim($("#txtFranquicias_Interes").val());
	
	var strRef1=trim($("#txtFranquicias_Ref1").val());
	var strRef2=trim($("#txtFranquicias_Ref2").val());
	var strRef3=trim($("#txtFranquicias_Ref3").val());
	var strRef4=trim($("#txtFranquicias_Ref4").val());
	
	var strNosotros=trim($("#txtFranquicias_Nosotros").val());
	
	var strComentarios=trim($("#txtFranquicias_Comentarios").val());
	
	var divCapa=$("#divFranquicias_Ajax");
	divCapa.html("<img src='../img/generales/cargador.gif' style='border:none;'>");
	
	if(strNombre!="" && strApellidos!="" && strCedula!="" && strCorreo!=""
	&& strTels!="" && strOcupacion!="" && strDireccion!="" && strProvincia!=""
	&& strCanton!="" && strLugar!="0" && strInteres!="" && strRef1!=""
	&& strRef2!="" && strRef3!="" && strRef4!="" && strNosotros!="" && strComentarios!=""){
		$.ajax({
			type:"GET",
			url:"../php/formularios.php",
			data:"formulario=franquicias&nombre=" + strNombre + "&apellidos=" + strApellidos +
			"&cedula=" + strCedula + "&ocupacion=" + strOcupacion + "&direccion=" + strDireccion +
			"&provincia=" + strProvincia + "&canton=" + strCanton + "&lugar=" + strLugar +
			"&interes=" + strInteres + "&ref1=" + strRef1 + "&ref2=" + strRef2 +
			"&ref3=" + strRef3 + "&ref4=" + strRef4 + "&nosotros=" + strNosotros +
			"&comentarios=" + strComentarios + "&tels=" + strTels + "&correo=" + strCorreo,
			success: function(strMensaje){
				if(strMensaje=="."){
					divCapa.html("El formulario se envi&oacute; correctamente");
					fntFranquicias_Limpiar();
				}else{
					divCapa.html(strMensaje);
				}
			},
			error: function(objObjeto,strMensaje){
				divCapa.html("Error al intentar enviar el formulario");
			}
		});
	}else{
		divCapa.html("Por favor, complete todos los campos del formulario");
	}
}

function fntFranquicias_Limpiar(){
	$("#txtFranquicias_Nombre").val("");
	$("#txtFranquicias_Apellidos").val("");
	$("#txtFranquicias_Cedula").val("");
	$("#txtFranquicias_Correo").val("");
	$("#txtFranquicias_Tels").val("");
	$("#txtFranquicias_Ocupacion").val("");
	$("#txtFranquicias_Direccion").val("");
	$("#txtFranquicias_Provincia").val("");
	$("#txtFranquicias_Canton").val("");
	$("#selFranquicias_Lugar").val("");
	$("#txtFranquicias_Interes").val("");
	
	$("#txtFranquicias_Ref1").val("");
	$("#txtFranquicias_Ref2").val("");
	$("#txtFranquicias_Ref3").val("");
	$("#txtFranquicias_Ref4").val("");
	
	$("#txtFranquicias_Nosotros").val("");
	$("#txtFranquicias_Comentarios").val("");
	
	//$("#divFranquicias_Ajax").html("");
}

function fntEmpleos_Enviar(){
	var strNombre=trim($("#txtEmpleos_Nombre").val());
	var strApellidos=trim($("#txtEmpleos_Apellidos").val());
	var strCedula=trim($("#txtEmpleos_Cedula").val());
	var strCorreo=trim($("#txtEmpleos_Correo").val());
	var strNacionalidad=trim($("#txtEmpleos_Nacionalidad").val());
	var strDireccion=trim($("#txtEmpleos_Direccion").val());
	var strTels=trim($("#txtEmpleos_Tels").val());
	var strArea=trim($("#selEmpleos_Area").val());
	var strInteres=trim($("#txtEmpleos_Interes").val());
	var strZona=trim($("#selEmpleos_Zona").val());
	var strExperiencia=trim($("#txtEmpleos_Experiencia").val());
	var strComentarios=trim($("#txtEmpleos_Comentarios").val());
	
	var divCapa=$("#divEmpleos_Ajax");
	divCapa.html("<img src='../img/generales/cargador.gif' style='border:none;'>");
	
	if(strNombre!="" && (strApellidos!="" || strCedula!="") && strCorreo!=""
	&& strNacionalidad!="" && strDireccion!="" && strTels!="" && strInteres!=""
	&& strExperiencia!="" && strComentarios!=""){
		$.ajax({
			type:"GET",
			url:"../php/formularios.php",
			data:"formulario=empleos&nombre=" + strNombre + "&apellidos=" + strApellidos +
			"&cedula=" + strCedula + "&correo=" + strCorreo + "&nacionalidad=" + strNacionalidad +
			"&direccion=" + strDireccion + "&tels=" + strTels + "&area=" + strArea +
			"&interes=" + strInteres + "&zona=" + strZona + "&experiencia=" + strExperiencia +
			"&comentarios=" + strComentarios,
			success: function(strMensaje){
				if(strMensaje=="."){
					divCapa.html("Sus datos se enviaron correctamente");
					fntEmpleos_Limpiar();
				}else{
					divCapa.html(strMensaje);
				}
			},
			error: function(objObjeto,strMensaje){
				divCapa.html("Error al intentar enviar sus datos");
			}
		});
	}else{
		divCapa.html("Por favor, complete todos los campos");
	}
}

function fntEmpleos_Limpiar(){

	$("#txtEmpleos_Nombre").val("");
	$("#txtEmpleos_Apellidos").val("");
	
	$("#txtEmpleos_Cedula").val("");
	$("#txtEmpleos_Correo").val("");
	$("#txtEmpleos_Nacionalidad").val("");
	$("#txtEmpleos_Direccion").val("");
	$("#txtEmpleos_Tels").val("");
	$("#txtEmpleos_Interes").val("");
	$("#txtEmpleos_Experiencia").val("");
	$("#txtEmpleos_Comentarios").val("");
	$("#archivo1").val("");
		
	//$("#divEmpleos_Ajax").html("");
}
