// JavaScript Document

	function objetus() {
			 try {
					 objeto = new ActiveXObject("Msxml2.XMLHTTP");
			} catch ( e) {
					 try {
							 objeto= new ActiveXObject (" Microsoft.XMLHTTP");
					 } catch (E) {
							  objeto= false;
					}
			}
			if (! objeto && typeof XMLHttpRequest!= 'undefined') {
					 objeto = new XMLHttpRequest();
			}
			return objeto;
	  }


function envio_email(){
		var aleatorio=Math.random();
		var nombre = document.getElementById('form_nombre').value;
		var telefono = document.getElementById('form_telefono').value;
		var email = document.getElementById('form_email').value;
		var poblacion = document.getElementById('form_poblacion').value;
		var consulta = document.getElementById('form_cons').value;
				
		//var input_marca = document.getElementById('marca').value;
		//var id_marca = document.getElementById('id_marca').value;
		/*if (input_marca.length==0)
			{
				alert("Introduzca la marca de la oferta");
				return 0;
			}
		if (id_marca.length==0)
			{
				alert("Debe asignar una imagen de marca.");
				return 0;
			}*/
			
		if (nombre.length==0)
			{
				document.getElementById('form_nombre').style.backgroundColor='#fff0a3';
				document.getElementById('form_nombre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('form_nombre').style.backgroundPosition="right";
				document.getElementById('form_nombre').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el nombre.");
				document.getElementById('form_nombre').focus();
				return 0;
			}
		if (telefono.length==0)
			{
				document.getElementById('form_telefono').style.backgroundColor='#fff0a3';
				document.getElementById('form_telefono').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('form_telefono').style.backgroundPosition="right";
				document.getElementById('form_telefono').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el numero de telefono.");
				document.getElementById('form_telefono').focus();
				return 0;
			}
		if (email.length==0)
			{
				document.getElementById('form_email').style.backgroundColor='#fff0a3';
				document.getElementById('form_email').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('form_email').style.backgroundPosition="right";
				document.getElementById('form_email').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el e-mail.");
				document.getElementById('form_email').focus();
				return 0;
			}
		if (poblacion.length==0)
			{
				document.getElementById('form_poblacion').style.backgroundColor='#fff0a3';
				document.getElementById('form_poblacion').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('form_poblacion').style.backgroundPosition="right";
				document.getElementById('form_poblacion').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la poblaci\u00f3n.");
				document.getElementById('form_poblacion').focus();
				return 0;
			}
		if (consulta.length==0)
			{
				document.getElementById('form_cons').style.backgroundColor='#fff0a3';
				document.getElementById('form_cons').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('form_cons').style.backgroundPosition="right";
				document.getElementById('form_cons').style.backgroundRepeat = "no-repeat";
				alert("Tienes que introducir una consulta.");
				document.getElementById('form_cons').focus();
				return 0;
			}
		
	  	//var url = "enviar_email.php?marca="+encodeURIComponent(input_marca)+"&id_marca="+id_marca+"";
		
		var url = "enviar_email.php?form_nombre="+encodeURIComponent(nombre)+"&form_telefono="+telefono+"&form_email="+encodeURIComponent(email)+"&form_poblacion="+encodeURIComponent(poblacion)+"&form_cons="+encodeURIComponent(consulta)+"";
		var params = "nocache="+aleatorio+"";
		
		var http = objetus();
		
		http.open("GET", url+"&"+params, true);
		
		//Send the proper header information along with the request
		http.setRequestHeader("Content-type", "text/html");
		//http.setRequestHeader("Content-length", params.length);
		//http.setRequestHeader("Connection", "close");
		
		http.onreadystatechange = function() 
		{//Call a function when the state changes.
			if (http.readyState == 1) { // Cargando...
			document.getElementById('loading-envio').style.display = "block";
			
			}
			if(http.readyState == 4 && http.status == 200) {
				
				 document.getElementById('loading-envio').style.display = "none";
				 document.getElementById('resultado').innerHTML = http.responseText;
				 document.getElementById('resultado').style.display = "block";	
				 setTimeout ("document.getElementById('resultado').style.display = 'none';", 3000);

			}

		}
		http.send(null);
		
	  }
	  
	  
function envio_inscripcion(){
		var aleatorio=Math.random();
		var nombre = document.getElementById('ins_nombre').value;
		var apellidos = document.getElementById('ins_apellidos').value;
		var dni = document.getElementById('ins_dni').value;
		var edad = document.getElementById('ins_edad').value;
		var direccion = document.getElementById('ins_direccion').value;
		var poblacion = document.getElementById('ins_poblacion').value;
	  	var cp = document.getElementById('ins_cp').value;
		var provincia = document.getElementById('ins_provincia').value;
		var telefono = document.getElementById('ins_telefono').value;
		var movil = document.getElementById('ins_movil').value;
		var email = document.getElementById('ins_email').value;
		var instrumento = document.getElementById('ins_instrumento').value;
	  	var curso = document.getElementById('ins_curso').value;
		var pertenece = document.getElementById('pertenece').checked;
		
		var autorizo = document.getElementById('autorizo').checked;
		var padre = document.getElementById('padre').value;
		var dnipadre = document.getElementById('dnipadre').value;
		var nombrealumno = document.getElementById('nombrealumno').value;
		
		var autorizo_evento = document.getElementById('autorizo_evento').checked;
		var padre_evento = document.getElementById('padre_evento').value;
		var dnipadre_evento = document.getElementById('dnipadre_evento').value;
		var nombrealumno_evento = document.getElementById('nombrealumno_evento').value;
		var dnialumno_evento = document.getElementById('dnialumno_evento').value;
		
		
		var tit_ins = document.getElementById('titulo_inscripcion').innerHTML;
		
		if (nombre.length==0)
			{
				document.getElementById('ins_nombre').style.backgroundColor='#fff0a3';
				document.getElementById('ins_nombre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_nombre').style.backgroundPosition="right";
				document.getElementById('ins_nombre').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el nombre.");
				document.getElementById('ins_nombre').focus();
				return 0;
			}
		if (apellidos.length==0)
			{
				document.getElementById('ins_apellidos').style.backgroundColor='#fff0a3';
				document.getElementById('ins_apellidos').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_apellidos').style.backgroundPosition="right";
				document.getElementById('ins_apellidos').style.backgroundRepeat = "no-repeat";
				alert("No has introducido los apellidos.");
				document.getElementById('ins_apellidos').focus();
				return 0;
			}
		if (dni.length==0)
			{
				document.getElementById('ins_dni').style.backgroundColor='#fff0a3';
				document.getElementById('ins_dni').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_dni').style.backgroundPosition="right";
				document.getElementById('ins_dni').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el dni.");
				document.getElementById('ins_dni').focus();
				return 0;
			}
		if (edad.length==0)
			{
				document.getElementById('ins_edad').style.backgroundColor='#fff0a3';
				document.getElementById('ins_edad').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_edad').style.backgroundPosition="right";
				document.getElementById('ins_edad').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la edad.");
				document.getElementById('ins_edad').focus();
				return 0;
			}
		if (direccion.length==0)
			{
				document.getElementById('ins_direccion').style.backgroundColor='#fff0a3';
				document.getElementById('ins_direccion').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_direccion').style.backgroundPosition="right";
				document.getElementById('ins_direccion').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la direcci\u00f3n.");
				document.getElementById('ins_direccion').focus();
				return 0;
			}
		if (poblacion.length==0)
			{
				document.getElementById('ins_poblacion').style.backgroundColor='#fff0a3';
				document.getElementById('ins_poblacion').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_poblacion').style.backgroundPosition="right";
				document.getElementById('ins_poblacion').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la poblaci\u00f3n.");
				document.getElementById('ins_poblacion').focus();
				return 0;
			}
		if (cp.length==0)
			{
				document.getElementById('ins_cp').style.backgroundColor='#fff0a3';
				document.getElementById('ins_cp').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_cp').style.backgroundPosition="right";
				document.getElementById('ins_cp').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el c\u00f3digo postal.");
				document.getElementById('ins_cp').focus();
				return 0;
			}
		if (provincia.length==0)
			{
				document.getElementById('ins_provincia').style.backgroundColor='#fff0a3';
				document.getElementById('ins_provincia').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_provincia').style.backgroundPosition="right";
				document.getElementById('ins_provincia').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la provincia.");
				document.getElementById('ins_provincia').focus();
				return 0;
			}
		if (telefono.length==0)
			{
				document.getElementById('ins_telefono').style.backgroundColor='#fff0a3';
				document.getElementById('ins_telefono').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_telefono').style.backgroundPosition="right";
				document.getElementById('ins_telefono').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el tel\u00e9fono.");
				document.getElementById('ins_telefono').focus();
				return 0;
			}
		if (email.length==0)
			{
				document.getElementById('ins_email').style.backgroundColor='#fff0a3';
				document.getElementById('ins_email').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_email').style.backgroundPosition="right";
				document.getElementById('ins_email').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el e-mail.");
				document.getElementById('ins_email').focus();
				return 0;
			}
		if (instrumento.length==0)
			{
				document.getElementById('ins_instrumento').style.backgroundColor='#fff0a3';
				document.getElementById('ins_instrumento').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_instrumento').style.backgroundPosition="right";
				document.getElementById('ins_instrumento').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el instrumento.");
				document.getElementById('ins_instrumento').focus();
				return 0;
			}
		if (curso.length==0)
			{
				document.getElementById('ins_curso').style.backgroundColor='#fff0a3';
				document.getElementById('ins_curso').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_curso').style.backgroundPosition="right";
				document.getElementById('ins_curso').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el curso.");
				document.getElementById('ins_curso').focus();
				return 0;
			}
		if(autorizo==true){
			if (padre.length==0)
			{
				document.getElementById('padre').style.backgroundColor='#fff0a3';
				document.getElementById('padre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('padre').style.backgroundPosition="right";
				document.getElementById('padre').style.backgroundRepeat = "no-repeat";
				alert("Introduzca el nombre del padre, madre o tutor legal");
				document.getElementById('padre').focus();
				return 0;
			}
		if (dnipadre.length==0)
			{
				document.getElementById('dnipadre').style.backgroundColor='#fff0a3';
				document.getElementById('dnipadre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('dnipadre').style.backgroundPosition="right";
				document.getElementById('dnipadre').style.backgroundRepeat = "no-repeat";
				alert("Introduzca el dni del padre, madre o tutor legal.");
				document.getElementById('dnipadre').focus();
				return 0;
			}
		if (nombrealumno.length==0)
			{
				document.getElementById('nombrealumno').style.backgroundColor='#fff0a3';
				document.getElementById('nombrealumno').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('nombrealumno').style.backgroundPosition="right";
				document.getElementById('nombrealumno').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el nombre del alumno/a.");
				document.getElementById('nombrealumno').focus();
				return 0;
			}
		}
		if(autorizo_evento==true){
			if (padre_evento.length==0)
			{
				document.getElementById('padre_evento').style.backgroundColor='#fff0a3';
				document.getElementById('padre_evento').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('padre_evento').style.backgroundPosition="right";
				document.getElementById('padre_evento').style.backgroundRepeat = "no-repeat";
				alert("Introduzca el nombre del padre, madre o tutor legal");
				document.getElementById('padre_evento').focus();
				return 0;
			}
		if (dnipadre_evento.length==0)
			{
				document.getElementById('dnipadre_evento').style.backgroundColor='#fff0a3';
				document.getElementById('dnipadre_evento').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('dnipadre_evento').style.backgroundPosition="right";
				document.getElementById('dnipadre_evento').style.backgroundRepeat = "no-repeat";
				alert("Introduzca el dni del padre, madre o tutor legal.");
				document.getElementById('dnipadre_evento').focus();
				return 0;
			}
		if (nombrealumno_evento.length==0)
			{
				document.getElementById('nombrealumno_evento').style.backgroundColor='#fff0a3';
				document.getElementById('nombrealumno_evento').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('nombrealumno_evento').style.backgroundPosition="right";
				document.getElementById('nombrealumno_evento').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el nombre del alumno/a.");
				document.getElementById('nombrealumno_evento').focus();
				return 0;
			}
		}
			
			
		
			
		var url = "enviar_inscripcion.php?ins_nombre="+encodeURIComponent(nombre)+"&ins_apellidos="+encodeURIComponent(apellidos)+"&ins_dni="+encodeURIComponent(dni)+"&ins_edad="+edad+"&ins_direccion="+encodeURIComponent(direccion)+"&ins_poblacion="+encodeURIComponent(poblacion)+"&ins_cp="+cp+"&ins_provincia="+encodeURIComponent(provincia)+"&ins_telefono="+telefono+"&ins_movil="+movil+"&ins_email="+encodeURIComponent(email)+"&ins_instrumento="+encodeURIComponent(instrumento)+"&ins_curso="+encodeURIComponent(curso)+"&pertenece="+pertenece+"&titulo_inscripcion="+encodeURIComponent(tit_ins)+"&autorizo="+autorizo+"&padre="+encodeURIComponent(padre)+"&dnipadre="+dnipadre+"&nombrealumno="+encodeURIComponent(nombrealumno)+"&autorizo_evento="+autorizo_evento+"&padre_evento="+encodeURIComponent(padre_evento)+"&dnipadre_evento="+dnipadre_evento+"&nombrealumno_evento="+encodeURIComponent(nombrealumno_evento)+"";
		
		var par = "nocache="+aleatorio+"";
		
		var http = objetus();
		
		http.open("GET", url+"&"+par, true);
		
		http.setRequestHeader("Content-type", "text/html");
		
		http.onreadystatechange = function() 
		{
			if (http.readyState == 1) { // Cargando...
			document.getElementById('send_cargando').style.display = "block";
			
			}
			if(http.readyState == 4 && http.status == 200) {
				
				 document.getElementById('send_cargando').style.display = "none";
				 document.getElementById('result').innerHTML = http.responseText;
				 document.getElementById('result').style.display = "block";	
				 setTimeout ("document.getElementById('result').style.display = 'none';", 3000);

			}

		}
		http.send(null);
		
	  }
function envio_inscripcion_informatica(){
		var aleatorio=Math.random();
		var nombre = document.getElementById('ins_nombre').value;
		var apellidos = document.getElementById('ins_apellidos').value;
		var dni = document.getElementById('ins_dni').value;
		var edad = document.getElementById('ins_edad').value;
		var direccion = document.getElementById('ins_direccion').value;
		var poblacion = document.getElementById('ins_poblacion').value;
	  	var cp = document.getElementById('ins_cp').value;
		var provincia = document.getElementById('ins_provincia').value;
		var telefono = document.getElementById('ins_telefono').value;
		var movil = document.getElementById('ins_movil').value;
		var email = document.getElementById('ins_email').value;
	  	var nivel = document.getElementById('nivel').value;
		var pertenece = document.getElementById('pertenece').checked;
		
		var autorizo = document.getElementById('autorizo').checked;
		var padre = document.getElementById('padre').value;
		var dnipadre = document.getElementById('dnipadre').value;
		var nombrealumno = document.getElementById('nombrealumno').value;
		
		
		var tit_ins = document.getElementById('titulo_inscripcion').innerHTML;
		
		if (nombre.length==0)
			{
				document.getElementById('ins_nombre').style.backgroundColor='#fff0a3';
				document.getElementById('ins_nombre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_nombre').style.backgroundPosition="right";
				document.getElementById('ins_nombre').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el nombre.");
				document.getElementById('ins_nombre').focus();
				return 0;
			}
		if (apellidos.length==0)
			{
				document.getElementById('ins_apellidos').style.backgroundColor='#fff0a3';
				document.getElementById('ins_apellidos').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_apellidos').style.backgroundPosition="right";
				document.getElementById('ins_apellidos').style.backgroundRepeat = "no-repeat";
				alert("No has introducido los apellidos.");
				document.getElementById('ins_apellidos').focus();
				return 0;
			}
		if (dni.length==0)
			{
				document.getElementById('ins_dni').style.backgroundColor='#fff0a3';
				document.getElementById('ins_dni').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_dni').style.backgroundPosition="right";
				document.getElementById('ins_dni').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el dni.");
				document.getElementById('ins_dni').focus();
				return 0;
			}
		if (edad.length==0)
			{
				document.getElementById('ins_edad').style.backgroundColor='#fff0a3';
				document.getElementById('ins_edad').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_edad').style.backgroundPosition="right";
				document.getElementById('ins_edad').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la edad.");
				document.getElementById('ins_edad').focus();
				return 0;
			}
		if (direccion.length==0)
			{
				document.getElementById('ins_direccion').style.backgroundColor='#fff0a3';
				document.getElementById('ins_direccion').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_direccion').style.backgroundPosition="right";
				document.getElementById('ins_direccion').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la direcci\u00f3n.");
				document.getElementById('ins_direccion').focus();
				return 0;
			}
		if (poblacion.length==0)
			{
				document.getElementById('ins_poblacion').style.backgroundColor='#fff0a3';
				document.getElementById('ins_poblacion').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_poblacion').style.backgroundPosition="right";
				document.getElementById('ins_poblacion').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la poblaci\u00f3n.");
				document.getElementById('ins_poblacion').focus();
				return 0;
			}
		if (cp.length==0)
			{
				document.getElementById('ins_cp').style.backgroundColor='#fff0a3';
				document.getElementById('ins_cp').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_cp').style.backgroundPosition="right";
				document.getElementById('ins_cp').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el c\u00f3digo postal.");
				document.getElementById('ins_cp').focus();
				return 0;
			}
		if (provincia.length==0)
			{
				document.getElementById('ins_provincia').style.backgroundColor='#fff0a3';
				document.getElementById('ins_provincia').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_provincia').style.backgroundPosition="right";
				document.getElementById('ins_provincia').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la provincia.");
				document.getElementById('ins_provincia').focus();
				return 0;
			}
		if (telefono.length==0)
			{
				document.getElementById('ins_telefono').style.backgroundColor='#fff0a3';
				document.getElementById('ins_telefono').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_telefono').style.backgroundPosition="right";
				document.getElementById('ins_telefono').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el tel\u00e9fono.");
				document.getElementById('ins_telefono').focus();
				return 0;
			}
		if (email.length==0)
			{
				document.getElementById('ins_email').style.backgroundColor='#fff0a3';
				document.getElementById('ins_email').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_email').style.backgroundPosition="right";
				document.getElementById('ins_email').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el e-mail.");
				document.getElementById('ins_email').focus();
				return 0;
			}
		if(autorizo==true){
			if (padre.length==0)
			{
				document.getElementById('padre').style.backgroundColor='#fff0a3';
				document.getElementById('padre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('padre').style.backgroundPosition="right";
				document.getElementById('padre').style.backgroundRepeat = "no-repeat";
				alert("Introduzca el nombre del padre, madre o tutor legal");
				document.getElementById('padre').focus();
				return 0;
			}
		if (dnipadre.length==0)
			{
				document.getElementById('dnipadre').style.backgroundColor='#fff0a3';
				document.getElementById('dnipadre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('dnipadre').style.backgroundPosition="right";
				document.getElementById('dnipadre').style.backgroundRepeat = "no-repeat";
				alert("Introduzca el dni del padre, madre o tutor legal.");
				document.getElementById('dnipadre').focus();
				return 0;
			}
		if (nombrealumno.length==0)
			{
				document.getElementById('nombrealumno').style.backgroundColor='#fff0a3';
				document.getElementById('nombrealumno').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('nombrealumno').style.backgroundPosition="right";
				document.getElementById('nombrealumno').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el nombre del alumno/a.");
				document.getElementById('nombrealumno').focus();
				return 0;
			}
			
			
		}
			
		var url = "enviar_inscripcion_informatica.php?ins_nombre="+encodeURIComponent(nombre)+"&ins_apellidos="+encodeURIComponent(apellidos)+"&ins_dni="+encodeURIComponent(dni)+"&ins_edad="+edad+"&ins_direccion="+encodeURIComponent(direccion)+"&ins_poblacion="+encodeURIComponent(poblacion)+"&ins_cp="+cp+"&ins_provincia="+encodeURIComponent(provincia)+"&ins_telefono="+telefono+"&ins_movil="+movil+"&ins_email="+encodeURIComponent(email)+"&nivel="+nivel+"&pertenece="+pertenece+"&titulo_inscripcion="+encodeURIComponent(tit_ins)+"&autorizo="+autorizo+"&padre="+encodeURIComponent(padre)+"&dnipadre="+dnipadre+"&nombrealumno="+encodeURIComponent(nombrealumno)+"";
		
		var par = "nocache="+aleatorio+"";
		
		var http = objetus();
		
		http.open("GET", url+"&"+par, true);
		
		http.setRequestHeader("Content-type", "text/html");
		
		http.onreadystatechange = function() 
		{
			if (http.readyState == 1) { // Cargando...
			document.getElementById('send_cargando').style.display = "block";
			
			}
			if(http.readyState == 4 && http.status == 200) {
				
				 document.getElementById('send_cargando').style.display = "none";
				 document.getElementById('result').innerHTML = http.responseText;
				 document.getElementById('result').style.display = "block";	
				 setTimeout ("document.getElementById('result').style.display = 'none';", 3000);

			}

		}
		http.send(null);
		
	  }
	  
function envio_curso(){
		var aleatorio=Math.random();
		var nombre = document.getElementById('ins_nombre').value;
		var apellidos = document.getElementById('ins_apellidos').value;
		var dni = document.getElementById('ins_dni').value;
		var edad = document.getElementById('ins_edad').value;
		var direccion = document.getElementById('ins_direccion').value;
		var poblacion = document.getElementById('ins_poblacion').value;
	  	var cp = document.getElementById('ins_cp').value;
		var provincia = document.getElementById('ins_provincia').value;
		var telefono = document.getElementById('ins_telefono').value;
		var movil = document.getElementById('ins_movil').value;
		var email = document.getElementById('ins_email').value;
	  	
		var indice = document.form_ins.ins_curso.selectedIndex;
		var curso = document.form_ins.ins_curso.options[indice].value 
		
		
		var pertenece = document.getElementById('pertenece').checked;
		var tit_ins = document.getElementById('titulo_inscripcion').innerHTML;
		
		if(document.form_ins.tipo_curso[0].checked)
			var tipo_curso = document.form_ins.tipo_curso[0].value;
		if(document.form_ins.tipo_curso[1].checked)
			var tipo_curso = document.form_ins.tipo_curso[1].value;
			
		if(document.form_ins.horario[0].checked)
			var horario = document.form_ins.horario[0].value;
		if(document.form_ins.horario[1].checked)
			var horario = document.form_ins.horario[1].value;
			
			var autorizo = document.getElementById('autorizo').checked;
		var padre = document.getElementById('padre').value;
		var dnipadre = document.getElementById('dnipadre').value;
		var nombrealumno = document.getElementById('nombrealumno').value;
			
		
		if (nombre.length==0)
			{
				document.getElementById('ins_nombre').style.backgroundColor='#fff0a3';
				document.getElementById('ins_nombre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_nombre').style.backgroundPosition="right";
				document.getElementById('ins_nombre').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el nombre.");
				document.getElementById('ins_nombre').focus();
				return 0;
			}
		if (apellidos.length==0)
			{
				document.getElementById('ins_apellidos').style.backgroundColor='#fff0a3';
				document.getElementById('ins_apellidos').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_apellidos').style.backgroundPosition="right";
				document.getElementById('ins_apellidos').style.backgroundRepeat = "no-repeat";
				alert("No has introducido los apellidos.");
				document.getElementById('ins_apellidos').focus();
				return 0;
			}
		if (dni.length==0)
			{
				document.getElementById('ins_dni').style.backgroundColor='#fff0a3';
				document.getElementById('ins_dni').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_dni').style.backgroundPosition="right";
				document.getElementById('ins_dni').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el dni.");
				document.getElementById('ins_dni').focus();
				return 0;
			}
		if (edad.length==0)
			{
				document.getElementById('ins_edad').style.backgroundColor='#fff0a3';
				document.getElementById('ins_edad').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_edad').style.backgroundPosition="right";
				document.getElementById('ins_edad').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la edad.");
				document.getElementById('ins_edad').focus();
				return 0;
			}
		if (direccion.length==0)
			{
				document.getElementById('ins_direccion').style.backgroundColor='#fff0a3';
				document.getElementById('ins_direccion').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_direccion').style.backgroundPosition="right";
				document.getElementById('ins_direccion').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la direcci\u00f3n.");
				document.getElementById('ins_direccion').focus();
				return 0;
			}
		if (poblacion.length==0)
			{
				document.getElementById('ins_poblacion').style.backgroundColor='#fff0a3';
				document.getElementById('ins_poblacion').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_poblacion').style.backgroundPosition="right";
				document.getElementById('ins_poblacion').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la poblaci\u00f3n.");
				document.getElementById('ins_poblacion').focus();
				return 0;
			}
		if (cp.length==0)
			{
				document.getElementById('ins_cp').style.backgroundColor='#fff0a3';
				document.getElementById('ins_cp').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_cp').style.backgroundPosition="right";
				document.getElementById('ins_cp').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el c\u00f3digo postal.");
				document.getElementById('ins_cp').focus();
				return 0;
			}
		if (provincia.length==0)
			{
				document.getElementById('ins_provincia').style.backgroundColor='#fff0a3';
				document.getElementById('ins_provincia').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_provincia').style.backgroundPosition="right";
				document.getElementById('ins_provincia').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la provincia.");
				document.getElementById('ins_provincia').focus();
				return 0;
			}
		if (telefono.length==0)
			{
				document.getElementById('ins_telefono').style.backgroundColor='#fff0a3';
				document.getElementById('ins_telefono').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_telefono').style.backgroundPosition="right";
				document.getElementById('ins_telefono').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el tel\u00e9fono.");
				document.getElementById('ins_telefono').focus();
				return 0;
			}
		if (email.length==0)
			{
				document.getElementById('ins_email').style.backgroundColor='#fff0a3';
				document.getElementById('ins_email').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('ins_email').style.backgroundPosition="right";
				document.getElementById('ins_email').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el e-mail.");
				document.getElementById('ins_email').focus();
				return 0;
			}
		if(autorizo==true){
			if (padre.length==0)
			{
				document.getElementById('padre').style.backgroundColor='#fff0a3';
				document.getElementById('padre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('padre').style.backgroundPosition="right";
				document.getElementById('padre').style.backgroundRepeat = "no-repeat";
				alert("Introduzca el nombre del padre, madre o tutor legal");
				document.getElementById('padre').focus();
				return 0;
			}
		if (dnipadre.length==0)
			{
				document.getElementById('dnipadre').style.backgroundColor='#fff0a3';
				document.getElementById('dnipadre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('dnipadre').style.backgroundPosition="right";
				document.getElementById('dnipadre').style.backgroundRepeat = "no-repeat";
				alert("Introduzca el dni del padre, madre o tutor legal.");
				document.getElementById('dnipadre').focus();
				return 0;
			}
		if (nombrealumno.length==0)
			{
				document.getElementById('nombrealumno').style.backgroundColor='#fff0a3';
				document.getElementById('nombrealumno').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('nombrealumno').style.backgroundPosition="right";
				document.getElementById('nombrealumno').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el nombre del alumno/a.");
				document.getElementById('nombrealumno').focus();
				return 0;
			}
			
			
		}

			
		var url = "enviar_inscripcion_curso.php?ins_nombre="+encodeURIComponent(nombre)+"&ins_apellidos="+encodeURIComponent(apellidos)+"&ins_dni="+encodeURIComponent(dni)+"&ins_edad="+edad+"&ins_direccion="+encodeURIComponent(direccion)+"&ins_poblacion="+encodeURIComponent(poblacion)+"&ins_cp="+cp+"&ins_provincia="+encodeURIComponent(provincia)+"&ins_telefono="+telefono+"&ins_movil="+movil+"&ins_email="+encodeURIComponent(email)+"&ins_curso="+encodeURIComponent(curso)+"&pertenece="+pertenece+"&titulo_inscripcion="+encodeURIComponent(tit_ins)+"&tipo_curso="+tipo_curso+"&horario="+horario+"&autorizo="+autorizo+"&padre="+encodeURIComponent(padre)+"&dnipadre="+dnipadre+"&nombrealumno="+encodeURIComponent(nombrealumno)+"";
		
		//alert(url);
		
		var par = "nocache="+aleatorio+"";
		
		var http = objetus();
		
		http.open("GET", url+"&"+par, true);
		
		http.setRequestHeader("Content-type", "text/html");
		
		http.onreadystatechange = function() 
		{
			if (http.readyState == 1) { // Cargando...
			document.getElementById('send_cargando').style.display = "block";
			
			}
			if(http.readyState == 4 && http.status == 200) {
				
				 document.getElementById('send_cargando').style.display = "none";
				 document.getElementById('result').innerHTML = http.responseText;
				 document.getElementById('result').style.display = "block";	
				 setTimeout ("document.getElementById('result').style.display = 'none';", 3000);

			}

		}
		http.send(null);
		
	  }
	  
function envio_matricula() {
		var aleatorio=Math.random();
		var apellido1 = document.getElementById('mat_apellido1').value;
		var apellido2 = document.getElementById('mat_apellido2').value;
		var nombre = document.getElementById('mat_nombre').value;
		var nif = document.getElementById('mat_nif').value;
		var lugar = document.getElementById('mat_lugar').value;
		var fecha = document.getElementById('mat_fecha').value;
		var calle = document.getElementById('mat_calle').value;
		var numero = document.getElementById('mat_numero').value;
		var piso = document.getElementById('mat_piso').value;
		var poblacion = document.getElementById('mat_poblacion').value;
		var provincia = document.getElementById('mat_provincia').value;
	  	var codigo_postal = document.getElementById('mat_cp').value;
		var madre_padre = document.getElementById('mat_mad_pad').value;
		var tlf_casa = document.getElementById('mat_telefono').value;
		var tlf_movil = document.getElementById('mat_movil').value;
		var email = document.getElementById('mat_email').value;
		
		var titulo_matricula = document.getElementById('titulo_inscripcion').innerHTML;
		
		var inf_mus = document.getElementById('estudios1').checked;
		var len_mus = document.getElementById('estudios2').checked;
		var len_mus_ad = document.getElementById('estudios3').checked;
		var yamaha = document.getElementById('estudios4').checked;
		var sol_ins = document.getElementById('estudios5').checked;
		var est_mant = document.getElementById('estudios6').checked;
		
		var acordeon = document.getElementById('acordeon').innerHTML;		
		var curso_acordeon = document.getElementById('curso_acordeon').value;
		var tiempo_acordeon = document.getElementById('tiempo_acordeon').value;
		
		var oboe = document.getElementById('oboe').innerHTML;
		var curso_oboe = document.getElementById('curso_oboe').value;
		var tiempo_oboe = document.getElementById('tiempo_oboe').value;
		
		var bombardino = document.getElementById('bombardino').innerHTML;
		var curso_bombardino = document.getElementById('curso_bombardino').value;
		var tiempo_bombardino = document.getElementById('tiempo_bombardino').value;
		
		var percusion = document.getElementById('percusion').innerHTML;
		var curso_percusion = document.getElementById('curso_percusion').value;
		var tiempo_percusion = document.getElementById('tiempo_percusion').value;
		
		var canto = document.getElementById('canto').innerHTML;
		var curso_canto = document.getElementById('curso_canto').value;
		var tiempo_canto = document.getElementById('tiempo_canto').value;
		
		var piano = document.getElementById('piano').innerHTML;
		var curso_piano = document.getElementById('curso_piano').value;
		var tiempo_piano = document.getElementById('tiempo_piano').value;
		
		var clarinete = document.getElementById('clarinete').innerHTML;
		var curso_clarinete = document.getElementById('curso_clarinete').value;
		var tiempo_clarinete = document.getElementById('tiempo_clarinete').value;
		
		var saxofon = document.getElementById('saxofon').innerHTML;
		var curso_saxofon = document.getElementById('curso_saxofon').value;
		var tiempo_saxofon = document.getElementById('tiempo_saxofon').value;
		
		var contrabajo = document.getElementById('contrabajo').innerHTML;
		var curso_contrabajo = document.getElementById('curso_contrabajo').value;
		var tiempo_contrabajo = document.getElementById('tiempo_contrabajo').value;
		
		var tuba = document.getElementById('tuba').innerHTML;
		var curso_tuba = document.getElementById('curso_tuba').value;
		var tiempo_tuba = document.getElementById('tiempo_tuba').value;
		
		var dulzaina = document.getElementById('dulzaina').innerHTML;
		var curso_dulzaina = document.getElementById('curso_dulzaina').value;
		var tiempo_dulzaina = document.getElementById('tiempo_dulzaina').value;
		
		var trombon = document.getElementById('trombon').innerHTML;
		var curso_trombon = document.getElementById('curso_trombon').value;
		var tiempo_trombon = document.getElementById('tiempo_trombon').value;
		
		var fagot = document.getElementById('fagot').innerHTML;
		var curso_fagot = document.getElementById('curso_fagot').value;
		var tiempo_fagot = document.getElementById('tiempo_fagot').value;
		
		var trompa = document.getElementById('trompa').innerHTML;
		var curso_trompa = document.getElementById('curso_trompa').value;
		var tiempo_trompa = document.getElementById('tiempo_trompa').value;
		
		var flauta = document.getElementById('flauta').innerHTML;
		var curso_flauta = document.getElementById('curso_flauta').value;
		var tiempo_flauta = document.getElementById('tiempo_flauta').value;
		
		var trompeta = document.getElementById('trompeta').innerHTML;
		var curso_trompeta = document.getElementById('curso_trompeta').value;
		var tiempo_trompeta = document.getElementById('tiempo_trompeta').value;
		
		var fliscornio = document.getElementById('fliscornio').innerHTML;
		var curso_fliscornio = document.getElementById('curso_fliscornio').value;
		var tiempo_fliscornio = document.getElementById('tiempo_fliscornio').value;
		
		var viola = document.getElementById('viola').innerHTML;
		var curso_viola = document.getElementById('curso_viola').value;
		var tiempo_viola = document.getElementById('tiempo_viola').value;
		
		var guitarra_clasica = document.getElementById('guitarra_clasica').innerHTML;
		var curso_guitarra_clasica = document.getElementById('curso_guitarra_clasica').value;
		var tiempo_guitarra_clasica = document.getElementById('tiempo_guitarra_clasica').value;
		
		var violin = document.getElementById('violin').innerHTML;
		var curso_violin = document.getElementById('curso_violin').value;
		var tiempo_violin = document.getElementById('tiempo_violin').value;
		
		var guitarra_electrica = document.getElementById('guitarra_electrica').innerHTML;
		var curso_guitarra_electrica = document.getElementById('curso_guitarra_electrica').value;
		var tiempo_guitarra_electrica = document.getElementById('tiempo_guitarra_electrica').value;
		
		var violonchelo = document.getElementById('violonchelo').innerHTML;
		var curso_violonchelo = document.getElementById('curso_violonchelo').value;
		var tiempo_violonchelo = document.getElementById('tiempo_violonchelo').value;
		
		var observaciones = document.getElementById('observaciones').value;
		
		
		var autorizo = document.getElementById('autorizo').checked;
		var padre = document.getElementById('padre').value;
		var dnipadre = document.getElementById('dnipadre').value;
		var nombrealumno = document.getElementById('nombrealumno').value;
		
		
		
		if (nombre.length==0)
			{
				document.getElementById('mat_nombre').style.backgroundColor='#fff0a3';
				document.getElementById('mat_nombre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_nombre').style.backgroundPosition="right";
				document.getElementById('mat_nombre').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el nombre.");
				document.getElementById('mat_nombre').focus();
				return 0;
			}
		if (apellido1.length==0)
			{
				document.getElementById('mat_apellido1').style.backgroundColor='#fff0a3';
				document.getElementById('mat_apellido1').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_apellido1').style.backgroundPosition="right";
				document.getElementById('mat_apellido1').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el primer apellido.");
				document.getElementById('mat_apellido1').focus();
				return 0;
			}
		if (apellido2.length==0)
			{
				document.getElementById('mat_apellido2').style.backgroundColor='#fff0a3';
				document.getElementById('mat_apellido2').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_apellido2').style.backgroundPosition="right";
				document.getElementById('mat_apellido2').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el segundo apellido.");
				document.getElementById('mat_apellido2').focus();
				return 0;
			}
		if (nif.length==0)
			{
				document.getElementById('mat_nif').style.backgroundColor='#fff0a3';
				document.getElementById('mat_nif').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_nif').style.backgroundPosition="right";
				document.getElementById('mat_nif').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el nif.");
				document.getElementById('mat_nif').focus();
				return 0;
			}
		if (lugar.length==0)
			{
				document.getElementById('mat_lugar').style.backgroundColor='#fff0a3';
				document.getElementById('mat_lugar').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_lugar').style.backgroundPosition="right";
				document.getElementById('mat_lugar').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el lugar de nacimiento.");
				document.getElementById('mat_lugar').focus();
				return 0;
			}
		if (fecha.length==0)
			{
				document.getElementById('mat_fecha').style.backgroundColor='#fff0a3';
				document.getElementById('mat_fecha').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_fecha').style.backgroundPosition="right";
				document.getElementById('mat_fecha').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la fecha de nacimiento.");
				document.getElementById('mat_fecha').focus();
				return 0;
			}
		if (calle.length==0)
			{
				document.getElementById('mat_calle').style.backgroundColor='#fff0a3';
				document.getElementById('mat_calle').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_calle').style.backgroundPosition="right";
				document.getElementById('mat_calle').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la calle o la plaza.");
				document.getElementById('mat_calle').focus();
				return 0;
			}
		if (numero.length==0)
			{
				document.getElementById('mat_numero').style.backgroundColor='#fff0a3';
				document.getElementById('mat_numero').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_numero').style.backgroundPosition="right";
				document.getElementById('mat_numero').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el n\u00famero.");
				document.getElementById('mat_numero').focus();
				return 0;
			}
		if (piso.length==0)
			{
				document.getElementById('mat_piso').style.backgroundColor='#fff0a3';
				document.getElementById('mat_piso').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_piso').style.backgroundPosition="right";
				document.getElementById('mat_piso').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el n\u00famero del piso.");
				document.getElementById('mat_piso').focus();
				return 0;
			}
		if (poblacion.length==0)
			{
				document.getElementById('mat_poblacion').style.backgroundColor='#fff0a3';
				document.getElementById('mat_poblacion').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_poblacion').style.backgroundPosition="right";
				document.getElementById('mat_poblacion').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la poblaci\u00f3n.");
				document.getElementById('mat_poblacion').focus();
				return 0;
			}
		if (provincia.length==0)
			{
				document.getElementById('mat_provincia').style.backgroundColor='#fff0a3';
				document.getElementById('mat_provincia').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_provincia').style.backgroundPosition="right";
				document.getElementById('mat_provincia').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la provincia.");
				document.getElementById('mat_provincia').focus();
				return 0;
			}
		if (codigo_postal.length==0)
			{
				document.getElementById('mat_cp').style.backgroundColor='#fff0a3';
				document.getElementById('mat_cp').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_cp').style.backgroundPosition="right";
				document.getElementById('mat_cp').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el c\u00f3digo postal.");
				document.getElementById('mat_cp').focus();
				return 0;
			}
		if (madre_padre.length==0)
			{
				document.getElementById('mat_mad_pad').style.backgroundColor='#fff0a3';
				document.getElementById('mat_mad_pad').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_mad_pad').style.backgroundPosition="right";
				document.getElementById('mat_mad_pad').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el nombre y los apellidos de la madre o el padre.");
				document.getElementById('mat_mad_pad').focus();
				return 0;
			}
		if (tlf_casa.length==0)
			{
				document.getElementById('mat_telefono').style.backgroundColor='#fff0a3';
				document.getElementById('mat_telefono').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_telefono').style.backgroundPosition="right";
				document.getElementById('mat_telefono').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el tel\u00e9fono de casa.");
				document.getElementById('mat_telefono').focus();
				return 0;
			}
		if (tlf_movil.length==0)
			{
				document.getElementById('mat_movil').style.backgroundColor='#fff0a3';
				document.getElementById('mat_movil').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_movil').style.backgroundPosition="right";
				document.getElementById('mat_movil').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el tel\u00e9fono del m\u00f3vil.");
				document.getElementById('mat_movil').focus();
				return 0;
			}
		if (email.length==0)
			{
				document.getElementById('mat_email').style.backgroundColor='#fff0a3';
				document.getElementById('mat_email').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('mat_email').style.backgroundPosition="right";
				document.getElementById('mat_email').style.backgroundRepeat = "no-repeat";
				alert("No has introducido la direcci\u00f3n de correo electr\u00f3nico.");
				document.getElementById('mat_email').focus();
				return 0;
			}
			
			if(autorizo==true){
			if (padre.length==0)
			{
				document.getElementById('padre').style.backgroundColor='#fff0a3';
				document.getElementById('padre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('padre').style.backgroundPosition="right";
				document.getElementById('padre').style.backgroundRepeat = "no-repeat";
				alert("Introduzca el nombre del padre, madre o tutor legal");
				document.getElementById('padre').focus();
				return 0;
			}
		if (dnipadre.length==0)
			{
				document.getElementById('dnipadre').style.backgroundColor='#fff0a3';
				document.getElementById('dnipadre').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('dnipadre').style.backgroundPosition="right";
				document.getElementById('dnipadre').style.backgroundRepeat = "no-repeat";
				alert("Introduzca el dni del padre, madre o tutor legal.");
				document.getElementById('dnipadre').focus();
				return 0;
			}
		if (nombrealumno.length==0)
			{
				document.getElementById('nombrealumno').style.backgroundColor='#fff0a3';
				document.getElementById('nombrealumno').style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById('nombrealumno').style.backgroundPosition="right";
				document.getElementById('nombrealumno').style.backgroundRepeat = "no-repeat";
				alert("No has introducido el nombre del alumno/a.");
				document.getElementById('nombrealumno').focus();
				return 0;
			}
			
			
		}
			
		var url = "enviar_matricula.php?mat_nombre="+encodeURIComponent(nombre)+"&mat_apellido1="+encodeURIComponent(apellido1)+"&mat_apellido2="+encodeURIComponent(apellido2)+"&mat_nif="+encodeURIComponent(nif)+"&mat_lugar="+encodeURIComponent(lugar)+"&mat_fecha="+encodeURIComponent(fecha)+"&mat_calle="+encodeURIComponent(calle)+"&mat_numero="+numero+"&mat_piso="+encodeURIComponent(piso)+"&mat_poblacion="+encodeURIComponent(poblacion)+"&mat_provincia="+encodeURIComponent(provincia)+"&mat_cp="+codigo_postal+"&mat_mad_pad="+encodeURIComponent(madre_padre)+"&mat_telefono="+tlf_casa+"&mat_movil="+tlf_movil+"&mat_email="+encodeURIComponent(email)+"&estudios1="+encodeURIComponent(inf_mus)+"&estudios2="+encodeURIComponent(len_mus)+"&estudios3="+encodeURIComponent(len_mus_ad)+"&estudios4="+encodeURIComponent(yamaha)+"&estudios5="+encodeURIComponent(sol_ins)+"&estudios6="+encodeURIComponent(est_mant)+"&curso_acordeon="+encodeURIComponent(curso_acordeon)+"&tiempo_acordeon="+encodeURIComponent(tiempo_acordeon)+"&curso_oboe="+encodeURIComponent(curso_oboe)+"&tiempo_oboe="+encodeURIComponent(tiempo_oboe)+"&curso_bombardino="+encodeURIComponent(curso_bombardino)+"&tiempo_bombardino="+encodeURIComponent(tiempo_bombardino)+"&curso_percusion="+encodeURIComponent(curso_percusion)+"&tiempo_percusion="+encodeURIComponent(tiempo_percusion)+"&curso_canto="+encodeURIComponent(curso_canto)+"&tiempo_canto="+encodeURIComponent(tiempo_canto)+"&curso_piano="+encodeURIComponent(curso_piano)+"&tiempo_piano="+encodeURIComponent(tiempo_piano)+"&curso_clarinete="+encodeURIComponent(curso_clarinete)+"&tiempo_clarinete="+encodeURIComponent(tiempo_clarinete)+"&curso_saxofon="+encodeURIComponent(curso_saxofon)+"&tiempo_saxofon="+encodeURIComponent(tiempo_saxofon)+"&curso_contrabajo="+encodeURIComponent(curso_contrabajo)+"&tiempo_contrabajo="+encodeURIComponent(tiempo_contrabajo)+"&curso_tuba="+encodeURIComponent(curso_tuba)+"&tiempo_tuba="+encodeURIComponent(tiempo_tuba)+"&curso_dulzaina="+encodeURIComponent(curso_dulzaina)+"&tiempo_dulzaina="+encodeURIComponent(tiempo_dulzaina)+"&curso_trombon="+encodeURIComponent(curso_trombon)+"&tiempo_trombon="+encodeURIComponent(tiempo_trombon)+"&curso_fagot="+encodeURIComponent(curso_fagot)+"&tiempo_fagot="+encodeURIComponent(tiempo_fagot)+"&curso_trompa="+encodeURIComponent(curso_trompa)+"&tiempo_trompa="+encodeURIComponent(tiempo_trompa)+"&curso_flauta="+encodeURIComponent(curso_flauta)+"&tiempo_flauta="+encodeURIComponent(tiempo_flauta)+"&curso_trompeta="+encodeURIComponent(curso_trompeta)+"&tiempo_trompeta="+encodeURIComponent(tiempo_trompeta)+"&curso_fliscornio="+encodeURIComponent(curso_fliscornio)+"&tiempo_fliscornio="+encodeURIComponent(tiempo_fliscornio)+"&curso_viola="+encodeURIComponent(curso_viola)+"&tiempo_viola="+encodeURIComponent(tiempo_viola)+"&curso_guitarra_clasica="+encodeURIComponent(curso_guitarra_clasica)+"&tiempo_guitarra_clasica="+encodeURIComponent(tiempo_guitarra_clasica)+"&curso_violin="+encodeURIComponent(curso_violin)+"&tiempo_violin="+encodeURIComponent(tiempo_violin)+"&curso_guitarra_electrica="+encodeURIComponent(curso_guitarra_electrica)+"&tiempo_guitarra_electrica="+encodeURIComponent(tiempo_guitarra_electrica)+"&curso_violonchelo="+encodeURIComponent(curso_violonchelo)+"&tiempo_violonchelo="+encodeURIComponent(tiempo_violonchelo)+"&titulo_inscripcion="+encodeURIComponent(titulo_matricula)+"&acordeon="+encodeURIComponent(acordeon)+"&oboe="+encodeURIComponent(oboe)+"&bombardino="+encodeURIComponent(bombardino)+"&percusion="+encodeURIComponent(percusion)+"&canto="+encodeURIComponent(canto)+"&piano="+encodeURIComponent(piano)+"&clarinete="+encodeURIComponent(clarinete)+"&saxofon="+encodeURIComponent(saxofon)+"&contrabajo="+encodeURIComponent(contrabajo)+"&tuba="+encodeURIComponent(tuba)+"&dulzaina="+encodeURIComponent(dulzaina)+"&trombon="+encodeURIComponent(trombon)+"&fagot="+encodeURIComponent(fagot)+"&trompa="+encodeURIComponent(trompa)+"&flauta="+encodeURIComponent(flauta)+"&trompeta="+encodeURIComponent(trompeta)+"&fliscornio="+encodeURIComponent(fliscornio)+"&viola="+encodeURIComponent(viola)+"&guitarra_clasica="+encodeURIComponent(guitarra_clasica)+"&violin="+encodeURIComponent(violin)+"&guitarra_electrica="+encodeURIComponent(guitarra_electrica)+"&violonchelo="+encodeURIComponent(violonchelo)+"&observaciones="+encodeURIComponent(observaciones)+"&autorizo="+autorizo+"&padre="+encodeURIComponent(padre)+"&dnipadre="+dnipadre+"&nombrealumno="+encodeURIComponent(nombrealumno)+"";
		
		//alert(url);
	
		var par = "nocache="+aleatorio+"";
		
		var http = objetus();
		
		http.open("GET", url+"&"+par, true);
		
		http.setRequestHeader("Content-type", "text/html");
		
		http.onreadystatechange = function() 
		{
			if (http.readyState == 1) { // Cargando...
			document.getElementById('send_cargando').style.display = "block";
			
			}
			if(http.readyState == 4 && http.status == 200) {
				
				 document.getElementById('send_cargando').style.display = "none";
				 document.getElementById('result').innerHTML = http.responseText;
				 document.getElementById('result').style.display = "block";	
				 setTimeout ("document.getElementById('result').style.display = 'none';", 3000);

			}

		}
		http.send(null);
		
	  }
	  
	  
function mostrar_desplegable_minutos(curso,tiempo){
	if (document.getElementById(curso).value != 0){
		document.getElementById(tiempo).style.display = "block";	
	} else {
		document.getElementById(tiempo).style.display = "none";
	}
}
			

// Estas son las funciones para insertar el curriculum si no tiene curriculum o para actualizar si tiene que modificar el curriculum.

// Esta es la funcion para modificar o insertar el curriculum para los alumnos
function actualiza_formulario(){
		var aleatorio=Math.random();
		// A esta variable se le pasa el valor por el id text_cur que es el textarea que se introduce el curriculum
		var curriculum = document.getElementById('text_cur').value;
		// Esta variable contiene el codigo de usuario por el id codigo_usuario que es el type=hidden
		var codigo = document.getElementById('codigo_usuario').value;
						
		if (curriculum.length==0)
			{
				document.getElementById('text_cur').style.backgroundColor='#fff0a3';
				alert("Debes introducir el curriculum.");
				document.getElementById('text_cur').focus();
				return 0;
			}
			
		var url = "insertar_actualizar_curriculum.php?text_cur="+encodeURIComponent(curriculum)+"&codigo_usuario="+codigo+"";
		var params = "nocache="+aleatorio+"";
		
		var http = objetus();
		
		http.open("GET", url+"&"+params, true);
		
		//Send the proper header information along with the request
		http.setRequestHeader("Content-type", "text/html");
		//http.setRequestHeader("Content-length", params.length);
		//http.setRequestHeader("Connection", "close");
		
		http.onreadystatechange = function() 
		{//Call a function when the state changes.
			if (http.readyState == 1) { // Cargando...
			document.getElementById('loading').style.display = "block";
			
			}
			if(http.readyState == 4 && http.status == 200) {
				
				 document.getElementById('loading').style.display = "none";
				 document.getElementById('total').innerHTML = http.responseText;
				 document.getElementById('total').style.display = "block";	
				 setTimeout ("document.getElementById('total').style.display = 'none';", 3000);

			}

		}
		http.send(null);
		
	  }
	  
// Esta funcion es igual q el anterior pero en este caso es para el personal
function actualiza_formulario_personal(){
		var aleatorio=Math.random();
		// A esta variable se le pasa el valor por el id text_cur que es el textarea que se introduce el curriculum
		var curriculum = document.getElementById('text_cur').value;
		// Esta variable contiene el codigo de usuario por el id codigo_usuario que es el type=hidden
		var codigo = document.getElementById('codigo_usuario').value;
						
		if (curriculum.length==0)
			{
				document.getElementById('text_cur').style.backgroundColor='#fff0a3';
				alert("Debes introducir el curriculum.");
				document.getElementById('text_cur').focus();
				return 0;
			}
			
		var url = "insertar_actualizar_curriculum_personal.php?text_cur="+encodeURIComponent(curriculum)+"&codigo_usuario="+codigo+"";
		var params = "nocache="+aleatorio+"";
		
		var http = objetus();
		
		http.open("GET", url+"&"+params, true);
		
		//Send the proper header information along with the request
		http.setRequestHeader("Content-type", "text/html");
		//http.setRequestHeader("Content-length", params.length);
		//http.setRequestHeader("Connection", "close");
		
		http.onreadystatechange = function() 
		{//Call a function when the state changes.
			if (http.readyState == 1) { // Cargando...
			document.getElementById('loading').style.display = "block";
			
			}
			if(http.readyState == 4 && http.status == 200) {
				
				 document.getElementById('loading').style.display = "none";
				 document.getElementById('total').innerHTML = http.responseText;
				 document.getElementById('total').style.display = "block";	
				 setTimeout ("document.getElementById('total').style.display = 'none';", 3000);

			}

		}
		http.send(null);
		
	  }

// Fin funciones actualizar_insertar curriculum
	  
// Estas funciones son para enviar el perfil y el comentario, ya sea en los alumnos y en el personal
function envio_perfil(){
		var aleatorio=Math.random();
		// A esta variable se le pasa el valor por el id text_per que es el textarea que se introduce el perfil
		var perfil = document.getElementById('text_per').value;
		// Esta variable contiene el codigo de usuario por el id codigo_usuario que es el type=hidden
		var codigo = document.getElementById('codigo_usuario').value;
						
		if (perfil.length==0)
			{
				document.getElementById('text_per').style.backgroundColor='#fff0a3';
				alert("Debes introducir el perfil.");
				document.getElementById('text_per').focus();
				return 0;
			}
			
		var url = "insertar_perfil.php?text_per="+encodeURIComponent(perfil)+"&id_usuario="+codigo+"";
		var params = "nocache="+aleatorio+"";
		
		var http = objetus();
		
		http.open("GET", url+"&"+params, true);
		
		//Send the proper header information along with the request
		http.setRequestHeader("Content-type", "text/html");
		//http.setRequestHeader("Content-length", params.length);
		//http.setRequestHeader("Connection", "close");
		
		http.onreadystatechange = function() 
		{//Call a function when the state changes.
			if (http.readyState == 1) { // Cargando...
			document.getElementById('loading-perfil').style.display = "block";
			
			}
			if(http.readyState == 4 && http.status == 200) {
				
				document.getElementById('loading-perfil').style.display = "none";
				document.getElementById('total_noticias').innerHTML = http.responseText;
				// Para que el contenido del textarea se vacie al iniciar
				document.getElementById('text_per').value = "";
				document.getElementById('total_noticias').style.display = "block";	
				//setTimeout ("document.getElementById('total_noticias').style.display = 'none';", 3000);

			}

		}
		http.send(null);
		
}
	  
	  
// Esta es la funcion para introducir un comentario de un perfil. En ella se le pasa 3 parametros: 
	// cod_blog --> El codigo de la publicacion a la que se refiere el comentario
	// cod_pers_perfil --> El codigo del usuario en el esta identificado
	// id_usuario --> El codigo del usuario en el que se esta viendo en perfil en ese momento
function envio_comentario(cod_blog, cod_pers_perfil, id_usuario){
		var aleatorio=Math.random();
		// la variable concattextcom es el texto del comentario de se recoge del id text_com y se concatena con el codigo del blog y despues a traves de la variable comentario se recoge el valor a traves del id que es la variable concattextcom
		var concattextcom = "text_com"+cod_blog;
		var comentario = document.getElementById(concattextcom).value;
		// Esta variable contiene el codigo de usuario por el id codigo_usuario que es el type=hidden
		var codigo = document.getElementById('codigo_usuario').value;
		var concatloading = "loading-comentario"+cod_blog;
								
		if (comentario.length==0)
			{
				document.getElementById(concattextcom).style.backgroundColor='#fff0a3';
				document.getElementById(concattextcom).style.backgroundImage="url('imagenes/alert.png')";
				document.getElementById(concattextcom).style.backgroundPosition="right";
				document.getElementById(concattextcom).style.backgroundRepeat = "no-repeat";
				alert("Debes introducir un comentario.");
				document.getElementById(concattextcom).focus();
				return 0;
			}
			
		var url = "insertar_comentario.php?text_com="+encodeURIComponent(comentario)+"&cod_blog="+cod_blog+"&cod_pers_perfil="+cod_pers_perfil+"&id_usuario="+id_usuario+"";
		var params = "nocache="+aleatorio+"";
		
		var http = objetus();
		
		http.open("GET", url+"&"+params, true);
		
		//Send the proper header information along with the request
		http.setRequestHeader("Content-type", "text/html");
		//http.setRequestHeader("Content-length", params.length);
		//http.setRequestHeader("Connection", "close");
		
		http.onreadystatechange = function() 
		{//Call a function when the state changes.
			if (http.readyState == 1) { // Cargando...
			document.getElementById(concatloading).style.display = "block";
			
			}
			if(http.readyState == 4 && http.status == 200) {
				var concatcoment = 'total_comentarios'+cod_blog;
				
				document.getElementById(concatloading).style.display = "none";
				document.getElementById(concatcoment).innerHTML = http.responseText;
				// Para que el contenido del input se vacie al iniciar
				document.getElementById(concattextcom).value = "";
				document.getElementById(concatcoment).style.display = "block";	
				//setTimeout ("document.getElementById('total_comentarios').style.display = 'none';", 3000);

			}

		}
		http.send(null);
		
	  }
	  

// Esta son las funciones para eliminar un perfil y para eliminar un comentario, ya sea de un alumno o de un personal	  
	  
// Esta es la funcion para eliminar un perfil, se le pasa un parametro:
	// cod_entrada --> Es el codigo el blog o perfil que se quiere eliminar
function eliminar_perfil(cod_entrada){
	if(confirm('¿Desea eliminar esta entrada?')){
		
		var aleatorio=Math.random();
		// Esta variable contiene el codigo de usuario por el id codigo_usuario que es el type=hidden
		var codigo = document.getElementById('codigo_usuario').value;
								
		var url = "eliminar_perfil.php?cod_entrada="+cod_entrada+"&id_usuario="+codigo+"";
		var params = "nocache="+aleatorio+"";
		var http = objetus();
		
		http.open("GET", url+"&"+params, true);
		
		//Send the proper header information along with the request
		http.setRequestHeader("Content-type", "text/html");
		//http.setRequestHeader("Content-length", params.length);
		//http.setRequestHeader("Connection", "close");
		
		http.onreadystatechange = function() 
		{//Call a function when the state changes.
			if (http.readyState == 1) { // Cargando...
			document.getElementById('loading-perfil').style.display = "block";
			
			}
			if(http.readyState == 4 && http.status == 200) {
				
				document.getElementById('loading-perfil').style.display = "none";
				document.getElementById('total_noticias').innerHTML = http.responseText;
				// Para que el contenido del textarea se vacie al iniciar
				//document.getElementById('text_per').value = "";
				document.getElementById('total_noticias').style.display = "block";	
				//setTimeout ("document.getElementById('total_noticias').style.display = 'none';", 3000);

			}

		}
		http.send(null);
	} // if del confirm
	  
}

// Esta es la funcion para eliminar un comentario, se le pasa 3 parametros:
	// cod_comentario --> es el codigo del comentario en el que se quiere eliminar.
	// cod_blog --> es el codigo del blog o perfil al que se refiere el comentario
	// cod_pers_perfil -->  es el id del usuario del perfil en el que estamos actualmente, que esta indicado en la url
function eliminar_comentario(cod_comentario, cod_blog, cod_pers_perfil){
	if(confirm('¿Desea eliminar el comentario?'))
	{
		var aleatorio=Math.random();
		// esta variable es el codigo del usuario que se recoge a traves del id codigo_usuario
		var codigo = document.getElementById('codigo_usuario').value;
		//var concatcomentario = "noticia-comentario"+cod_comentario;
		//var concattextcom = "text_com"+cod_blog;
		//var comentario = document.getElementById(concatcomentario).value;
		var concatloading = "loading-comentario"+cod_blog;
								
		var url = "eliminar_comentario.php?cod_comentario="+cod_comentario+"&id_usuario="+cod_pers_perfil+"&cod_blog="+cod_blog+"&cod_pers_perfil="+codigo+"";
		var params = "nocache="+aleatorio+"";
		
		var http = objetus();
		
		http.open("GET", url+"&"+params, true);
		
		//Send the proper header information along with the request
		http.setRequestHeader("Content-type", "text/html");
		//http.setRequestHeader("Content-length", params.length);
		//http.setRequestHeader("Connection", "close");
		
		http.onreadystatechange = function() 
		{//Call a function when the state changes.
			if (http.readyState == 1) { // Cargando...
			document.getElementById(concatloading).style.display = "block";
			
			}
			if(http.readyState == 4 && http.status == 200) {
				var concatcoment = 'total_comentarios'+cod_blog;
				
				document.getElementById(concatloading).style.display = "none";
				document.getElementById(concatcoment).innerHTML = http.responseText;
				//Para que el contenido del input se vacie al iniciar
				//document.getElementById(concattextcom).value = "";
				document.getElementById(concatcoment).style.display = "block";	
				//setTimeout ("document.getElementById('total_comentarios').style.display = 'none';", 3000);

			}

		}
		http.send(null);
		
	  }
}

// Fin funciones eliminar_perfil y eliminar_comentario

function cambia_mes_calendario(valor){
		var aleatorio=Math.random();
			
		var url = "actualiza_calendario_agenda.php?valorsuma_agenda="+valor+"";
		var params = "nocache="+aleatorio+"";
		
		var http = objetus();
		
		http.open("GET", url+"&"+params, true);
		
		//Send the proper header information along with the request
		http.setRequestHeader("Content-type", "text/html");
		//http.setRequestHeader("Content-length", params.length);
		//http.setRequestHeader("Connection", "close");
		
		http.onreadystatechange = function() 
		{//Call a function when the state changes.
			if (http.readyState == 1) { // Cargando...
			
			}
			if(http.readyState == 4 && http.status == 200) {
				
				
				  
				document.getElementById('calendario-eventos').innerHTML = http.responseText;
				
				var js = document.createElement("script");
				js.type = "text/javascript";
				js.src = "js/coda.js";
				document.body.appendChild(js);
				
				var js2 = document.createElement("script");
				js2.type = "text/javascript";
				js2.src = "js-funciones.js";
				document.body.appendChild(js2);
				
				//pathCSS se extrae de la respuesta del servidor
				var css = document.createElement("CSS");
				css.type = "text/css";
				css.rel="stylesheet";
				css.src = "css/master_agenda_cultural.css"; //creo que href
				document.body.appendChild(css);

			}

		}
		http.send(null);
		
	  }