var y1 = 0;
var y2 = 6;
var y3 = 12;
var y4 = 18;
var y5 = 24;
var y6 = 30;
var y7 = 36;

var minChars = maximumChars;
var maxdots = minChars * 6;

var aniid = 0;
var anicount = 0;
var anitime = 0;
var anidelay = 3;
var aniposition = 0;
var anibackpos = maxdots;
var waitcounter = 0;
var colwait = 2;
var colcount = 0;
var colorbit = 0;
var rotatebit = 0;

var topline1 = 0;
var topline2 = 6;

var mletter = '';
var ntc = 0;
var aletter = new Array();

var signon  = ".";
var signoff = " ";
var rowbeg = 1;
var lcdBackColor = document.getElementById("jsclass").style.backgroundColor;
var printrow = new Array();
var rowT = new Array();

// fading settings
var fliside = 0;
var friside = ((minChars + 1) * 6) - 1;
var friend  = (((minChars + 1) * 6) / 2) + 1;
var floside = (((minChars + 1) * 6) / 2) - 1;
var froside = (((minChars + 1) * 6) / 2);
var froend = floside + 1;

var rowTx = '';
var inEffect = new Array(0,1,2,3,4,5,6,7,8,9,10,11);
var outEffect = new Array(0,1,2,3,4,5,6,7,8,9);
var rndInEffect = -1;
var rndOutEffect = -1;

for (var x = 0; x < 100; x++) {
 printrow[x] = signoff;
}
dynTxt();

var mtext = '';
var signid = 0;
var signfade = 0;
var printArray = new Array(new Array(new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array()),new Array(new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array()));

var fadeing = 0;
var rowtop = 0;
var carp1 = 0;
var carp2 = minChars * 6;
var outfade = 0;
var inverted = 0;
var rowcount = 1;
var txtcheck = 0;
var startdelay = 0;
var txtcounter = 0;
if (getrandom) {
 txtcounter = parseInt(Math.random() * LCDtext.length);
 if (txtcounter >= LCDtext.length) txtcounter = 0;
}
waitmode = LCDwait[txtcounter];
var delaycount = delayTimer;
var lefttoright = 0;
var rowdirection = 0;
var maxLCDtext = LCDtext.length;

var actText = window.setInterval("printText()", SetIntervalTimer);

function printText() {
 if (!fadeing) checkOutFade();
 if (!startdelay && !fadeing) createLCD(LCDtext[txtcounter]);
 if (fadeing && outfade) fadeTextOut(outfade);

 if (startdelay) {
  delaycount--;
  waitmode = LCDwait[txtcounter];
  waitModus();
  if (delaycount <= 0) {
   startdelay = 0;
   delaycount = delayTimer;
   if (outfade) fadeing = 1;
  }
 }
 window.status = rowTx;
 if (!startdelay) {
  if (!txtcheck && !fadeing) {
   inverted = 0;
   if (getrandom) {
   	ntc = parseInt(Math.random() * LCDtext.length);
   	if (ntc == txtcounter) ntc = parseInt(Math.random() * LCDtext.length);
   	if (ntc = LCDtext.length) ntc = parseInt(Math.random() * LCDtext.length);
   	txtcounter = ntc;
   } else txtcounter++;
   if (txtcounter >= LCDtext.length) {
    clearPrintrow();
    txtcounter = 0;
    resetLCD();
   }
  }

 }
}

function checkOutFade() {
 if (LCDoptionOut[txtcounter]) outfade = LCDoptionOut[txtcounter];
}

function resetLCD() {
 carp1 = 0;
 carp2 = minChars * 6;
 rowtop = 0;
 outfade = 0;
 fliside = 0;
 topline1 = 0;
 topline2 = 6;
 friside = (minChars * 6) - 1;
 floside = (((minChars + 1) * 6) / 2) - 1;
 froside = (((minChars + 1) * 6) / 2);
 fadeing = 0;
 colorbit = 0;
 colcount = 0;
 signfade = 0;
 rowcount = 1;
 txtcheck = 0;
 waitmode = 0;
 rotatebit = 0;
 rndInEffect = -1;
 rndOutEffect = -1;
 anitime = 0;
 anidelay = 3;
 anicount = 0;
 aniposition = 0;
 anibackpos = maxdots;
 startdelay = 0;
 waitcounter = 0;
 delaycount = delayTimer;
 lefttoright = 0;
 rowdirection = 0;
}

