var counterid = null;
var timerid = null;
var waitid = null;
var demoid = null;
var flashid = null;
var round = 1;
var INT = 105;
var loadFLG = 0;
var gameFLG = 0;
var missFLG = 0;
var tmpFLG = 0;
var waitFLG = 0;
var tim = 0;
var lastlevel = false;
var armageddon = false;
var armageddontime = 250;
var levelname = new Array(8); // block color
var blcol = new Array(5); // block color
var blsta = new Array(40); // block status
var blhit = new Array(40); // block hits
var blNO = new Array(40); // block No
var blclr = 0; // clear block
var ballX = 209; // ball data
var ballY = 270;
var ballN = 5;
var ballDX = 0;
var ballDY = 0;
var tmpRL = 193;
var tmpOffset = 0;
var count = 0;
var X = 0;
var zero = 0;
var playcountpaused = false;
var NS = (navigator.appName == 'Netscape') ? true : false;
var showSplash = false;
var tmpSplash = false;
var level = 1;
var combo = 1;
var realscore = 0;
var score = 0;
var tmpScr = 0;
var waitScr = 0;
var bonus = 0;
var tbonus = 0;
var bumpcount = 0;
var tilt = false;
var demomode = false;
blcol[0] = '#FFFFFF';
blcol[1] = '#7799FF';
blcol[2] = '#0055EE';
blcol[3] = '#0022AA';
blcol[4] = '#001166';
blcol[5] = '#000000';
blcol[6] = '#00FF00';
blcol[7] = '#CC0000';
blcol[8] = '#666666';
levelname[0] = 'Take the High Road';
levelname[1] = 'Chaos';
levelname[2] = 'Four Corners';
levelname[3] = 'Skylight';
levelname[4] = 'When in Rome';
levelname[5] = 'Caged Beast';
levelname[6] = 'Dunce in the Corner';
levelname[7] = 'Flanked';
levelname[8] = 'Live at Red Rocks';

if (NS) {
window.captureEvents(Event.KEYPRESS); 
document.captureEvents(Event.KEYPRESS); 
window.captureEvents(Event.KEYDOWN); 
document.captureEvents(Event.KEYDOWN); 
window.captureEvents(Event.KEYUP); 
document.captureEvents(Event.KEYUP); 
}
if (window.onkeypress) window.onkeypress = checkPress;
else document.onkeypress = checkPress;

function mainF() {
clearTimeout(timerid);
if (document.getElementById('frame1content').style.display  ==  '') {
ballX = ballX + ballDX;
ballY = ballY + ballDY;
outCHK();
blkCHK();
if (demomode) {
count++;
if ((count % 20) == 0) {
if (Math.random() > 0.5) tmpOffset = tmpOffset + 5;
else tmpOffset = tmpOffset - 5;
if (tmpOffset > 1) tmpOffset = 1;
if (tmpOffset < -35) tmpOffset = -35;
}
if (tmpOffset < -17 && ballDX < 0) tmpRL = ballX + tmpOffset;
else if (tmpOffset > -17 && ballDX > 0) tmpRL = ballX + tmpOffset;
else tmpRL = ballX + ballDX + tmpOffset;
if (tmpRL < 16) tmpRL = 16;
if (tmpRL > 370) tmpRL = 370;
}
document.getElementById('ball').style.top = ballY + 'px';
document.getElementById('ball').style.left = ballX + 'px';
document.getElementById('racket').style.left = tmpRL + 'px';
if (gameFLG == 01){
timerid = setTimeout('mainF()', INT);
}
}
else if (document.getElementById('frame1splash').style.display  ==  '') splash();
}

function playcount() {
clearTimeout(counterid);
if (gameFLG == 01) {
if (bumpcount > 0) bumpcount--;
tim = tim + 1;
tmptim = tim;
playcountpaused = false;
if (armageddon) {
document.getElementById('TM').style.color = '#FF0000';
tmptim = armageddontime - tim;
if (tmptim <= 0) ballN = 0;
}
document.getElementById('TM').innerHTML = tmptim;
if (ballN == 0) {
gameEnd();
armageddon = false;
clearTimeout(counterid);
}
else counterid = setTimeout('playcount()', 1000);
}
else playcountpaused = true;
}

