// Some global variables available to all the functions in this script var interval; //time interval between the scrolling of two consecutive characters string=new String; //the character string to be scrolled iID=new String; //the ID of the input string oID=new String; //the ID of the output string h=new String; //scrolling pauses when the value of h is "*PAUSE" l=new Number; //the length of the character string to be scrolled n=new Number; //the number of characters of the string to be shown o=new Number; //the offset to the initial position of the string to be shown p2=new Number; //the number of microseconds between the scrolling of two consecutive characters p3=new Number; //the number of microseconds to wait before restarting the scroll rmax=new Number; //the maximum number of repetitions of string scrolling r=new Number; //the current number of repetitions of string scrolling var shiftLen=1; substring=new String; function strLineScroll(i,u,m,w,b,p,t) { // - receives 6 parameters: // - 1. The ID of the source string element // - 2. The ID of the output element // - 3. Number of milliseconds to wait before starting // - 4. Number of milliseconds to wait before scrolling one more string character // - 5. Once the string scroll completes, the number of milliseconds to wait before auto-restarting the scroll. // - 6. Maximum number of times to repeat the string scroll // - waits for the initial number of milliseconds, than calls function strLineScrollGo(). iID=i; //ID of the source string element oID=u; //ID of the output element if (isNaN(m)) {alert(m+" not a number");return;}; n=m; //Number of milliseconds to wait before starting if (isNaN(b)) {alert(b+" not a number");return;}; p2=b; //Number of milliseconds to wait before scrolling one more string character, see setInterval in scrollGo() if (isNaN(p)) {alert(p+" not a number");return;}; p3=p; //Number of milliseconds to wait before auto-restarting the scroll. if (isNaN(t)) {alert(t+" not a number");return;}; rmax=t; //Max number of repetitions r=0; //Current number of repetitions h=""; //reset *PAUSE clrLineScroll(); timerID1=setTimeout("scrollGo()",w); } function pauseLineScroll() { // - toggles lineScroll() pause if (h=="") {h="*PAUSE"} else {h=""}; } function endLineScroll() { // - ends function lineScroll() clearInterval(interval); r=0; } function clrLineScroll() { // - ends function lineScroll() // - clears the shown line endLineScroll(); document.getElementById(oID).innerHTML=""; } function scrollGo() { // - checks that its length is at least 30 characters // - makes up a prefix for the character string to be shown // - picks up the character string from the hidden input field of a form and connects it to the prefix // - sets variable l to the length of the string (with prefix) // - sets variable o (offset) at the beginning of the string // - sets variable n to the number of characters to be shown // - sets an interval time for the required number of milliseconds (p2): every such milliseconds, function pick() is called. var prefix; var space; if (document.getElementById(iID).value.length<30) return; space=" ."; prefix=space; for (var i=0; i<35; i++) {prefix=prefix+space;}; string=prefix+document.getElementById(iID).value; l=string.length; o=0; interval=setInterval("pick()",p2); } function pick() { // - when the offset equals the string length, waits 5 seconds then sets the offset back to the beginning of the string // - copies a section of the string to the display area jrnOut // - increases the offset o in order to pick up a substring starting with the next character var timerId2; if (o==l) { timerID2=setTimeout("o=0",p3); //wait p3 milliseconds, then set o (offset) to zero (start repeating the scroll) r=++r; //increase the number of repetitions if (r==rmax) clrLineScroll(); //end of repetitions }; doSubstring(); //make up variable substring document.getElementById(oID).innerHTML=substring; if (h!="*PAUSE") { o=o+shiftLen; newShiftLen(); } } function doSubstring() { //Make up variable substring substring=string.substr(o,n); //If an HTML tag detected at the end of the substring, enlarge the substring to contain the entire html tag var re1=/>/ x=new Number; y=new Number; z=new Number; if (substring.substr(substring.length-1,1)=="<") { x=Number(o)+Number(n)-1; y=string.substr(x,l-x).search(re1); if (y!=-1) {z=Number(n)+Number(y); substring=string.substr(o,z); o=Number(o)+Number(y);} } } function newShiftLen() { //If an HTML tag detected at the beginning of the substring, in the next step scroll left the entire html tag var re1=/>/ var s; shiftLen=1; if ((string.substr(o,1)=="<")&&(o