// formulario
var msjSI = "Su mensaje ha sido enviado correctamente";
var msjNO = "Debe llenar todos los campos";
/*
function validate(formData, jqForm, options) { 
    // formData is an array of objects representing the name and value of each field 
    // that will be sent to the server;  it takes the following form: 
    // 
    // [ 
    //     { name:  username, value: valueOfUsernameInput }, 
    //     { name:  password, value: valueOfPasswordInput } 
    // ] 
    // 
    // To validate, we can examine the contents of this array to see if the 
    // username and password fields have values.  If either value evaluates 
    // to false then we return false from this method. 
for (var i=0; i < formData.length; i++) { 
        if (!formData[i].value) { 
		    $('#gracias').fadeOut("slow").empty();
            $('#gracias').append(msjNO); 
			$('#gracias').fadeIn("slow");
            return false; 
        } 
    } 
    
}
// esperamos que el DOM cargue
$(document).ready(function() { 
	// definimos las opciones del plugin AJAX FORM
	var opciones = {
		beforeSubmit: validate, //funcion que se ejecuta antes de enviar el form
		success: mostrarRespuesta, //funcion que se ejecuta una vez enviado el formulario
		//url: '/envio-contactenos.php',
		url: 'http://www.laoffis.com/js/envio-contactenos-bt.php',
		resetForm: true
	};
	//asignamos el plugin ajaxForm al formulario myForm y le pasamos las opciones
	$('#myForm').ajaxForm(opciones);
										

	function mostrarRespuesta (responseText){
		    $('#gracias').fadeOut("slow").empty();
		    $('#gracias').append(msjSI);
			$('#gracias').fadeIn("slow");
			//alert("Gracias por contactarnos ");
			$('#loader_gif').fadeOut("slow");
			//$('#ajax_loader').append("<br>Mensaje: "+responseText);
	 };
						   
}); */
// Iniciamos BG adaptable
$(document).ready(function() {
    $("#body-background").ezBgResize();
	$(".entrenadores").tooltip({ 
		effect: 'slide',
		position: 'center center',
		offset: [-50, 15],
		relative: false
	});
});
// Iniciamos el tiempo
$(function() {
			$.simpleWeather({
				location: 'santiago, chile',
				unit: 'c',
				success: function(weather) {
					$("#weather").append('<div class="miniatura" style="background-image: url('+weather.thumbnail+')"></div>');
					$("#weather").append('<div class="max">'+weather.high+'&deg; </div> <div class="min">/ '+weather.low+'&deg; </div>');
				},
				error: function(error) {
					$("#weather").html('<span>'+error+'</span>');
				}
			});			
		});
// Iniciamos el menu
jQuery(function($) {
    $('#navigation ul.pages li.page_item a').ahover({toggleEffect: 'height', moveSpeed: 75, toggleSpeed: 250});
	$('#navigation ul.pages li.page_item a').ahover({toggleEffect: 'height', moveSpeed: 75, toggleSpeed: 250});
   });
// quitamos los titles
$(function(){
	$('a').removeAttr('title');
	$('.tooltipzone p').replaceWith('');
	});   
// Iniciamos el slider
$(window).load(function() {
        $('#slider').nivoSlider({
		captionOpacity:1,
		directionNav:false,
		effect:'random',
		pauseTime:4000
		});
    });



