// COMPA, AQUI ESTAN LAS VARIALBES QUE APARECEN EN LAS ALERTAS DEL FORM

	var mensajes = {txt_nombre: "Ingrese Su Nombre",txt_mail: "Ingrese Mail Valido",txt_telefono: "Ingrese Su Tel&eacute;fono",cmb_salon: "Seleccione Sal&oacute;n",txt_comentario: "Ingrese Comentario"};													

	var mensajes2 = {txt_nombre: "Ingrese Su Nombre",txt_mail: "Ingrese Mail Valido",txt_telefono: "Ingrese Su Tel&eacute;fono",cmb_cargo: "Seleccione Cargo",txt_experiencia: "Ingrese Experiencia",cmb_expectativarenta: "Seleccione Renta"};													
	
	var mensajes3 = {txt_nombreempresa: "Ingrese Nombre Empresa",txt_nombrecontacto: "Ingrese Nombre Contacto",txt_mail: "Ingrese Mail Valido",txt_telefono: "Ingrese Tel&eacute;fono",txt_comentario: "Ingrese Comentario",cmb_motivo: "Seleccione Motivo Contacto"};													
		
	var reglas = {txt_nombre: {required: true},txt_mail: {required: true,email:true},txt_telefono: {required: true},cmb_salon: {required: true},txt_comentario: {required: true}};			

	var reglas2 = {txt_nombre: {required: true},txt_mail: {required: true,email:true},txt_telefono: {required: true},cmb_cargo: {required: true},txt_experiencia: {required: true},cmb_expectativarenta: {required: true}};			

	var reglas3 = {txt_nombreempresa: {required: true}, txt_nombrecontacto: {required: true},txt_mail: {required: true,email:true},txt_telefono: {required: true},txt_comentario: {required: true},cmb_motivo: {required: true}};			

// TERMINO DE LAS VARIALBES QUE APARECEN EN LAS ALERTAS DEL FORM

$(document).ready(function() {

// COMPA, AQUI EL JQUERY PARA VALIDAR LOS FORMULARIOS

 $("#contacto").validate({
    	 messages: mensajes,
		rules: reglas,
		 submitHandler: function(form) {
			enviarconsulta();
			setTimeout ("cerrarfancy()", 3000);
			setTimeout ("activarenviarconsulta()", 4000);	
			return false;
		    }
		});

 $("#trabajo").validate({
    	 messages: mensajes2,
		 rules: reglas2,
		 submitHandler: function(form) {
			enviartrabajo();
			setTimeout ("cerrarfancy()", 3000);
			setTimeout ("activarenviartrabajo()", 4000);	
			return false;
		    }
		});

 $("#convenios").validate({
    	 messages: mensajes3,
		 rules: reglas3,
		 submitHandler: function(form) {
			enviarconvenios();
			setTimeout ("cerrarfancy()", 3000);
			setTimeout ("activarconvenios()", 4000);	
			return false;
		    }
		});

// TERMINO DE LA VALIDACION DE LOS FORMULARIOS

	$(".BKG, .Buscador").css({'background-color':'#000'}).animate({opacity:0.7});

	$(".subnav, .subnav2").css({'background-color':'#000'}).animate({opacity:0.8});

	$("#Footer").css({'background-color':'#4c4c4c'}).animate({opacity:0.2}, 0);

	$(".Buscador").find("span").animate({opacity:0});

	$(".bton").hover(function(){

		$(this).find("span").fadeToggle("slow");						  

	 });	



	$(".contenido").hide();

	$("ul.Menu li:first").addClass("active").show();

	$(".contenido:first").show();

	$("ul.Menu li").click(function() {

		$("ul.Menu li").removeClass("active");

		$(this).addClass("active");

		$(".contenido").slideUp();

		var activeTab = $(this).find("a").attr("href");

		$(activeTab).slideDown(1300);

		return false;

	});
	
	
	$(".contenido").hide();

	$("#slideshow ul li:first").addClass("active").show();

	$(".contenido:first").show();

	$(".giftme").click(function() {

		$(".giftme").removeClass("active");

		$(this).addClass("active");

		$(".contenido").slideUp();

		var activeTab = $(this).find("a").attr("href");

		$(activeTab).slideDown(1300);

		return false;

	});


	$(".ver").click(function(){
		$(this).find("a").attr("href").show();											 
	});

	$(".elTooltip").hover(function(){

	$("#Tooltip").slideToggle("slow");

	$("#Tooltip > p").fadeToggle("slow");

	});



	$(".Menu").parent().append("");

	$(".sub").hover(function() {

		$(this).parent().find("ul.subnav").slideDown("slow").show();

		$(this).parent().hover(function() {

		}, function(){	

			$(this).parent().find("ul.subnav").slideUp("slow"); 

		});

	});



	$(".Menu").parent().append("");

	$(".sub2").hover(function() {

		$(this).parent().find("ul.subnav2").slideDown("slow").show();

		$(this).parent().hover(function() {

		}, function(){	

			$(this).parent().find("ul.subnav2").slideUp("slow"); 

		});

	});







$(".otro").click( function (){
		//alert($("#ColDer").css('left'))					
		if ($("#ColDer").css('right') == '0px'  ){ 

			$("#ColIzq").animate({left: '+=260'}, 1500, function() {});

			$("#ColDer").animate({right: '+=700'}, 1000, function() {});

		}
				

	});					   

					    

$(".inicios, .otro2").click( function (){
//alert($("#ColDer").css('left'))	
	if ($("#ColDer").css('right') != '0px'){ 

		$("#ColIzq").animate({left: '-=260'}, 1500, function() {});

		$("#ColDer").animate({right: '-=700'}, 1000, function() {});

	 }
	 
	

});		



});


