Añadir una nueva capa a un script.

Etxe
05 de Julio del 2002
Estimados amigos:

Descargé de Internet (concretamente de www.dhtmlcentral.com) un script para crear un efecto dinámico de texto en la pantalla. El script original utiliza dos objetos, cada uno de los cuales se corresponde con un texto. En primer lugar se escribe el primer texto y luego el segundo. Estoy tratando de añadir un tercer texto, que se escribiría después de los dos primeros, pero no hay manera. La función del script que escribe los dos objetos, y en la cual en teoría habría que definir nuevos objetos es la siguiente:

/*Initiates the object, shows it and starts the zoom
****************************************************************************/
function writeInit(){
if(bw.bw){
oWrite = new makeWriteObj('divWrite',wText,wFontsize,wColor,wAlign,wSpeed,wFont,wHide,wHidewait,wWorks)
//Change the line below to: oWrite.write(0) if you only have one object.
oWrite.write(0,'oWrite2.css.visibility="visible";oWrite2.write(0)')
oWrite.css.visibility = "visible"

//Another object, just remove this line if you only want one object. It's just to show you how can have more objects.
oWrite2 = new makeWriteObj('divWrite2',"Texto segundo",50,"#BFBFDF","left",70,"Times New Roman,Times",0,500,0)
}
}
¿Cómo se os ocurre que prodría añadir un tercer elemento (y un cuarto, un quinto, etc), que se identificaría, por ejemplo mediante el id divWrite3. Por más que he probado no ha habido forma. Por si os interesa, el script completo dentro de la página (ya que para funcionar necesita una hoja de estilo y varias etiquetas <div> en el cuerpo del documento html) es el siguiente:

<html>
<head>

<style type="text/css">

#divWrite
{
position: absolute;
top: 120px;
left: -40px;
width: 100%;
visibility: hidden;
}
#divWrite2
{
position: absolute;
top: 190px;
left: 150px;
width: 600px;
visibility: hidden;
}

</style>

<script language="JavaScript" type="text/javascript">
/**********************************************************************************
WriteText
* Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
* This script was released at DHTMLCentral.com
* Visit for more great scripts!
* This may be used and changed freely as long as this msg is intact!
* We will also appreciate any links you could give us.
*
* Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*********************************************************************************/

function lib_bwcheck(){ //Browsercheck (needed)
this.ver=navigator.appVersion
this.agent=navigator.userAgent
this.dom=document.getElementById?1:0
this.opera5=this.agent.indexOf("Opera 5")>-1
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
this.ie=this.ie4||this.ie5||this.ie6
this.mac=this.agent.indexOf("Mac")>-1
this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
return this
}
var bw=new lib_bwcheck()


//Here are the variables you have to set:

//There are 2 ways this script can work.
// 0 = WriteText
// 1 = RemoveText
wWorks = 0

var wText = "Texto primero" //The text you want write out
var wFontsize = 80 //Set the fontsize you want
var wColor = "#FFCC99" //The text color
var wAlign = "center" //the alignment of the text, you can choose center, right or left.
var wSpeed = 170 //Set the speed you want it to write in (in milliseconds between each letter)
var wFont = 'arial black,arial,helvetica,sans-serif' //The font face
var wHide = false //do you want it to hide when its done? (true or false)
var wHidewait = 500 //Set the time you want it to wait before it hides

/*You can remove this if you don't wan't it to start right away.
You can have it start if someone clicks a link (make a link like this:
<a href="#" onclick="writeInit()">Click to writetext</a>)*/

onload = writeInit;

/********* You shouldn't really have to set anything below this point ***********/
//Object functions
function makeWriteObj(obj,text,size,color,align,speed,font,hide,hidewait,works){
this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?document.layers[obj]:0;
this.writeref=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj].document:0;
this.text=text; this.size=size; this.color=color; this.align=align; this.speed=speed;
this.font=font; this.hide=hide; this.hidewait=hidewait; this.writeWrite=b_writeWrite;
this.writeText=b_writeText; this.removeText=b_removeText; this.works=works; this.write=b_write
if(bw.dom || bw.ie4){ //Setting the style properties
this.css.fontFamily=this.font; this.css.fontSize=this.size+"px"; this.css.color=this.color;
this.css.textAlign=this.align
}
this.obj = obj + "Object"; eval(this.obj + "=this"); return this
}
function b_write(num,fn){
if(!fn) fn=""
if(!this.works) this.writeText(num,fn)
else this.removeText(fn)
}
function b_writeWrite(text){
if(bw.ns4){
this.writeref.write('<p style="text-align:'+this.align+'; font-size:' +this.size+'px; font-family:'+this.font+'; color:'+this.color+'">'+text+'</p>')
this.writeref.close()
}else this.writeref.innerHTML = text
}
function b_writeText(num,fn){
if (num<=this.text.length){
wtext = this.text.substr(0,num)
this.writeWrite(wtext)
num ++
setTimeout(this.obj+".writeText("+num+",'"+fn+"')",this.speed)
}else{
if(this.hide) setTimeout(this.obj+".css.visibility='hidden'",this.hidewait);
eval(fn)
}
}
function b_removeText(fn){
if (this.text.length>0){
this.text = this.text.slice(0,this.text.length-1)
this.writeWrite(this.text)
setTimeout(this.obj+".removeText('"+fn+"')",this.speed)
}else{
if(this.hide) setTimeout(this.obj+".css.visibility='hidden'",this.hidewait);
eval(fn)
}
}
/*Initiates the object, shows it and starts the zoom
****************************************************************************/
function writeInit(){
if(bw.bw){
oWrite = new makeWriteObj('divWrite',wText,wFontsize,wColor,wAlign,wSpeed,wFont,wHide,wHidewait,wWorks)
//Change the line below to: oWrite.write(0) if you only have one object.
oWrite.write(0,'oWrite2.css.visibility="visible";oWrite2.write(0)')
oWrite.css.visibility = "visible"

//Another object, just remove this line if you only want one object. It's just to show you how can have more objects.
oWrite2 = new makeWriteObj('divWrite2',"Texto segundo",50,"#BFBFDF","left",70,"Times New Roman,Times",0,500,0)
}
}
</script>
</head>

<body marginleft="0" marginheight="0">

<div id="divWrite"></div>
<div id="divWrite2"></div>

</body>
</html>

En fín, os agradeceré cualquier ayuda al respecto, ya que he perdido una cantidad increíble de tiempo dándole vueltas.

Un saludo, Etxe.