var  marquee_slogan , marquee_parceiros; //globais que guardam os objetos marquee



function marquee(target_id,direction,delay,amount,myVarName){

/* objeto que simula o funcionamento do elemento marquee

** autor: Náiron J.C.G - micoxjcg@yahoo.com.br - elmicox.blogspot.com

** versao: 0.9 - 24/07/2006

** testado: Firefox 1.5; IE 6.0; Opera 8.5 */

    var target_id,direction,delay,amount,myVarName;

    var target,targetmid,targetfilho, movendo,timeout;



    //funções públicas para parar e recomeçar

    this.pause = function (){ clearTimeout(timeout); movendo = false; }

    this.restart = function () { movendo=true; this.move(); }



    this.start = function(){ //private chamada inicialmente. lá embaixo está a chamada a este

        /* gera os elementos fantasmas a serem movidos */

        /* bug com text nodes no opera. A primeira letra é repetida */

        if(target.style.position==""){ target.style.position="relative";}

        //definindo elementos extra pra esconder ao andar

        //o span sem nome é por causa de outro bug no opera

        target.innerHTML = "<span id='mid-" + target_id + "-marquee'><span style='display:block;'>" + target.innerHTML + "</span></span>";

        targetmid = document.getElementById("mid-"+target_id + "-marquee");

        targetmid.style.display = "block";    targetmid.style.overflow = "hidden";

        targetmid.style.width = "99%"; targetmid.style.height="99%";

        targetmid.style.top = "0px"; targetmid.style.left = "0px";

        targetmid.style.position = "relative"; targetmid.style.textAlign="left";

        //definindo o novo filho no meio pra aplicar o scroll

        targetmid.innerHTML = "<span id='" +target_id+ "-marquee'>" +targetmid.innerHTML+ "</span>";

        targetfilho = document.getElementById(target_id + "-marquee");    

        targetfilho.style.position = "relative";  targetfilho.style.display="block";

        //targetfilho.style.border="1px solid yellow";

        if(direction=="left"){ targetfilho.style.left="200px";}

        //manda mover

        movendo=true;

        this.move();

    }

    this.move=function(){ //public

        /* executa o movimento do elemento */

        if(direction=="up"||direction=="left"){ var amount_new = amount * (-1); }

        else if(direction=="down"||direction=="right"){ var amount_new = amount  * (1);}

        if(direction=="left"||direction=="right"){

            var left = Number(targetfilho.style.left.replace("px",""));

            if(-left>targetfilho.offsetWidth){ left = targetmid.offsetWidth;}

            else if(left>targetmid.offsetWidth){ left = -targetfilho.offsetWidth; }

            targetfilho.style.left =  (left+amount_new) + "px";        

        }else if(direction=="up"||direction=="down"){

            var top = Number(targetfilho.style.top.replace("px",""));

            if(-top>targetfilho.offsetHeight){ top = targetmid.offsetHeight;}

            else if(top>targetmid.offsetHeight){ top = -targetfilho.offsetHeight; }

            targetfilho.style.top =  (top+amount_new) + "px";

        }

        if(movendo){ timeout = setTimeout(myVarName+".move()",delay) /* chama novamente */;}

    }

    //construtor

    target = document.getElementById(target_id);

    this.start();

    return this;

}