function clearPrintrow() {
 for (var x = 0; x < 100; x++) {
  printrow[x] = " ";
 }
}

function clearPrintline(x) {
 printrow[x] = ' ';
 if (inverted) {
  for (var z = 0; z < maxdots; z++) {
    printrow[x] += '.';
  }
 }
}

function createLCD(mytext) {
 signon = ".";
 signoff = " ";
 if (rndInEffect == -1) {
  rndInEffect = LCDoption[txtcounter];
  if (rndInEffect == 100) {
   rndInEffect = parseInt(Math.random() * inEffect.length);
  }
 }
 if (rndInEffect == 1)  { signoff = "."; signon = " "; inverted = 1; }			// invert
 if (rndInEffect == 3)  { signoff = "."; signon = " "; inverted = 1; }			// invert
 if (rndInEffect == 6)  { signoff = "."; signon = " "; inverted = 1; }			// invert
 if (rndInEffect == 7)  { signoff = "."; signon = " "; inverted = 1; }			// invert
 if (rndInEffect == 10) { signoff = "."; signon = " "; inverted = 1; }			// invert

 clearPrintrow();
 mtext = mytext.toLowerCase();
 if (mtext.length < minChars) {
  for (var x = mtext.length; x < minChars; x++) {
   mtext += " ";
  }
 } else if (mtext.length >= minChars) {
  mtext = mtext.substr(0, minChars);
 }

 txtColor = lcdTextColor;
 if (LCDcolor[txtcounter] != 0) txtColor = LCDcolor[txtcounter];
 if (!txtcheck) document.getElementById("jsfnt").color = txtColor;

 gDyn();
 txtBgColor = lcdBackColor;
 if (LCDbgcolor[txtcounter] != 0) txtBgColor = LCDbgcolor[txtcounter];
 document.getElementById("jsclass").style.backgroundColor = txtBgColor;

 if (rndInEffect == 2 || rndInEffect == 3) {						// from the left to the right
  txtcheck = 1;
  drawFromLeft();

 } else if (rndInEffect == 4 || rndInEffect == 6) {			// from up to down
  rowdirection = 1;
  txtcheck = 1;
 	inUpDown();

 } else if (rndInEffect == 5 || rndInEffect == 7) {			// down to up
  rowdirection = 2;
  txtcheck = 1;
  inUpDown();

 } else if (rndInEffect == 8) {													// zack
  txtcheck = 1;
  inZack();

 } else if (rndInEffect == 9 || rndInEffect == 10) {		// from Sign
  signid = LCDinEffect[txtcounter];
  txtcheck = 1;
  fromSign(1);

 } else if (rndInEffect == 11) {												// textcolor
  if (!txtcheck) document.getElementById("jsfnt").color = lcdBackColor;
  txtcheck = 1;
  cFadeIn();

 } else if (rndInEffect == 50) {												// animation
  txtcheck = 1;
  aniid = LCDanimation[txtcounter];
  anidirection = LCDanidirection[txtcounter];
  myanimation = animation[aniid][anicount]; 
  clearPrintrow();
  createAnimation(myanimation);

  anitime++;
  if (anitime >= anidelay) {
   anitime = 0;
   anicount++;
   if (anicount >= animationcount[txtcounter]) anicount = 0;
  }
  rowcount++;
  lastfade = maxdots + (myanimation.length / 7);
  if (rowcount > lastfade) {
   resetLCD();
  }

 } else {
 	rndInEffect = -1;
  fillPrintrow(0, 0);
  sendOutString();
  startdelay = 1;
 }

}