function initG() {
stopreel();
clearTimeout(demoid);
bumpcount = 0;
tilt = false;
document.getElementById('tltmes').style.display = 'none';
document.getElementById('racket').style.backgroundColor = '#FFFFFF';
document.getElementById('showtempscore').style.color = '#555555';
document.getElementById('showtempscore').innerHTML = '+ 0';
tmpScr = 0;
if (blclr >= 40) {
blclr = 0;
tim = 0;
if (level <= 3) ballN++;
document.getElementById('timmes').style.display = 'none';
document.getElementById('clrmes').style.display = 'none';
document.getElementById('ovrmes').style.display = 'none';
document.getElementById('paumes').style.display = 'none';
document.getElementById('labelspan').innerHTML = '- Level ' + round + ': ' + levelname[round - 1] + ' -';
if (round == 1) {
for (ib = 0; ib < 5; ib++) {
for (ia = 0; ia < 8; ia++) {
chc(ib * 8 + ia +1, ib);
blsta[ib * 8 + ia] = ib;
blhit[ib * 8 + ia] = ib;
}
}
}
if (round == 2) {
for (ia = 1; ia <= 40; ia++) {
ib = Math.floor(Math.random() * 5);
if (ib > 4) ib = 4;
if (ia == 18 || ia == 19 || ia == 22 || ia == 23) ib = 8;
chc(ia, ib);
blsta[ia - 1] = ib;
blhit[ia - 1] = ib;
}
blclr = 4;
}
if (round == 3) {
for (ia = 1; ia <= 40; ia++) {
ib = 4;
if (ia == 1 || ia == 8 || ia == 33 || ia == 40) ib = 8;
if (ia == 10 || ia == 11 || ia == 12 || ia == 13 || ia == 14 || ia == 15 || ia == 18 || ia == 23 || ia == 26 || ia == 27 || ia == 28 || ia == 29 || ia == 30 || ia == 31) ib = 2;
if (ia == 2 || ia == 3 || ia == 4 || ia == 5 || ia == 6 || ia == 7 || ia == 9 || ia == 16 || ia == 17 || ia == 24 || ia == 25 || ia == 32 || ia == 34 || ia == 35 || ia == 36 || ia == 37 || ia == 38 || ia == 39) ib = 0;
chc(ia, ib);
blsta[ia - 1] = ib;
blhit[ia - 1] = ib;
}
blclr = 4;
}
if (round == 4) {
for (ia = 1; ia <= 40; ia++) {
ib = 4;
if (ia == 1 || ia == 2 || ia == 3 || ia == 6 || ia == 7 || ia == 8 || ia == 9 || ia == 16 || ia == 17 || ia == 20 || ia == 21 || ia == 24 || ia == 25 || ia == 32 || ia == 33 || ia == 35 || ia == 38 || ia == 40) ib = 8;
if (ia == 4 || ia == 5 || ia == 11 || ia == 14 || ia == 18 || ia == 23) ib = 3;
if (ia == 12 || ia == 13 || ia == 19 || ia == 22 || ia == 26 || ia == 31) ib = 2;
if (ia == 27 || ia == 30) ib = 1;
if (ia == 28 || ia == 29 || ia == 34 || ia == 36 || ia == 37 || ia == 39) ib = 0;
chc(ia, ib);
blsta[ia - 1] = ib;
blhit[ia - 1] = ib;
}
blclr = 18;
}
if (round == 5) {
for (ia = 1; ia <= 40; ia++) {
ib = 1;
if (ia == 1 || ia == 2 || ia == 3 || ia == 6 || ia == 7 || ia == 8 || ia == 10 || ia == 15 || ia == 18 || ia == 23 || ia == 26 || ia == 31 || ia == 33 || ia == 34 || ia == 35 || ia == 38 || ia == 39 || ia == 40) ib = 8;
chc(ia, ib);
blsta[ia - 1] = ib;
blhit[ia - 1] = ib;
}
blclr = 18;
}
if (round == 6) {
for (ia = 1; ia <= 40; ia++) {
ib = 4;
if (ia == 1 || ia == 3 || ia == 5 || ia == 7 || ia == 16 || ia == 17 || ia == 32 || ia == 33 || ia == 35 || ia == 37 || ia == 39) ib = 8;
if (ia == 4 || ia == 20 || ia == 36 || ia == 13 || ia == 29) ib = 3;
if (ia == 11 || ia == 27 || ia == 6 || ia == 22 || ia == 38) ib = 2;
if (ia == 2 || ia == 18 || ia == 34 || ia == 15 || ia == 31) ib = 1;
if (ia == 9 || ia == 25 || ia == 8 || ia == 24 || ia == 40) ib = 0;
chc(ia, ib);
blsta[ia - 1] = ib;
blhit[ia - 1] = ib;
}
blclr = 11;
}
if (round == 7) {
for (ia = 1; ia <= 40; ia++) {
ib = 4;
if (ia == 1 || ia == 8) ib = 6;
if (ia == 9 || ia == 16 || ia == 18 || ia == 23 || ia == 27 || ia == 30 || ia == 36 || ia == 37) ib = 3;
if (ia == 10 || ia == 15 || ia == 19 || ia == 22 || ia == 28 || ia == 29) ib = 2;
if (ia == 2 || ia == 7 || ia == 11 || ia == 14 || ia == 20 || ia == 21) ib = 1;
if (ia == 3 || ia == 4 || ia == 5 || ia == 6 || ia == 12 || ia == 13) ib = 0;
chc(ia, ib);
blsta[ia - 1] = ib;
blhit[ia - 1] = ib;
}
blclr = 2;
}
if (round == 8) {
for (ia = 1; ia <= 40; ia++) {
ib = 4;
if (ia == 1 || ia == 8 || ia == 33 || ia == 40) ib = 6;
if (ia == 12 || ia == 13 || ia == 19 || ia == 22 || ia == 28 || ia == 29) ib = 3;
if (ia == 4 || ia == 5 || ia == 11 || ia == 14 || ia == 18 || ia == 23 || ia == 27 || ia == 30 || ia == 36 || ia == 37) ib = 2;
if (ia == 3 || ia == 10 || ia == 17 || ia == 6 || ia == 15 || ia == 24 || ia == 26 || ia == 35 || ia == 31 || ia == 38) ib = 1;
if (ia == 2 || ia == 9 || ia == 7 || ia == 16 || ia == 25 || ia == 34 || ia == 32 || ia == 39) ib = 0;
chc(ia, ib);
blsta[ia - 1] = ib;
blhit[ia - 1] = ib;
}
blclr = 4;
armageddontime = armageddontime * 2;
}
if (round == 9) {
for (ia = 1; ia <= 40; ia++) {
ib = 4;
if (ia == 20 || ia == 21) ib = 7;
if (ia == 2 || ia == 3 || ia == 6 || ia == 7 || ia == 9 || ia == 16 || ia == 18 || ia == 23 || ia == 25 || ia == 32 || ia == 34 || ia == 35 || ia == 38 || ia == 39) ib = 3;
if (ia == 12 || ia == 13 || ia == 19 || ia == 22 || ia == 28 || ia == 29) ib = 2;
if (ia == 1 || ia == 8 || ia == 10 || ia == 11 || ia == 14 || ia == 15 || ia == 26 || ia == 27 || ia == 30 || ia == 31 || ia == 33 || ia == 40) ib = 0;
chc(ia, ib);
blsta[ia - 1] = ib;
blhit[ia - 1] = ib;
}
blclr = 2;
armageddon = false;
lastlevel = true;
}
if (round == 0){
for (ib = 0; ib < 5; ib++) {
for (ia = 0; ia < 8; ia++) {
chc(40 - (ib * 8 + ia), ib);
blsta[39 - (ib * 8 + ia)] = ib;
blhit[39 - (ib * 8 + ia)] = ib;
}
}
}
}
document.getElementById('BL').innerHTML = ballN - 1;
document.getElementById('starter').style.display = 'none';
gameFLG = 1;
loadFLG = 1;
ballX = 209;
ballY = 270;
ballDX =- 8;
ballDY =- 8;
tmpRL = 193;
missFLG = 0;
if (armageddon) {
document.getElementById('TM').style.color = '#FF0000';
tmptim = armageddontime - tim;
}
else document.getElementById('TM').style.color = '#FFFFFF';
timerid = setTimeout('mainF()', INT);
counterid = setTimeout('playcount()', 1000);
}

