function checkforblanks() {
	for (var i=0; i<arguments.length; i+=2) {
		if (!arguments[i]) {
			alert("El campo " + arguments[i+1] + " es obligatorio.");
			return false;
		}
	}
	return true;
}

function validate2() {
	var isFull = checkforblanks(document.getElementById("nombre").value, "[Nombre]",
	document.getElementById("email").value, "[E-Mail]",
	document.getElementById("asunto").value, "[Asunto]",
	document.getElementById("comentario").value, "[Comentario]");
	if (!isFull) {
		return false;
	}
	var dirmail = document.getElementById("email").value;
	var filter = /^.+@.+\..{2,4}$/;
	if (!filter.test(dirmail)) {
		alert("La dirección de correo electrónico no es correcta.");
		return false;
	}
}

function MailLink (texto,usuario,dominio,tld) {
	var arroba = '@';
	var punto = '.';
	var etiqueta = 'ma' + '' + 'il';
	var dospuntos = 'to:';
	var localizador = usuario;
	localizador = localizador + arroba + dominio;
	localizador = localizador + punto + tld;
	if (texto=='') {
		texto = localizador;
	}
	document.write('<a href="' + etiqueta + dospuntos + localizador + '">' + texto + '</a>');
}

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

function dispproducto(dato) {
	document.getElementById('visorproducto').style.display = 'inline';
	document.getElementById('divproducto').style.display = 'inline';
}

function verproducto(dato) {
	document.getElementById('visorproducto').src = 'img/nada.jpg';
	document.getElementById('visorproducto').src = 'img/'+dato+'.jpg';
	//var winw = (screen.width - 720) / 2;
	//var winh = 360;
	//var posleft = winw+'px';
	//var postop = winh+'px';
	//document.getElementById('divproducto').style.left = posleft;
	//document.getElementById('divproducto').style.top = postop;
	dispproducto();
}

function ocultarproducto(dato) {
	document.getElementById('divproducto').style.display = 'none';
	document.getElementById('visorproducto').style.display = 'none';
}

function preloader() {
	var i = 0;
	// create object
	imageObj = new Image();
	// set image list
	images = new Array();
	images[0]="ladrillo-salmon.jpg";
	images[1]="ladrillo-cana.jpg";
	images[2]="taco-salmon.jpg";
	images[3]="taco-cana.jpg";
	images[4]="plaqueta-r-salmon.jpg";
	images[5]="plaqueta-r-cana.jpg";
	images[6]="plaqueta-salmon.jpg";
	images[7]="plaqueta-cana.jpg";
	images[8]="pecho-paloma-salmon.jpg";
	images[9]="pecho-paloma-cana.jpg";
	images[10]="romo-salmon.jpg";
	images[11]="romo-cana.jpg";
	images[12]="nada.jpg";
	// start preloading
	for(i=0; i<=12; i++) {
		imageObj.src=images[i];
	}
}
