
function maximaLongitud(firma,maxlong)
{
		 var tecla, in_value, out_value;
		
		 if (firma.value.length > maxlong) 
		 {
		 in_value = firma.value;
		 out_value = in_value.substring(0,maxlong);
		 firma.value = out_value;
		 return false;
		 }
		 return true;
}
function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	var xmlhttp=false;
	try
	{
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			// Creacion del objet AJAX para IE
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(E)
		{
			if (!xmlhttp && typeof XMLHttpRequest!='undefined') xmlhttp=new XMLHttpRequest();
		}
	}
	return xmlhttp; 
}
// Declaro los selects que componen el documento HTML. Su atributo ID debe figurar aqui.
var listadoSelects=new Array();
listadoSelects[0]="paises";
listadoSelects[1]="lugares";

function buscarEnArray(array, dato)
{
	// Retorna el indice de la posicion donde se encuentra el elemento en el array o null si no se encuentra
	var x=0;
	while(array[x])
	{
		if(array[x]==dato) return x;
		x++;
	}
	return null;
}

function cargaContenido(idSelectOrigen)
{
	// Obtengo la posicion que ocupa el select que debe ser cargado en el array declarado mas arriba
	var posicionSelectDestino=buscarEnArray(listadoSelects, idSelectOrigen)+1;
	// Obtengo el select que el usuario modifico
	var selectOrigen=document.getElementById(idSelectOrigen);
	// Obtengo la opcion que el usuario selecciono
	var opcionSeleccionada=selectOrigen.options[selectOrigen.selectedIndex].value;
	// Si el usuario eligio la opcion "Elige", no voy al servidor y pongo los selects siguientes en estado "Selecciona opcion..."
	if(opcionSeleccionada==0)
	{
		var x=posicionSelectDestino, selectActual=null;
		// Busco todos los selects siguientes al que inicio el evento onChange y les cambio el estado y deshabilito
		while(listadoSelects[x])
		{
			selectActual=document.getElementById(listadoSelects[x]);
			selectActual.length=0;
			
			var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Selecciona Opci&oacute;n...";
			selectActual.appendChild(nuevaOpcion);	selectActual.disabled=true;
			x++;
		}
	}
	// Compruebo que el select modificado no sea el ultimo de la cadena
	else if(idSelectOrigen!=listadoSelects[listadoSelects.length-1])
	{
		// Obtengo el elemento del select que debo cargar
		var idSelectDestino=listadoSelects[posicionSelectDestino];
		var selectDestino=document.getElementById(idSelectDestino);
		// Creo el nuevo objeto AJAX y envio al servidor el ID del select a cargar y la opcion seleccionada del select origen
		var ajax=nuevoAjax();
		ajax.open("GET", "select_dependientes_proceso.php?select="+idSelectDestino+"&opcion="+opcionSeleccionada, true);
		ajax.onreadystatechange=function() 
		{ 
			if (ajax.readyState==1)
			{
				// Mientras carga elimino la opcion "Selecciona Opcion..." y pongo una que dice "Cargando..."
				selectDestino.length=0;
				var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Cargando...";
				selectDestino.appendChild(nuevaOpcion); selectDestino.disabled=true;	
			}
			if (ajax.readyState==4)
			{
				selectDestino.parentNode.innerHTML=ajax.responseText;
			} 
		}
		ajax.send(null);
	}
}

// Cambiar color de celdas onmouseon

var colores = Array();
function overcol(obj)
{
      for(i = 0; i < 12 && obj.cells[i] != null; i++ )
      {
            if (obj.cells[i].id != "no" )
            {
                  colores[i] = obj.cells[i].style.backgroundColor;
                  obj.cells[i].style.backgroundColor = '#1A2C33';
            }
      }
}
function outcol(obj)
{
      for(i = 0; i < 12 && obj.cells[i] != null; i++ )
      {
            if (obj.cells[i].id != "no" )
            {
                   obj.cells[i].style.backgroundColor = colores[i];
            }
      }
}

function popUp(URL) 
{
        day = new Date();
        id = day.getTime();
        eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=380,height=300');");
}


/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="index.php?a=conciertos&b=proximos&todos=1">Agenda de Shows</a>'
menu1[1]='<a href="index.php?a=buscar">Buscador</a>'
menu1[2]='<a href="index.php?a=destacados">Destacados</a>'
menu1[3]='<a href="index.php?a=conciertos&b=festivales&todos=1">Festivales/Fiestas</a>'
menu1[4]='<a href="index.php?a=conciertos&b=viejos&todos=1">Historial de Shows</a>'
menu1[5]='<a href="index.php?a=nconciertos">Nuevos Shows</a>'

var menu2=new Array()
menu2[0]='<a href="index.php?a=anunciosbanda">Anuncios de Bandas</a>'
menu2[1]='<a href="index.php?a=concursos">Concursos</a>'
menu2[2]='<a href="index.php?a=directorioe&segun=bandas">Directorio de Estilos</a>'
menu2[3]='<a href="index.php?a=directoriop&segun=bandas">Directorio de Provincias</a>'
menu2[4]='<a href="index.php?a=listas&segun=bandas">Listado</a>'
menu2[5]='<a href="index.php?a=videos">Videos</a>'
menu2[6]='<a href="index.php?a=registrarse&tiporeg=b">Registración de BANDA</a>'

var menu3=new Array()
menu3[0]='<a href="index.php?a=contacto">Contacto con A.C.</a>'
menu3[1]='<a href="index.php?a=enviarfecha">Enviar Concierto</a>'
menu3[2]='<a href="index.php?a=staff">Equipo de AtConcert</a>'
menu3[3]='<a href="index.php?a=publicidad">Publicidad</a>'

var menu4=new Array()
menu4[0]='<a href="index.php?a=cronicasd">Críticas de Discos</a>'
menu4[1]='<a href="index.php?a=cronicas">Cronicas de Shows</a>'
menu4[2]='<a href="index.php?a=entrevistas">Entrevistas</a>'

var menu5=new Array()
menu5[0]='<a href="index.php?a=clasificados">Clasificados</a>'
menu5[1]='<a href="/foro">Foro</a>'
menu5[2]='<a href="index.php?a=links">Links</a>'
menu5[3]='<a href="index.php?a=registrarse">REGISTRARSE!</a>'

var menu6=new Array()
menu6[0]='<a href="index.php?a=noticiasall">Generales</a>'
menu6[1]='<a href="index.php?a=underall">Under</a>'
		
var menu7=new Array()
menu7[0]='<a href="index.php?a=teatro">Cartelera</a>'
menu7[1]='<a href="index.php?a=listas&segun=lugarese">Lugares</a>'
menu7[2]='<a href="index.php?a=teatro&b=viejost">Historial</a>'

var menu8=new Array()
menu8[0]='<a href="index.php?a=anunciosusuario">Anuncios de usuarios</a>'
menu8[1]='<a href="index.php?a=directorioe&segun=usuarios">Directorio de Estilos</a>'
menu8[2]='<a href="index.php?a=directoriop&segun=usuarios">Directorio de Provincias</a>'
menu8[3]='<a href="index.php?a=listas&segun=usuarios&position=0">Lista de usuarios</a>'
menu8[4]='<a href="index.php?a=registrarse&tiporeg=u">Registración de USUARIO</a>'

var menuwidth='145px' //default menu width
var menubgcolor='grey'  //menu bgcolor
var disappeardelay=100  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu