function imprimir() 
{
    window.print ();
}

var tamanoLetrapordefecto = 11;
var tamanoLetra = tamanoLetrapordefecto;
var tamanoLetraminimo = 9;
var tamanoLetramaximo = 15;
var identidadLetra;

function aumentaLetra() {
    if (tamanoLetra < tamanoLetramaximo) {
    tamanoLetra += 1;
    contador = document.getElementById('TxtCuentaApoyo')
    numeroapoyo = contador.value;
    identidadLetra = document.getElementById('tamano');
    identidadLetra.className = 'Formateo' + tamanoLetra;
    identidadLetra = document.getElementById('tamanoapoyo1');
    if (identidadLetra != null)
    {
		 for(i=1; i<=numeroapoyo; i++ ) 
		 {
			
			identidadLetra = document.getElementById('tamanoapoyo' + i + '');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
			}
	}
    }
}

function aumentaLetraPerfil() {
    if (tamanoLetra < tamanoLetramaximo) 
    {
		tamanoLetra += 1;
		identidadLetra = document.getElementById('tamano1');
		if (identidadLetra != null)
		{
			identidadLetra = document.getElementById('tamano1');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
		}
		identidadLetra = document.getElementById('tamano2');
		if (identidadLetra != null)
		{
			identidadLetra = document.getElementById('tamano2');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
		}
	}
}


function disminuyeLetra() {
    if (tamanoLetra > tamanoLetraminimo) {
    tamanoLetra -= 1;
    contador = document.getElementById('TxtCuentaApoyo')
    numeroapoyo = contador.value;
    identidadLetra = document.getElementById('tamano');
    identidadLetra.className = 'Formateo' + tamanoLetra;
    identidadLetra = document.getElementById('tamanoapoyo1');
    if (identidadLetra != null)
    {
		for(i=1; i<=numeroapoyo; i++ ) 
		 {
			
			identidadLetra = document.getElementById('tamanoapoyo' + i + '');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
			}
    }
    }
}

function disminuyeLetraPerfil() {
    if (tamanoLetra > tamanoLetraminimo) 
    {
		tamanoLetra -= 1;
		identidadLetra = document.getElementById('tamano1');
		if (identidadLetra != null)
		{
			
				identidadLetra = document.getElementById('tamano1');
				identidadLetra.className = 'Formateo' + tamanoLetra;	
		}
		identidadLetra = document.getElementById('tamano2');
		if (identidadLetra != null)
		{
			identidadLetra = document.getElementById('tamano2');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
		}
    }
}

function aumentaLetraNoticias() {
    if (tamanoLetra < tamanoLetramaximo) {
    tamanoLetra += 1;
    contador = document.getElementById('TxtCuentaApoyo')
    numeroapoyo = contador.value;
    identidadLetra = document.getElementById('tamano1');
    if (identidadLetra != null)
    {
		 for(i=1; i<=numeroapoyo; i++ ) 
		 {
			
			identidadLetra = document.getElementById('tamano' + i + '');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
			}
	}
    }
}

function disminuyeLetraNoticias() {
    if (tamanoLetra > tamanoLetraminimo) {
    tamanoLetra -= 1;
    contador = document.getElementById('TxtCuentaApoyo')
    numeroapoyo = contador.value;
    identidadLetra = document.getElementById('tamano1');
    if (identidadLetra != null)
    {
		for(i=1; i<=numeroapoyo; i++ ) 
		 {
			
			identidadLetra = document.getElementById('tamano' + i + '');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
			}
    }
    }
}


function aumentaLetraOpinion() {
    if (tamanoLetra < tamanoLetramaximo) {
    tamanoLetra += 1;
    contador = document.getElementById('TxtCuentaApoyo')
    numeroapoyo = contador.value;
    identidadLetra = document.getElementById('tamano1');
    if (identidadLetra != null)
    {
		 for(i=1; i<=numeroapoyo; i++ ) 
		 {
			
			identidadLetra = document.getElementById('tamano' + i + '');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
			}
	}
    }
}

function disminuyeLetraOpinion() {
    if (tamanoLetra > tamanoLetraminimo) {
    tamanoLetra -= 1;
    contador = document.getElementById('TxtCuentaApoyo')
    numeroapoyo = contador.value;
    identidadLetra = document.getElementById('tamano1');
    if (identidadLetra != null)
    {
		for(i=1; i<=numeroapoyo; i++ ) 
		 {
			
			identidadLetra = document.getElementById('tamano' + i + '');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
			}
    }
    }
}

function aumentaLetraEspecial() {
    if (tamanoLetra < tamanoLetramaximo) 
    {
		tamanoLetra += 1;
		identidadLetra = document.getElementById('tamano1');
		if (identidadLetra != null)
		{
			identidadLetra = document.getElementById('tamano1');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
		}
		identidadLetra = document.getElementById('tamano2');
		if (identidadLetra != null)
		{
			identidadLetra = document.getElementById('tamano2');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
		}
		contador = document.getElementById('TxtCuentaApoyo')
		numeroapoyo = contador.value;
		identidadLetra = document.getElementById('tamanoapoyo1');
		if (identidadLetra != null)
		{
			 for(i=1; i<=numeroapoyo; i++ ) 
			 {
				
				identidadLetra = document.getElementById('tamanoapoyo' + i + '');
				identidadLetra.className = 'Formateo' + tamanoLetra;	
				}
		}
	}
}

