var pageWdth = 800;
var fadeSpeed = 100;

function txtSlide(txt, eName, x, y, opc, iId) {
    this.txt = txt;
    this.eleName = eName;
    this.posX = x;
    this.posY = y;
    this.opac = opc;
    this.intId = iId;
    this.tId = null;
    
    this.init = function() {
        var myCell = document.getElementById(this.eleName);
        myCell.style.left = this.posX;
        myCell.style.top = this.posY;
        var tmpOpac = this.opac/100;
        myCell.style.opacity = tmpOpac; 
        myCell.style.MozOpacity = tmpOpac; 
        myCell.style.KhtmlOpacity = tmpOpac; 
        myCell.style.filter = "alpha(opacity=" + this.opac + ")"; 
        myCell.innerHTML = this.txt;
    }

    this.fadeIn = function(tm) {
        if(this.opac >= 100)
            window.clearInterval(this.intId);
        var myCell = document.getElementById(this.eleName);
        myCell.style.left = ++this.posX;
        myCell.style.top = this.posY;
        var tmpOpac = (this.opac+=tm)/100;
        myCell.style.opacity = tmpOpac; 
        myCell.style.MozOpacity = tmpOpac; 
        myCell.style.KhtmlOpacity = tmpOpac; 
        myCell.style.filter = "alpha(opacity=" + this.opac + ")"; 
    }

    this.fadeOut = function(tm) {
        if(this.opac <= 0)
            window.clearInterval(this.intId);
        var myCell = document.getElementById(this.eleName);
        myCell.style.left = this.posX;
        myCell.style.top = this.posY;
        var tmpOpac = (this.opac-=tm)/100;
        myCell.style.opacity = tmpOpac; 
        myCell.style.MozOpacity = tmpOpac; 
        myCell.style.KhtmlOpacity = tmpOpac; 
        myCell.style.filter = "alpha(opacity=" + this.opac + ")"; 
    }
    
    this.clear = function() {
        if(this.tId)
            clearTimeout(this.tId);
		this.tId = null;
        if(this.intId)
            clearInterval(this.intId);
		this.intId = null;

        var myCell = document.getElementById(this.eleName);
        myCell.style.opacity = 0.0; 
        myCell.style.MozOpacity = 0.0; 
        myCell.style.KhtmlOpacity = 0.0; 
        myCell.style.filter = "alpha(opacity=0)"; 
        this.opac = 0;
    }
}

function showText(theText, ele, stX, stY, idx) {
    var offst = parseInt(document.body.scrollLeft);
    if( document.body && document.body.clientWidth) {
        offst += Math.round(((parseInt(document.body.clientWidth) - pageWdth) / 2));
    } else {
        offst += Math.round(((parseInt(window.innerWidth) - pageWdth) / 2));
    }
    var txtObj = new txtSlide(theText, ele, stX + offst, stY, 0, null);
    txtObj.init();
    txtCol[idx] = txtObj;
    switch(idx) {
        case 0:
            txtCol[0].intId = setInterval('txtCol[0].fadeIn(4)', fadeSpeed);
            txtCol[0].tId = setTimeout("txtCol[0].intId = setInterval('txtCol[0].fadeOut(2)', fadeSpeed)",5250);
            break;
        case 1:
            txtCol[1].intId = setInterval('txtCol[1].fadeIn(4)', fadeSpeed);
            txtCol[1].tId = setTimeout("txtCol[1].intId = setInterval('txtCol[1].fadeOut(2)', fadeSpeed)",5250);
            break;
        case 2:
            txtCol[2].intId = setInterval('txtCol[2].fadeIn(4)', fadeSpeed);
            txtCol[2].tId = setTimeout("txtCol[2].intId = setInterval('txtCol[2].fadeOut(2)', fadeSpeed)",5250);
            break;
        case 3:
            txtCol[3].intId = setInterval('txtCol[3].fadeIn(4)', fadeSpeed);
            txtCol[3].tId = setTimeout("txtCol[3].intId = setInterval('txtCol[3].fadeOut(2)', fadeSpeed)",5250);
            break;
    }
}
