// JavaScript Document

// Funcion de La Barra de Estado
var current = 0
var x = 0
var speed = 300
var speed2 = 2000

function initArray(n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '
  }
}

typ = new initArray(4)
typ[0]="Bienvenido a la página de ...."
typ[1]="La Iglesia San Roque de Tarija - Bolivia"
typ[2]="Sede de la Fiesta Grande de Tarija: La Fiesta de San Roque"
typ[3]="Patrimonio Cultural y Religioso de Bolivia"

function typewrite() {
var m = typ[current]
window.status = m.substring(0, x++) + "_"
if (x == m.length + 1) {
x = 0
current++
if (current > typ.length - 1) {
current = 0
}
setTimeout("typewrite()", speed2)
}
else {
setTimeout("typewrite()", speed)
}
}
//typewrite()

var imgEtiSupAct = new Image(140, 30)
imgEtiSupAct.src = 'imagenes/etiqueta_sup_act.gif'

function cambiarFondoEtiqueta(obj)
{
 obj.parentNode.background = imgEtiSupAct.src
}

function restablecerFondoEtiqueta(obj)
{
 obj.parentNode.background = 'imagenes/etiqueta_sup.gif'
}


var ultimoSelec = null
function mostrarActividades(obj)
{

 if (ultimoSelec & (ultimoSelec != obj))
 {
  ultimoSelec.style.color = 'ffffff'
  ultimoSelec.style.backgroundColor = 'B67171'
  elDiv = ultimoSelec.parentNode.nextSibling.firstChild.firstChild
  elDiv.style.visibility = 'hidden'
  elDiv.style.position = 'absolute'  
 }
 if (ultimoSelec == obj)
 {
  elDiv = obj.parentNode.nextSibling.firstChild.firstChild
  if ( elDiv.style.position == 'absolute')
  {
   elDiv.style.position = 'relative'
   elDiv.style.visibility = 'inherit'  
  } else
  {
   elDiv.style.position = 'absolute'
   elDiv.style.visibility = 'hidden' 
  }
 } else
 {
  elDiv = obj.parentNode.nextSibling.firstChild.firstChild
  if ( elDiv.style.position == 'absolute')
  {
   obj.style.textDecoration = 'none'
   obj.style.backgroundColor = '990000'  
   elDiv.style.position = 'relative'
   elDiv.style.visibility = 'inherit'
  
  } else
  {
   obj.style.textDecoration = 'none'
   obj.style.backgroundColor = 'B67171'  
   elDiv.style.position = 'absolute'
   elDiv.style.visibility = 'hidden'  
  }
  
 }
 ultimoSelec = obj
}

function entraAFecha(obj)
{
 obj.style.cursor = 'hand'
 obj.style.backgroundColor = '990000'
 obj.style.textDecoration = 'underline'
}

function saleDeFecha(obj)
{
 if (obj.parentNode.nextSibling.firstChild.firstChild.style.position == 'absolute')
  {
   obj.style.backgroundColor = 'B67171'
  }
 obj.style.textDecoration = 'none'
}

function finCarga()
{

 typewrite()
 
 // Precarga de imagenes
for (i=1 ; i<=5; i++)
{
 for (j=1; j<=6; j++)
 {
  sentencia = "figura"+i+j+" = new Image(140, 30)";
  eval(sentencia);
  sentencia = "figura"+i+j+".src = 'imagenes/opcion"+i+"a"+j+".gif'"
  eval(sentencia)
 }
}

 
 efecto() 
 cambiarEnlace()
 if (document.getElementById('tdBannerSup')) BSefecto()
 if (document.getElementById('uno')) escrolea()
 
}


function valTexto(campo, event)
{
 var key, keychar
 if (window.event)
  key = window.event.keyCode
 else if (event)
  key = event.which
   else
    return true;
 keychar = String.fromCharCode(key)
 if (keychar =='\'') return false
 if (keychar =='\\') return false
 return true
}


function validarComentario(obj){ 
    //valido remitente
    if (obj.remitente.value.length==""){ 
       document.getElementById('campoMensaje').innerHTML = 'ˇˇˇ Debes introducir tu nombre !!!'
       obj.remitente.focus() 
       return false; 
    } 

    //valido el mensaje
	if (obj.comentario.value.length==""){ 
	   document.getElementById('campoMensaje').innerHTML = 'ˇˇˇ Debes  introducir un comentario!!!'
       obj.comentario.focus()
       return false; 
    }
	return true;
}

// Funcion para tratamiento de imagenes

function mostrarImg(obj)
{
 ventana = open("", "", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,titlebar=no,toolbar=no,top=0,left=0","")
 ventana.document.writeln("<head><title>Iglesia de San Roque Tarija - Bolivia</title></head><body style='margin:0'><table cellspacing=0 cellpadding=0 id='tabla'><tr><td><img src="+obj.src+" id='imagen'><tr><td align='center'><input type='button' value='Cerrar ventana' style='BORDER-RIGHT: #990000 1px solid; BORDER-LEFT: #990000 1px solid; BORDER-TOP: #990000 1px solid; BORDER-BOTTOM: #990000 1px solid;	PADDING-RIGHT: 0px;  PADDING-LEFT: 0px; PADDING-TOP: 0px; PADDING-BOTTOM: 0px;	FONT-SIZE: 8pt;  MARGIN: 1px; FONT-FAMILY: Arial; HEIGHT: 16px; WIDTH: 100%; cursor: hand' onclick='window.close()'></table></body>")
 ventana.resizeTo(ventana.document.getElementById('imagen').width+10, ventana.document.getElementById('tabla').clientHeight+29)
}



var ventana2=null

function abrirventana(url, x, y)
{
if (x<200)
	x=300
if (y<200)
	y=300
y=y+20
if (ventana2)
	window.ventana2.close()
eval("ventana2=window.open('ventana.php?id="+url+"', 'Imagen', 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,titlebar=yes,top=10,left=10,width=" + x + ",height=" + y + ",dependent=yes', true)")
}