﻿var outMsg = "";
var i = 0;
var lineNo = 1;
var timerDM=null;
var msg = " ";
function araVob() {
}
var Line = new araVob();
Line[1]  = "Check Here Regularly"
Line[2]  = "For Coming Events"
Line[3]  = "２F企画展示ご案内"
Line[4]  = ""
Line[5]  = ""
Line[6]  = ""
Line[7]  = ""
Line[8]  = ""
Line[9]  = ""
Line[10]  = "unused6"
Line[11]  = "unused7"
Line[12]  = "unused8"
Line[13]  = "unused9"
Line[14]  = "unused10"
Line[15]  = "unused11"

/*
For new message, replace the text in Lines.
Each Line[n] is a separate line.  To change the "page" before 
the defined page length is reached, insert a ﾂ･f character at the end of the 
line where you want the break.    Use ﾂ･" for quotes and ﾂ･t for tabs in the 
message text.
*/
var msgNum = 1;          // first page.
var msgCnt = 9;         // last line. Set this for the last line to be shown.
var Speed = 70;      // typing speed.
var pageLen = 1;         // size of page.
var delay=Speed;
var r = 0;
var cr="\r\n"
if ("3" <=navigator.appVersion.charAt(0)) {
 var cr="\n"
}
for (x = 1; x<=(msgCnt); x++) {
  Line[x] = Line[x] + cr;
}
msg = Line[1];

function DisplayMsg() {
  if (msg.length <= i || msg.charAt(i) == "\f") {
    r=i;
    i=0;
    ChangeMsg();
  }
  outMsg = outMsg + msg.charAt(i);
  i++; 
  if (msg.charAt(i) == "\f" || (lineNo == pageLen && i==msg.length)) {
    delay = 1000; } // delay for Line
  else {
  if (msg.charAt(i) == cr && msg != " "+cr) {
    delay = 1000; }
  else {
    delay = Speed; } 
  }
  self.document.forms['FormName']['ticker'].value=outMsg;
  timerDM = setTimeout("DisplayMsg()",delay);
}

function ChangeMsg() {
 msgNum++;
 if (msgCnt < msgNum) {
   msgNum = 1;
 }
 lineNo++;
 if (pageLen < lineNo || msg.charAt(r) == "\f") {
  outMsg=Line[msgNum].charAt(i);
  i++;
  lineNo = 1;
 }
  msg = Line[msgNum];
}

function quitDisplay() {
  self.document.forms['FormName']['ticker'].value = "123";
}