function disminuyeLetraEspecial() {
    if (tamanoLetra > tamanoLetraminimo) 
    {
		tamanoLetra -= 1;
		identidadLetra = document.getElementById('tamano1');
		if (identidadLetra != null)
		{
			
				identidadLetra = document.getElementById('tamano1');
				identidadLetra.className = 'Formateo' + tamanoLetra;	
		}
		identidadLetra = document.getElementById('tamano2');
		if (identidadLetra != null)
		{
			identidadLetra = document.getElementById('tamano2');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
		}
		contador = document.getElementById('TxtCuentaApoyo')
		numeroapoyo = contador.value;
		identidadLetra = document.getElementById('tamanoapoyo1');
		if (identidadLetra != null)
		{
			 for(i=1; i<=numeroapoyo; i++ ) 
			 {
					
				identidadLetra = document.getElementById('tamanoapoyo' + i + '');
				identidadLetra.className = 'Formateo' + tamanoLetra;	
				}
		}
		
    }
}

function MostrarBoletin(URL)
{
	new_window=window.open(URL,'FrmBoletinSolo','width=670,height=425,menubar=no,statusbar=no,scrollbars=no,toolbar=no,location=no,directories=no,resizable=no,top=200,left=200');
	new_window.focus();
}


function Buscar(objeto)
{
	
	var evento_key = window.event.keyCode;

	if (13 == evento_key)
	{
		// Le pasamos el valor
		trim(document.Central.TxtBuscar.value);
		
		// a ver que tenemos ahora
		if (document.Central.TxtBuscar.value == "")
		{
			
			return;
		}
	
		//document.Central.TxtControlBuscar.value = 1;
		//document.Central.submit();
	}
	else
	{
		if (37 == evento_key)
		{
			window.event.keycode = 0;
			window.event.returnValue = 0;
		}
		else
		{
			if (42 == evento_key)
			{
				window.event.keycode = 0;
				window.event.returnValue = 0;
			}
		}
	}
}


function trim(cadena) 
{ 
    for(i=0; i<cadena.length; ) 
    { 
        if(cadena.charAt(i)==" ") 
            cadena=cadena.substring(i+1, cadena.length); 
        else 
            break; 
    } 

    for(i=cadena.length-1; i>=0; i=cadena.length-1) 
    { 
        if(cadena.charAt(i)==" ") 
            cadena=cadena.substring(0,i); 
        else 
            break; 
    } 
    document.Central.TxtBuscar.value = cadena; 
} 

function QuitaBuscar()
{
	document.Central.TxtControlBuscar.value = "";
}

function CambiarBusqueda()
{
	//if (Id == 0)
	var valor;
	valor = document.getElementById("ComboCampo").value;
	if (valor != "Genero")
	{
		texto = document.getElementById("TextoBusqueda");
		texto.style.display = ""; //mostrar fila 
		combo = document.getElementById("ComboGenero");
		combo.style.display = "none"; // ocultamos fila
 

	}
	else
	{
		texto = document.getElementById("TextoBusqueda");
		texto.style.display = "none"; //ocultamos fila 
		combo = document.getElementById("ComboGenero");
		combo.style.display = ""; // mostrarmos fila
		
	}
}


function CambiarBusquedagoogle()
{
	//if (Id == 0)
	var valor;
	valor = document.getElementById("ComboCampo").value;
	if (valor != "Genero")
	{
		texto = document.getElementById("TextoBusqueda");
		texto.style.display = ""; //mostrar fila 
		combo = document.getElementById("ComboGenero");
		combo.style.display = "none"; // ocultamos fila
		/*
        if ((valor=="Titulo")||(valor=="Titulo Original"))
            document.getElementById("cx").value="012119090662623041329:lpqun6iswms";
        if (valor=="Personaje")
            document.getElementById("cx").value="012119090662623041329:yqzxrmmfr00";
        if (valor=="Todos")
            document.getElementById("cx").value="012119090662623041329:hltp76cvdis";
        if (valor=="Entrevistas")
            document.getElementById("cx").value="012119090662623041329:hltp76cvdis";  
        if (valor=="Ano")
            document.getElementById("cx").value="012119090662623041329:vy244eaifn8"; 
              */

	}
	else
	{
		texto = document.getElementById("TextoBusqueda");
		texto.style.display = "none"; //ocultamos fila 
		combo = document.getElementById("ComboGenero");
		combo.style.display = ""; // mostrarmos fila
		
	}
}
function pagBus(pagina)
{
    document.getElementById("txtpagina").value = pagina;
    document.getElementById("Central").submit();
    
}

function PonerCombo()
{
	texto = document.getElementById("TextoBusqueda");
	texto.style.display = "none"; //mostrar fila 
	combo = document.getElementById("ComboGenero");
	combo.style.display = ""; // ocultamos fila
}

function Regenerar(numdatos)
{
	// Llamamos a la funcion para generar un numero
	var numaleatorio = aleatorio(1,numdatos);
	var img = document.getElementById("ImagenCambiar");
	var textosel = document.getElementById("txtvalidacion");
	textosel.value=numaleatorio;
	img.src = "http://www.decine21.com/imagenes/Validacion/f" + numaleatorio + ".jpeg";
}
	
	function aleatorio(inferior,superior)
	{ 
		numPosibilidades = superior - inferior 
		aleat = Math.random() * numPosibilidades 
		aleat = Math.round(aleat) 
		return parseInt(inferior) + aleat 
	}
function Enviar()
	{
		if (document.comentarios.TxtNombre.value == "")
		{
			alert("Debe de Introducir su Nombre");
			return;
		}
		if (document.comentarios.TxtEmail.value == "")
		{
			alert("Debe de Introducir su Email");
			return;
		}
		if (document.comentarios.TxtComentario.value == "")
		{
			alert("Debe de Introducir su Comentario");
			return;
		}
		if (document.comentarios.TxtNumero.value == "")
		{
			alert("Debe de Introducir las letras de seguridad");
			return;
		}
		document.comentarios.TxtEnviarComentario.value = 1;
		document.comentarios.submit();
	}

