//precargamos las imagenes
bVerde = new Image();		bVerde.src = "img/bulletVerde.gif";
bNaranja = new Image();		bNaranja.src = "img/bulletNaranja.gif";
bNegro = new Image();		bNegro.src = "img/bulletNegro.gif";
sp = new Image();			sp.src = "img/sp.gif";


function cambiar(nombre,estado) {
	document.images[nombre].src = eval(estado+".src");
}


// escribimos el menu de navegacion
menu = new Array();
	menu[0] = ["Inicio","index.html",""];
	menu[1] = ["Me presento","mePresento.html",""];
	menu[2] = ["Poemas","poemas.html",""];
	menu[3] = ["Artículos","articulos.html",""];
	menu[4] = ["Un cuento","unCuento.html",""];
	menu[5] = ["Cine","cine.html",""];
	menu[6] = ["Mis libros","misLibros.html",""];
	menu[7] = ["Fotos con Alma","fotosConAlma.html",""];
	menu[8] = ["A Juan XXIII","juanXXIII.html",""];
	menu[9] = ["Con Arrupe","http://personales.mundivia.es/pedromi/ArrupeNuevo/Indice.htm","<span class='rojo'><i><b>Remozado</b></i></span>"];
	menu[10] = ["Amigos portugueses","portugueses.html",""];
	menu[11] = ["Miguel Batllori","MiguelBatllori.html",""];
  menu[12] = ["Amigos y enlaces","amigosyenlaces.html",""];
	menu[13] = ["Anterior libro de visitas","Libro de visitas anterior.htm",""];
function escribirMenu(estado){
	txt = "";
	txt += "<table cellpadding='0' cellspacing='0' border='0' width='220'>\n";
	for (i=0; i<menu.length; i++){
		txt += "<tr valign='baseline'>\n";
		if (estado=="b"+i){
			txt += "<td width='20'><img src='img/bulletNegro.gif' width='20' height='11' name='b" + i + "'></td>\n";
			txt += "<td><a href='" + menu[i][1] + "' class='menu' onMouseOver='cambiar(\"b" + i + "\",\"bVerde\")' onMouseOut='cambiar(\"b" + i + "\",\"bNegro\")'>" + menu[i][0] + "</a> " + menu[i][2] + "</td>\n";
		} else {
			txt += "<td width='20'><img src='img/sp.gif' width='20' height='11' name='b" + i + "'></td>\n";
			txt += "<td><a href='" + menu[i][1] + "' class='menu' onMouseOver='cambiar(\"b" + i + "\",\"bVerde\")' onMouseOut='cambiar(\"b" + i + "\",\"sp\")'>" + menu[i][0] + "</a> " + menu[i][2] + "</td>\n";
		}
		txt += "</tr>\n";
	}
	txt += "</table>\n";
	
	txt += "<br><br><br>\n"
	

	txt += "Firma mi <a href=\"http://librosdevisitas.com?205735\" target=\"_blank\" class=\"enlace\">libro de visitas</a><br><br>"

	txt += "<a href=\"http://www.thehungersite.com/\" target=\"_blank\" class=\"enlace\">The Hungersite:</a> Si cliqueas<br>"
	txt += "&nbsp; &nbsp; aquí, va dinero al hambre<br>"
	txt += "&nbsp; &nbsp; sin dar un céntimo.<br><br>"
	
	txt += "&nbsp; &nbsp; <a href=\"http://www.thehungersite.com/\" target=\"_blank\" class=\"enlace\"><img src=\"img/hungersite.gif\" width=\"120\" height=\"60\" alt=\"\" border=\"0\"></a><br><br>\n";
	
	txt += "Tómate un descanso de<br>"
	txt += "&nbsp; &nbsp; silencio interior en la web<br>"
	txt += "&nbsp; &nbsp; de meditación<br>"
	txt += "&nbsp; &nbsp; <a href=\"http://www.sacredspace.ie/es\" target=\"_blank\" class=\"enlace\">Espacio Sagrado</a><br><br>"
	
	txt += "Escríbeme a<br>"
	txt += "&nbsp; &nbsp; <a href=\"mailto:pedromi@mundivia.es\" class=\"enlace\">pedromi@mundivia.es</a><br>"

	document.write(txt);
}


