ciclopide=1;

function pideaqui()
{
	if(ciclopide%2==0)
		{document.getElementById("inipideaqui").src="img/inipideaqui_f2.jpg"}
	else
		{document.getElementById("inipideaqui").src="img/inipideaqui.jpg"}
	ciclopide++;
	setTimeout("pideaqui()",100);
}

function vertab()
{
q='<table cellspacing=0 cellpadding=0 border=0><tr><td style="width:24px;height:24px"><img src="img/ver1.gif" width=24 height=24></td><td background="img/ver2.gif"><img src="img/spacer.gif"></td><td style="width:24px;height:24px"><img src="img/ver3.gif" width=24 height=24></td></tr><tr><td background="img/ver4.gif"><img src="img/spacer.gif"></td><td>';
document.write(q);
}

function verbla()
{
q='</td><td background="img/ver4.gif"><img src="img/spacer.gif"></td></tr><tr><td style="width:24px;height:24px"><img src="img/ver6.gif" width=24 height=24></td><td background="img/ver2.gif"><img src="img/spacer.gif"></td><td style="width:24px;height:24px"><img src="img/ver8.gif" width=24 height=24></td></tr></table>';
document.write(q);
}

function abre728(texto)
{
if(texto==null)
	{q='<center><table cellspacing=0><tr><td><img src="img/espiralizq.gif"></td><td width=728 height=90>';}
else
		{q='<center><div class=textopubli>'+texto+'</div><table cellspacing=0><tr><td><img src="img/espiralizq.gif"></td><td width=728 height=90>';}
document.write(q);
}

function cierra728()
{
q='</td><td><img src="img/espiralder.gif"></td></tr></table></center>';
document.write(q);
}

function lenguaje() {leng=(document.all?navigator.browserLanguage:navigator.language);if(leng.indexOf("es")!=-1) return "es"; else return "en";}

function mandamail()
{location.href="mail"+"to:voe"+'t@cra'+"nf.net"}

function firmarLV()
{
document.lvform.accion.value="firmar";
document.lvform.submit();
}

function compruebaEntrada()
{
roj="#ff0000";
whi='#D2DADA';
mens="";
f=document.lvfirma;
lengua=lenguaje();

f.nombre.style.borderColor=whi;
f.lugar.style.borderColor=whi;
f.url.style.borderColor=whi;
f.texto.style.borderColor=whi;

//nombre debe estar relleno
if(f.nombre.value=="") 
	{
	f.nombre.style.borderColor=roj;
	mens+=(lengua=='es'?'se debe introducir un nombre<br>':'name is obligatory<br>');
	}
//lugar también
if(f.lugar.value=="") 
	{
	f.lugar.style.borderColor=roj;
	mens+=(lengua=='es'?'se debe introducir un lugar<br>':'place is obligatory<br>');
	}
//si hay url, que lleve http
if(f.url.value!="")
	if(f.url.value.substr(0,7).toLowerCase()!="http://" && f.url.value.substr(0,8).toLowerCase()!="https://")
	{
	f.url.style.borderColor=roj;
	mens+=(lengua=='es'?'la url ha de comenzar por http:// o https://<br>':'the url must begin with http:// or https://<br>');
	}
//controlar texto
if(f.texto.value=="") 
	{
	f.texto.style.borderColor=roj;
	mens+=(lengua=='es'?'hay que introducir texto en los regalos<br>':'you must introduce some text in gifts<br>');
	}
if(f.texto.value.length>1024)
	{
	f.texto.style.borderColor=roj;
	mens+=(lengua=='es'?'el texto admite máximo de 1024 caracteres y tiene '+f.texto.value.length+'<br>':'text 1024 characters maximum and it has '+f.texto.value.length+'<br>');
	}

//quita mayúsculas
if(f.texto.value==f.texto.value.toUpperCase()) f.texto.value=f.texto.value.toLowerCase();


//final
if(mens!="") 
	{
	document.getElementById("mensaje").innerHTML="<table class=avisotabla><tr><td style='text-align:center;font-weight:bolder;background:#E5D6A6'>"+mens+"</td></tr></table>";
	return false;
	} 
	else {return true};
}


function lanzaLogon()
{
document.lvform.accion.value="logon";
document.lvform.submit();
}

function borrarEntrada(n)
{
//if(!confirm("¿está seguro?")) return;
document.listaform.accion.value='borrar';
document.listaform.numero.value=n;
document.listaform.submit();
}

function agradecimiento()
{
	createCookie("firmo","SI",1);
document.lvform.accion.value='agradecer';
document.lvform.submit();
}


function editarEntrada(n)
{
document.listaform.accion.value='editar';
document.listaform.numero.value=n;
document.listaform.submit();
}

function mailea(){location.href="mailto:voet"+"@"+"cra"+'nf.ne'+"t";}

function puteasuplantador(ip)
{
alert('La suplantación de personalidad es delito');
alert('IP '+ip+' almacenada');
alert('(y yo que tú apagaba el ordenador antes de darle a ENTER)');
location.href='http://google.com';
}

function puteajavascript(ip)
{
alert('No me hurgues en el javascript');
alert('IP '+ip+' almacenada');
alert('(y yo que tú apagaba el ordenador antes de darle a ENTER)');
location.href='http://google.com';
}

function puteaspam(ip)
{
alert('don´t send spam, bastard');
alert('IP '+ip+' stored');
alert('(better turn off the computer instead of pressing ENTER)');
location.href='http://google.com';
}

//***************
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

//***************
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

//***************
function eraseCookie(name) {
	createCookie(name,"",-1);
}

//***************
function dependeCookie()
{
	q=readCookie("firmo");
	if(q=="SI")
	{
	document.getElementById("depende").style.display="none";
	document.getElementById("depende2").style.display="none";
	}
	else
	{
	document.getElementById("depende").style.display="";
	document.getElementById("depende2").style.display="";
	}
}
