	//Desarrollado por Jesus Liñán
//ribosomatic.com
//Puedes hacer lo que quieras con el código
//pero visita la web cuando te acuerdes

function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function valorlista(campo){

var lista = document.getElementById(campo);
// Obtener el índice de la opción que se ha seleccionado
var indiceSeleccionado = lista.selectedIndex;
// Con el índice y el array "options", obtener la opción seleccionada
var opcionSeleccionada = lista.options[indiceSeleccionado];
 
// Obtener el valor y el texto de la opción seleccionada
var valorsel = opcionSeleccionada.value;
return valorsel;
}

function quitarguiones(orig)
{
	str 	= new String(orig);

	rExp	= "/"+"-"+"/g";
	rExp	= eval(rExp);
	newS	= String("");

	str = new String(str.replace(rExp, newS));

	return str;
}




function MostrarConsulta0v(datos){
	
	divResultado = document.getElementById('resultado');
	datos=datos;
	ajax=objetoAjax();
	ajax.open("GET", datos);
	
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		
			divResultado.innerHTML = ajax.responseText;
		}
	}
	ajax.send(null)
	}
	
	function MostrarConsulta0vcapa(datos,capa){
	
	divResultado = document.getElementById(capa);
	datos=datos;
	ajax=objetoAjax();
	ajax.open("GET", datos);
	
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
		
			divResultado.innerHTML = ajax.responseText;
		}
	}
	ajax.send(null)
	}
	
function MostrarConsulta1v(datos,variable,contvariable){
	divResultado = document.getElementById('resultado');
	datos=datos+'?'+variable+'='+contvariable;
	ajax=objetoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
				divResultado.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
    }
	
function MostrarConsulta1vcapa(datos,variable,conte,capa){
	divResultado = document.getElementById(capa);
	datos=datos+'?'+variable+'='+conte;
	ajax=objetoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divResultado.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
}
	
function MostrarConsulta2v(datos,variable,contvariable,variable2,contvariable2){
	divResultado = document.getElementById('resultado');
	datos=datos+'?'+variable+'='+contvariable+'&'+variable2+'='+contvariable2;
	ajax=objetoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divResultado.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
    }

	
function MostrarConsulta2vcapa(datos,variable,conte,variable2,conte2,capa){
	divResultado = document.getElementById(capa);
	datos=datos+'?'+variable+'='+conte+'&'+variable2+'='+conte2;
	ajax=objetoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divResultado.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
}

function MostrarConsulta4vcapa(datos,variable,conte,variable2,conte2,variable3,conte3,variable4,conte4,capa){
	divResultado = document.getElementById(capa);
	datos=datos+'?'+variable+'='+conte+'&'+variable2+'='+conte2+'&'+variable3+'='+conte3+'&'+variable4+'='+conte4;
	ajax=objetoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divResultado.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
}

function MostrarConsulta7vcapa(datos,variable,conte,variable2,conte2,variable3,conte3,variable4,conte4,variable5,conte5,variable6,conte6,variable7,conte7,capa){
	divResultado = document.getElementById(capa);
	datos=datos+'?'+variable+'='+conte+'&'+variable2+'='+conte2+'&'+variable3+'='+conte3+'&'+variable4+'='+conte4+'&'+variable5+'='+conte5+'&'+variable6+'='+conte6+'&'+variable7+'='+conte7;
	ajax=objetoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divResultado.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
}

function InsertarActualizarIncidencia(dia,idcurso,idalumno,datos,variable,contvariable,contvariable2,contvariable3,capa){
	divResultado = document.getElementById(capa);
	datos=datos+'?fecha='+dia+'&idcurso='+idcurso+'&idalumno='+idalumno+'&'+variable+'='+contvariable+'&variable='+contvariable2+'&contvar='+contvariable3;
	
	ajax=objetoAjax();
	ajax.open ("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divResultado.innerHTML = ajax.responseText
			
		}
	}
	ajax.send(null)
    }