

// BUSCADOR


	function enviarBuscador(){
	
		if( (document.getElementById("form_buscar").value == "palabras a buscar") || ( document.getElementById("form_buscar").value == "paraules a cercar") || ( document.getElementById("form_buscar").value == "searched words") ) document.getElementById("form_buscar").value="";
		
		document.getElementById('from_buscador').submit();
		
	}


// N OTICIAS 


	function mostrarNoticia(mostrar, ocultar,numero){
	
	
		esconderNoticias(numero);
	
		document.getElementById(mostrar).style.display='block';
		
		document.getElementById(ocultar).style.display='none';
	
	}
	
	
	function esconderNoticias(numero){
	
	var capa;
	
	var capa2;
	
	for (i=1;i<=numero;i++){
		
		capa="noticia_"+i;
		
		capa2="resumen_"+i;
		
		document.getElementById(capa).style.display='none';
		
		document.getElementById(capa2).style.display='block';
	
	}
		
	}

	
	
	
// FIN NOTICIAS 



// CARRITO COMPRA



function esconder_capa(capa){

	
	// mostrar_menus('solo_menu.php', 'contenedor_menu');
	
	
	document.getElementById(capa).style.display='none';
	
}


function cambiarFondo(capa,estado){
	
		if(estado=="hover"){
				
			document.getElementById(capa).style.backgroundColor='#cccccc';
			
		} else {
			
			document.getElementById(capa).style.backgroundColor='#ffffff';
				
		}		
}

function esconder_capa_super(capa){

	document.getElementById(capa).style.display='none';
	
}

function swicth_capa(capa){

	//mostrar_menus('solo_menu.php', 'contenedor_menu');
	
	document.getElementById(capa).style.display='block';
							   
	
}

function swicth_capa_sem(capa){

	
	if(document.getElementById(capa).style.display=='block'){
		
		document.getElementById(capa).style.display='none';
		
	}else{
		
		document.getElementById(capa).style.display='block';
		
	}
							   
	
}


function vaciar_input(capa){

	document.getElementById(capa).value='';
	
}

function popUp(pagina, titulo, propiedades){
	
	window.open(pagina,titulo,propiedades);
	
}


function setArtista(iden,nombre,modNombre){
	
	document.getElementById('menu_rapido').innerHTML+="<li><a class='enlaces_internos' href='artista_"+iden+"_"+modNombre+".html'>"+nombre+"</a></li>";
	
}


function setExposiciones(iden,nombre){
	
	document.getElementById('menu_rapido').innerHTML+="<li><a class='enlaces_internos' href='ficha_exposicion.php?iden="+iden+"'>"+nombre+"</a></li>";
	
}


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 send_newsletter(capa, lang){
	
	
	if ((isEmail(document.getElementById('email').value))||((document.getElementById('email').value==""))){
	
	
		document.getElementById('error').innerHTML="error email!";
			
	}else{
		
		var url = "core.php?case=send_newsletter&email="+document.getElementById('email').value+"&lang="+lang;
		
		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 validar_contacto(){
	
	esconder_capa('menu_exposiciones');
		
	var semafor=1;
	
	var frase ="";
	
	// VALIDAR MAIL
	
	if( (document.getElementById('correo').value=="") || (isEmail(document.getElementById('correo').value))) {
				
		document.getElementById('id_correo').className='texto_error_formulario';
		
		document.getElementById('correo').className='input_formulario_error';
		
		semafor = 0;

	    frase ="Rellena los campos obligatorios o EMAIL incorrecto";
				
		
	}else{
	
		document.getElementById('id_correo').className='';
		
		document.getElementById('correo').className='input_formulario';
	
	}
	
	
	// VALIDAR NOMBRES	

	if(document.getElementById('nombre').value==""){
				
		document.getElementById('id_nombre').className='texto_error_formulario';
		
		document.getElementById('nombre').className='input_formulario_error';
		
		semafor = 0;
		
		frase ="Rellena los campos obligatorios";
				
		
	}else{
	
		document.getElementById('id_nombre').className='';
		
		document.getElementById('nombre').className='input_formulario';
	
	}
	
	// VALIDAR APELLIDOS
		
	if(document.getElementById('apellidos').value==""){
				
		document.getElementById('id_apellidos').className='texto_error_formulario';
		
		document.getElementById('apellidos').className='input_formulario_error';
		
		semafor = 0;
		
		frase ="Rellena los campos obligatorios";
				
		
	}else{
	
		document.getElementById('id_apellidos').className='';
		
		document.getElementById('apellidos').className='input_formulario';
	
	}
	
		
	// ENVIO DEL FORMULARIO
	
	if(semafor==1){
			
			document.getElementById('form_conatcto').submit();
	
	} else { 
	
		alert(frase);
	}
			
			
	
}

function preload(carga){
	ld=document.getElementById(carga).style;
	lid=document.getElementById("imagen_preload").style;
	lid.display="none";
	ld.display="none";
}