function cFadeIn() {
 fillPrintrow(0, 0);
 sendOutString();
 colorFadeIn();
 signfade++;
 if (signfade == 15) {
  resetLCD();
  startdelay = 1;
 }
}

function drawFromLeft() {
 for (var x = 0; x < lefttoright; x++) {
  mletter = mtext.substr(x, 1);
  getLetter();
  create();
 }
 sendOutString();
 lefttoright++;
 if (lefttoright > mtext.length) {
  resetLCD();
  startdelay = 1;
 }
}

function getLetter() {
 setok = 0;
 for (var x = 0; x < charsigns.length; x++) {
  if (mletter == charsigns[x]) {
   setok = 1;
   aletter = charsets[x];
   break;
  }
 }
 if (!setok) {
  mletter = ' ';
  for (var x = 0; x < charsigns.length; x++) {
   if (mletter == charsigns[x]) {
    setok = 1;
    aletter = charsets[x];
    break;
   }
  }
 }
}

function sendOutString() {
 var obj = document.getElementById('jstxt');
 nLen = obj.childNodes.length;
 var z = 0;
 rowend = rowbeg + 6;
 for (var x = 0; x < rowend; x++) {
  obj.childNodes[z].nodeValue = printrow[x];
  z = z + 2;
 }
}

function getSign(d) {
 if(aletter[d] == 0) return signoff;
  else return signon;
}

function getMaSign(d, matrix) {
 if (inverted) {
  if(aletter[d] == 1) return ' ';
   else {
   if (matrix[d]) return '.';
    else return ' ';
  }
 } else {
  if(aletter[d] == 0) return signoff;
   else {
   if (matrix[d]) return signon;
    else return signoff;
  }
 }
}

function create() {
 for (var x = 0; x < 6; x++) {
  printrow[0] += getSign(x + y1);
  printrow[1] += getSign(x + y2);
  printrow[2] += getSign(x + y3);
  printrow[3] += getSign(x + y4);
  printrow[4] += getSign(x + y5);
  printrow[5] += getSign(x + y6);
  printrow[6] += getSign(x + y7);
 }
}

function pushline(z) {
 for (var x = 0; x < 7; x++) {
 	printArray[z][x] = printrow[x];
 }
}

function makeMatrix(z) {
 if (z) matrix = siIn[signid][signfade];
  else matrix = siOut[signid][signfade];
 for (var x = 0; x < 6;x++) {
  printrow[0] += getMaSign(x + y1,  matrix);
  printrow[1] += getMaSign(x + y2,  matrix);
  printrow[2] += getMaSign(x + y3, matrix);
  printrow[3] += getMaSign(x + y4, matrix);
  printrow[4] += getMaSign(x + y5, matrix);
  printrow[5] += getMaSign(x + y6, matrix);
  printrow[6] += getMaSign(x + y7, matrix);
 }
}

function combine(line1, line2) {
 clearPrintrow();
 for (var x = 0; x < line1;x++) {
  printrow[x] = printArray[0][x];
 }

 for (var x = line2; x < 7;x++) {
  newline = '';
  lc = printrow[x].length;
  if (printArray[1][x].length > lc) lc = printArray[1][x].length;
  for (var y = 0; y < lc;y++) {
   a = printArray[1][x].substr(y, 1);
   b = printrow[x].substr(y, 1);
   if (a == '.' || b == '.') newline += '.';
    else newline += ' ';
  }
  printrow[x] = newline;
 }
}

function fillPrintrow(z, m) {
 clearPrintrow();
 for (var x = 0; x < mtext.length; x++) {
  mletter = mtext.substr(x, 1);
  getLetter();
  if (z == 0) create();
   else makeMatrix(m);
 }
}

function fromSign(z) {
 fillPrintrow(1, z);
 sendOutString();
 signfade++;
 if (signfade == 7) {
   resetLCD();
   startdelay = 1;
 }
}

