
$(document).ready(function(){


$("#form_contacto").submit(function(){
        //return $("input", this).val().length > 0;
        
        if ($("#Email").val() == "") {
            alert("\n Por favor introduzca una cuenta de correo.")
            $("#Email").focus();
            return false;
        }
        
        
        if ($("#Email").val().indexOf('@', 0) == -1 ||
        $("#Email").val().indexOf('.', 0) == -1) {
            alert("\n Debe utilizar una cuenta de correo valida.")
            $("#Email").select();
            $("#Email").focus();
            return false;
        }

    });


    $("dl#menu dt a.despliega").click(function(){
        $("dl#menu dd:visible").slideUp("fast");
        $(this).parent().next().slideDown("slow");
        return false;
    });
    
    if ($('#contenedor').height() < $('#barra_lateral').height()) {
        $('#contenedor').css("height", $('#barra_lateral').height());
    }
    
    $(function(){
        setInterval("slideSwitch()", 5000);
    });
});

/*** 
 Simple jQuery Slideshow Script
 Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
 ***/
function slideSwitch(){
    var $active = $('#slideshow IMG.active');
    
    if ($active.length == 0) 
        $active = $('#slideshow IMG:last');
    
    // use this to pull the images in the order they appear in the markup
    var $next = $active.next().length ? $active.next() : $('#slideshow IMG:first');
    
    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );
    
    
    $active.addClass('last-active');
    
    $next.css({
        opacity: 0.0
    }).addClass('active').animate({
        opacity: 1.0
    }, 1000, function(){
        $active.removeClass('active last-active');
    });
}




function validar(){
    //return $("input", this).val().length > 0;
    
    if ($("#Email").val() == "") {
        alert("\n Por favor introduzca una cuenta de correo.")
        $("#Email").focus();
        return false;
    }
    
    
    if ($("#Email").val().indexOf('@', 0) == -1 ||
    $("#Email").val().indexOf('.', 0) == -1) {
        alert("\n Debe utilizar una cuenta de correo valida.")
        $("#Email").select();
        $("#Email").focus();
        return false;
    }
    if (document.getElementById("Acepto").checked == true) {
        return true;
    }
    else {
        alert("Debe aceptar la ley de proteccion de Datos\npara  enviar este formulario.");
        return false;
    }
    
}


function abrir(web, alto, ancho){
    if (window.pantmsg) {
        pantmsg.close();
    }
    pantmsg = open(web, 'pantmsg', "top=" + (screen.height - alto) / 2 + ",left=" + (screen.width - ancho) / 2 + ",toolbar=no,width=" + ancho + ",height=" + alto + ",directories=no,status=no,scrollbars=no,resize=no,menubar=no");
    pantmsg.focus();
}

