
var flyingText = null;

function classChange(element,newclass) {
	element.className = newclass;
	}

function linkblink() {	
switch (blink.className) {
case "normallink":
	blink.className = "em1link";
	break;
case "em1link":
	blink.className = "em2link";
	break;
case "em2link":
	blink.className = "em3link";
	break;
case "em3link":
	blink.className = "normallink";
	break;	
};
	window.setTimeout("linkblink()", 100);
}

      function FlyingText() {
        // Array of element ID's to animate in. These elements should be relatively positioned.
        // Change these to ID's in your document.
        this.elements = new Array("marchingtext")
        this.order = new Array()         
        // You can customize the following settings 
        this.iterations = 10;  // Defines how many iterations to take
        this.msecs = 125;     // Defines time between iterations
        var count = 0
        for (var intLoop = 0; intLoop < this.elements.length; intLoop++) {
          var el = document.all[this.elements[intLoop]]
          var txt = el.innerText
          var newHTML = ""
          for (var intChar = 0; intChar < txt.length; intChar++) {
            this.order[count] = "marchingElement"+count.toString()
   
            newHTML+="<SPAN ID='marchingElement"+count.toString()+"'"
            if (0!=intChar)
              newHTML+="class='right'"
            newHTML+=">"+txt.substring(intChar,intChar+1)+"</SPAN>"
            count++
          }          
          el.style.visibility = "visible"
          el.innerHTML=newHTML;
        }

        // state variables - don't modify
        this.item = 1
        this.clickCount = 0;
        this.currCount = 0;  
      }

 

      function movingText() {
        ft = flyingText;
        if (ft.currCount==0) {         
          var el = document.all[ft.order[1]]  // Get the element
          el.style.pixelLeft = el.offsetWidth + document.body.clientWidth;
          // Calculate distance to move
          ft.dl = el.style.posLeft / ft.iterations;   
          for (var intLoop=2; intLoop < ft.order.length; intLoop++) 
            document.all[ft.order[intLoop]].style.pixelLeft = document.all[ft.order[intLoop-1]].style.pixelLeft+ft.dl
        }

        ft.currCount++;
        // Reposition element  
        for (var intLoop=ft.item; intLoop < ft.order.length; intLoop++) 
          document.all[ft.order[intLoop]].style.pixelLeft -= ft.dl;
      
        if (ft.currCount < ft.iterations) 
          window.setTimeout("movingText()", ft.msecs)
        else {
          document.all[ft.order[ft.item]].style.pixelLeft=0
          if (++ft.item < ft.order.length)
            window.setTimeout("movingText()", ft.msecs)         
          else
            document.all[ft.order[ft.item-2]].style.color=""

        }
      }


function doLoad() {
    if (document.all.marchingtext) {
	flyingText = new FlyingText();
        movingText();
	}    
    if (document.all.blink) {
	window.setTimeout("linkblink()", 5000);
	}
}    

      


