var obj_no = 0, count = 0, step = 10;
var xstart, ystart, xend, yend;

function init() {
    if(!document.getElementById) return;
    xstart = new Array(20, winWidth());
    ystart = new Array(winHeight(), 450);
    xend = new Array(20, (winWidth() - 800) * 0.5 + 100);
    yend = new Array(10, 450);
    textAnim();
}

function textAnim () {
    var obj = document.getElementById("obj" + (obj_no+1));
    
	if(!obj) {
		return
	};
    
	if (count == 0) {
		obj.style.visibility = "visible";
	}
    
	var x = xend[obj_no] + (step - (count + 1)) * 
        ((xstart[obj_no] - xend[obj_no]) / step);
    var y = yend[obj_no] + (step - (count + 1)) * 
        ((ystart[obj_no] - yend[obj_no]) / step);
    obj.style.left = x + "px";
    obj.style.top  = y + "px";
	
	var cmn = 255;
	if (obj_no == 0) {
		cmn = 116;
	}
	
    var col  = 255 - 255 * ((count + 1) / step);
    var col2 = 255- cmn * ((count + 1) / step);
	
	col = Math.floor(col);
    obj.style.color = "rgb(" + col + "," + col2 + ","
                      + col + ")";
    count++;
	
    if (count == step) {
		obj_no++; count = 0;
	}
	
    setTimeout("textAnim();", 50);
}

if(document.getElementById) {
    document.write("<style type='text/css'>");
    document.write("div#topics div, div#topics h2 { visibility: hidden; color: white; }");
	document.write("div#topics div { position:absolute; margin-left:0px; }");
    document.write("</style>");
}

function winWidth () {
    if (document.documentElement.clientWidth) {
        //return window.innerWidth;
		return document.documentElement.clientWidth;
	}
    if (document.compatMode == "CSS1Compat") {
        return document.body.parentNode.clientWidth;
	}
    if (document.body.clientWidth) {
        return document.body.clientWidth;
	}
	
    return 1024;
}

function winHeight () {
    if(window.innerHeight)
        return window.innerHeight;
    if(document.compatMode == "CSS1Compat")
        return document.body.parentNode.clientHeight;
    if(document.body.clientHeight)
        return document.body.clientHeight;
    return 568;
}

