//********************************************************
//*           CONTENIDO.JS: FUNCIONES JAVASCRIPT         *
//*           DESARROLLADAS POR Jesús Quílez Bielsa      *
//*           jquilez@roble.pntic.mec.es                 *
//*           Y EL GRUPO PALLADIUM                       *
//********************************************************
var cautr="Dirección y diseño de Jesús Quílez Bielsa. "
var cnavg="Microsoft Internet Explorer"
var posdiviniy=0
var cvern="4"
var lsuenamusica=false
var ldesactivaboton=false
var nscr=0
var nsct=0
var ncierra=0
var lLeeTexto=false
var esqvis=false
var posratx=-1
var posraty=-1
var csepcad=""
var csepcar=""
var cnavegador=navigator.appName
var intlinant=""

window.onerror = trataerror;
window.onbeforeprint = preparaprint;
window.onafterprint = revierteprint;

window.document.onmousedown = ratonabajo;
window.document.onkeydown = pulsateclason;

if (cnavegador=="Netscape"){
window.captureEvents(Event.MOUSEMOVE | Event.MOUSEDOWN | Event.MOUSEUP | Event.KEYDOWN);
document.onmousemove=mueveraton
document.onmousedown=ratonabajo
}

function ratonabajo(e){
if (cnavegador=="Netscape"){tipo=e.which}
else {tipo=event.button}
cnombre=document.URL
if (tipo!=1){
   if (estaen(cnombre,"ej")>-1){ldesactivaboton=true}
   if (estaen(cnombre,"datos.php")>-1){ldesactivaboton=true}
   if (ldesactivaboton){
      alert("El botón derecho no se puede usar en los ejercicios")
      return false;
   }
}
}

function leetexto(){
var cpagina = document.location.href
  if (lLeeTexto) {
      calla()
      lLeeTexto=false
  }
  else {
       	nPunto = cpagina.lastIndexOf(".")
        cclave = cpagina.substring(0,nPunto)+".mp3"
        lLeeTexto=true
        oir(cclave)
  }
}

function fondoamarillo(){
   oFuentes = document.getElementsByTagName("*")
   nobjtot=oFuentes.length
   ccolor="yellow"
   for (nobj=0;nobj<nobjtot;nobj++){
       ccolfon=oFuentes[nobj].style.color
       if (ccolfon != "#000000"){
          oFuentes[nobj].style.color="#000000"
       }
       oFuentes[nobj].style.backgroundColor=ccolor
   }
}

function cambiatamano(){
   oFuentes = document.getElementsByTagName("*")
   nobjtot=oFuentes.length
   ctamano=""
   for (nobj=0;nobj<nobjtot;nobj++){
       ctamano=oFuentes[nobj].style.fontSize
       switch(ctamano){
           case "": ctamano="medium";break;
           case "small": ctamano="medium";break;
           case "medium": ctamano="large";break;
           case "large": ctamano="small";break;
       }
       oFuentes[nobj].style.fontSize=ctamano
   }
}