function EnviarNoticia()
	{
		if (document.Noticia.TxtNombre.value == "")
		{
			alert("Debe de Introducir su Nombre");
			return;
		}
		if (document.Noticia.TxtEmail.value == "")
		{
			alert("Debe de Introducir su Email");
			return;
		}
		if (document.Noticia.TxtComentario.value == "")
		{
			alert("Debe de Introducir su Comentario");
			return;
		}
		if (document.Noticia.TxtNumero.value == "")
		{
			alert("Debe de Introducir el Número de Seguridad");
			return;
		}
		document.Noticia.TxtEnviarComentario.value = 1;
		document.Noticia.submit();
	}

function EnviarBlog()
	{
		if (document.Blog.TxtNombre.value == "")
		{
			alert("Debe de Introducir su Nombre");
			return;
		}
		if (document.Blog.TxtEmail.value == "")
		{
			alert("Debe de Introducir su Email");
			return;
		}
		if (document.Blog.TxtComentario.value == "")
		{
			alert("Debe de Introducir su Comentario");
			return;
		}
		if (document.Blog.TxtNumero.value == "")
		{
			alert("Debe de Introducir el Número de Seguridad");
			return;
		}
		document.Blog.TxtEnviarComentario.value = 1;
		document.Blog.submit();
	}
function EnviarADebate()
	{
		if (document.ADebate.TxtNombre.value == "")
		{
			alert("Debe de Introducir su Nombre");
			return;
		}
		if (document.ADebate.TxtEmail.value == "")
		{
			alert("Debe de Introducir su Email");
			return;
		}
		if (document.ADebate.TxtComentario.value == "")
		{
			alert("Debe de Introducir su Comentario");
			return;
		}
		if (document.ADebate.TxtNumero.value == "")
		{
			alert("Debe de Introducir el Número de Seguridad");
			return;
		}
		document.ADebate.TxtEnviarComentario.value = 1;
		document.ADebate.submit();
	}

function QuitaComentario()
	{
		document.Central.TxtEnviarComentario.value = "";
	}
function imposeMaxLength(Object, MaxLen)
{
  etiqueta = document.getElementById("Etiqueta");
  totalcaracteres = MaxLen - Object.value.length;
  var hasInnerText = (document.getElementsByTagName("body")[0].innerText != undefined) ? true : false; 
   
  if (totalcaracteres < 0)
  {
	if(!hasInnerText)
	{
		etiqueta.textContent = "Le quedan 0.";
	}
	else
	{
		etiqueta.innerText = "Le quedan 0.";
	}
  }
  else
  {
	if(!hasInnerText)
	{
		etiqueta.textContent = "Le quedan " + totalcaracteres + ".";
	}
	else
	{
		etiqueta.innerText = "Le quedan " + totalcaracteres + ".";
	}
  } 		
  return (Object.value.length <= MaxLen);
}

function EscribeResto(Object, MaxLen)
{
  etiqueta = document.getElementById("Etiqueta");
  totalcaracteres = MaxLen - Object.value.length;
  var hasInnerText = (document.getElementsByTagName("body")[0].innerText != undefined) ? true : false;  
   
  if (totalcaracteres < 0)
  {
	if(!hasInnerText)
	{
		etiqueta.textContent = "Le quedan 0.";
	}
	else
	{
		etiqueta.innerText = "Le quedan 0.";
	}
  }
  else
  {
	if(!hasInnerText)
	{
		etiqueta.textContent = "Le quedan " + totalcaracteres + ".";
	}
	else
	{
		etiqueta.innerText = "Le quedan " + totalcaracteres + ".";
	}
  } 		
}

function Concurso(URL,ancho,alto)
{
	new_window=window.open(URL + "&URL=" + document.URL,'Concurso','width=' + ancho + ',height=' + alto + ',menubar=no,statusbar=no,scrollbars=no,toolbar=no,location=no,directories=no,resizable=no,top=200,left=200');
	new_window.focus();
}


function Banner(n, lugar, dir)
{	
	window.open(n + "&Ta=" + lugar + "&We=" + dir + "&URL=" + document.URL);
}

function BannerMedio(n, lugar, dir, op)
{	
	if (op == 1)
	{
		window.open(n + "&Ta=" + lugar + "&We=" + dir + "&URL=" + document.URL);				
	}
	else
	{
		window.location = n + "&Ta=" + lugar + "&We=" + dir + "&URL=" + document.URL;
	}

}

function BuscarAno()
{
	var combo = document.getElementById("CmbListadoAno");
	var valor = combo.value;

	window.location="http://www.decine21.com/Anios/Titulo/Peliculas-" + valor;
}

function MostrarMultimedia()
{
	tabla = document.getElementById("TablaMultimedia");
	if (tabla.style.display == "")
	{
		tabla.style.display = "none";
	}
	else
	{
		tabla.style.display = "";
	}

}

function DescuentoDetalles(ancho,alto,id)
{
	URL = "DescuentoDetalles.asp?De=" + id + "";
	new_window=window.open(URL,'DescuentoDetalles','width=' + ancho + ',height=' + alto + ',menubar=no,statusbar=no,scrollbars=yes,toolbar=no,location=no,directories=no,resizable=no,top=10,left=200');
	new_window.focus();
}

function MostrarInformacionPersonaje(id)
{
	totaltexto = document.getElementById("TxtNumTextos");
	totaltextovalor = totaltexto.value;

	for (i=0; i<=totaltextovalor-1; i++)
	{
		// Vamos ocultando
		fila = document.getElementById("TextApoyo" + i);
		fila.style.display = "none"; //mostrar fila 
	}
	

	tabla = document.getElementById("TextApoyo" + id);
	tabla.style.display = "";

	location.hash = "InformacionPersonaje" + id;
	
}