function SUP() {
if (INT >= 15) {
INT = INT-10;
var speednum=INT + 5;
speednum=speednum/10;
speednum=11-speednum;
document.getElementById('speed'+speednum.toString()).style.backgroundColor = '#003399';
}
}

function SDN() {
if (INT <= 95) {
INT = INT+10;
var speednum=INT + 5;
speednum=speednum/10;
speednum=12-speednum;
document.getElementById('speed'+speednum.toString()).style.backgroundColor = '#666666';
}
}

function setSpeed(spd) {
INT = 105 - (10 * spd);
if (spd == 0) {
for (speednum=1;speednum<=10;speednum++) {
document.getElementById('speed'+speednum.toString()).style.backgroundColor = '#666666';
}
}
else if (spd == 10) {
for (speednum=1;speednum<=10;speednum++) {
document.getElementById('speed'+speednum.toString()).style.backgroundColor = '#003399';
}
}
else {
for (speednum=1;speednum<=spd;speednum++) {
document.getElementById('speed'+speednum.toString()).style.backgroundColor = '#003399';
}
for (speednum=spd+1;speednum<=10;speednum++) {
document.getElementById('speed'+speednum.toString()).style.backgroundColor = '#666666';
}
}
}

function PAUSE() {
tmpFLG = 1;
if (gameFLG == 1) {
document.getElementById('paumes').style.display = '';
}
gameFLG = 0;
}