function pulsateclason(e){
var cpagina = document.location.href
var teclalee = 0
var lctr = 0
var cclave = ""
if (cnavegador=="Netscape"){teclalee=e.keyCode;lctr=e.ctrlKey}
else {teclalee=window.event.keyCode;lctr=window.event.ctrlKey}
if (teclalee==120){
   cambiatamano()
}
if (teclalee==119){
   fondoamarillo()
}
if (teclalee==113){
   leetexto()
}
else {
  if (lctr) {
    if (teclalee==67){window.location="../cclasica/esc311.php"}
    if (teclalee==75){window.location="../latin/esl111.php"}
    if (teclalee==71){window.location="../griego/esg111.php"}
    if (teclalee==77){window.location="../usuario0.php"}
    if (teclalee==82){window.location="../usuario1.php"}
    if (teclalee==85){window.location="../usuario2.php"}
     if (teclalee==49 || teclalee==48){
          ninipag=cpagina.lastIndexOf("es")
          cmateria=cpagina.substring(ninipag+2,ninipag+4)
          ninipag=ninipag+4
          nantpag=parseInt(cpagina.substring(ninipag,ninipag+1))
          if (teclalee==49){nnvapag=nantpag+1}
          else {nnvapag=nantpag-1}
          cclave = cpagina.substring(0,ninipag)+nnvapag+"1.php"
     }
     if (teclalee==50 || teclalee==57){
          ninipag=cpagina.lastIndexOf("ca")
          if (ninipag<cpagina.lastIndexOf("/")){
             cclave=cpagina.substring(0,cpagina.lastIndexOf("."))+"ca1.php"
          }
          else {
            ninipag=ninipag+2
            nantpag=parseInt(cpagina.substring(ninipag,ninipag+1))
            if (teclalee==50){nnvapag=nantpag+1}
            else {nnvapag=nantpag-1}
            cclave = cambiacadena(cpagina,"ca"+nantpag,"ca"+nnvapag)
          }
     }
     if (teclalee==51){
          ninipag=cpagina.lastIndexOf("es")
          cmateria=cpagina.substring(ninipag+2,ninipag+4)
          alert(cmateria)
          switch(cmateria){
               case "c3": cmateria="c4";break;
               case "c4": cmateria="c3";break;
               case "l1": cmateria="l2";break;
               case "l2": cmateria="l1";break;
               case "g1": cmateria="g2";break;
               case "g2": cmateria="g1";break;
          }
          cclave = cpagina.substring(0,ninipag)+"es"+cmateria+"11.php"
     }
     if (cclave>""){
        cdatbod=document.body.innerHTML
        ninipag=cclave.lastIndexOf("/")
        cpagina=cclave.substring(ninipag+1)
        if (cdatbod.indexOf(cpagina)>0) {window.location=cclave}
      }
  }
  }
}

function preparaprint(){
var contenido=""
if (document.all) {
 if (document.all["contenido"]){
  contenido = document.all["contenido"].innerHTML
 }
}
if (document.getElementById){
 if (document.getElementById("contenido")){
  contenido = document.getElementById("contenido").innerHTML
 }
}
if (contenido>""){
 document.body.background = " "
 document.body.leftMargin = 100
 document.body.innerHTML = document.all("contenido").innerHTML
}
if (document.QA0.cs00){verdefiniciones()}
}

function revierteprint(){
setTimeout("window.location.reload()",50)
}


function mueveraton(e){
posratx=e.pageX
posraty=e.pageY
}

function trataerror(){
return true;
}

function compruebanavegador(){
cnavegador=navigator.appName
}

function navegador(ntip) {
cnavact=navigator.appName
nveract=navigator.appVersion
if (ntip==2) {
if (cnavact!=cnavg) {
alert("Esta página está preparada para "+cnavg+".  Es posible que con su navegador no se vea bien")
}
}
else {
if (ntip==1) {
if (nveract<cvern) {
alert("Esta página está preparada para versión "+cvern+" ó superior.  Es posible que con la versión de su navegador: "+nveract+" No se vea bien")
}
}
}
}
function enviarformulario(){
npts=0
if (document.QT0){ccal=document.QT0.tx00.value}
if (document.QS0){ccal=document.QS0.tx00.value}
if (document.QA0){
   if (ntextot){
      ccal=document.QA0.tx00.value
      nttl= ntextot
   }
   else{
     if (paltot){
          nttl=paltot
          nfaltan=paltot-cortot
          if (nfaltan>0){
             ccal="Faltan "+nfaltan
          }
          else{
             ccal="¡Muy bien!"
          }
       }
   }
   }
else {
     nttl=respuestas.length
}
nfal=estaen(ccal," ")+1
if (estaen(ccal,"uy ")>0){npts=10}
else {
     if (nfal>0){
	cflt=ccal.substring(nfal,nfal+2)
	nflt=parseInt(cflt,10)
	npts=nttl-nflt
	npts=parseInt((npts/nttl)*10)
     }
}
if (lsolucion ){npts=0}
if (npts>10){npts=10}
if (document.QA0){
	document.QA0.total.value=npts
	document.QA0.submit()
}
if (document.QT0){
	document.QT0.total.value=npts
	document.QT0.submit()
}
if (document.QS0){
	document.QS0.total.value=npts
	document.QS0.submit()
}
}