function MostrarAniversario()
{
	tabla = document.getElementById("TablaAniversario");
	if (tabla.style.display == "")
	{
		tabla.style.display = "none";
		var txtenlace = document.getElementById("vermasaniversario");
		txtenlace.innerText = "Ver más...";	
	}
	else
	{
		tabla.style.display = "";
		var txtenlace = document.getElementById("vermasaniversario");
		txtenlace.innerText = "Ocultar...";
	}

}

function Votar()
{
	var i;
	var IdEncuesta;
	var Marcado;
	i = 0;
	Marcado = 0;
	//IdEncuesta = document.Encuesta.TxtIdEncuesta.value;
	IdEncuesta = document.getElementById("TxtIdEncuesta");
		
	numrespuestas = document.getElementById("TxtNumEncuestaRespuestas");
		
	for (i=1;i<=numrespuestas.value;i++)
	{
		if (Marcado == 0)
		{
			optencuesta = document.getElementById("OptEncuesta" + i + "");
			if (optencuesta.checked)
			{
				Marcado = 1;
				break;
			}
		}
	}
						
	if (Marcado == 0)
	{
		alert("Debe de Elegir una Opción para Votar");
		return;
	}
	else
	{
		optencuesta = document.getElementById("OptEncuesta" + i + "");
		window.location="http://www.decine21.com/FrmControlVotar.asp?id=" + IdEncuesta.value + "&amp;op=" + optencuesta.value + "";
	}
}


function VotarPortada(nombre)
{
	var i;
	var IdEncuesta;
	var Marcado;
	i = 0;

	Marcado = 0;
	//IdEncuesta = document.Encuesta.TxtIdEncuesta.value;
	IdEncuesta = document.getElementById("TxtIdEncuesta");
		
	numrespuestas = document.getElementById("TxtNumEncuestaRespuestas");
	for (i=1;i<=numrespuestas.value;i++)
	{
		if (Marcado == 0)
		{
			optencuesta = document.getElementById("OptEncuesta" + i + "");
			if (optencuesta.checked)
			{
				Marcado = 1;
				break;
			}
		}
	}
						
	if (Marcado == 0)
	{
		alert("Debe de Elegir una Opción para Votar");
		return;
	}
	else
	{
	    
		optencuesta = document.getElementById("OptEncuesta" + i + "");
		//window.location="FrmControlVotar.asp?id=" + IdEncuesta.value + "&op=" + document.Encuesta.OptEncuesta[i].value + "";
		window.location="http://www.decine21.com/encuestas/"+nombre+"?id="+IdEncuesta.value+"&op=" + optencuesta.value + "";
	}
}
function ResponderTrivial(infantil)
{
	var i;
	var txttrivial;
	var idtrivial;
	var Marcado;
	var optfalso;
	var optverdadero;
	i = 0;
	Marcado = 0;
	
	txttrivial = document.getElementById("TxtIdTrivial");
	idtrivial = txttrivial.value;
	
	optverdadero = document.getElementById("OptTrivial0");
	optfalso = document.getElementById("OptTrivial1");		
						
    if (optverdadero.checked || optfalso.checked)
    {
     Marcado = 1;
	}
	
				
	if (Marcado == 0)
	{
		alert("Debe de Elegir una Respuesta para el Trivial");
		return;
	}
	else
	{
		if (optverdadero.checked)
		{
			valorrespuesta = 1;
		}
		else
		{
			valorrespuesta = 0;
		}
	
	    if(infantil==0)
		    URL = "http://www.decine21.com/trivial/respuesta?Id=" + idtrivial + "&R=" + valorrespuesta + "";
		else
		    URL = "http://www.decine21.com/trivial/familiar/respuesta?Id=" + idtrivial + "&R=" + valorrespuesta + "";
		
		new_window=window.open(URL,'Trivial','width=650,height=300,menubar=no,status=no,scrollbars=no,toolbar=no,location=no,directories=no,resizable=no,top=250,left=250');
		new_window.focus();
	}
}

function ResponderTrivialCabecera(infantil)
{
	var txttrivial;
	var idtrivial;
	
	txttrivial = document.getElementById("TxtIdTrivialCabecera");
	idtrivial = txttrivial.value;
	
	if(infantil==1)
	    URL = "http://www.decine21.com/trivial/familiar?Id=" + idtrivial + "";
	else
	    URL = "http://www.decine21.com/trivial?Id=" + idtrivial + "";
		
	new_window=window.open(URL,'Trivial','width=650,height=300,menubar=no,status=no,scrollbars=no,toolbar=no,location=no,directories=no,resizable=no,top=250,left=250');
	new_window.focus();
}

function VolverAtras()
{
	txtpaginacartelera = document.getElementById("TxtPaginaCartelera");
	txtidcartelera = document.getElementById("TxtIdCartelera");
	
	//Le redireccionamos a la pagina
	if (txtpaginacartelera.value == "")
	{
		return;
	}
	
	if (txtidcartelera.value == "")
	{
		return;
	}
	
	strpelicula = txtpaginacartelera.value;
	idpelicula = txtidcartelera.value;
				
	window.location = "http://www.decine21.com/Peliculas/" + strpelicula + "?Id=" + idpelicula + "&#Cartelera";
}

function CargarMunicipios()
{
cmbprovincia = document.getElementById("CmbProvincia");
NumProvincia = cmbprovincia.value;

cmbpoblacion = document.getElementById("CmbPoblacion");


VaciarSeleccion(cmbpoblacion);
CargarSeleccion(cmbpoblacion,eval ("ArraySelect"+NumProvincia), eval("ArraySelectId"+NumProvincia),eval("ArraySelectCapital"+NumProvincia));
}

function VaciarSeleccion(Seleccion) {
	SelectionLength=Seleccion.length-1;
	for (n=SelectionLength; n>0; n--)
	{
		Seleccion.options[n]=null;
	}
	Seleccion.options[0].selected=true;
}

