/************* 
**** <config> 
**/ 
startColor = "#ffffff"; // MouseOut link color 
endColor = "#ff0000"; // MouseOver link color 

stepIn = 20; // delay when fading in 
stepOut = 40; // delay when fading out 

/* 
** set to true or false; true will 
** cause all links to fade automatically 
***/ 
autoFade = false; 
/* 
** set to true or false; true will cause all CSS 
** classes with "fade" in them to fade onmouseover 
***/ 
sloppyClass = true; 
/** 
**** </config> 
**************/ 
/************* 
**** <install> 
** 
** 
**** </install> 
**************/ 

hexa = new makearray(16); 
for(var i = 0; i < 10; i++) 
hexa[i] = i; 
hexa[10]="a"; hexa[11]="b"; hexa[12]="c"; 
hexa[13]="d"; hexa[14]="e"; hexa[15]="f"; 

document.onmouseover = domouseover; 
document.onmouseout = domouseout; 

startColor = dehexize(startColor.toLowerCase()); 
endColor = dehexize(endColor.toLowerCase()); 

var fadeId = new Array(); 
var timerID = 0; 
var theElement,theTagName,theClassName,theUniqueID 

function dehexize(Color){ 
var colorArr = new makearray(3); 
for (i=1; i<7; i++){ 
for (j=0; j<16; j++){ 
if (Color.charAt(i) == hexa[j]){ 
if (i%2 !=0) 
colorArr[Math.floor((i-1)/2)]=eval(j)*16; 
else 
colorArr[Math.floor((i-1)/2)]+=eval(j); 
} 
} 
} 
return colorArr; 
} 

function domouseover() { 
if(document.all) { 
clearTimeout(timerID); 
theElement = event.srcElement; 
theTagName = theElement.tagName; 
theClassName = theElement.className; 
theUniqueID = theElement.uniqueID; 
if ((theTagName == "A" && autoFade) || theClassName == "fade" || (sloppyClass && theClassName.indexOf("fade") != -1)) { 
//alert(theElement); 
fade(startColor,endColor,theUniqueID,stepIn); 
timerID = setTimeout('pulsedown()',20); 
} 
} 
} 

function pulseup() { 
if(document.all) { 
clearTimeout(timerID); 
if ((theTagName == "A" && autoFade) || theClassName == "fade" || (sloppyClass && theClassName.indexOf("fade") != -1)) { 
//alert(theElement); 
fade(startColor,endColor,theUniqueID,stepIn); 
timerID = setTimeout('pulsedown(theElement)',20); 
} 
} 
} 

function pulsedown(theElement) { 
if (document.all) { 
clearTimeout(timerID); 
if ((theTagName == "A" && autoFade) || theClassName == "fade" || (sloppyClass && theClassName.indexOf("fade") != -1)) { 
//alert(theElement); 
fade(endColor,startColor,theUniqueID,stepOut); 
timerID = setTimeout('pulseup()',20); 
} 
} 
} 


function domouseout() { 
if (document.all) { 
clearTimeout(timerID); 
var srcElement = event.srcElement; 
if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1)) 
fade(endColor,startColor,srcElement.uniqueID,stepOut); 
} 
} 

function makearray(n) { 
this.length = n; 
for(var i = 1; i <= n; i++) 
this[i] = 0; 
return this; 
} 

function hex(i) { 
if (i < 0) 
return "00"; 
else if (i > 255) 
return "ff"; 
else 
return "" + hexa[Math.floor(i/16)] + hexa[i%16];} 

function setColor(r, g, b, element) { 
var hr = hex(r); var hg = hex(g); var hb = hex(b); 
element.style.color = "#"+hr+hg+hb; 
} 

function fade(s,e, element,step){ 
var sr = s[0]; var sg = s[1]; var sb = s[2]; 
var er = e[0]; var eg = e[1]; var eb = e[2]; 

if (fadeId[0] != null && fade[0] != element){ 
setColor(sr,sg,sb,eval(fadeId[0])); 
var i = 1; 
while(i < fadeId.length){ 
clearTimeout(fadeId[i]); 
i++; 
} 
} 

for(var i = 0; i <= step; i++) { 
fadeId[i+1] = setTimeout("setColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" + 
step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+ 
")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");",i*step); 
} 
fadeId[0] = element; 
}

var anioFinal = 2008
var mesFinal = 8
var diaFinal = 8
mesFinal -= 1
function faltan()
{
fechaFinal = new Date(anioFinal,mesFinal,diaFinal)
fechaActual = new Date()
diferencia = fechaFinal - fechaActual
diferenciaSegundos = diferencia /1000
diferenciaMinutos = diferenciaSegundos/60
diferenciaHoras = diferenciaMinutos/60
diferenciaDias = diferenciaHoras/24
diferenciaHoras2 = parseInt(diferenciaHoras) - (parseInt(diferenciaDias) *24)
diferenciaMinutos2 = parseInt(diferenciaMinutos) - (parseInt(diferenciaHoras) * 60)
diferenciaSegundos2 = parseInt(diferenciaSegundos) - (parseInt(diferenciaMinutos) * 60)
diferenciaDias = parseInt(diferenciaDias)
if (diferenciaDias < 10 && diferenciaDias > -1){diferenciaDias = "0" + diferenciaDias}
if(diferenciaHoras2 < 10 && diferenciaHoras2 > -1){diferenciaHoras2 = "0" + diferenciaHoras2}
if(diferenciaMinutos2 < 10 && diferenciaMinutos2 > -1){diferenciaMinutos2 = "0" + diferenciaMinutos2}
if(diferenciaSegundos2 < 10 && diferenciaSegundos2 > -1){diferenciaSegundos2 = "0" + diferenciaSegundos2}
if(diferenciaDias <= 0 && diferenciaHoras2<= 0 && diferenciaMinutos2 <= 0 && diferenciaSegundos2 <= 0)
	{
	diferenciaDias = 0
	diferenciaHoras2 = 0
	diferenciaMinutos2 = 0
	diferenciaSegundos2 = 0
	document.getElementById('dias').innerHTML =  diferenciaDias 
document.getElementById('tiempo').innerHTML =  diferenciaHoras2 + ':' + diferenciaMinutos2 + ':' + diferenciaSegundos2
	}
else{
	document.getElementById('dias').innerHTML =  diferenciaDias 
	document.getElementById('tiempo').innerHTML =  diferenciaHoras2 + ':' + diferenciaMinutos2 + ':' + diferenciaSegundos2
	setTimeout('faltan()',1000)
	}
}