//***********************************************
//*     FUNCIONES DE ABRIR Y CERRAR VENTANAS    *
//***********************************************

function nvotex(loc) {
cnav=navigator.appName
tx=document.body.clientWidth
ty=document.body.scrollHeight
if (cnavegador=="Netscape") {
x=posratx
y=posraty
}
else {
x=window.event.screenX
y=window.event.screenY
}
if (x+480>tx) {x=x-480}
if (y+200>ty) {y=y-200}
opc="scrollbars=yes,width=480,height=200,top="+y+",left="+x+""
if (loc=="esvn01.htm"){opc="scrollbars=no,width=500,height=470,top="+y+",left="+x+""}
nuevo=window.open(loc,"",opc)
}

function nvaven(loc,anc,lar) {
if (cnavegador=="Netscape"){
	if (estaen(loc,"qt")>5){
		loc=loc+"l"
	}
}
if (anc==0) {anc=750}
if (lar==0) {lar=500}
opc="scrollbars=yes,width="+anc+",height="+lar+",top=20,left=20"
nuevo=window.open(loc,'',opc)
}

function vertraduc(loc) {
cnav=navigator.appName
tx=document.body.clientWidth
ty=document.body.scrollHeight
if (cnavegador=="Netscape") {
x=posratx
y=posraty
}
else {
x=window.event.screenX
y=window.event.screenY
}
if (x+480>tx) {x=x-480}
opc="scrollbars=yes,width=480,height=200,top="+y+",left="+x+""
nuevo=window.open(loc,"",opc)
}

function abrelista(){
var cpagina = drop.texto.options[drop.texto.selectedIndex].value
var cclave = cpagina.substring(6,8)
parent.textos.location.href = cpagina
if (estaen("qt;ac;ej;ap;ex;",cclave+";")>-1) {
	nvaven(cpagina,0,0)
	}
return (false)
}

function iniactividad(){
var nindice = drop.texto.selectedIndex
var cpagina = ""
var cclave = ""
if (nindice<0){
   drop.texto.selectedIndex=0
   nindice=0
   }
cpagina = drop.texto.options[nindice].value
cclave = cpagina.substring(6,8)
//if (estaen("qt;ac;ej;ap;dc;dt;an;",cclave+";")>-1) {
	if (estaen(cpagina,".htm")>-1){cimagen=cambiauna(cpagina,".htm",".jpg")}
	if (estaen(cpagina,".zip")>-1){cimagen=cambiauna(cpagina,".zip",".jpg")}
	cimagen=cambiauna(cimagen,"es","images/es")
	document.images["muestra"].src=cimagen
//	}
return (false)
}

function veractividad(){
var cpagina = drop.texto.options[drop.texto.selectedIndex].value
var cclave = cpagina.substring(6,8)
//if (estaen("qt;ac;ej;ap;dc;dt;an;",cclave+";")>-1) {
	nvaven(cpagina,0,0)
//	}
return (false)
}

//** NOTAS **

function abrenota(loc){
cnta="d"+loc
if (cnavegador=="Netscape"){
tx=window.innerWidth
ty=window.innerHeight
nvax = posratx
nvay = posraty
}
else {
tx=document.body.clientWidth
ty=document.body.scrollHeight
nvax = window.event.clientX + document.body.scrollLeft
nvay = window.event.clientY + document.body.scrollTop
}
ancnot=ancdiv(cnta)
altnot=altdiv(cnta)
if (nvax+ancnot>tx) {nvax=nvax-ancnot}
if (nvay+altnot>ty) {nvay=nvay-altnot}
camina(cnta,nvax,nvay)
verdiv(cnta)
}

function cierranota(cnota){
ocudiv(cnota)
}

function abremapa(loc){
opc="scrollbars=no,width=780,height=420,top=40,left=5"
nuevo=window.open("swf/"+loc,'',opc)
}

function nvoind(loc,anc) {
//if (anc==undefined) {anc=320}
anc=320
//posiniy=fincab()+window.screenTop
posiniy=120
opc="scrollbars=yes,width="+anc+",height=500,top="+posiniy+",left=0"
nuevo=window.open(loc,'',opc)
}