function CargarSeleccion(Seleccion,ArrayMunicipios,ArrayMunicipiosId,ArraySelectCapital)
{
	var NewOption;
	ArrayLength = ArrayMunicipios.length;
	for (n=0; n<ArrayLength; n++)
	{
		NewOption = new Option;
		NewOption.text = ArrayMunicipios[n];
		NewOption.value = ArrayMunicipiosId[n];
		Seleccion.options[n]=NewOption;
		// Miramos si el nuevo elemento esta marcado como capital si lo esta cogemos ese
		//if (NewOption.value == municipio_actual)
		if (NewOption.value == ArraySelectCapital[0])
		{
			Seleccion.options[n].selected=true;
		}
	}
}

function ElegirPoblacion()
{
    cmbprovincia = document.getElementById("CmbProvincia");
    cmbpoblacion = document.getElementById("CmbPoblacion");
    txtpaginacartelera = document.getElementById("TxtPaginaCartelera");
    txtidcartelera = document.getElementById("TxtIdCartelera");
	if (cmbprovincia.value == 0) 
	{
		return;
	}
	if (cmbpoblacion.value == 0)
	{
		return;
	}
	
	//Le redireccionamos a la pagina
	if (txtpaginacartelera.value == "")
	{
		return;
	}
	
	if (txtidcartelera.value == "")
	{
		return;
	}
	
	strpelicula = txtpaginacartelera.value;
	idpelicula = txtidcartelera.value;
	IdPo = cmbpoblacion.value;
				
	window.location = "http://www.decine21.com/Peliculas/" + strpelicula + "?Id=" + idpelicula + "&Ca=1&pob=" + IdPo + "&OpCa=1#Cartelera";
}

function MostrarCompartir()
{
	tabla = document.getElementById("TablaCompartir");
	if (tabla.style.display == "")
	{
		tabla.style.display = "none";
	}
	else
	{
		tabla.style.display = "";
	}

}


function enlacescompartir()
{
    // Cargamos los enlaces de compartir
    strtitulo = document.title;
    strurl = document.location.href;


    // Tenemos que reemplezar los espacios por +
    do {    
    strtitulo = strtitulo.replace(' ','+');
    } 
    while(strtitulo.indexOf(' ') >= 0);

    // meneame
    enlacecompartir = document.getElementById("compartirmeneame");
    enlacecompartir.href = "http://meneame.net/submit.php?url=" + strurl + "&ei=UTF"
    enlacecompartir = document.getElementById("compartirmeneametitulo");
    enlacecompartir.href = "http://meneame.net/submit.php?url=" + strurl + "&ei=UTF"
    // digg
//    enlacecompartir = document.getElementById("compartirdigg");
//    enlacecompartir.href = "http://digg.com/submit?phase=2&url=" + strurl + "&title=" + strtitulo + ""
//    enlacecompartir = document.getElementById("compartirdiggtitulo");
//    enlacecompartir.href = "http://digg.com/submit?phase=2&url=" + strurl + "&title=" + strtitulo + ""
//    // del.icio.us
//    enlacecompartir = document.getElementById("compartirdelicious");
//    enlacecompartir.href = "http://del.icio.us/post?v=4&noui&jump=close&url=" + strurl + "&title=" + strtitulo + ""
//    enlacecompartir = document.getElementById("compartirdelicioustitulo");
//    enlacecompartir.href = "http://del.icio.us/post?v=4&noui&jump=close&url=" + strurl + "&title=" + strtitulo + ""
//    // blinklist
//    enlacecompartir = document.getElementById("compartirblinklist");
//    enlacecompartir.href = "http://www.blinklist.com/index.php?Action=Blink/addblink.php&Url=" + strurl + "&Title=" + strtitulo + ""
//    enlacecompartir = document.getElementById("compartirblinklisttitulo");
//    enlacecompartir.href = "http://www.blinklist.com/index.php?Action=Blink/addblink.php&Url=" + strurl + "&Title=" + strtitulo + ""
    // yahoo
//    enlacecompartir = document.getElementById("compartiryahoo");
//    enlacecompartir.href = "http://myweb2.search.yahoo.com/myresults/bookmarklet?url=" + strurl + ""
//    enlacecompartir = document.getElementById("compartiryahootitulo");
//    enlacecompartir.href = "http://myweb2.search.yahoo.com/myresults/bookmarklet?url=" + strurl + ""
    // fresqui
//    enlacecompartir = document.getElementById("compartirfresqui");
//    enlacecompartir.href = "http://ocio.fresqui.com/post?url=" + strurl + ""
//    enlacecompartir = document.getElementById("compartirfresquititulo");
//    enlacecompartir.href = "http://ocio.fresqui.com/post?url=" + strurl + ""
//    // technorati
//    enlacecompartir = document.getElementById("compartirtechnorati");
//    enlacecompartir.href = "http://technorati.com/faves?add=" + strurl + ""
//    enlacecompartir = document.getElementById("compartirtechnoratititulo");
//    enlacecompartir.href = "http://technorati.com/faves?add=" + strurl + ""
    // wikio
    enlacecompartir = document.getElementById("compartirwikio");
    enlacecompartir.href = "http://www.wikio.es/vote?url=" + strurl + ""
    enlacecompartir = document.getElementById("compartirwikiotitulo");
    enlacecompartir.href = "http://www.wikio.es/vote?url=" + strurl + ""
    //facebook
//    enlacecompartir = document.getElementById("compartirfacebook");
//    enlacecompartir.href = "http://www.facebook.com/share.php?u=" + strurl + ""
//    enlacecompartir = document.getElementById("compartirfacebooktitulo");
//    enlacecompartir.href = "http://www.facebook.com/share.php?u=" + strurl + ""
    //myspace
    enlacecompartir = document.getElementById("compartirmyspace");
    enlacecompartir.href = "http://www.myspace.com/Modules/PostTo/Pages/?u=" + strurl + "&t=" + strtitulo + ""
    enlacecompartir = document.getElementById("compartirmyspacetitulo");
    enlacecompartir.href = "http://www.myspace.com/Modules/PostTo/Pages/?u=" + strurl + "&t=" + strtitulo + ""
}

