// Clase IndigoMenuDesplazable
// 20000801
// Copyright (C) 2000 Indigo
// Thanks To Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynapi/

function IndigoMenuDesplazable(anchoVentana,anchoContenido) {
        this.name = 'IndigoMenuDesplazable'+(IndigoMenuDesplazable.count++)
        this.w = anchoVentana
        this.c = anchoContenido
                                this.diff = anchoContenido-anchoVentana

        this.obj = this.name + "Object"
        eval(this.obj + "=this")
        this.items = new Array()
        this.scrollCount = 0

        this.pauseLength = 0
        //5 - 30
                                this.inc = 2
        this.speed = 1
        this.fromX = this.w
        this.bgColor = null

        this.addItem = IndigoMenuDesplazableAddItem
        this.activate = IndigoMenuDesplazableActivate
        this.izda = IndigoMenuDesplazableIzda
        this.decha = IndigoMenuDesplazableDecha
        this.stop = IndigoMenuDesplazableStop
        this.slidecha = IndigoMenuDesplazableSlidecha
        this.slidizda = IndigoMenuDesplazableSlidizda
}
function IndigoMenuDesplazableAddItem(text) {
        var i = this.items.length
        this.items[i] = new Object()
        this.items[i].text = text
}
function IndigoMenuDesplazableActivate(autostart) {
        for (var i=0;i<this.items.length;i++) {
                this.items[i].lyr = new DynLayer(this.name+'Item'+i)
                this.items[i].lyr.moveTo(this.fromX+this.diff,null)
                this.items[i].lyr.show()
        }
        this.scrollCount = this.items.length-1;
        this.items[this.scrollCount].lyr.moveTo(0,null)
        this.lyr = new DynLayer(this.name)
        var num = Math.sqrt(Math.pow(this.fromX,2))/this.inc
        this.dx = this.fromX/num || 0
}
function IndigoMenuDesplazableIzda() {
        if (!this.started) {
        this.started = true
        var t = this.scrollCount
        var b = (this.scrollCount==this.items.length-1)? 0 : this.scrollCount+1
        var obj1 = this.items[t].lyr.obj
        var obj2 = this.items[b].lyr.obj
        this.timer = setInterval(this.obj+'.slidizda('+obj1+','+obj2+')',this.speed)
        }
}
function IndigoMenuDesplazableDecha() {
        if (!this.started) {
        this.started = true
        var t = this.scrollCount
        var b = (this.scrollCount==0)? this.items.length-1 : this.scrollCount-1
        var obj1 = this.items[t].lyr.obj
        var obj2 = this.items[b].lyr.obj
        this.timer = setInterval(this.obj+'.slidecha('+obj1+','+obj2+')',this.speed)
        }
}
function IndigoMenuDesplazableStop() {
        clearInterval(this.timer)
        this.started = false
}
function IndigoMenuDesplazableSlidizda(obj1,obj2) {
        if (Math.floor(obj1.x)<-(this.c+this.diff)) obj1.moveTo(this.fromX-4,null)
        obj1.moveBy(-this.dx,null)
        obj2.moveBy(-this.dx,null)
        if ((this.dx!=0 && Math.floor(obj2.x)==0) || (this.dx!=0 && Math.floor(obj1.x)==0)) {
                clearInterval(this.timer)
                obj1.moveTo(this.fromX+this.diff,null)
                obj2.moveTo(0,null)
                this.scrollCount = (this.scrollCount==this.items.length-1)? 0 : this.scrollCount+1
                this.timer = setTimeout(this.obj+'.started=false;'+this.obj+'.izda()',this.pauseLength)
        }
}
function IndigoMenuDesplazableSlidecha(obj1,obj2) {
        if (Math.floor(obj2.x)>this.c) obj2.moveTo(-(this.c-4),null)
        if (Math.floor(obj1.x)>this.c) obj1.moveTo(-(this.c-4),null)
        obj1.moveBy(this.dx,null)
        obj2.moveBy(this.dx,null)
        if ((this.dx!=0 && Math.floor(obj1.x)==this.fromX) || (this.dx!=0 && Math.floor(obj2.x)==this.fromX)) {
                clearInterval(this.timer)
                obj1.moveTo(this.fromX-this.c,null)
                obj2.moveTo(-(this.c+this.diff),null)
                this.scrollCount = (this.scrollCount==0)? this.items.length-1 : this.scrollCount-1
                this.timer = setTimeout(this.obj+'.started=false;'+this.obj+'.decha()',this.pauseLength)
        }
}
IndigoMenuDesplazable.count = 0

//Clase IndigoNoticias
// 20010122
// Copyright (C) 2000 Indigo
// Thanks To Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynapi/