function hazpag(dts,tit) {
cnav=navigator.appName
tx=screen.width
ty=screen.height
if (cnav=="Netscape") {
x=parseInt(tx/3,10)
y=parseInt(ty/3,10)
}
else {
x=window.event.screenX
y=window.event.screenY
}
if (x+400>tx) {x=x-400}
if (y+200>ty) {y=y-200}
opc="scrollbars=yes,width=400,height=200,top="+y+",left="+x+""
dts="<html><head><title>"+tit+"</title></head><body bgcolor='#CCCCFF'>"+dts+"</body><html>"
nuevo=window.open("","",opc)
nuevo.document.write(dts)
nuevo.document.close()
}

function dicphp(plbbus) {
plbbus=cambiacadena(plbbus,".","")
plbbus=cambiacadena(plbbus,",","")
plbbus=cambiacadena(plbbus,";","")
plbbus=cambiacadena(plbbus,":","")
plbbus=cambiacadena(plbbus,")","")
plbbus=cambiacadena(plbbus,"(","")
plbbus=plbbus.toLowerCase()
cnav=navigator.appName
tx=screen.width
ty=screen.height
if (cnav=="Netscape") {
x=parseInt(tx/3,10)
y=parseInt(ty/3,10)
}
else {
x=window.event.screenX
y=window.event.screenY
}
if (x+400>tx) {x=x-400}
if (y+200>ty) {y=y-200}
opc="scrollbars=yes,width=400,height=200,top="+y+",left="+x+""
dts="<html><head><title>Diccionario latino</title></head>"
dts=dts+"<body bgcolor='#CCCCFF' onload=document.datos.submit()>"
dts=dts+"<FONT face='Verdana' size=2>"
dts=dts+"Buscando el término '"+plbbus+"', espera por favor...</font>"
dts=dts+"<FORM name=datos action='../diclat/diclat.php' method=post>"
dts=dts+"<input name=tx00 type=hidden value='"+plbbus+"'></form>"
dts=dts+"</body><html>"
nuevo=window.open("","",opc)
nuevo.document.write(dts)
nuevo.document.close()
}

function cierra(){
window.close()
}

function descargadoc(){
diract=window.location.href
dirdoc=cambiacadena(diract,".html",".doc")
dirdoc=cambiacadena(diract,".htm",".doc")
window.location=dirdoc
}

function iradoc(destino) {
nuevo=window.open(destino)
}

function busposx(imagen){
var npos=0
nscroll = document.body.scrollLeft
opar = document.images[imagen].offsetParent
ctag = opar.tagName
while (ctag.toUpperCase() != "BODY") {
      npos = npos + opar.offsetLeft
      opar = opar.offsetParent
      ctag = opar.tagName
}
return (npos)
}

function busposy(imagen){
var npos=0
nscroll = document.body.scrollTop
opar = document.images[imagen].offsetParent
ctag = opar.tagName
while (ctag.toUpperCase() != "BODY") {
      npos = npos + opar.offsetTop
      opar = opar.offsetParent
      ctag = opar.tagName
}
return (npos)
}

function posareax(area){
if (document.getElementById){
   oarea=document.getElementById(area)
   ccoors=oarea.coords
   npos=estaen(ccoors,",")
   ccor1=ccoors.substring(0,npos)
   ncor1=parseInt(ccor1)
}
else {ncor1=0}
return (ncor1)
}

