/*
Text message script pared down from Bouncy message script - By Dynamicdrive.com
I changed it to only animate horizontally. - KEK, march 2004
Code based on Lloyd Hassell's, at http://www.dynamicdrive.com/dynamicindex4/bounceimage.htm
For full source, TOS, and 100s DTHML scripts, visit http://dynamicdrive.com
*/

//Configure the below three variables
//1) Set message to display (HTML accepted)
var thecontent='<h2><font color="#0000FF">Connecting to database...</font></h2>'
//2) Set delay after which message should be hidden, in milliseconds ('' makes it incessantly visible on the screen)
var hidetimer='';
//3) Set speed of animation (1-50), where larger is faster
var TextSpeed = 10;

///NO NEED TO EDIT BELOW THIS LINE///////////
var contentWidth;
var maxTextSpeed = 50;
var xMax;
var xPos = 0;
var yPos=250;
var xDir = 'right';
var superTextRunning = true;
var tempTextSpeed;
var currentTextSrc;
var newXDir;

function initializeText() {

   if (document.all) {
      xMax = document.body.clientWidth
      document.all("supertext").style.visibility = "visible";
      contentWidth=supertext.offsetWidth
      }
   else if (document.layers) {
      xMax = window.innerWidth;
      contentWidth=document.supertext.document.width
      document.layers["supertext"].visibility = "show";
      }
   setTimeout('moveText()',400);
   if (hidetimer!='')
   setTimeout("hidetext()",hidetimer)
   }

function moveText() {
   if (superTextRunning == true) {
      calculatePosition();
      if (document.all) {
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
         document.all("supertext").style.top = yPos;
         }
      else if (document.layers) {
         document.layers["supertext"].left = xPos + pageXOffset;
         document.layers["supertext"].top = yPos;
         }
      animatetext=setTimeout('moveText()',20);
      }
   }

function calculatePosition() {
   if (xDir == "right") {
      if (xPos > (xMax - contentWidth - TextSpeed)) { 
         xDir = "left";
         }
      }
   else if (xDir == "left") {
      if (xPos < (0 + TextSpeed)) {
         xDir = "right";
         }
      }
   if (xDir == "right") {
      xPos = xPos + TextSpeed;
      }
   else if (xDir == "left") {
      xPos = xPos - TextSpeed;
      }
   else {
      xPos = xPos;
      }
   }

function hidetext(){
if (document.all)
supertext.style.visibility="hidden"
else if (document.layers)
document.supertext.visibility="hide"
clearTimeout(animatetext)
}

if (document.all||document.layers){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeText;
window.onresize = new Function("window.location.reload()");
}