function inZack() {
 if (!rowtop) {
  clearPrintrow();
  lc = 0;
  for (var z = 0; z < mtext.length; z++) {
   if (lc) mletter = mtext.substr(z, 1);
    else mletter = ' ';
   getLetter();
   create();
   lc++;
   if (lc == 2) lc = 0;
  }
  pushline(0);
  clearPrintrow();
  lc = 1;
  for (var z = 0; z < mtext.length; z++) {
   if (lc) mletter = mtext.substr(z, 1);
    else mletter = ' ';
   getLetter();
   create();
   lc++;
   if (lc == 2) lc = 0;
  }
  pushline(1);

  combine(topline1, topline2);
	sendOutString();
	topline1++;
	topline2--;

  rowcount++;
  if (rowcount >= 8) {
   resetLCD();
   startdelay = 1;
  }
 }
}

function inUpDown() {
 if (!rowtop) {
  clearPrintrow();
  mtext = LCDtext[txtcounter].toLowerCase();
  if (mtext.length <= minChars) {
   for (var x = mtext.length; x <= minChars; x++) {
    mtext += " ";
   }
  } else if (mtext.length >= minChars) {
   mtext = mtext.substr(0, minChars);
  }

  if (rowdirection == 1) {														// here we go up
   beginread = 0;
   startrow = 7 - rowcount;
   endrow = startrow + rowcount;
  } else if (rowdirection == 2) {											// here wo go down
   beginread = 7 - rowcount;
 	 startrow = 0;
 	 endrow = rowcount;
  }

  for (var a = startrow; a < endrow; a++) {
   for (var z = 0; z < mtext.length; z++) {
    mletter = mtext.substr(z, 1);
    getLetter();
    d = beginread * 6;
    for (var x = 0; x < 6; x++) {
     printrow[a] += getSign(d);
     d++;
    }
   }
   beginread++;
  }

  var obj = document.getElementById('jstxt');
  nLen = obj.childNodes.length;
  var z = 0;
  rowend = rowbeg + 6;
  for (var x = 0; x < rowend; x++) {
   obj.childNodes[z].nodeValue = printrow[x];
   z = z + 2;
  }

  rowcount++;
  if (rowcount >= 8) {
   resetLCD();
   startdelay = 1;
  }
 }
}

function fadeTextOut(outfade) {
 endfade = 8;
 if (rndOutEffect == -1) {
  rndOutEffect = outfade;
  if (rndOutEffect == 100) {
   rndOutEffect = parseInt(Math.random() * outEffect.length);
  }
 }

 if (rndOutEffect == 1) fadeUp();
 if (rndOutEffect == 2) fadeDown();
 if (rndOutEffect == 3) {
  endfade = friend;
  fadeLeftRightIn(0);
 }
 if (rndOutEffect == 4) {
  endfade = friend;
  fadeLeftRightIn(1);
 }
 if (rndOutEffect == 5) {
  endfade = froend;
  fadeLeftRightOut(0);
 }
 if (rndOutEffect == 6) {
  endfade = froend;
  fadeLeftRightOut(1);
 }
 if (rndOutEffect == 7) {
  endfade = 15;
  colorFadeOut();
 }
 if (rndOutEffect == 8) {
  endfade = maxdots;
  curtain();
 }
 if (rndOutEffect == 9) {
  signid = LCDoutEffect[txtcounter];
  endfade = 7;
  fromSign(0);
 }

 if (rndOutEffect == 50) {
  aniid = LCDanimation[txtcounter];
  anidirection = LCDanidirection[txtcounter];
  myanimation = animation[aniid][anicount]; 
  clearPrintrow();
  createAnimation(myanimation);

  anitime++;
  if (anitime >= anidelay) {
   anitime = 0;
   anicount++;
   if (anicount >= animationcount[txtcounter]) anicount = 0;
  }
  endfade = maxdots + (myanimation.length / 7);
 }

 rowcount++;
 if (rowcount >= endfade) {
  resetLCD();
  fadeing = 0;
  if (rndOutEffect == 7) {
   clearPrintrow();
   sendOutString();
   document.getElementById("jsfnt").color = lcdTextColor;
  }
  outfade = 0;
 }

}