function RESUME() {
stopreel();
tmpFLG = 0;
if (gameFLG == 0) {
if (playcountpaused) counterid = setTimeout('playcount()', 1000);
document.getElementById('paumes').style.display = 'none';
playcountpaused = false;
gameFLG = 1;
}
}

function mouseMv() {
if (!demomode && !tilt) {
if (loadFLG == 1) {
tmpRL = X - 20;
if (tmpRL < 16) { tmpRL = 16; }
if (tmpRL > 370) { tmpRL = 370; }
   }
}
}

function outCHK() {
if (ballX < 16){ ballX = 32 - ballX; ballDX = -ballDX; }
if (ballX > 401){ ballX = 802 - ballX; ballDX = -ballDX; }
if (ballY < 16){ ballY = 32 - ballY; ballDY = -ballDY; }
if (ballY >= 272) {
if (missFLG == 0) {
tmpX = (ballDX / ballDY) * (272 - ballY) + ballX;
if (tmpX >= tmpRL - 11) {
if (tmpX <= tmpRL + 45) {
ballY = 272;
ballDY = -ballDY;
combo = 1;
waitScr = waitScr + tmpScr;
realscore = realscore + tmpScr;
if (waitScr > 0) document.getElementById('showwaitscore').innerHTML = '+ ' + waitScr;
tmpScr = 0;
document.getElementById('showtempscore').innerHTML = '+ 0';
document.getElementById('showtempscore').style.color = '#555555';
if (waitFLG == 0) {
waitFLG = 1;
waitid = setTimeout('addScore()', 1000);
}
ballX = tmpX;
ballRD = tmpX - tmpRL;
with (Math){ ballDX = 8 * abs(ballDX) / ballDX; }
if (ballRD <= -7) { ballDX = -16; }
else if (ballRD <= -3) { ballDX = -12; }
else if (ballRD <= 1) { ballDX = -10; }
else if (ballRD <= 5) { ballDX = -8; }
else if (ballRD <= 9) { ballDX = -6; }
else if (ballRD <= 13) { ballDX = -4; }
else if (ballRD <= 17) { ballDX = -2; }
else if (ballRD <= 21) { ballDX = 2; }
else if (ballRD <= 25) { ballDX = 4; }
else if (ballRD <= 29) { ballDX = 6; }
else if (ballRD <= 33) { ballDX = 8; }
else if (ballRD <= 37) { ballDX = 10; }
else if (ballRD <= 41) { ballDX = 12; }
else if (ballRD <= 45) { ballDX = 16; }
   }
}
if (ballDY > 0){ missFLG = 1; }
} else {
if (ballY > 290){
missFLG = 0;
ballN = ballN - 1;
combo = 1;
if (tmpScr > 0) document.getElementById('showtempscore').style.color = '#FF0000';
tmpScr = 0;
gameEnd(); 
}
      }
   }
}