function IndigoNoticias(anchoVentana,anchoContenido) {
        this.name = 'IndigoNoticias'+(IndigoNoticias.count++)
        this.h = anchoVentana
        this.c = anchoContenido
        this.diff = anchoContenido-anchoVentana

        this.obj = this.name + "Object"
        eval(this.obj + "=this")
        this.items = new Array()
        this.scrollCount = 0
        this.contador = 0

        this.pauseLength = 4000
        //5 - 30
        this.inc = 5
        this.speed = 100
        this.fromY = this.h
        this.bgColor = null
        //muevea => 1 mueve arriba - 0 mueve abajo
        this.muevea = 1
        this.accion = 0

        this.addItem = IndigoNoticiasAddItem
        this.activate = IndigoNoticiasActivate
        this.mueve = IndigoNoticiasMueve
        this.stop = IndigoNoticiasStop
        this.arriba = IndigoNoticiasArriba
        this.abajo = IndigoNoticiasAbajo

}
function IndigoNoticiasMueve() {
        if (!this.started) {
                if (this.muevea) {
                        var t = this.scrollCount
                             var b = (this.scrollCount==this.items.length-1)?  0 : this.scrollCount+1
                             var obj1 = this.items[t].lyr.obj
                             var obj2 = this.items[b].lyr.obj
                             eval(this.obj+'.arriba('+obj1+','+obj2+')');
                } else {
                        var t = this.scrollCount
                             if (!this.accion) {
                                     var b = (this.scrollCount==0)? this.items.length-1 : this.scrollCount-1
                             } else {
                                     var b = (this.scrollCount==this.items.length-1)? 0 : this.scrollCount+1
                             }
                             var obj1 = this.items[t].lyr.obj
                             var obj2 = this.items[b].lyr.obj
                             eval(this.obj+'.abajo('+obj1+','+obj2+')');
                }
        }
        setTimeout(this.obj+'.mueve()',this.speed)
}
function IndigoNoticiasAddItem(text) {
        var i = this.items.length
        this.items[i] = new Object()
        this.items[i].text = text
}
function IndigoNoticiasActivate(autostart) {
        for (var i=0;i<this.items.length;i++) {
                this.items[i].lyr = new DynLayer(this.name+'Item'+i)
                this.items[i].lyr.moveTo(null,this.fromY+5)
                this.items[i].lyr.show()
        }

        this.scrollCount = this.items.length-1;
        this.items[this.scrollCount].lyr.moveTo(null,0)
        this.lyr = new DynLayer(this.name)
        var num = Math.sqrt(Math.pow(this.fromY,2))/this.inc
        this.dy = this.fromY/num || 0

}

function IndigoNoticiasStop() {
        clearInterval(this.timer)
        this.accion = 1
        this.started = false
}
function IndigoNoticiasArriba(obj1,obj2) {
        if (Math.floor(obj1.y)<-(this.c-5)) obj1.moveTo(null,this.fromY)
        obj1.moveBy(null,-this.dy)
        obj2.moveBy(null,-this.dy)
        if ((this.dy!=0 && Math.floor(obj2.y)==0) || (this.dy!=0 && Math.floor(obj1.y)==0)) {
                this.started = true;
                obj1.moveTo(null,this.fromY+5)
                obj2.moveTo(null,0)
                this.scrollCount = (this.scrollCount==this.items.length-1)? 0 : this.scrollCount+1
                this.timer = setTimeout(this.obj+'.started=false',this.pauseLength)

        }
}
function IndigoNoticiasAbajo(obj1,obj2) {
        if (obj2.y>this.c) obj2.moveTo(null,-(this.c+5))
        if (obj1.y>this.c) obj1.moveTo(null,-5)
        obj1.moveBy(null,this.dy)
        obj2.moveBy(null,this.dy)
        if ((this.dy!=0 && Math.floor(obj1.y)==this.fromY) || (this.dy!=0 && Math.floor(obj2.y)==this.fromY)) {
                this.started = true;
                if (this.accion) {
                        obj1.moveTo(null,0)
                        obj2.moveTo(null,-(this.c+5))
                } else {
                        obj1.moveTo(null,-(this.c+5))
                        obj2.moveTo(null,0)
                }
                if (this.accion) {
                        this.scrollCount = (this.scrollCount == this.items.length-1) ? 0 : this.scrollCount + 1;
                } else {
                               this.scrollCount = (this.scrollCount == 0) ? this.items.length-1 : this.scrollCount - 1;
                       }
                this.accion=0;
                this.timer = setTimeout(this.obj+'.started=false',this.pauseLength)
        }
}
IndigoNoticias.count = 0
