function getHTTPObject(){
    if (window.ActiveXObject) return new ActiveXObject("Msxml2.XMLHTTP");
    else if (window.XMLHttpRequest) return new XMLHttpRequest();
    else {
        alert("Your browser does not support AJAX.");
        return null;
    }
}
	  
function setOutput(){
    if(httpObject.readyState == 4){
        document.getElementById("columna2").innerHTML = httpObject.responseText; <!-- para un div en la pagina regreso el elemento>
    }
    else if(httpObject.readyState == 1){
        document.getElementById("columna2").innerHTML = '<div align="center"><img src="../images/ajax-loader.gif" alt="Cargando"></div>';
    }
}

function doWork(id){
    httpObject = getHTTPObject();
    if (httpObject != null) {
        httpObject.open("GET", "../include/servidor.php?id="+id, true);
        pageTracker._trackPageview("../include/servidor.php?id="+id);
        httpObject.onreadystatechange = function (){
            if(httpObject.readyState == 4){
                document.getElementById("columna2").innerHTML = httpObject.responseText; <!-- para un div en la pagina regreso el elemento>
            }
            else {
                document.getElementById("columna2").innerHTML = '<div align="center" class="titulo">Cargando<br><br><img src="../images/preloader.gif" alt="Cargando"></div>';
            }
        }
        httpObject.send(null);
    }
}
	  
function doWorkinter(id){
    httpObject = getHTTPObject();
    if (httpObject != null) {
        httpObject.open("GET", "../include/servidor.php?idin="+id, true);
        httpObject.onreadystatechange = function (){
            if(httpObject.readyState == 4){
                document.getElementById("columna2").innerHTML = httpObject.responseText; <!-- para un div en la pagina regreso el elemento>
            }
            else {
                document.getElementById("columna2").innerHTML = '<div align="center" class="titulo">Cargando<br><br><img src="../images/preloader.gif" alt="Cargando"></div>';
            }
        }
        httpObject.send(null);
    }
}
var httpObject = null;
	  
function doWorkNoti(id){
    httpObject = getHTTPObject();
    if (httpObject != null) {
        httpObject.open("GET", "../include/servidor.php?idnoti="+id, true);
        httpObject.onreadystatechange = function (){
            if(httpObject.readyState == 4){
                document.getElementById("columna2").innerHTML = httpObject.responseText; <!-- para un div en la pagina regreso el elemento>
            }
            else {
                document.getElementById("columna2").innerHTML = '<div align="center" class="titulo">Cargando<br><br><img src="../images/preloader.gif" alt="Cargando"></div>';
            }
        }
        httpObject.send(null);
    }
}

function nonulos(){
    if (document.getElementById('matricula').value == ""){
        alert("No se ha llenado correctamente el formulario, \n Por favor introduzca su matrícula");
        document.getElementById('matricula').focus();
        return false;
    }else
    if (document.getElementById('pass').value == ""){
        alert("No se ha llenado correctamente el formulario, \n Por favor introduzca su contraseña");
        document.getElementById('pass').focus();
        return false;
    }else
    if (document.getElementById('sistema').selectedIndex == 0){
        alert("No se ha llenado correctamente el formulario, \n Por favor seleccione sección");
        document.getElementById('sistema').focus();
        return false;
    }else
    {
        document.registro.submit();
    }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
}

function cambia() {
    if ( $("#derecha #content .activo").next().html() == null ) {
        prox = $("#derecha #content div:first");
    } else {
        prox = $("#derecha #content .activo").next();
    }
    $("#derecha #content .activo").fadeOut(700,function(){
        $("#derecha #content .activo").removeClass("activo");
        prox.addClass("activo");
        $("#derecha #content .activo").fadeIn(700);
    });
    setTimeout( 'cambia()', 5000);
}