// COMPA, AQUI ESTAN LAS FUNCIONES QUE ME PERMITEN ENVIAR LOS DATOS VIA AJAX
function enviarconsulta(){

document.getElementById('Contacto2').style.display="none"; 	

document.getElementById('mensajeconsulta').innerHTML="<h1 style='text-align:center'>Mensaje Enviado</h1>";

var txt_nombre = document.contacto.txt_nombre.value;
var txt_mail = document.contacto.txt_mail.value;
var txt_telefono = document.contacto.txt_telefono.value;
var cmb_salon = document.contacto.cmb_salon.value;
var txt_comentario = document.contacto.txt_comentario.value;
var identificador = document.contacto.identificador.value;

	doAjax('http://www.sebastianferrer.cl/mail.php','txt_nombre='+txt_nombre+'&txt_mail='+txt_mail+'&txt_telefono='+txt_telefono+'&cmb_salon='+cmb_salon+'&txt_comentario='+txt_comentario+'&identificador='+identificador,'mensaje','post',0);	

}

function enviartrabajo(){

document.getElementById('Trabaja2').style.display="none"; 	

document.getElementById('mensajeTrabaja').innerHTML="<h1 style='text-align:center'>Mensaje Enviado</h1>";


var txt_nombre = document.trabajo.txt_nombre.value;
var txt_mail = document.trabajo.txt_mail.value;
var txt_telefono = document.trabajo.txt_telefono.value;
var cmb_cargo = document.trabajo.cmb_cargo.value;
var txt_experiencia = document.trabajo.txt_experiencia.value;
var cmb_expectativarenta = document.trabajo.cmb_expectativarenta.value;
var identificador = document.trabajo.identificador.value;

doAjax('http://www.sebastianferrer.cl/mail.php','txt_nombre='+txt_nombre+'&txt_mail='+txt_mail+'&txt_telefono='+txt_telefono+'&cmb_cargo='+cmb_cargo+'&txt_experiencia='+txt_experiencia+'&cmb_expectativarenta='+cmb_expectativarenta+'&identificador='+identificador,'mensajetrabajo','post',0);	
}
function enviarconvenios(){

document.getElementById('FormConvenios2').style.display="none"; 	

document.getElementById('mensajeFormConvenios').innerHTML="<h1 style='text-align:center'>Mensaje Enviado</h1>";

var txt_nombreempresa = document.convenios.txt_nombreempresa.value;
var txt_nombrecontacto = document.convenios.txt_nombrecontacto.value;
var txt_mail = document.convenios.txt_mail.value;
var txt_telefono = document.convenios.txt_telefono.value;
var txt_comentario = document.convenios.txt_comentario.value;
var cmb_motivo = document.convenios.cmb_motivo.value;
var identificador = document.convenios.identificador.value;

doAjax('http://www.sebastianferrer.cl/mail.php','txt_nombreempresa='+txt_nombreempresa+'&txt_nombrecontacto='+txt_nombrecontacto+'&txt_mail='+txt_mail+'&txt_telefono='+txt_telefono+'&txt_comentario='+txt_comentario+'&cmb_motivo='+cmb_motivo+'&identificador='+identificador,'mensajeconvenios','post',0);	
}
// TERMINO DEL ENVIO DE DATOS A TRAVES DE AJAX

//////////// CERRAR FANCY ////////////////
function cerrarfancy(){
parent.$.fancybox.close();
}
//////////////////////////////////////////

function activarenviarconsulta(){

	document.getElementById('Contacto2').style.display=""; 	
	document.getElementById('mensajeconsulta').innerHTML="";

	var txt_nombre = document.contacto.txt_nombre;
	var txt_mail = document.contacto.txt_mail;
	var txt_telefono = document.contacto.txt_telefono;
	var cmb_salon = document.contacto.cmb_salon;
	var txt_comentario = document.contacto.txt_comentario;

   txt_nombre.value = "";
   txt_mail.value = "";
   txt_telefono.value = "";
   cmb_salon.value = "";
   txt_comentario.value = "";
}
function activarenviartrabajo(){

	document.getElementById('Trabaja2').style.display=""; 	
	document.getElementById('mensajeTrabaja').innerHTML="";

	var txt_nombre = document.trabajo.txt_nombre;
	var txt_mail = document.trabajo.txt_mail;
	var txt_telefono = document.trabajo.txt_telefono;
	var cmb_cargo = document.trabajo.cmb_cargo;
	var txt_experiencia = document.trabajo.txt_experiencia;
	var cmb_expectativarenta = document.trabajo.cmb_expectativarenta;

   txt_nombre.value = "";
   txt_mail.value = "";
   txt_telefono.value = "";
   cmb_cargo.value = "";
   txt_experiencia.value = "";
   cmb_expectativarenta.value = "";   
  
}
function activarconvenios(){

	document.getElementById('FormConvenios2').style.display=""; 	
	document.getElementById('mensajeFormConvenios').innerHTML="";

	var txt_nombreempresa = document.convenios.txt_nombreempresa;
	var txt_nombrecontacto = document.convenios.txt_nombrecontacto;
	var txt_mail = document.convenios.txt_mail;
	var txt_telefono = document.convenios.txt_telefono;
	var txt_comentario = document.convenios.txt_comentario;
	var cmb_motivo = document.convenios.cmb_motivo;

   txt_nombreempresa.value = "";
   txt_nombrecontacto.value = "";
   txt_mail.value = "";
   txt_telefono.value = "";
   txt_comentario.value = "";
   cmb_motivo.value = "";   
  
}