function addScore() {
clearTimeout(waitid);
if (waitScr >= 100) {
score = score + 100;
waitScr = waitScr - 100;
document.getElementById('showwaitscore').innerHTML = '+ ' + waitScr;
}
else {
score = score + waitScr;
waitScr = 0;
}
if (waitScr == 0) document.getElementById('showwaitscore').innerHTML = '';
document.getElementById('showscore').innerHTML = score;
if (waitScr > 0) waitid = setTimeout('addScore()', 50);
else waitFLG = 0;
}

function blkCHK() {
tmpY = ballY + 4;
tmpX = ballX + 4;
if (tmpY >= 48) { 
if (tmpY <= 147) {
if (tmpX >= 29) {
if (tmpX <= 396) {
with (Math) {
ia = floor((tmpX - 29) / 46);
ib = floor((tmpY - 48) / 20);
ic = ib * 8 + ia;
}
if (blsta[ic] != 5) {
tmpbc = blsta[ic];
if (tmpbc == 6) {
ic = Math.floor(Math.random() * 8) + 33;
if (ic > 40) ic = 40;
if (blsta[ic - 1] == 5) blclr--;
if (blsta[ic - 1] <= 5) blsta[ic - 1] = blsta[ic - 1] - 1;
if (blsta[ic - 1] < 0) blsta[ic - 1] = 0;
chc(ic, blsta[ic - 1]);
}
else if (tmpbc == 7) {
ic = Math.floor(Math.random() * 8) + 33;
if (ic > 40) ic = 40;
if (blsta[ic - 1] == 5) blclr--;
if (blsta[ic - 1] <= 5) blsta[ic - 1] = blsta[ic - 1] - 2;
if (blsta[ic - 1] < 0) blsta[ic - 1] = 0;
chc(ic, blsta[ic - 1]);
}
else if (tmpbc <= 5) {
if (blhit[ic] < 5) {
tmpScr = tmpScr + (10 * combo * level);
document.getElementById('showtempscore').innerHTML = '+ ' + tmpScr;
document.getElementById('showtempscore').style.color = '#FFFFFF';
blhit[ic]++;
combo++;
}
tmpbc = blsta[ic] + 1;
blsta[ic] = tmpbc;
chc(ic + 1, tmpbc);
}
if (tmpbc == 5){ blclr = blclr + 1; }
if (blclr >= 40) {
combo = 1;
tmpScr = tmpScr * 10;
tbonus = (250 - tim) * 100;
if (tbonus < 0) tbonus = 0;
bonus = 5000 * level;
if (lastlevel) bonus = bonus + (50000 * level);
document.getElementById('showtempscore').innerHTML = '+ ' + tmpScr;
document.getElementById('timmes').innerHTML = 'Time Bonus + ' + tbonus;
if (tbonus > 0) document.getElementById('timmes').style.display = '';
if (lastlevel) document.getElementById('clrmes').innerHTML = 'All Levels Clear Bonus + ' + bonus;
else document.getElementById('clrmes').innerHTML = 'Level Clear Bonus + ' + bonus;
waitScr = waitScr + tmpScr + bonus + tbonus;
realscore = realscore + tmpScr + bonus + tbonus;
tmpScr = 0;
bonus = 0;
tbonus = 0;
document.getElementById('showtempscore').style.color = '#44CC44';
if (waitFLG == 0) {
waitFLG = 1;
waitid = setTimeout('addScore()', 1000);
}
gameEnd();
}
if (ballDX > 0) {
iy=(ballDY / ballDX) * (29 + 46 * ia - tmpX) + tmpY;
if (iy > 48 + 20 * ib + 18) {
tmpY1 = 48 + 20 * ib + 18;
tmpX1 = (ballDX / ballDY) * (48 + 20 * ib + 18 - tmpY) + tmpX;
ballX = tmpX1 - 4;
ballY = tmpY1 - 4;
ballDY = -ballDY;
} else {
if (iy < 44 + 20 * ib) {
tmpY1 = 48 + 20 * ib;
tmpX1 = (ballDX / ballDY) * (48 + 20 * ib - tmpY) + tmpX;
ballX = tmpX1 - 4;
ballY = tmpY1 - 4;
ballDY = -ballDY;
} else {
tmpX1 = 29 + 46 * ia;
tmpY1 = (ballDY / ballDX) * (29 + 46 * ia - tmpX) + tmpY;
ballX = tmpX1 - 4;
ballY = tmpY1 - 4;
ballDX = -ballDX;
      }
   }
} else {
iy = (ballDY / ballDX) * (29+46 * ia + 44 - tmpX) + tmpY;
if (iy > 48 + 20 * ib + 18) {
tmpY1 = 48 + 20 * ib + 18;
tmpX1 = (ballDX / ballDY) * (48 + 20 * ib + 18 - tmpY) + tmpX;
ballX = tmpX1 - 4;
ballY = tmpY1 - 4;
ballDY = -ballDY;
} else {
if (iy < 44 + 20 * ib) {
tmpY1 = 48 + 20 * ib;
tmpX1 = (ballDX / ballDY) * (48 + 20 * ib - tmpY) + tmpX;
ballX = tmpX1 - 4;
ballY = tmpY1 - 4;
ballDY = -ballDY;
} else {
tmpX1 = 29+46 * ia + 44;
tmpY1 = (ballDY / ballDX) * (29 + 46 * ia + 44 - tmpX) + tmpY;
ballX = tmpX1 - 4;
ballY = tmpY1 - 4;
ballDX = -ballDX;
      }
   }
}
      }
   }
}
      }
   }
}