function validarRegistroGrupoRock(formulario) {
	if ((formulario.nombre.value=="") || (formulario.estilo.value=="") || (formulario.comentarios.value=="") || (formulario.procedencia.value==""))
	{
	alert("Ups... Algun campo está vacio...");
	return false; 
	}
	else 
	{ 
	return true; 
	}
}
function validarRegistroEvento(formulario) {
	if ((formulario.nombre.value=="") || (formulario.dia_evento.value=="") || (formulario.mes_evento.value=="") || (formulario.anio_evento.value==""))
	{
	alert("Ups... Algun campo está vacio...");
	return false; 
	}
	if ((formulario.hora_evento.value=="") || (formulario.minuto_evento.value=="") || (formulario.grupos.value=="") || (formulario.provincia.value=="-----------------"))
	{
	alert("Ups... Algun campo está vacio...");
	return false;
	}
	if ((formulario.localidad.value=="") || (formulario.sala.value=="") || (formulario.precios.value==""))
	{
	alert("Ups... Algun campo está vacio...");
	return false;
	}
	else 
	{ 
	return true; 
	}
}
	
function validarRegistroNoticias(formulario) {
	if ((formulario.titular.value=="") || (formulario.texto.value==""))
	{
	alert("Te has dejado en blanco algun campo de estos: Titular -  Texto de la Noticia o Articulo");
	return false; 
	}
	else 
	{ 
	return true; 
	}
}
function viriato(URL) {
day = new Date();
id = day.getTime();
caracteristicas="toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,left = 0,top = 0";
eval("page" + id + " = window.open(URL, '" + id + "', caracteristicas);");
}

function validarCancionMp3(formulario) {
	if ((formulario.nombremp3.value=="") || (formulario.nombremp3.value=="") || (formulario.url.value=="http://"))
	{
	alert("Te has dejado en blanco algun campo de estos: \n\n + Nombre de la Cancion \n + Nombre del Grupo \n + URL Descarga");
	return false; 
	}
	else 
	{ 
	return true; 
	}
}

function validarRegistroUsuarios(formulario) {
	if ((formulario.nombre.value=="") || (formulario.procedencia.value==""))
	{
	alert("Te has dejado en blanco algun campo de estos: \n\n + Nombre  \n + De dónde eres");
	return false; 
	}
	if ((formulario.fechanacimiento.value==""))
	{
	alert("Cuidado !! La fecha de nacimiento es básica para poder recibir premios tales como: entradas, camisetas, cds... que sorteamos en la web");
	return false; 
	}
    if (formulario.nick.value.length < 4) {
    alert("El nick debe de tener al menos 4 caracteres.");
    formulario.nick.focus();
    return (false);
   }
	if ((formulario.nick.value=="") || (formulario.pass.value==""))
	{
	alert("Error con el nick o la contraseña...");
	return false; 
	}
	//nick
	var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚ0123456789_" + "abcdefghijklmnñopqrstuvwxyzáéíóú012345678_";
    var checkStr = formulario.nick.value;
    var allValid = true; 
    for (i = 0; i < checkStr.length; i++) {
    ch = checkStr.charAt(i); 
    for (j = 0; j < checkOK.length; j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length) { 
      allValid = false; 
      break; 
    }
  }
  if (!allValid) { 
    alert("Escriba sólo letras,numeros o guión bajo _ en el campo \"Nick\"."); 
    formulario.nick.focus(); 
    return (false); 
  } 
    if (formulario.nick.value.length < 4) {
    alert("El nick debe de tener al menos 4 caracteres.");
    formulario.nick.focus();
    return (false);
   }
	//fin nick
	if ((formulario.pass.value!=formulario.pass2.value))
	{
	alert("Las contraseñas no coinciden");
	return false; 
	}
	if ((formulario.email.value==""))
	{
	alert("El campo de E-mail (Correo Electronico) está vacio.");
	return false; 
	}
	else 
	{ 
	return true; 
	}
}

function soloRegistrados() 
{
	alert("Para poder descargar este mp3 debes de ser usuario de la web y estar identificado. \n\n + Registrate primero como usuario. \n + Una vez registrado ya podras disfrutar de todos estos mp3 ;-).");
}
function mp3Borrado() 
{
	alert("Estamos recuperando todo el material, vuelve pasado unos días.");
}
function mp3Retirado() 
{
	alert("Lo sentimos, este mp3 no puede ser descargado debido a que ha sido retirado por petición del grupo. \n Visita su pagina web y compra el disco original. \n Para comprar discos de rock visita: www.tutiendadediscos.com !!");
}
function ventanapop(URL) {
day = new Date();
id = day.getTime();
caracteristicas="toolbar=0,scrollbars=1,location=0,statusbar=yes,menubar=yes,resizable=0,left = 301,top = 267.5, width=650, height=400";
eval("page" + id + " = window.open(URL, '" + id + "', caracteristicas);");
}

