

function nuevo_ajax(){
	
	
	//Crear una variable de Bool para comprobar si se esta usando Internet Explorer.
	var xmlhttp = false;
	
	//Comprobar si se esta usando IE.
	try {
		//Si la version de javascript es superior a la 5.
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		
	} catch (e) {
		//Si no, utilizar el tradicional objeto ActiveX.
		try {
			//Si se esta usando Internet Explorer.
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		
		} catch (E) {
			//En caso contrario no se debe estar usando Internet Explorer.
			xmlhttp = false;
		}
	}
	
	//Si no se esta usando IE, crear una instancia ActiveX del objeto.
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		
		xmlhttp = new XMLHttpRequest();
		
	}
	
	return xmlhttp;
	
}


function send_ajax(url, capa){
	
		var xmlhttp = nuevo_ajax();
				
				var obj = document.getElementById(capa);
				
				xmlhttp.open("GET", url);
				
				xmlhttp.onreadystatechange = function() {
					
					if(xmlhttp.readyState == 1){
						
							obj.innerHTML = "Cargando...";
							
					} else {
					
						if ( xmlhttp.readyState == 4 && xmlhttp.status == 200 ) {
							
							obj.innerHTML = xmlhttp.responseText;
					
						} 
					}
				
				}
				
				xmlhttp.send(null);
	
}



function enviar(){
	
	if(document.getElementById('suma').value!=document.getElementById('suma_text').value){   
		
		alert("error pregunta");
		
	}else{
	
		if(document.getElementById("email").value!=""){
		
			if(!isEmail(document.getElementById("email").value)){	
				
							document.getElementById("register").submit();
					
					}else{
						
							alert("error email");		
					}
			
		}else{
			
		alert("falta email");	
			
		}


	}
	
}




function isEmail(smail) {
	
	var re=/^[a-z0-9\-\.]+@[a-z0-9\-\.]+\.[a-z]{2,}$/i;
	
	if(smail.match(re))	{
		
		return false;
		
	} else {
				
		return true;
		
	}
}

function enviar_precio(dom){
	
	
	window.location="http://"+dom+"/obras-de-arte.php?price="+document.getElementById("price").value; 
	
	
}

function enviar_provincias(dom){
	
	
	window.location="http://"+dom+"/museos.php?provincia="+document.getElementById("provincia").value; 
	
	
}

function validar_code(capa, id_obra){
	
		var url = "mod_dto.php?code_discount="+document.getElementById('code_discount').value+"&id_obra="+id_obra;
		
		send_ajax(url, capa)
	
	
}

function run(num){
	document.getElementById('video'+num).style.display="inherit";
	document.getElementById('boton_video_hiden'+num).style.display="inherit";
	document.getElementById('boton_video'+num).style.display="none";
}
function stop(num){
	document.getElementById('video'+num).style.display="none";
	document.getElementById('boton_video_hiden'+num).style.display="none";
	document.getElementById('boton_video'+num).style.display="inherit";
}

