function photo_in(foto) {
	var mydiv = "fotogrande";
	var lafoto = "fotobig";
	var newTop;
	var _src = "_thumbs_real.asp?path=/imgbd/&file="+foto;
	
	if (self.pageYOffset){
	  // all except Explorer
	  newTop = self.pageYOffset;

	}
	else if (document.documentElement && document.documentElement.scrollTop){
	  // Explorer 6 Strict
	  newTop = document.documentElement.scrollTop;

	}
	else if (document.body){
	  // all other Explorers
	  newTop = document.body.scrollTop;
	}
	
	newTop = newTop + 20 + "px";
	document.getElementById(lafoto).src=_src;
	document.getElementById(mydiv).style.top = newTop;
	document.getElementById(mydiv).style.display = 'inline';
}

function photo_out() {
	var mydiv = "fotogrande";
	var lafoto = "fotobig";
	var _src = "img/cargando.jpg";
	document.getElementById(lafoto).src=_src;
	document.getElementById(mydiv).style.display = 'none';
}

function change_prov(id) {
	var myprov = "provincia";
	document.getElementById(myprov).value = id;
	//mostrar_tipo();
}

function mostrar_tipo()
{
	var mytipo = "tipo";
	document.getElementById(mytipo).style.display = 'inline';
}

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 validate() {
	var isFull = checkforblanks(document.getElementById("nombre").value, "[Nombre]",
		document.getElementById("organizacion").value, "[Organización]",
		document.getElementById("tlfn").value, "[Teléfono]",
		document.getElementById("email").value, "[Email]");
	if (!isFull) {
		return false;
	}
	var dirmail = document.getElementById("email").value;
	var filter = /^.+@.+\..{2,3}$/;
	if (!filter.test(dirmail)) {
		alert("La dirección de correo electrónico no es correcta.");
		return false;
	}
}

function validate2() {
	var isFull = checkforblanks(document.getElementById("nombre").value, "[Nombre]",
		document.getElementById("organizacion").value, "[Organización]",
		document.getElementById("consulta").value, "[Consulta]",
		document.getElementById("tlfn").value, "[Teléfono]",
		document.getElementById("email").value, "[Email]");
	if (!isFull) {
		return false;
	}
	var dirmail = document.getElementById("email").value;
	var filter = /^.+@.+\..{2,3}$/;
	if (!filter.test(dirmail)) {
		alert("La dirección de correo electrónico no es correcta.");
		return false;
	}
}


function sol_info(ref,idProv,idOpe,idPag)
{
	document.location.href="sol_info.asp?idRef="+ref+"&provincia="+idProv+"&tipologia="+idOpe+"&pagina="+idPag;	
}

function MailLink (usuario, dominio, tld) {
	 //codifica los caracteres mas significativos
	 var arroba = '@'
	 var punto = '.'
	
	 //utiliza variables para ocultar las palabras clave
	 var etiqueta = 'ma' + '' + 'il'
	 var dospuntos = 'to:'
	 var localizador = usuario
	 localizador = localizador + arroba + dominio;
	 localizador = localizador + punto + tld;
	
	 //escribe en enlace
	 document.write('<a href="' + etiqueta + dospuntos + localizador + '">' + localizador + '</a>');
}
