// JavaScript Document

	function nuevoAjax(){ 
	   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 cargaContenido()
{

		ajax=nuevoAjax();
		ajax.open("GET","calendario.php", true);
		ajax.onreadystatechange=function() { 
			if ((ajax.readyState==4) && (ajax.status==200) )
			{ 
				document.getElementById("calen").innerHTML=ajax.responseText;
			} 
		}
		ajax.send(null);

}
function cargaContenido2(m,a)
{

		ajax=nuevoAjax();
		ajax.open("GET","calendario.php?van=s&m="+m+"&a="+a, true);
		ajax.onreadystatechange=function() { 
			if ((ajax.readyState==4) && (ajax.status==200) )
			{ 
				document.getElementById("calen").innerHTML=ajax.responseText;
				
			
			} 
			if (ajax.readyState==1) { 
			  document.getElementById("calen").innerHTML="<br><br><br><br><br><br><DIV align='center'><img src='loader.gif'><br><br><br>Cargando...</DIV><br><br><br><br><br><br>"; 
			} 
		}
		ajax.send(null);
}

function cargaContenido3(ori,des)
{

		ajax=nuevoAjax();
		ajax.open("GET",ori, true);
		ajax.onreadystatechange=function() { 
			if ((ajax.readyState==4) && (ajax.status==200) )
			{ 
				document.getElementById(des).innerHTML=ajax.responseText;
			} 
			if (ajax.readyState==1) { 
			  document.getElementById(des).innerHTML="Cargando..."; 
			}			
		}
		ajax.send(null);
		
}

function eliminar(id, t){
	if (confirm('Esta seguro que desea eliminar '+t)){
		document.location.href=id
	}
}

function cargar(url){

	document.location.href=url	
}


function validacion3() {

	var bien=true

	if (document.getElementById('nom').value==''){
		alert('Debe introducir un Nombre de usuario.')
			bien = false
	}
	
	if (document.getElementById('contra').value==''){
		alert('Debe introducir una Contraseña.')
			bien = false
	}
	if (document.getElementById ('contra').value != document.getElementById ('contrac').value){
		alert('Error en la confirmación de la contraseña')
			bien = false
	}
	//alert('Los campos introducidos son CORRECTOS.')
	
	if(bien==true){
		
		var p="cambio_contra.php?m=si&n="+document.getElementById('nom').value+"&c="+document.getElementById('contra').value
		cargaContenido3(p,'con')
		var element = document.getElementById ('con2');
		element.style.display = "block";
		
	}

}

function validacion4() {

	var bien=true

	if (document.getElementById('nom').value==''){
		alert('Debe introducir un usuario.')
			bien = false
	}
	
	if (document.getElementById('contra').value==''){
		alert('Debe introducir una Contraseña.')
			bien = false
	}
	if (document.getElementById ('contra').value != document.getElementById ('contrac').value){
		alert('Error en la confirmación de la contraseña')
			bien = false
	}
	//alert('Los campos introducidos son CORRECTOS.')
	
	if(bien==true){
		
		var p="cambio_contra2.php?m=si&n="+document.getElementById('nom').value+"&c="+document.getElementById('contra').value+"&nombre="+document.getElementById('nombre').value
		cargaContenido3(p,'con')
		
	}

}

function validacion5() {

	var bien=true

	if (document.getElementById('nom').value==''){
		alert('Debe introducir un usuario.')
			bien = false
	}
	
	if (document.getElementById('contra').value==''){
		alert('Debe introducir una Contraseña.')
			bien = false
	}
	if (document.getElementById ('contra').value != document.getElementById ('contrac').value){
		alert('Error en la confirmación de la contraseña')
			bien = false
	}
	//alert('Los campos introducidos son CORRECTOS.')
	
	if(bien==true){
		
		var p="cambio_contra2.php?a=si&n="+document.getElementById('nom').value+"&c="+document.getElementById('contra').value+"&nombre="+document.getElementById('nombre').value+"&id="+document.getElementById('id').value
		cargaContenido3(p,'con')
		
	}

}