function posareay(area){
if (document.getElementById){
   oarea=document.getElementById(area)
   ccoors=oarea.coords
   npos=estaen(ccoors,",")
   ccor2=ccoors.substring(npos+1)
   npos=estaen(ccor2,",")
   ccor2=ccor2.substring(0,npos)
   ncor2=parseInt(ccor2)
}
else {ncor2=0}
return (ncor2)
}
function posareay2(area){
if (document.getElementById){
   oarea=document.getElementById(area)
   ccoors=oarea.coords+","
   npos=estaen(ccoors,",")
   ccor2=ccoors.substring(npos+1)
   npos=estaen(ccor2,",")
   ccor2=ccor2.substring(npos+1)
   npos=estaen(ccor2,",")
   ccor2=ccor2.substring(npos+1)
   npos=estaen(ccor2,",")
   ccor2=ccor2.substring(0,npos)
   ncor2=parseInt(ccor2)
}
else {ncor2=0}
return (ncor2)
}
function posareay2(area){
if (document.getElementById){
   oarea=document.getElementById(area)
   ccoors=oarea.coords+","
   npos=estaen(ccoors,",")
   ccor2=ccoors.substring(npos+1)
   npos=estaen(ccor2,",")
   ccor2=ccor2.substring(npos+1)
   npos=estaen(ccor2,",")
   ccor2=ccor2.substring(npos+1)
   npos=estaen(ccor2,",")
   ccor2=ccor2.substring(0,npos)
   ncor2=parseInt(ccor2)
}
else {ncor2=0}
return (ncor2)
}
function posareax2(area){
if (document.getElementById){
   oarea=document.getElementById(area)
   ccoors=oarea.coords
   npos=estaen(ccoors,",")
   ccor2=ccoors.substring(npos+1)
   npos=estaen(ccor2,",")
   ccor2=ccor2.substring(npos+1)
   npos=estaen(ccor2,",")
   ccor2=ccor2.substring(0,npos)
   ncor2=parseInt(ccor2)
}
else {ncor2=0}
return (ncor2)
}
function ponarea(area,ccors){
if (document.getElementById){
   oarea=document.getElementById(area)
   oarea.coords=ccors
}
}

function marcazona(area){
if (document.getElementById){
   oarea=document.getElementById(area)
   oarea.setActive()
}
}
//************************************************
//* FUNCIONES GENERALES                          *
//************************************************

function estaen(cad,ter) {
pos=-1
lng=cad.length
lnt=ter.length
for (con=0;con+lnt-1<lng;++con) {
if (cad.substring(con,con+lnt)==ter) {
pos=con
return (pos);
}
}
return (pos);
}

function estaenarray(nomarr,datos){
nposicion=-1
nelementos=eval(nomarr+".length")
for (neleact=0;neleact<nelementos;++neleact){
	celemento=eval(nomarr+"["+neleact+"]")
	nposicion=estaen(celemento,datos)
	if (nposicion>-1){
		return (neleact)
		}
	}
return (-1)
}

function cambiacadena(pal,ori,des) {
nLp=pal.length
orb=ori
nLo=orb.length
nSd=estaen(pal,orb)
nLo=orb.length
if (nSd>-1){
	pal=pal.substring(0,nSd)+des+pal.substring(nSd+nLo)
	pal=cambiacadena(pal,ori,des)
}
return (pal)
}

function cambiauna(pal,ori,des) {
nLp=pal.length
orb=ori
nLo=orb.length
nSd=estaen(pal,orb)
nLo=orb.length
if (nSd>-1){
	pal=pal.substring(0,nSd)+des+pal.substring(nSd+nLo)
}
return (pal)
}

function rellena(caracter,veces){
var crelleno=""
for (nlonact=1;nlonact<=veces;++nlonact){
	crelleno=crelleno+caracter
}
return (crelleno)
}


function daazar(valormax) {
  var ahora = new Date()
  var nazar = ahora.getTime() * ahora.getSeconds() * Math.random()
  return Math.round(nazar % valormax)
}

function trim(cadena){
	return rtrim(ltrim(cadena))
}

function ltrim (cadena){
	return cadena.replace( /^\s*/, "" );
}

function rtrim (cadena){
	return cadena.replace( /\s*$/, "" );
}

function interlineado(objeto){
	if (document.all) {
		parrafo=document.all[objeto]
	} 
	else {
		if (document.getElementById) {
			parrafo=document.getElementById(objeto)
		}
	}
	if (parrafo){
		if (parrafo.style.lineHeight<"40px") {
		        intlinant=parrafo.style.lineHeight
                        parrafo.style.lineHeight="40px"
                        }
		else {parrafo.style.lineHeight=intlinant}
	}
}