// Para la pulsacion de Enter en la busqueda avanzada
function BuscarAvanzado(objeto,e)
{

	evt = e || window.event;
	var keyPressed = evt.which || evt.keyCode;


	
	//var evento_key = window.event.keyCode;
	var evento_key = keyPressed;
	
	if (13 == evento_key)
	{
		
		// Le pasamos el valor
		
		trimAvanzado(objeto);
				
		// a ver que tenemos ahora
		if (objeto.value == "")
		{
			
			return;
		}
		
		document.Busqueda.TxtControlAvanzado.value = 1;
		document.Busqueda.submit();
	}
	else
	{
		if (37 == evento_key)
		{
			window.event.keycode = 0;
			window.event.returnValue = 0;
		}
		else
		{
			if (42 == evento_key)
			{
				window.event.keycode = 0;
				window.event.returnValue = 0;
			}
		}
	}
}

function trimAvanzado(objeto) 
{ 
	var cadena = objeto.value;
	
    for(i=0; i<cadena.length; ) 
    { 
        if(cadena.charAt(i)==" ") 
            cadena=cadena.substring(i+1, cadena.length); 
        else 
            break; 
    } 

    for(i=cadena.length-1; i>=0; i=cadena.length-1) 
    { 
        if(cadena.charAt(i)==" ") 
            cadena=cadena.substring(0,i); 
        else 
            break; 
    } 
    objeto.value = cadena; 
} 

function QuitaBuscarAvanzado()
{
	document.Busqueda.TxtControlAvanzado.value = "0";
}

function VolverABuscar(idpag,idcont)
{
	document.Busqueda.TxtContador.value = idcont;
	document.Busqueda.TxtPagina.value = idpag;
	document.Busqueda.submit();
}

function disminuyeLetraComentarios() {
    if (tamanoLetra > tamanoLetraminimo) {
    tamanoLetra -= 1;
    contador = document.getElementById('TxtCuentaApoyo')
    numeroapoyo = contador.value;
    identidadLetra = document.getElementById('tamanoapoyo1');
    if (identidadLetra != null)
    {
		for(i=1; i<=numeroapoyo; i++ ) 
		 {
			
			identidadLetra = document.getElementById('tamanoapoyo' + i + '');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
			}
    }
    }
}

function aumentaLetraComentarios() {
    if (tamanoLetra < tamanoLetramaximo) {
    tamanoLetra += 1;
    contador = document.getElementById('TxtCuentaApoyo')
    numeroapoyo = contador.value;
    identidadLetra = document.getElementById('tamanoapoyo1');
    if (identidadLetra != null)
    {
		for(i=1; i<=numeroapoyo; i++ ) 
		 {
			
			identidadLetra = document.getElementById('tamanoapoyo' + i + '');
			identidadLetra.className = 'Formateo' + tamanoLetra;	
			}
    }
    }
}

function ElegirPoblacionCartelera()
{
	var cmbprov = document.getElementById('CmbProvincia');
	var cmbpob = document.getElementById('CmbPoblacion');

	if (cmbprov.value == 0) 
	{
		return;
	}
	if (cmbpob.value == 0)
	{
		return;
	}
	IdPr = cmbprov .value;
	IdPo = cmbpob.value;
	window.location = "cartelera?prov=" + IdPr + "&pob=" + IdPo + "";
}

function ElegirPeliculaEstrenos(idPo)
{
	var cmbpel = document.getElementById('CmbEstrenos');

	IdPelicula = cmbpel.value;
	if (IdPelicula == 0)
	{
		return;
	}
	window.location = IdPelicula + "?Ca=1&pob=" + idPo + "#Cartelera";
}

function ElegirPeliculaResto(idPo)
{
	var cmbpel = document.getElementById('CmbResto');
	IdPelicula = cmbpel.value;
	if (IdPelicula == 0)
	{
		return;
	}
	window.location = IdPelicula + "?Ca=1&pob=" + idPo + "#Cartelera";
}

function ElegirCine()
{
	var cmbpel = document.getElementById('CmbCines');
	IdCine = cmbpel.value;
	if (IdCine == 0)
	{	
		return;
	}
	var cmbprov = document.getElementById('CmbProvincia');
	var cmbpob = document.getElementById('CmbPoblacion');
	IdPr = cmbprov .value;
	IdPo = cmbpob.value;
	window.location = "cartelera?prov=" + IdPr + "&pob=" + IdPo + "&cine=" + IdCine + "";
}

function UltimoBoletin(NombreBoletin)
{
	URL = "http://www.decine21.com/HistorialBoletines/" + NombreBoletin + ""
	new_window=window.open(URL,'Boletin','width=550,height=700,menubar=no,statusbar=no,scrollbars=yes,toolbar=no,location=no,directories=no,resizable=no,top=0,left=250');
	new_window.focus();
}

function HistorialBoletin(NombreBoletin)
{
	URL = "http://www.decine21.com/HistorialBoletines/" + NombreBoletin + ""
	new_window=window.open(URL,'HistorialBoletin','width=550,height=700,menubar=no,statusbar=no,scrollbars=yes,toolbar=no,location=no,directories=no,resizable=no,top=0,left=250');
	new_window.focus();
}


