$(document).ready(function() {
	var urlActual=window.location.href;
			$(".menu-header li a").each(function() {	
				if("http://"+location.hostname+$(this).attr("href") == urlActual){
					$(this).removeClass("current");
					$(this).addClass("current");
				}
			});
			
	// === Formulario de Contacto ==================================================================
	
	// Parte del nombre
	$("#nombre").focus(function () { 
		if($(this).val()=="Nombre"){
     		$("#nombre").attr("value","");    
     		}   
    });
    
    $("#nombre").focusout(function() {
    	if($(this).attr("value").length==0){
  	 		$("#nombre").attr("value","Nombre");     	 		
  	 	}	
    });


	// Parte de la institucion 
    $("#Institucion").focus(function () { 
    	if($(this).val()=="Institución/Organización"){
      		$(this).attr("value",""); 
  		}
    });
    
     $("#Institucion").focusout(function() {
    	if($(this).attr("value").length==0){
  	 		 $(this).attr("value","Institución/Organización");
  	 	}	
    });
    
    
    // Parte del correo
    $("#puesto").focus(function () { 
    if($(this).val()=="Puesto"){
      $(this).attr("value",""); 
  	}
    });
    
    $("#puesto").focusout(function() {
    	if($(this).attr("value").length==0){
  	 		 $(this).attr("value","Puesto");
  	 	}	
    });
    
     
    // Parte del correo
    $("#correo").focus(function () { 
    if($(this).val()=="Correo Electrónico"){
      $(this).attr("value",""); 
  	}
    });
    
    $("#correo").focusout(function() {
    	if($(this).attr("value").length==0){
  	 		 $(this).attr("value","Correo Electrónico");
  	 	}	
    });
    
    
    // Parte del telefono
    $("#telefono").focus(function () { 
    	if($(this).val()=="Teléfono"){
      $(this).attr("value",""); 
  }
    });
    
    $("#telefono").focusout(function() {
    	if($(this).attr("value").length==0){
  	 		 $(this).attr("value","Teléfono");
  	 	}	
    });
    
    
    
    $("#id").focus(function () { 
    if($(this).val()=="ID"){	
      $(this).attr("value",""); 
  	}
    });
    
    $("#id").focusout(function() {
    	if($(this).attr("value").length==0){
  	 		 $(this).attr("value","ID");
  	 	}	
    });
    
    
    // Parte del Comentario
    $("#comentario").focus(function () { 
    	if($(this).val()=="Comentario"){
      $(this).attr("value",""); 
  	}
    });
    
    $("#comentario").focusout(function() {
    	if($(this).attr("value").length==0){
  	 		 $(this).attr("value","Comentario");
  	 	}	
    });
    
    
    
    // === Validar campos requeridos antes de enviar ======================================
    $("#contact-form").submit(function (e) { 
     	if($("#nombre").attr("value")=="Nombre"){
  	 		$("#nombre").css("border","2px solid red");
  	 		e.preventDefault();
  	 	}
  	 	
  	 	if($("#correo").attr("value")=="Correo Electrónico"){
  	 		$("#correo").css("border","2px solid red");
  	 		e.preventDefault();
  	 	}       
  	 	
  	 	if($("#comentario").attr("value")=="Comentario"){
  	 		$("#comentario").css("border","2px solid red");
  	 		e.preventDefault();
  	 	}   	 	
    });

  //============= Función para cargar la ruta seleccionada en el filtro, en el campo de la forma correspondiente
    $("#show_path_button").click(function(e){
        e.preventDefault();

        $("#elementos_menu_ruta").val( $("input[name='page_radio']:checked").val() );
        $.fancybox.close();
    });
    
    // ========== Hide/Show Information ( Coaching ) ===========================================================
    
    $(".coaching #contenido_generico .first,.coaching #contenido_generico .second,.coaching #contenido_generico .third").css("margin-bottom","20px").css("cursor","pointer")
    .prepend("<img class='more-information' src='images/flecha-esquemas.gif'");
    
    
    $(".coaching #contenido_generico .first").click(function(){
    		$(".coaching #contenido_generico .first-content").slideToggle("slow");
    });
    
     
    $(".coaching #contenido_generico .second").click(function(){
    		$(".coaching #contenido_generico .second-content").slideToggle("slow");
    });
    
     
    $(".coaching #contenido_generico .third").click(function(){
    		$(".coaching #contenido_generico .third-content").slideToggle("slow");
    });
    
    // ============================================================================
    
  //función para cargar la ruta seleccionada en el filtro, en el campo de la forma correspondiente
    $("#show_path_button").click(function(e){
        e.preventDefault();

        $("#elementos_menu_ruta").val( $("input[name='page_radio']:checked").val() );
        $.fancybox.close();
    });
    
});
