$(document).ready(function(){

$("#botonera > ul > li").hover(function () {
    $(this).find('img').fadeIn();
    $(this).find('> a').css('color','#333');
    $(this).find('> a').css('fontWeight','bold');
    $(this).next('li').slideDown();
},function () {});

$("#botonera > ul").hover(function () {},function () {
    $(this).find('> li.normal img').fadeOut('fast');
    $(this).find('> li.normal a').css('color','#fff');
    $(this).find('> li.normal a').css('fontWeight','normal');
    $(this).find('> li+li').fadeOut();
})
var emailreg = /^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/;
$("input").keyup(function(){
    if($('input[name="nombre"]').val()!='' && $('input[name="tel"]').val()!='' && $('input[name="email"]').val()!='' && emailreg.test($('input[name="email"]').val()) && $('input[name="tel"]').val()!='' ){
    $('input[type="submit"]').fadeIn();
    $('.rrhh div input[type="submit"]').css("margin-left","141px");
    $('.rrhh div input[type="submit"]').css("margin-top","0");
}else{
    $('input[type="submit"]').fadeOut();
}

});

$(".contacto").submit(function(event){
    event.preventDefault();
    var datos = $(this).serialize();
    $.post("enviaForm/enviaContacto.php" ,datos ,function(resultado) {
        $(".contacto").html('<span id="gracias"> Gracias por enviarnos su consulta</span>');
        setTimeout('location.href="."', 4000);
    });
});

$(".rrhh2").submit(function(event){
    event.preventDefault();
    var datos = $(this).serialize();
    $.post("enviaForm/enviaContactoRRHH.php" ,datos ,function(resultado) {
        $(".rrhh").html('<span id="gracias">Gracias por enviarnos sus datos</span>');
        setTimeout('location.href="."', 4000);
    });
});
});
