/* cursor.js -- cursor trailor text */

  /* {
      cursor.js for "cursor trailer text" is based on the Java Script at
      http://www.dynamicdrive.com/dynamicindex13/trailortext.htm by
      Peter Gehrig. It has been modified by Gilbert Healton to make it
      a generic function in a stand alone *.js file. This allows the
      code to be used from multiple web pages rather than embedding the
      code in each web page that uses it.

	ghealton		combine address elements on the
	   @			left into a single
	exit109			E-mail
	  com			address

      (or search the web for all of the words Gilbert Healton Mad Programmer)

      Gilbert's changes are available for public use in the same manner 
      Peter's original work is.

      NOTE: also see corresponding cursor.css file that contains 
      style-sheet settings required by cursor.js.

	IMPORTANT: anyone using these files must copy them to their local 
	system rather referencing Gilbert's files on Gilbert's web pages. 
	Modify local files to meet your needs and keep traffic to yourself.

	THIS INCLUDES THE IMPORT STATEMENT WITHIN cursor.css... delete the
	import or redirect it to your own standard style sheet.

      From my hmac.pl web page systems, simply issue the following before
      opening the text to the web page:

	{CursorText Message To Display}

     In raw web pages, you must manually do what {CursorText} expands to:


      <HTML>
	 <HEAD>
	    ...
	    <LINK rel="stylesheet" href="/~yourdirectory/cursor.css">
	    <SCRIPT src="~yourdirectory/cursor.js" 
		    type="test/javascript" 
		    language="JavaScript"></SCRIPT>
	    <SCRIPT><!--
		    cursor_head( "message to display" );
		--></SCRIPT>
	</HEAD>
	<BODY
		onLoad="makesnake()" 
		style="width:100%;overflow-x:hidden;overflow-y:scroll" >
	    <SCRIPT><!--
		    cursor_body();
		--></SCRIPT>

  } */

var Rev_cursor = "$Id: cursor.js,v 1.3 2001/06/26 18:19:15 ghealton Exp $";		// our internal revision level


///////////////////////////////////////////////////////////////////////

/*
Cursor Trailor Text- By Peter Gehrig (http://www.24fun.ch/)
Permission given to Dynamicdrive.com to feature script in it's archive.
For full source code, installation instructions, and 1000's more DHTML scripts,
visit http://dynamicdrive.com
*/

var x,y;		// current cursor position
var step=20;		// increment for X movement
var flag=0;		// 1 if handlerMM has been called (e.g., onmousemove
			// //pointed to handlerMM). 0 if "not yet".

var message = "";	// message text, split up as needed
    // Your snappy message. Important: the space at the end of the sentence!

var xpos=new Array();
var ypos=new Array();

function cursor_head( message_in ) {
	return;		// DISABLE FOR NOW
	message = message_in + " ";	// add the all important trailing space
	message=message.split("")

	for (i=0;i<=message.length-1;i++) {
		xpos[i]=-50
	}

	for (i=0;i<=message.length-1;i++) {
		ypos[i]=-50
	}


}

// handlerMM: process mouse motion events
function handlerMM(e){
	x = (document.layers) 
		  ? e.pageX 
		  : document.body.scrollLeft+e.clientX
	     /*	  : document.body.scrollTop+event.clientX  */
	y = (document.layers)
		  ? e.pageY 
		  : document.body.scrollTop+e.clientY
	     /*	  : document.body.scrollTop+event.clientY  */
	flag=1;			// allow trailing text to be generated
}

function makesnake() {
	if (flag==1 && document.all) {
    	for (i=message.length-1; i>=1; i--) {
   			xpos[i]=xpos[i-1]+step
			ypos[i]=ypos[i-1]
    	}
		xpos[0]=x+step
		ypos[0]=y
	
		for (i=0; i<message.length-1; i++) {
    		var thisspan = eval("span"+(i)+".style")
    		thisspan.posLeft=xpos[i]
			thisspan.posTop=ypos[i]
    	}
	}
	
	else if (flag==1 && document.layers) {
    	for (i=message.length-1; i>=1; i--) {
   			xpos[i]=xpos[i-1]+step
			ypos[i]=ypos[i-1]
    	}
		xpos[0]=x+step
		ypos[0]=y
	
		for (i=0; i<message.length-1; i++) {
    		var thisspan = eval("document.span"+i)
    		thisspan.left=xpos[i]
			thisspan.top=ypos[i]
		}
	}
		var timer=setTimeout("makesnake()",30)
}


function cursor_body() {
return;
    for (i=0;i<=message.length-1;i++)
    {   // put out a <span id="span#" class='spanstyle'>letter</span> for
	// //each letter in message
	document.write("<span id='span"+i+"' class='spanstyle'>")
	    document.write(message[i])
	document.write("</span>")
    }

    if (document.layers)
    {	// document layers supported
	document.captureEvents(Event.MOUSEMOVE);
    }
    document.onmousemove = handlerMM;
}

//end: cursor.js