function gameEnd() {
document.getElementById('BL').innerHTML = ballN;
gameFLG = 0;
loadFLG = 0;
if (blclr >= 40) {
document.getElementById('clrmes').style.display = '';
document.getElementById('tltmes').style.display = 'none';
if (lastlevel) {
if (!demomode && realscore > topscore) {
document.getElementById('hiddenscore').innerHTML = '<input type="hidden" name="playerscore" value="' + realscore + '" />';
document.getElementById('highscore').style.display = '';
document.getElementById('inits').focus();
}
else document.getElementById('resetgame').style.display  =  '';
document.getElementById('labelspan').innerHTML = '- Congratulations! All Levels Cleared -';
}
else {
round++;
document.getElementById('starter').style.display  =  '';
document.getElementById('labelspan').innerHTML = '- Next Level: ' + levelname[round - 1] + ' -';
if (demomode) demoid = setTimeout('autoStart()',3000);
}
}
else if (ballN <= 0) {
if (!demomode && realscore > topscore) {
document.getElementById('hiddenscore').innerHTML = '<input type="hidden" name="playerscore" value="' + realscore + '" />';
document.getElementById('highscore').style.display = '';
document.getElementById('inits').focus();
}
else document.getElementById('resetgame').style.display  =  '';
document.getElementById('tltmes').style.display = 'none';
document.getElementById('ovrmes').style.display = '';
document.getElementById('labelspan').innerHTML = '- Break-out - Try to Beat the High Score -';
}
else  {
document.getElementById('starter').style.display  =  '';
if (demomode) demoid = setTimeout('autoStart()',3000);
}
}

