var intLeft = 5;  // Seconds until navigation occurs
var nextPage="";
//Configure message to display. Use "$" for linebreak
//By default, set to just grab the text from element with ID="fly"

var distance = 50; // pixel(s)
var speed = 100; // milliseconds

var txt="";
var num=0;
var num4=0;
var flyofle="";
var flyofwi="";
var flyofto="";

function stfly( ) {
	for(i=0;i != message.length;i++) {
		if(message.charAt(i) != "$")
			txt += "<span style='position:relative;visibility:hidden;' id='n"+i+"'>"+message.charAt(i)+"<\/span>";
		else
			txt += "<br>";
	}
	fly.innerHTML = txt;
	txt = "";
	flyofle = fly.offsetLeft;
	flyofwi = fly.offsetWidth;
	flyofto = fly.offsetTop;

	fly2b( );
}

function fly2b( ) {

	if(num4 != message.length) {
		if(message.charAt(num4) != "$") {
			var then = document.getElementById("n" + num4);
			then.style.left = flyofle - then.offsetLeft + flyofwi / 2;
			then.style.top = flyofto - then.offsetTop + distance;
			fly3(then.id, parseInt(then.style.left), parseInt(then.style.left) / 5, parseInt(then.style.top), parseInt(then.style.top) / 5);
		}
		num4++;
		setTimeout("fly2b( )", speed);
  } else {
    //window.alert( 'num4 = ' + num4  + ' length = ' + message.length );
    setTimeout("leavePage()", 1000);
   // document.write(intLeft);
	}
}

function fly3(target,lef2,num2,top2,num3) {
	if((Math.floor(top2) != 0 && Math.floor(top2) != -1) || (Math.floor(lef2) != 0 && Math.floor(lef2) != -1)) {
		if(lef2 >= 0) {
			lef2 -= num2;
		} else {
			lef2 += num2 * -1;
		}
		if(Math.floor(lef2) != -1) {
			document.getElementById(target).style.visibility = "visible";
			document.getElementById(target).style.left = Math.floor(lef2);
		} else {
			document.getElementById(target).style.visibility = "visible";
			document.getElementById(target).style.left = Math.floor(lef2 + 1);
		}
		if(lef2 >= 0) {
			top2 -= num3
		} else {
			top2 += num3 * -1;
		}
		if(Math.floor(top2) != -1) {
			document.getElementById(target).style.top = Math.floor(top2);
		} else {
			document.getElementById(target).style.top = Math.floor(top2 + 1);
		}
		setTimeout("fly3('"+target+"',"+lef2+","+num2+","+top2+","+num3+")",50)
	} else {
	}
}
// var intLeft = 10;  // Seconds until navigation occurs

function leavePage() {
  if (0 == intLeft) { // Time is up—navigate.
    //window.alert( 'leavePage  intLeft = ' + intLeft );
		//window.alert( 'fly2b  nextPage = ' + nextPage );
        document.location = nextPage;
  } else {
    // Count down and output updated time by
    // changing the contents of the element.
    intLeft -= 1;
    
    //document.all.countdown.innerText = intLeft + " ";
    // Wait another second.
    setTimeout("leavePage()", 1000);
  }
}