//mis ultimos libros
libros = new Array();
	libros[0] = ["El místico: Juan de la Cruz","libros_JCruz.html","<span class='rojo'><i><b>(nuevo)</b></i></span>"]
	libros[1] = ["El retrato","libros_elretrato.html","<span class='rojo'><i><b>(2ªed bolsillo)</b></i></span>"]
	libros[2] = ["El mar de dentro. Poemas","libros_antologia.html","<span class='rojo'><i><b>(Antología)</b></i></span>"]
	libros[3] = ["El aventurero de Dios","libros_Javier.html","<span class='rojo'><i><b>(3ªedicion y bols.)</b></i></span>"]
	libros[4] = ["Biografía de Díez Alegría","libros_diezalegria.html","<span class='rojo'><i><b>(3ªedición)</b></i></span>"];
	libros[5] = ["Las Palabras calladas","libros_maria.html","<span class='rojo'><i><b>(7ª edición  y ed. especial iilustrada)</b></i></span>"];
	libros[6] = ["Hombre y papa","libros_papa.html",""];
	libros[7] = ["Fotos con alma","libros_fotosconalma.html",""];
	libros[8] = ["Borja, los enigmas del Duque","libros_Borja.html",""];
	libros[9] = ["Como lámpara encendida","libros_comolampara.html",""];
	libros[10] = ["Desde mi ventana","libros_desdeMiVentana.html",""];
	libros[11] = ["El esclavo blanco","libros_elEsclavoBlanco.html",""];
	libros[12] = ["Un hombre increible","libros_unHombreIncreible.html",""];
	libros[13] = ["El caballero de las dos banderas","libros_elCaballeroDeLasDosBanderas.html",""];

	
	
function escribirLibros(){
	txt = "";
	txt += "<table cellpadding='0' cellspacing='0' border='0' width='315'>\n";
	for (i=0; i<libros.length; i++){
		txt += "<tr valign='baseline'>\n";
		txt += "	<td width='20'><img src='img/sp.gif' width='20' height='11' name='l" + i + "'></td>\n";
		txt += "	<td><a href='" + libros[i][1] + "' class='libros' onMouseOver='cambiar(\"l" + i + "\",\"bNaranja\")' onMouseOut='cambiar(\"l" + i + "\",\"sp\")'>" + libros[i][0] + "</a> " + libros[i][2] + "</td>\n";
		txt += "</tr>\n";
	}
	txt += "</table>\n";
	document.write(txt);
}


vPie = new Array();
	//vPie[0] = [height];
	vPie[0] = ["102"];
	vPie[1] = ["90"];
	vPie[2] = ["101"];
	vPie[3] = ["103"];
	vPie[4] = ["135"];
	vPie[5] = ["131"];
	vPie[6] = ["135"];
	vPie[7] = ["127"];
    vPie[8] = ["135"];
	vPie[9] = ["162"];
	vPie[10] = ["186"];
    vPie[11] = ["186"];
	vPie[12] = ["153"];
	vPie[13] = ["125"];
	vPie[14] = ["189"];
	vPie[15] = ["111"];
	vPie[16] = ["97"];
	vPie[17] = ["114"];
function escribirPie(){
	numElementos = vPie.length;
	numAleatorio = Math.floor(Math.random() * numElementos);
	

	txt = "";	
	txt += "					</td>\n";
	txt += "					<td><!-- margen der --><img src=\"img/sp.gif\" width=\"15\" height=\"1\"></td>\n";
	txt += "				</tr>\n";
	txt += "				</table>\n";
	txt += "			\n";
	txt += "			</td>\n";
	txt += "		</tr>\n";
	txt += "		<tr valign=\"top\">\n";
	txt += "			<td><img src=\"img/inf_" + numAleatorio + ".jpg\" width=\"734\" height=\"" + vPie[numAleatorio] + "\" border=\"0\"></td>\n";
	txt += "		</tr>\n";
	txt += "		</table>\n";
	txt += "		\n";
	txt += "	</td>\n";
	txt += "	<td width=\"3\" bgcolor=\"#000000\"><img src=\"img/sp.gif\" width=\"3\" height=\"1\"></td>\n";
	txt += "	<td width=\"10\"><img src=\"img/sp.gif\" width=\"10\" height=\"1\"></td>\n";
	txt += "</tr>\n";
	txt += "<tr>\n";
	txt += "	<td width=\"10\"><img src=\"img/sp.gif\" width=\"10\" height=\"1\"></td>\n";
	txt += "	<td width=\"3\" bgcolor=\"#000000\"><img src=\"img/sp.gif\" width=\"3\" height=\"3\"></td>\n";
	txt += "	<td width=\"734\" bgcolor=\"#000000\"><img src=\"img/sp.gif\" width=\"734\" height=\"3\"></td>\n";
	txt += "	<td width=\"3\" bgcolor=\"#000000\"><img src=\"img/sp.gif\" width=\"3\" height=\"3\"></td>\n";
	txt += "	<td width=\"10\"><img src=\"img/sp.gif\" width=\"10\" height=\"1\"></td>\n";
	txt += "</tr>\n";
	txt += "</table>\n";

	document.write(txt);
}