function onLD() {
blclr = 0;
tim = 0;
ballN = 0;
tmptim = tim;
for (ib = 0; ib < 5; ib++) {
for (ia = 0; ia < 8; ia++) {
chc(ib * 8 + ia +1, ib);
blsta[ib * 8 + ia] = ib;
blhit[ib * 8 + ia] = ib;
}
}

lastlevel = false;
armageddon = false;
round = 1;
document.getElementById('BL').innerHTML = ballN;
document.getElementById('labelspan').innerHTML = '- Break-out (Level 1) -';
}

function chc(bno,bcl) {
tmpbno = 'b' + (bno-1).toString();
document.getElementById(tmpbno).style.backgroundColor = blcol[bcl];
}

function rules() {
if (gameFLG == 1) {
PAUSE();
}
if (document.getElementById('frame1splash').style.display == '') tmpSplash = true;
document.getElementById('frame1rules').style.display = (document.getElementById('frame1rules').style.display == 'none') ? '' : 'none';
if (!showSplash) {
document.getElementById('frame1content').style.display = (document.getElementById('frame1rules').style.display == 'none') ? '' : 'none';
document.getElementById('frame1splash').style.display = 'none';
}
else {
tmpSplash = false
showSplash = false;
document.getElementById('frame1splash').style.display = (document.getElementById('frame1rules').style.display == 'none') ? '' : 'none';
document.getElementById('frame1content').style.display = 'none';
}
document.getElementById('frame1encyclopedia').style.display = 'none';
document.getElementById('frame1browserinfo').style.display = 'none';
document.getElementById('frame1setashome').style.display = 'none';
replaceContent();
if (document.getElementById('frame1rules').style.display == 'none' && tmpFLG == 1) {
RESUME();
mainF();
}
if (tmpSplash) showSplash = true;
}

function switchit() {
if (demomode) splash();
else {
if (tmpFLG == 1) {
RESUME();
mainF();
}
else if (gameFLG == 1) {
PAUSE();
}
}
}

function checkPress(keyPress) {
key = (NS) ? keyPress.which : window.event.keyCode;
if (key == 114) {
if (tmpFLG == 1) {
RESUME();
mainF();
}
}
if (key == 112) {
if (gameFLG == 1) {
PAUSE();
}
}
if (key == 115) {
if (document.getElementById('starter').style.display  ==  '') initG();
}
if (key == 117) SUP();
if (key == 100) SDN();
if (key == 98) bump();
if (key == 32) bump();
if (key == 46) moveRight();
if (key == 44) moveLeft();
}

function bump() {
if (gameFLG == 1 && !demomode && !tilt) {
bumpcount++;
if (combo > 1) {
tmpScr = tmpScr - (10 * (combo - 1) * level);
document.getElementById('showtempscore').innerHTML = '+ ' + tmpScr;
if (tmpScr == 0) document.getElementById('showtempscore').style.color = '#555555';
combo--;
}
if (bumpcount <= 1) {
if (Math.random() > 0.5) ballDX = ballDX + 3;
else ballDX = ballDX - 3;
if (ballDX > 16) ballDX = 16;
if (ballDX < -16) ballDX = -16;
}
else {
tilt = true;
document.getElementById('tltmes').style.display = '';
document.getElementById('racket').style.backgroundColor = '#FF0000';
}
}
}

function moveRight() {
X += 10;
mouseMv();
}