function CargarMunicipiosCabecera()
{
	cmbprovincia = document.getElementById("CmbProvinciaCabecera");
	NumProvincia = cmbprovincia.value;

	cmbpoblacion = document.getElementById("CmbPoblacionCabecera");		

	// hacemos la comproabacion de mirar si se ha rellenado el txt de provincia ya o no
	VaciarSeleccionCabecera(cmbpoblacion);
	CargarSeleccionCabecera(cmbpoblacion,eval ("ArraySelectCab"+NumProvincia), eval("ArraySelectCabId"+NumProvincia),eval("ArraySelectCabCapital"+NumProvincia));
	
}

function VaciarSeleccionCabecera(Seleccion) {
	SelectionLength=Seleccion.length-1;
	for (n=SelectionLength; n>0; n--)
	{
		Seleccion.options[n]=null;
	}
	Seleccion.options[0].selected=true;
}


function CargarSeleccionCabecera(Seleccion,ArrayMunicipios,ArrayMunicipiosId,ArraySelectCapital)
{
	var NewOption;
	ArrayLength = ArrayMunicipios.length;
	for (n=0; n<ArrayLength; n++)
	{
		NewOption = new Option;
		NewOption.text = ArrayMunicipios[n];
		NewOption.value = ArrayMunicipiosId[n];
		Seleccion.options[n]=NewOption;
		// Miramos si el nuevo elemento esta marcado como capital si lo esta cogemos ese
		if (NewOption.value == ArraySelectCapital[0])
		{
			Seleccion.options[n].selected=true;
		}
	}
}

function ElegirCineCabecera()
{
	var provincia = document.getElementById("CmbProvinciaCabecera");
	var poblacion = document.getElementById("CmbPoblacionCabecera");
		
	if (provincia.value == 0 || poblacion.value == 0) 
	{
		return;
	}
	
	IdPr = provincia.value;
	IdPo = poblacion.value;
	window.location = "http://www.decine21.com/cartelera/?prov=" + IdPr + "&pob=" + IdPo + "&js=1";
}

function pruebaboletin()
{
		if (document.getElementById("TxtNombre").value == '')
		{
			alert("Debe de Introducir el Nombre");
		    return ;
		}
		if (document.getElementById("TxtApellidos").value == '')
		{
			alert("Debe de Introducir los Apellidos");
		    return ;
		}		
		if (document.getElementById("TxtEmail").value == '')
		{
			alert("Debe de Introducir el Email");
		    return ;
		}			

		if (document.getElementById("TxtNumero").value == '')
		{
			alert("Debe de Introducir el codigo de validacion");
		    return ;
		}	
		document.getElementById("txtoperacion").value='1';		
		document.getElementById("boletin").submit();
}

function enviosugerencia()
{
		if (document.getElementById("TxtNombre").value == '')
		{
			alert("Debe de Introducir el Nombre");
		    return ;
		}
		if (document.getElementById("TxtApellidos").value == '')
		{
			alert("Debe de Introducir los Apellidos");
		    return ;
		}		
		if (document.getElementById("TxtEmail").value == '')
		{
			alert("Debe de Introducir el Email");
		    return ;
		}			

		if (document.getElementById("TxtNumero").value == '')
		{
			alert("Debe de Introducir el codigo de validacion");
		    return ;
		}	
		document.getElementById("txtoperacion").value='1';		
		document.getElementById("sugerencia").submit();
}

function ElegirPoblacionPeliculas()
		{
		    cmbprovincia = document.getElementById("CmbProvincia");
		    cmbpoblacion = document.getElementById("CmbPoblacion");
		    txtpaginacartelera = document.getElementById("TxtPaginaCartelera");
		    
			if (cmbprovincia.value == 0) 
			{
				return;
			}
			if (cmbpoblacion.value == 0)
			{
				return;
			}
			
			//Le redireccionamos a la pagina
			if (txtpaginacartelera.value == "")
			{
				return;
			}
						
			strpelicula = txtpaginacartelera.value;
			IdPo = cmbpoblacion.value;
						
			window.location = "http://www.decine21.com/peliculas/" + strpelicula + "?Ca=1&pob=" + IdPo + "&ori=1#Cartelera";
		}
		
function VolverAtrasPelicula()
			{
				txtpaginacartelera = document.getElementById("TxtPaginaCartelera");
								
				//Le redireccionamos a la pagina
				if (txtpaginacartelera.value == "")
				{
					return;
				}
				
								
				strpelicula = txtpaginacartelera.value;
											
				window.location = "http://www.decine21.com/Peliculas/" + strpelicula + "#Cartelera";
			}
			
			
			
function ResponderTrivialPagina()
{
	var i;
	var txttrivial;
	var idtrivial;
	var Marcado;
	var optfalso;
	var optverdadero;
	var opinfantil;
	i = 0;
	Marcado = 0;
	

	txttrivial = document.getElementById("TxtIdTrivial");
	idtrivial = txttrivial.value;
	optverdadero = document.getElementById("OptTrivial0");
	optfalso = document.getElementById("OptTrivial1");	
	
	opinfantil = document.getElementById("TxtOpcionInfantil");
    if (optverdadero.checked || optfalso.checked)
    {
     Marcado = 1;
	}
	
				
	if (Marcado == 0)
	{
		alert("Debe de Elegir una Respuesta para el Trivial");
		return;
	}
	else
	{		
		if (optverdadero.checked)
		{
			valorrespuesta = 1;
		}
		else
		{
			valorrespuesta = 0;
		}
	
	    if (opinfantil.value==1)
    	    window.location = "http://www.decine21.com/trivial/familiar/respuesta?Id=" + idtrivial + "&R=" + valorrespuesta;		   
        else
            window.location = "http://www.decine21.com/trivial/respuesta?Id=" + idtrivial + "&R=" + valorrespuesta;
            
	}
}