function escribirCabecera(opcion){
	txt  = "";
	
	txt += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"760\">\n";
	txt += "<tr><td colspan=\"5\"><img src=\"img/sp.gif\" width=\"1\" height=\"10\"></td></tr>\n";
	txt += "<tr>\n";
	txt += "	<td width=\"10\"><img src=\"img/sp.gif\" width=\"10\" height=\"1\"></td>\n";
	txt += "	<td width=\"3\" bgcolor=\"#000000\"><img src=\"img/sp.gif\" width=\"3\" height=\"3\"></td>\n";
	txt += "	<td width=\"734\" bgcolor=\"#000000\"><img src=\"img/sp.gif\" width=\"734\" height=\"3\"></td>\n";
	txt += "	<td width=\"3\" bgcolor=\"#000000\"><img src=\"img/sp.gif\" width=\"3\" height=\"3\"></td>\n";
	txt += "	<td width=\"10\"><img src=\"img/sp.gif\" width=\"10\" height=\"1\"></td>\n";
	txt += "</tr>\n";
	txt += "<tr>\n";
	txt += "	<td width=\"10\"><img src=\"img/sp.gif\" width=\"10\" height=\"1\"></td>\n";
	txt += "	<td width=\"3\" bgcolor=\"#000000\"><img src=\"img/sp.gif\" width=\"3\" height=\"1\"></td>\n";
	txt += "	<td width=\"734\">\n";
	txt += "	\n";
	txt += "		<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"734\">\n";
	txt += "		<tr valign=\"top\">\n";
	txt += "			<td background=\"img/sup_1.jpg\"><img src=\"img/titulo.gif\" width=\"734\" height=\"125\" border=\"0\"></td>\n";
	txt += "		</tr>\n";
	txt += "		<tr valign=\"top\">\n";
	txt += "			<td>\n";
	txt += "			\n";
	txt += "				<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"734\">\n";
	txt += "				<tr valign=\"top\">\n";
	txt += "					<td><!-- margen izq --><img src=\"img/sp.gif\" width=\"17\" height=\"1\"></td>\n";
	txt += "					<td><!-- indice --><img src=\"img/sp.gif\" width=\"220\" height=\"1\"></td>\n";
	txt += "					<td><!-- margen central --><img src=\"img/sp.gif\" width=\"20\" height=\"1\"></td>\n";
	txt += "					<td><!-- contenido --><img src=\"img/sp.gif\" width=\"455\" height=\"1\"></td>\n";
	txt += "					<td><!-- margen der --><img src=\"img/sp.gif\" width=\"15\" height=\"1\"></td>\n";
	txt += "				</tr>\n";
	txt += "				<tr valign=\"top\">\n";
	txt += "					<td><!-- margen izq --><img src=\"img/sp.gif\" width=\"17\" height=\"1\"></td>\n";
	txt += "					<td>";
	document.write(txt);
	escribirMenu(opcion);
	
	txt  = "";
	txt += "					</td>\n";
	txt += "					<td><!-- margen central --><img src=\"img/sp.gif\" width=\"20\" height=\"1\"></td>\n";
	txt += "					<td>\n";

	document.write(txt);
}

function escribirVolver(){
	txt  = "";
	txt += "<p align=\"right\">\n";
	txt += "	<i><a href=\"javascript:imprimirPag()\" class=\"rojo\">Imprimir</a></i>\n";
	txt += "	<img src=\"img/bulletRojo.gif\" width=\"20\" height=\"11\" border=\"0\">\n";
	txt += "	<br><br>\n";
	txt += "	<i><a href=\"javascript:window.history.back()\" class=\"rojo\">Volver</a></i>\n";
	txt += "	<img src=\"img/bulletRojo.gif\" width=\"20\" height=\"11\" border=\"0\">\n";
	txt += "</p><br><br>\n";
	
	document.write(txt);
}


// funciones y variables relacionados con la impresión
imprimir="no";

function esImprimible(){
	if (imprimir=="si"){
		print();
	}
}

function imprimirPag(){
	url = window.location.href + "?imprimir=si";
	abrirVentana(url,600,400);
}

function abrirVentana(url,w,h){
	vetanita=window.open(url,'ventanita','toolbar=no,resizable=no,status=no,scrollbars=no,location=no,menubar=no,width='+w+',height='+h);
}

// para recoger el estado en que estamos 
function getArgs() {
	var args = new Object();
	var query = location.search.substring(1);	  // quitamos el ? a la cadena
	var pairs = query.split("&");                 // troceamos la cadena por los &

	for (var i=0; i < pairs.length; i++) {
		var pos = pairs[i].indexOf('='); 	      // Busca nombre=valor
		if (pos == -1) continue;
		var argName  = pairs[i].substring(0,pos); // el nombre
		var argValue = pairs[i].substring(pos+1); // el valor
		args [argName] = unescape(argValue);      // lo guarda como propiedad
	}

	return args;
}

var queryValues = getArgs();
var imprimir = queryValues.imprimir;