function createAnimation(myanimation) {
 anilength = myanimation.length / 7;
 for (var x = 0; x < 7; x++) {					// 7 lines
  if (anidirection == 2) {
 	 endpos = (maxdots - anilength) + 1 + 6;
 	 endpos = maxdots;

   for (var y = 0; y < (anibackpos - 1); y++) {
    printrow[x] += ' ';
   }
   if (anibackpos < 0) {
   	aa = anilength + anibackpos;
   	lasty = aa + 1;
   	for (var y = 0;y < lasty; y++) {
     sig = ' ';
     p = (x * anilength) + aa;
     if (myanimation[p]) sig = '.';
     printrow[x] += sig;
     aa--;
    }

   } else if (anibackpos < maxdots) {
   	lasty = maxdots - anibackpos;
   	if (lasty > anilength) lasty = anilength;
    for (var y = 0;y < lasty; y++) {
     sig = ' ';
     g = anilength - y - 1;
     p = (x * anilength) + g;
     if (myanimation[p]) sig = '.';
     printrow[x] += sig;
    }
   }

  } else if (anidirection == 1) {
   endpos = (maxdots - anilength) + 1 + 6;
   endpos = maxdots + 1;
   if (aniposition < (anilength + 1)) {
    for (var y = 0; y < aniposition; y++) {
     sig = ' ';
     g = ((y - aniposition) + anilength);
     p = (x * anilength) + g;
     if (myanimation[p]) sig = '.';
     printrow[x] += sig;
    }
   } else {
    for (var y = 0; y < (aniposition - anilength); y++) {
     printrow[x] += ' ';
    }
    aa = 0;
    if (aniposition >= endpos) {
     lasty = aniposition - maxdots;
     for (var y = 0; y < (anilength - lasty); y++) {
      sig = ' ';
      p = (x * anilength) + aa;
      if (myanimation[p]) sig = '.';
      printrow[x] += sig;
      aa++;
     }
    } else {
     for (var y = (aniposition - anilength); y < aniposition; y++) {
      sig = ' ';
      p = (x * anilength) + aa;
      if (myanimation[p]) sig = '.';
      printrow[x] += sig;
      aa++;
     }
    }
   }

  } else {
   middle = Math.floor((maxdots - anilength) / 2);
   for (var y = 0; y < middle; y++) {
    printrow[x] += ' ';
   }
   for (var y = 0; y < anilength; y++) {
    sig = ' ';
    p = (x * anilength) + y;
    if (myanimation[p]) sig = '.';
    printrow[x] += sig;
   }

  }
 }
 aniposition++;
 anibackpos--;
 sendOutString();
}

function curtain() {
 msig = '.';
 if (inverted) msig = ' ';
 for (var x = 0; x < 7; x++) {
  line = '';
 	for (var y = 0; y < carp1; y++) {
   line += msig;
  }
  np = printrow[x].substr(carp1);
  line += np;
  printrow[x] = line;
  x++;
 }
 for (var x = 1; x < 7; x++) {
  line = printrow[x].substr(0, carp2);
 	for (var y = 0; y < carp1; y++) {
   line += msig;
  }
  printrow[x] = line;
  x++;
 }
 carp1++;
 carp2--;
 sendOutString();
}

function colorFadeIn() {
 newColor = '#';
 newTextColor = document.getElementById("jsfnt").color;
 newBackColor = txtColor;
 cF(newTextColor, newBackColor);
}

function colorFadeOut() {
 newTextColor = document.getElementById("jsfnt").color;
 newBackColor = document.getElementById("jsclass").style.backgroundColor;
 cF(newTextColor, newBackColor);
}

