// JavaScript Document
function click_casilla(C){
	clearTimeout(x);
	for(i=0; i<9; i++){
		if(parseInt(C)==i){
			document.getElementById('casillas'+C).style.background='url(imagenes/fondo-casillas-select.png)';
		} else {
			document.getElementById('casillas'+i).style.background='url(imagenes/fondo-casillas.png)';
		}
	}
	
	//Nombre producto
	document.getElementById('nombre_producto').innerText = todos[C][0][1];
	//Descripcion
	document.getElementById('descripcion').innerHTML = todos[C][0][2].substr(0,200)+"...";
	//Precio
	document.getElementById('precio').innerText = todos[C][0][3];
	//Link detalle
	document.getElementById('link_detalle').href='detalle/'+todos[C][0][0]+'/'+todos[C][0][1].replace(/ /gi,"-");
	//Foto
	document.getElementById('foto').style.display='none';
	Effect.toggle('foto','appear');
	document.getElementById('foto').src=todos[C][0][5];
	
	tiempo_espera();
}

function tiempo_espera(){
	x = setTimeout("LosArticulos()", 10000);
}


// CONTACTO

function Verificacion(Pagina) {
		var Fields = new Array ("Nombre", "e-Mail", "Consulta");
		if (document.Contacto.Nombre.value != "" && document.Contacto.Mail.value != "" && document.Contacto.Consulta.value != "")
		  {
			if (Alfanumerico(document.Contacto.Nombre.value))
			  {
				if (Mail(document.Contacto.Mail.value)) {
					
					
					document.location.href='?Action=1&Nombre='+document.Contacto.Nombre.value+'&Empresa='+document.Contacto.Empresa.value+'&Mail='+document.Contacto.Mail.value+'&Telefono='+document.Contacto.Telefono.value+'&Consulta='+document.Contacto.Consulta.value;
					
					//document.getElementById('cuerpo').innerHTML = '<img src=\"imagenes/loading2.gif\">';
					//return (true);
				} else { return (false); }
			} else { return (false); }
		} else { alert ('Los campos NOMBRE, E-MAIL y CONSULTA deben estar completados') ; return (false); }
	}// Fin Verificación
	
	
	function Mail(Dato) {
		// Verificacion del mail
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(Dato))
		  { return (true); } 
		 else 
		  {	alert('Por favor, ingrese una cuenta de mail válida.');
			return (false); }
	}
	
	
	function Alfanumerico(Dato) {
		// Verificacion de los caracteres
		var CadenaNumeros = "0123456789";
		var EsteCaracter;
		var flagBoolean = true;
		for (var i=0; i < Dato.length; i++)
		  {
			EsteCaracter = Dato.substr (i,1);
			if (CadenaNumeros.indexOf (EsteCaracter) != -1) 
			  { 
				alert ('Los números no son válidos en el campo NOMBRE'); 
				return (false);
				break;
			} 
		}
		return (true);
	}