function nuevoAjax(){ 
	var objeto=false; 

	if(window.XMLHttpRequest){
		objeto = new XMLHttpRequest(); 
	}else{ 
		try{
			objeto = new ActiveXObject("Microsoft.XMLHTTP"); 
		}
		catch (e){
			alert('El navegador utilizado no cumple los requisitos para ver esta página.');
		}
	}

	return objeto; 
}

function cargaContenido(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 cargaContenidoc(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="<DIV align='center'><br><br><br>Cargando...</DIV>"; 
			} 
		}
		ajax.send(null);
}
function cargaContenido2(ori,valores, des){
	
		ajax=nuevoAjax();
		ajax.open("POST",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 = "<div align='center'>Cargando...</div>";
			} 		
		}
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send(valores);
}

function cargaContenido3(ori,valores, des){
	
		ajax=nuevoAjax();
		ajax.open("POST",ori, true);
		ajax.onreadystatechange=function() { 
			if ((ajax.readyState==4) && (ajax.status==200) ){ 
				opener.document.getElementById(des).innerHTML=ajax.responseText;

			} 
			if (ajax.readyState==1) { 
				opener.document.getElementById(des).innerHTML = "<div align='center'>Cargando...</div>";
			} 		
		}
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send(valores);
}

function eMsg(msg,id){
    var div = document.getElementById(id);
    div.style.color='red';
    div.style.fontSize="16";
    //remove old messages
    if(div.hasChildNodes()){
        div.removeChild(div.firstChild);
    }
    div.appendChild(document.createTextNode(msg));

}

function ventana (url){
	var newWindow;
	newWindow = window.open(url,'','height=575,width=850,toolbar=no,minimize=no,status=no,memubar=no,location=no,scrollbars=yes')
}
function ventana2 (url){
	var newWindow;
	newWindow = window.open(url,'','height=370,width=850,toolbar=no,minimize=no,status=no,memubar=no,location=no,scrollbars=yes')
}
function ventana3 (url){
	var newWindow;
	newWindow = window.open(url,'','height=500,width=850,toolbar=no,minimize=no,status=no,memubar=no,location=no,scrollbars=yes')
}
function ventana4 (url){
	var newWindow;
	newWindow = window.open(url,'','height=140,width=330,toolbar=no,minimize=no,status=no,memubar=no,location=no,scrollbars=yes')
}
function ventana5 (url){
	var newWindow;
	newWindow = window.open(url,'','height=675,width=850,toolbar=no,minimize=no,status=no,memubar=no,location=no,scrollbars=yes')
}





function validacorreo(){
	var bien=true

	if(document.getElementById('nombre').value==''){
		eMsg("Debes introducir tu nombre","error1")
		bien=false		
	}else{
		eMsg("","error1")	
	}
	
	if(isEmail(document.getElementById('email').value)){
		eMsg("","error2")
	}else{
		eMsg("Debes introducir tu email","error2")
		bien=false		
	}
	
	if(bien){
		document.form1.submit()	
	}
}

function validaformulario(){
	var bien=true

	if(document.getElementById('nombre').value==''){
		eMsg("Debes introducir tu nombre","error1")
		bien=false		
	}else{
		eMsg("","error1")	
	}
	
	if(isEmail(document.getElementById('email').value)){
		eMsg("","error2")
	}else{
		eMsg("Debes introducir tu email","error2")
		bien=false		
	}
	if(document.getElementById('telefono').value==''){
		eMsg("Debes introducir un telefono de contacto","error3")
		bien=false		
	}else{
		eMsg("","error3")	
	}	
	if(bien){
		document.form1.submit()	
	}
}


function comprar(){
	
	var f=document.form1.pago.value
	
	
	if(f==0){
		alert('Debe seleccionar una forma de pago')
	}else{
		document.form1.submit()	
	}
}