function moveLeft() {
X -= 10;
mouseMv();
}

function setLevel(lvl) {
level = lvl;
stopreel();
onLD();
document.getElementById('ball').style.top  =  '270px';
document.getElementById('ball').style.left  =  '209px';
document.getElementById('racket').style.left  =  '193px';
if (level==1) {
document.getElementById('showdifficulty').innerHTML = 'Easy';
ballN = 5;
armageddon = false;
}
if (level==2) {
document.getElementById('showdifficulty').innerHTML = 'Normal';
ballN = 3;
armageddon = true;
armageddontime = 250;
}
if (level==3) {
document.getElementById('showdifficulty').innerHTML = 'Hard';
ballN = 1;
armageddon = true;
armageddontime = 200;
}
if (level==4) {
document.getElementById('showdifficulty').innerHTML = 'Impossible';
ballN = 1;
armageddon = true;
armageddontime = 150;
}
if (armageddon) {
document.getElementById('TM').style.color = '#FF0000';
tmptim = armageddontime - tim;
}
else document.getElementById('TM').style.color = '#FFFFFF';
document.getElementById('TM').innerHTML = tmptim;
document.getElementById('BL').innerHTML = ballN;
document.getElementById('frame1splash').style.display  =  'none';
document.getElementById('frame1content').style.display  =  '';
replaceContent();
if (screen.height <= 600) window.location = 'break-out.php#play';
}

function splash() {
gameFLG = 0;
clearTimeout(counterid);
clearTimeout(timerid);
clearTimeout(waitid);
clearTimeout(demoid);
clearTimeout(flashid);
demomode = false;
score = 0;
waitScr = 0;
realscore = 0;
tmpScr = 0;
bonus = 0;
tbonus = 0;
combo = 1;
bumpcount = 0;
tilt = false;
count = 0;
loadFLG = 0;
tmpFLG = 0;
waitFLG = 0;
playcountpaused = false;
onLD();
document.getElementById('showwaitscore').innerHTML = '';
document.getElementById('showscore').innerHTML = score;
document.getElementById('showtempscore').style.color = '#555555';
document.getElementById('showtempscore').innerHTML = '+ 0';
document.getElementById('showdifficulty').innerHTML = 'Choose It';
document.getElementById('demmes').style.display = 'none';
document.getElementById('tltmes').style.display = 'none';
document.getElementById('racket').style.backgroundColor = '#FFFFFF';
document.getElementById('hiddenscore').innerHTML = '';
document.getElementById('highscore').style.display = 'none';
document.getElementById('timmes').style.display = 'none';
document.getElementById('resetgame').style.display = 'none';
document.getElementById('starter').style.display = '';
document.getElementById('TM').style.color = '#FFFFFF';
document.getElementById('TM').innerHTML = tim;
document.getElementById('clrmes').style.display = 'none';
document.getElementById('ovrmes').style.display = 'none';
document.getElementById('paumes').style.display = 'none';
document.getElementById('frame1encyclopedia').style.display = 'none';
document.getElementById('frame1browserinfo').style.display = 'none';
document.getElementById('frame1setashome').style.display = 'none';
document.getElementById('frame1rules').style.display = 'none';
document.getElementById('frame1content').style.display = 'none';
document.getElementById('frame1splash').style.display = '';
replaceContent();
}

function demo() {
demomode = true;
tmplvl = Math.floor(Math.random() * 4) + 1;
if (tmplvl > 4) tmplvl = 4;
setLevel(tmplvl);
demoid = setTimeout('autoStart()',3000);
flashid = setTimeout('flashDemo()',1000);
}

function autoStart() {
clearTimeout(demoid);
if (gameFLG == 0 && document.getElementById('frame1content').style.display  ==  '') initG();
}

function flashDemo() {
clearTimeout(flashid);
document.getElementById('demmes').style.display = (document.getElementById('demmes').style.display == '') ? 'none' : '';
flashid = setTimeout('flashDemo()',1000);
}