function dapalabras(cadena,separador){
if (!cadena){}
else {
      csepcad=cadena
      if (!separador){csepcar=";"}
      else {csepcar=separador}
}
npos=estaen(csepcad,csepcar)
if (npos==0){
   csepcad=csepcad.substring(1)
   npos=estaen(csepcad,csepcar)
}
if (npos>0){
   cpalabra=csepcad.substring(0,npos)
   csepcad=csepcad.substring(npos+1)
}
else {cpalabra=""}
return(cpalabra)
}

//************************************************
//* FUNCIONES DE SONIDO                          *
//************************************************

function oir(snd){
lsuenamusica=true
if (document.getElementById){
divsonido=document.getElementById("divson")
divsonido.innerHTML="<embed src='"+snd+"' height=0 width=0 >"
}
}
function rep(snd){
lsuenamusica=true
if (document.getElementById){
divsonido=document.getElementById("divson")
divsonido.innerHTML="<embed src='"+snd+"' height=0 width=0 loop=true>"
}
}
function calla() {
if (lsuenamusica){
if (document.getElementById){
divsonido=document.getElementById("divson")
divsonido.innerHTML=""
}
lsuenamusica=false
}
}

//************************************************
//* FUNCIONES DE MANIPULACIÓN DE DIVS            *
//************************************************

//** POSICIÓN **

function camina(cap,x,y) {
	if (document.all) {
		document.all[cap].style.left = x    
		document.all[cap].style.top = y
	} 
	if (document.layers) {
    		document.layers[cap].moveTo(x, y)
	}
	if (document.getElementById) {
		document.getElementById(cap).style.left = x
		document.getElementById(cap).style.top = y 
	}
}

function posdivx(cap) {
  	if (document.all) {
		x = document.all[cap].style.left
	}
	if (document.layers) {
		x = document.layers[cap].left
	}
	if (document.getElementById) {
		x = document.getElementById(cap).style.left
	}
  return (parseInt(x,10))
}

function posdivy(cap) {
	if (document.all) {
		y = document.all[cap].style.top
	} 
	if (document.layers) {
		y = document.layers[cap].clip.top
	}
	if (document.getElementById){
		y = document.getElementById(cap).style.top
	}
	return (parseInt(y,10))
}

function posdivz(cap) {
	if (document.all) {
		z=document.all[cap].style.zIndex
	}
	if (document.layers) {
		z=document.layers[cap].clip.zIndex
	}
	if (document.getElementById){
		z=document.getElementById(cap).style.zIndex
	}
	return (parseInt(z,10))
}

function pondivz(cap,z) {
	if (document.all) {
		document.all[cap].style.zIndex=z
	}
	if (document.layers) {
		document.layers[cap].clip.zIndex=z
	}
	if (document.getElementById){
		document.getElementById(cap).style.zIndex=z
	}
}

function mantendiv(cnomdiv) {
if (posdiviniy==0) {posdiviniy=posdivy(cnomdiv)}
camina(cnomdiv,posdivx(cnomdiv),document.body.scrollTop+(posdiviniy-10))
}

function arrastradiv(cap){
	if (cnavegador=="Netscape"){
		tx=window.innerWidth
		ty=window.innerHeight
		nvax = posratx
		nvay = posraty
	}
	else {
		tx=document.body.clientWidth
		ty=document.body.scrollHeight
		nvax = window.event.clientX + document.body.scrollLeft
		nvay = window.event.clientY + document.body.scrollTop
	}
	nvax=nvax-20
	nvay=nvay+5
	andiv=50
	aldiv=50
	if (nvax+andiv<tx) {
		if (nvay+aldiv<ty) {
			camina(cap,nvax,nvay)
		}
	}
}
function movdiv(cap){
	if (cnavegador=="Netscape"){
		tx=window.innerWidth
		ty=window.innerHeight
		nvax = posratx
		nvay = posraty
	}
	else {
		tx=document.body.clientWidth
		ty=document.body.scrollHeight
		nvax = window.event.clientX + document.body.scrollLeft
		nvay = window.event.clientY + document.body.scrollTop
	}
	anchodiv=ancdiv(cap)
	altodiv=altdiv(cap)
	andiv=parseInt(anchodiv/2,10)
	aldiv=parseInt(altodiv/2,10)
	nvax=nvax-andiv
	nvay=nvay-aldiv
	if (nvax<tx) {
		if (nvay<ty) {
			camina(cap,nvax,nvay)
		}
	}
}
//** ALTO Y ANCHO **