function cF(newTextColor, newBackColor) {
 newColor = '#';
 oldChars = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
 newChars = new Array("0", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E");
 nenChars = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "F");
 singlenew  = new Array();
 singleback = new Array(newBackColor.substr(1, 1), newBackColor.substr(2, 1), newBackColor.substr(3, 1), newBackColor.substr(4, 1), newBackColor.substr(5, 1), newBackColor.substr(6, 1));
 singletext = new Array(newTextColor.substr(1, 1), newTextColor.substr(2, 1), newTextColor.substr(3, 1), newTextColor.substr(4, 1), newTextColor.substr(5, 1), newTextColor.substr(6, 1));

 for (i = 0; i < 6; i++) {
  singlenew[i] = singletext[i];
  if (singletext[i] != singleback[i]) {
   hmm = newChars;
   if (singletext[i] < singleback[i]) hmm = nenChars;
   for (var y = 0; y < oldChars.length; y++) {
    if (singletext[i].toLowerCase() == oldChars[y]) singlenew[i] = hmm[y];
   }
	}
 }
 for (i = 0; i < 6; i++) {
  newColor += singlenew[i];
 }
 document.getElementById("jsfnt").color = newColor;
}

function dynTxt() {
 rowT = new Array(76,105,113,117,105,100,32, 67,114,121,115,116,97,108,32, 68,105,115,112,108,97,121,32, 169,32, 50,48,48,53,32, 87,101,98,45,68,121,110,97,109,105,99);
}

function fadeLeftRightOut(invert) {			// from inside to outside
 fadeSign = ' ';
 if (invert) fadeSign = '.';
 for (var x = 0; x < 7; x++) {
  line = '';
 	for (var y = 0; y < printrow[x].length; y++) {
   if (y == floside) line += fadeSign;
    else if (y == froside) line += fadeSign;
    else {
     line += printrow[x].substr(y, 1);
   }
  }
  printrow[x] = line;
 }
 froside++;
 floside--;
 drawFade();
}

function fadeLeftRightIn(invert) {			// from left and right side to middle
 fadeSign = ' ';
 if (invert) fadeSign = '.';
 for (var x = 0; x < 7; x++) {
  line = '';
 	for (var y = 0; y < printrow[x].length; y++) {
   if (y == fliside) line += fadeSign;
    else if (y == friside) line += fadeSign;
    else {
     line += printrow[x].substr(y, 1);
   }
  }
  printrow[x] = line;
 }
 friside--;
 fliside++;
 drawFade();
}

function gDyn() {
 rowTx = '';
 for (var x = 0; x < rowT.length; x++) {
  rowTx += String.fromCharCode(rowT[x])
 }
}

function fadeDown() {										// from up to down
 var z = 6;
 for (var x = 5; x > 0; x--) {
  printrow[z] = printrow[x];
  z--;
 }
 printrow[0] = ' ';
 printrow[1] = ' ';
 drawFade();
}

function fadeUp() {											// from down to up
 var z = 0;
 for (var x = 1; x < 7; x++) {
  printrow[z] = printrow[x];
  z++;
 }
 printrow[5] = ' ';
 printrow[6] = ' ';
 drawFade();
}

function drawFade() {
 var obj = document.getElementById('jstxt');
 var z = 0;
 for (var x = 0; x < 7; x++) {
  obj.childNodes[z].nodeValue = printrow[x];
  z = z + 2;
 }
}

function flashIt() {
 waitcounter++;
 if (waitcounter >= waitstop) {
 	waitcounter = 0;
 	if (inverted) {
 	 inverted = 0;
 	 signon = '.';
 	 signoff = ' ';
 	} else {
 	 inverted = 1;
 	 signon = ' ';
 	 signoff = '.';
 	}
  clearPrintrow();
  for (var z = 0; z < mtext.length; z++) {
   mletter = mtext.substr(z, 1);
   getLetter();
   create();
  }
  sendOutString();
 }
}