function funcenvioarticulo()
{
        if (document.getElementById("TxtTituloOculto").value == '')
		{
			alert("Ficha incorrecta. No accedio a traves de ningun enlace");
		    return ;
		}

		if (document.getElementById("TxtEmail").value == '')
		{
			alert("Debe de Introducir el email de origen");
		    return ;
		}
		if (document.getElementById("TxtDestinatario").value == '')
		{
			alert("Debe de Introducir el email de destino");
		    return ;
		}		
		if (document.getElementById("TxtComentario").value == '')
		{
			alert("Debe de Introducir el comentario");
		    return ;
		}			

		if (document.getElementById("TxtNumero").value == '')
		{
			alert("Debe de Introducir el codigo de validacion");
		    return ;
		}	
		document.getElementById("txtoperacion").value='1';		
		document.getElementById("envioarticulo").submit();
}

function BuscarMultimedia()
{
	if (document.Buscador.ChkTrailer.checked == false && document.Buscador.ChkVideoCritica.checked == false && document.Buscador.ChkReportaje.checked == false && document.Buscador.ChkEntrevista.checked == false && document.Buscador.ChkCortoMetraje.checked == false)
	{
		alert("Debe de elegir al menos uno de los tipos para buscar");
		return false;
	}
	else
	{
		document.Buscador.submit();
	}
}

function BuscarPorTexto(objeto)
{
	
	
	var evento_key = window.event.keyCode;

	if (13 == evento_key)
	{
	
		// Le pasamos el valor
		texto = document.getElementById("TxtBuscarVideo");
				
		
		
		// a ver que tenemos ahora
		if (texto.value == "")
		{	
			alert("Debe de especificar el texto a buscar");
			return false;	
		}
		else
		{
			if (document.Buscador.ChkTrailer.checked == false && document.Buscador.ChkVideoCritica.checked == false && document.Buscador.ChkReportaje.checked == false && document.Buscador.ChkEntrevista.checked == false && document.Buscador.ChkCortoMetraje.checked == false)
			{
				alert("Debe de elegir al menos uno de los tipos para buscar");
				return false;
			}
			else
			{
				document.Buscador.submit();
			}
		}
		return false;
	}
	else
	{
		if (37 == evento_key)
		{
			window.event.keycode = 0;
			window.event.returnValue = 0;
		}
		else
		{
			if (42 == evento_key)
			{
				window.event.keycode = 0;
				window.event.returnValue = 0;
			}
		}
	}
}

function pagbuscador(pagina)
{
    document.getElementById("txtpaginamultimedia").value = pagina;

    document.getElementById("paginacionmultimedia").submit();
}



function getFecha()
{
      mydate = new Date();
      myday = mydate.getDay();
      mymonth = mydate.getMonth();
      myweekday= mydate.getDate();
      myyear = mydate.getFullYear();
      weekday= myweekday;
      if(myday == 0)
      day = " Domingo "
      else if(myday == 1)
      day = " Lunes "
      else if(myday == 2)
      day = " Martes "
      else if(myday == 3)
      day = " Miércoles "
      else if(myday == 4)
      day = " Jueves "
      else if(myday == 5)
      day = " Viernes "
      else if(myday == 6)
      day = " Sábado "
      if(mymonth == 0)
      month = "Enero "
      else if(mymonth ==1)
      month = "Febrero "
      else if(mymonth ==2)
      month = "Marzo "
      else if(mymonth ==3)
      month = "Abril "
      else if(mymonth ==4)
      month = "Mayo "
      else if(mymonth ==5)
      month = "Junio "
      else if(mymonth ==6)
      month = "Julio "
      else if(mymonth ==7)
      month = "Agosto "
      else if(mymonth ==8)
      month = "Septiembre "
      else if(mymonth ==9)
      month = "Octubre "
      else if(mymonth ==10)
      month = "Noviembre "
      else if(mymonth ==11)
      month = "Diciembre "
      
      return (day+", " + myweekday+ " de "+month + " de " + myyear);
      
}


function pulsadoBuscar()
{

	var valor;
	valor = document.getElementById("ComboCampo").value;

    if ((valor=="Titulo")||(valor=="Titulo Original"))
        document.getElementById("cx").value="012119090662623041329:lpqun6iswms";
    if (valor=="Personaje")
        document.getElementById("cx").value="012119090662623041329:yqzxrmmfr00";
    if (valor=="Todos")
        document.getElementById("cx").value="012119090662623041329:hltp76cvdis";
    if (valor=="Entrevistas")
        document.getElementById("cx").value="012119090662623041329:vy244eaifn8";  
    if (valor=="Ano")
    {
        document.getElementById("searchbox_004825717204032381724:jfqcclqsbpi").action="http://www.decine21.com/anios/titulo/peliculas-"+document.getElementById("q").value;
        document.getElementById("searchbox_004825717204032381724:jfqcclqsbpi").method="post";
    }
    
    
    if (valor=="Genero")
    {
        document.getElementById("searchbox_004825717204032381724:jfqcclqsbpi").action="http://www.decine21.com/generos/titulo/peliculas-"+document.getElementById("CmbBuscar").value;
        document.getElementById("searchbox_004825717204032381724:jfqcclqsbpi").method="post";
    }    
    
    document.getElementById("searchbox_004825717204032381724:jfqcclqsbpi").submit();
    
}

function cambia_pestana(numero)
{
    var div;
    var div2;
    var recuadro;
    var recuadro2;
    
    div = document.getElementById("divlomasvistohoy");
    div2 = document.getElementById("divlomascomentado");
    
    recuadro = document.getElementById("recuadrolomasvisto");
    recuadro2 = document.getElementById("recuadrolomascomentado");
    
    if (numero == 1)
    {
        div.className = "numero_activa";
        div2.className = "numero_inactiva";
        recuadro.style.display = "";
        recuadro2.style.display = "none";
    }
    else
    {
        div.className = "numero_inactiva";
        div2.className = "numero_activa";
        recuadro.style.display = "none";
        recuadro2.style.display = "";
    }    
}