function altdiv(cap) {
	if(document.all) {
		y = document.all[cap].style.height 
  	} 
	if (document.getElementById){
		y = document.getElementById(cap).style.height
	}
	if (document.layers){
		y = document.layers[cap].clip.height
	}
  return (parseInt(y,10))
}

function ancdiv(cap){
  	if (document.all){
		x = document.all[cap].offsetWidth
	} 
	if (document.getElementById){
		x = document.getElementById(cap).offsetWidth
	}
	if (document.layers){
		x = document.layers[cap].clip.width 
	}
	return (parseInt(x,10))
}

function hazaltdiv(cap,alt) {
  	if (document.all) {
		document.all[cap].style.height = alt
  	}
	if (document.layers) {
    		document.layers[cap].clip.height = alt
	}
	if (document.getElementById) {
		document.getElementById(cap).style.height = alt
	}
}

function hazancdiv(cap,anc) {
  	if (document.all) {
		document.all[cap].style.width = anc
  	}
	if (document.layers) {
		document.layers[cap].clip.width = anc
	}
	if (document.getElementById) {
		document.getElementById(cap).style.width = anc
	}
}

//** COLORES **

function hazcolordiv(cap,color) {
  	if (document.all){
		document.all[cap].style.backgroundColor = color
	} 
	if (document.getElementById){
		document.getElementById(cap).style.backgroundColor = color
	}
	if (document.layers){
		document.layers[cap].clip.backgroundColor = color
	}
}

function dacolordiv(cap){
  	if (document.all){
		color = document.all[cap].style.backgroundColor
	} 
	if (document.getElementById){
		color = document.getElementById(cap).style.backgroundColor
	}
	if (document.layers){
		color = document.layers[cap].clip.backgroundColor
	}
	return (color)
}

//** VISIBILIDAD **

function esvisiblediv(cnomdiv) {
	var esvisible=false
	if(document.all) {
		if(document.all[cnomdiv].style.visibility=="visible"){esvisible=true}
	} 
	if(document.layers) {
		if(document.layers[cnomdiv].visibility=="visible"){esvisible=true}
	}
	if(document.getElementById){
		if(document.getElementById(cnomdiv).style.visibility=="visible"){esvisible=true}
	}
return (esvisible)
}

function verdiv(cnomdiv) {
	if (document.getElementById){
		document.getElementById(cnomdiv).style.visibility="visible"
	}
	if(document.all) {
		document.all[cnomdiv].style.visibility="visible"
	} 
	if(document.layers) {
		document.layers[cnomdiv].visibility="visible"
	}
}

function ocudiv(cnomdiv) {
	if (document.getElementById){
		document.getElementById(cnomdiv).style.visibility="hidden"
	}
	else {
		if(document.all) {
			document.all(cnomdiv).style.visibility="hidden"
		}
		else {
			if(document.layers) {
				document.layers[cnomdiv].visibility="hidden"
			}
		}
	}
}

function estadivendiv(divnum1,divnum2){
posx1=posdivx(divnum1)
posy1=posdivy(divnum1)
posx2=posdivx(divnum2)
posy2=posdivy(divnum2)
if (posx1>posx2){
	if (posx1<posx2+ancdiv(divnum2)){
		if (posy1>posy2){	
			if (posy1<posy2+altdiv(divnum2)){
				return (true)
			}
		}
	}
}
return (false)
}

function tocadivendiv(divnum1,divnum2){
anc1=ancdiv(divnum1)
anc2=ancdiv(divnum2)
alt1=altdiv(divnum1)
alt2=altdiv(divnum2)
posx1=parseInt(posdivx(divnum1)+(anc1/2),"10")
posy1=parseInt(posdivy(divnum1)+(alt1/2),"10")
posx2a=posdivx(divnum2)
posx2b=posx2a+anc2
posy2a=posdivy(divnum2)
posy2b=posy2a+alt2

if (posx1>posx2a && posx1<posx2b){
   if (posy1>posy2a && posy1<posy2b){
      return (true)
   }
}

return (false)
}