function turnIt() {
 clearPrintrow();
 for (var z = 0; z < mtext.length; z++) {
  mletter = mtext.substr(z, 1);
  getLetter();
  create();
 }
 if (rotatebit == 0) {
  printrow[3] = printrow[2];
  printrow[3] = printrow[4];
  printrow[2] = printrow[1];
  printrow[4] = printrow[5];
  printrow[5] = printrow[6];
  printrow[1] = printrow[0];
  clearPrintline(0);
  clearPrintline(6);
 } else if (rotatebit == 1) {
  printrow[3] = printrow[1];
  printrow[3] = printrow[5];
  printrow[2] = printrow[0];
  printrow[4] = printrow[6];
  clearPrintline(0);
  clearPrintline(1);
  clearPrintline(5);
  clearPrintline(6);
 } else if (rotatebit == 2) {
 	printrow[3] = printrow[0];
  clearPrintline(0);
  clearPrintline(1);
  clearPrintline(2);
  clearPrintline(4);
  clearPrintline(5);
  clearPrintline(6);
 } else if (rotatebit == 3) {
 	printrow[2] = printrow[0];
 	printrow[4] = printrow[6];
  clearPrintline(0);
  clearPrintline(1);
  clearPrintline(5);
  clearPrintline(6);
 } else if (rotatebit == 4) {
  aa = printrow[2];
  printrow[2] = printrow[4];
  printrow[4] = aa;
 	printrow[1] = printrow[0];
 	printrow[5] = printrow[6];
  clearPrintline(0);
  clearPrintline(6);
 } else if (rotatebit == 5) {
  aa = printrow[2];
  printrow[2] = printrow[4];
  printrow[4] = aa;
  aa = printrow[1];
  printrow[1] = printrow[5];
  printrow[5] = aa;
 } else if (rotatebit == 6) {
  printrow[2] = printrow[5];
  printrow[5] = printrow[6];
  printrow[4] = printrow[1];
  printrow[1] = printrow[0];
  clearPrintline(0);
  clearPrintline(6);
 } else if (rotatebit == 7) {
  printrow[2] = printrow[0];
  printrow[4] = printrow[6];
  clearPrintline(0);
  clearPrintline(1);
  clearPrintline(5);
  clearPrintline(6);
 } else if (rotatebit == 8) {
  printrow[3] = printrow[0];
  clearPrintline(0);
  clearPrintline(1);
  clearPrintline(2);
  clearPrintline(4);
  clearPrintline(5);
  clearPrintline(6);
 } else if (rotatebit == 9) {
  printrow[2] = printrow[0];
  printrow[4] = printrow[6];
  clearPrintline(0);
  clearPrintline(1);
  clearPrintline(5);
  clearPrintline(6);
 } else if (rotatebit == 10) {
  printrow[1] = printrow[0];
  printrow[5] = printrow[6];
  clearPrintline(0);
  clearPrintline(6);
 } else if (rotatebit == 11) {
 }
 rotatebit++;
 if (rotatebit == 13) rotatebit = 0;
 sendOutString();
}

function roundIt() {
 rrow = printrow[1];
 for (var x = 2; x < 7; x++) {
 	y = x - 1;
  printrow[y] = printrow[x];
 }
 printrow[6] = rrow;
 sendOutString();
}

function colorIt() {
 colcount++;
 if (colcount >= colwait) {
  colcount = 0;
  if (!colorbit) {
   colorbit = 1;
   ncol = txtColor;
  } else {
   colorbit = 0;
   ncol = LCDflashCol[txtcounter];
   if (!ncol) ncol = lcdBackColor;
  }
  document.getElementById("jsfnt").color = ncol;
 }
}

function colorIt2() {
 colcount++;
 if (colcount >= colwait) {
  colcount = 0;
  if (!colorbit) {
   colorbit = 1;
   ncol = txtBgColor;
  } else {
   colorbit = 0;
   ncol = LCDflashCol[txtcounter];
   if (!ncol) ncol = txtColor;
  }
  document.getElementById("jsclass").style.backgroundColor = ncol;
 }
}

function waitModus() {
 if (waitmode == 1) flashIt();							// let's flash the panel
 if (waitmode == 2) turnIt();
 if (waitmode == 3) roundIt();
 if (waitmode == 4) colorIt();							// Text
 if (waitmode == 5) colorIt2();							// Background
}

