n = (document.layers) ? 1:0
ie = (document.all) ? 1:0

img = new Array("blank","blue","lblue","red","orange","green","yellow","purple","grey","blank","sblue","slblue","sred","sorange","sgreen","syellow","spurple")
for (var i=0;i<img.length;i++) {
eval(img[i]+"=new Image()")
eval(img[i]+".src='"+img[i]+".gif'")
eval("s"+img[i]+"=new Image()")
eval("s"+img[i]+".src='s"+img[i]+".gif'")
}

b = new Array()
for (var i=0;i<=25;i++) {
	b[i] = new Array()
	for (var j=0;j<16;j++) {
		b[i][j] = 0
	}
}
for (var i=0;i<=25;i++) {
	b[i][0] = 1
	b[i][1] = 1
	b[i][14] = 1
	b[i][15] = 1
}
for (var j=0;j<=15;j++) {
	b[0][j] = 1
	b[1][j] = 1
	b[23][j] = 1
	b[24][j] = 1
	b[25][j] = 1
}

shape = new Array()
shapenew = new Array()
for (var i=0;i<=3;i++) {
	shape[i] = new Array
	shapenew[i] = new Array
	for (var j=0;j<=3;j++) {
		shape[i][j] = 0
		shapenew[i][j] = 0
	}
}
shape.type = 1
shape.color = lblue
nextshape = Math.ceil(9*Math.random())
if (nextshape==1) nextshapecolor = "lblue"
else if (nextshape==2) nextshapecolor = "blue"
else if (nextshape==3) nextshapecolor = "yellow"
else if (nextshape==4) nextshapecolor = "orange"
else if (nextshape==5 || nextshape==6) nextshapecolor = "purple"
else if (nextshape==7 || nextshape==8) nextshapecolor = "green"
else if (nextshape==9) nextshapecolor = "red"

leftactive = 0
rightactive = 0
score = 0

function init() {
	board = new dynLayer("boardDiv","boardAreaDiv")
	pc = new dynLayer("pcDiv","boardAreaDiv")
	pc.xp = Math.floor(pc.x/15)+2
	pc.yp = Math.floor(pc.y/15)+4
	nextpc = new dynLayer("nextpcDiv","nextpcArea")
	changePiece()
	shownon("links")
	document.onkeydown = keyDown
	document.onkeyup = keyUp
	if (n) document.captureEvents(Event.KEYDOWN | Event.KEYUP)
}

gameplaying = 0
function startGame() {
	if (!gameplaying) {
	gameplaying = 1
	playMusic1()
	pc.show()
	nextpc.show()
	downactive = 1
	down()
	}
}

function stopGame() {
	if (gameplaying) {
	gameplaying = 0
	snapXactive = 0
	snapYactive = 0
	leftactive = 0
	rightactive = 0
	downactive = 0
	plantactive = 0
	planted = 0
	lefthold = 0
	righthold = 0
	leftpause = 0
	rightpause = 0
	pc.hide()
	nextpc.hide()
	xsnapped = 1
	ysnapped = 1
	level = 0
	levelSpeed()
	lines = 0
	score = 0
	displayScore()
	pc.x = 60
	pc.css.left = pc.x
	pc.y = -30
	pc.css.top = pc.y
	pc.xp = Math.floor(pc.x/15)+2
	pc.yp = Math.floor(pc.y/15)+4
	stopMusic()
	if (topmost<22) {
	for (var i=2;i<=22;i++) {
		for (var j=2;j<=13;j++) {
			b[i][j] = 0
			eval("board.ref.images['b"+i+"_"+j+"'].src = grey.src")
		}
	}
	}
	topmost = 22
	for (var i=0;i<=3;i++) {
		for (var j=0;j<=2;j++) {
			shape[i][j] = 0
			pc.ref.images['pc'+i+'_'+j].src = blank.src
			nextpc.ref.images['nextpc'+i+'_'+j].src = blank.src
		}
	}
	changePiece()
	if (startagain) {
		setTimeout("startGame()",500)
	}
	else {
	}
	}
}

function quitGame() {
	if (gameplaying) {
	if (confirm("Do you want to play again?")) startagain = 1
	else startagain = 0
	stopGame()
	}
}

level = 0
lines = 0
direction = 'left'
function keyDown(e) {
	if (n) var nKey = e.which
	if (ie) var ieKey = window.event.keyCode
	if (nKey==52 || nKey==98 || ieKey==100 || ieKey==66) { // 4 or b
		lefthold = 1
		if (!leftpause && !leftactive) {
		snapXactive = 0
		rightactive = 0
		leftactive = 1
		direction = 'left'
		pc.xp = Math.floor((pc.x)/15)+2
		left()
		}
	}
	else if (nKey==53 || nKey==110 || ieKey==101 || ieKey==78) { // 5 or n
		levelSpeedUp()
	}
	else if (nKey==54 || nKey==109 || ieKey==102 || ieKey==77) { // 6 or m
		righthold = 1
		if (!rightpause && !rightactive) {
		snapXactive = 0
		leftactive = 0
		rightactive = 1
		direction = 'right'
		pc.xp = Math.ceil((pc.x)/15)+2
		right()
		}
	}
	else if (nKey==99 || ieKey==67) rotatePiece('left') // c
	else if (nKey==118 || nKey==32 || nKey==48 || ieKey==86 || ieKey==32 || ieKey==96) rotatePiece('right') // space or v or space or 0
	else if (nKey==113 || ieKey==81) {  //Q
		quitGame()
	}
}

lefthold = 0
leftactive = 0
leftpause = 0
righthold = 0
rightactive = 0
rightpause = 0
function keyUp(e) {
	if (n) var nKey = e.which
	if (ie) var ieKey = window.event.keyCode
	if (nKey==52 || nKey==98 || ieKey==100 || ieKey==66) { // 4 or b
		lefthold = 0
		if (!leftpause) {
		leftactive = 0
		if (righthold && !rightactive) {
			snapXactive = 0
			rightactive = 1
			direction = 'right'
			pc.xp = Math.ceil((pc.x)/15)+2
			right()
		}
		else {
			if (!xsnapped && !snapXactive) {
				snapXactive = 1
				snapX(-5)
			}
		}
		}
	}
	else if (nKey==53 || nKey==110 || ieKey==101 || ieKey==78) { // 5 or n
		levelSpeed()
	}
	else if (nKey==54 || nKey==109 || ieKey==102 || ieKey==77) { // 6 or m
		righthold = 0
		if (!rightpause) {
		rightactive = 0
		if (lefthold && !leftactive) {
			snapXactive = 0
			leftactive = 1
			direction = 'left'
			pc.xp = Math.floor((pc.x)/15)+2
			left()
		}
		else {
			if (!xsnapped && !snapXactive) {
				snapXactive = 1
				snapX(5)
			}
		}
		}
	}
}

function levelSpeed() {
	if (level==0) {yinc=5;yspeed=240;xinc=5;xspeed=50}
	else if (level==1) {yinc=5;yspeed=220;xinc=5;xspeed=50}
	else if (level==2) {yinc=5;yspeed=200;xinc=5;xspeed=45}
	else if (level==3) {yinc=5;yspeed=180;xinc=5;xspeed=45}
	else if (level==4) {yinc=5;yspeed=160;xinc=5;xspeed=40}
	else if (level==5) {yinc=5;yspeed=140;xinc=5;xspeed=40}
	else if (level==6) {yinc=5;yspeed=120;xinc=5;xspeed=35}
	else if (level==7) {yinc=5;yspeed=100;xinc=5;xspeed=35}
	else if (level==8) {yinc=5;yspeed=80;xinc=5;xspeed=30}
	else if (level==9) {yinc=5;yspeed=60;xinc=5;xspeed=25}
	else if (level==10) {yinc=5;yspeed=40;xinc=5;xspeed=20}
	else if (level==11) {yinc=5;yspeed=20;xinc=5;xspeed=15}
	else if (level==12) {yinc=5;yspeed=10;xinc=5;xspeed=10}
	else if (level==13) {yinc=15;yspeed=100;xinc=15;xspeed=120}
	else if (level==14) {yinc=15;yspeed=90;xinc=15;xspeed=100}
	else if (level==15) {yinc=15;yspeed=80;xinc=15;xspeed=80}
	else if (level==16) {yinc=15;yspeed=70;xinc=15;xspeed=60}
	else if (level==17) {yinc=15;yspeed=60;xinc=15;xspeed=50}
	else if (level==18) {yinc=15;yspeed=50;xinc=15;xspeed=40}
	else if (level==19) {yinc=15;yspeed=40;xinc=15;xspeed=25}
	else if (level==20) {yinc=15;yspeed=35;xinc=15;xspeed=10}
	else if (level==21) {yinc=15;yspeed=30;xinc=15}
	else if (level==22) {yinc=15;yspeed=25;xinc=15}
	else if (level==23) {yinc=15;yspeed=20;xinc=15}
	else if (level==24) {yinc=15;yspeed=15;xinc=15}
	else if (level==25) {yinc=15;yspeed=10;xinc=15}
}
function levelSpeedUp() {
	if (level==0) {yinc=10;yspeed=50}
	else if (level==1) {yinc=10;yspeed=40}
	else if (level==2) {yinc=10;yspeed=30}
	else if (level==3) {yinc=10;yspeed=20}
	else if (level==4) {yinc=10;yspeed=10}
	else if (level==5) {yinc=15;yspeed=70}
	else if (level==6) {yinc=15;yspeed=65}
	else if (level==7) {yinc=15;yspeed=60}
	else if (level==8) {yinc=15;yspeed=55}
	else if (level==9) {yinc=15;yspeed=50}
	else if (level==10) {yinc=15;yspeed=45}
	else if (level==11) {yinc=15;yspeed=40}
	else if (level==12) {yinc=15;yspeed=35}
	else if (level==13) {yinc=15;yspeed=30}
	else if (level==14) {yinc=15;yspeed=20}
	else if (level>=15) {yinc=15;yspeed=10}
}

yinc=5
yspeed=240
xinc=5
xspeed=36

xsnapped = 1
ysnapped = 1
function move(inc) {
	if (inc < 0) pc.xp = Math.floor((pc.x+inc)/15)+2
	else pc.xp = Math.ceil((pc.x+inc)/15)+2
	pc.x += inc
	pc.css.left = pc.x
	if (pc.x/15==Math.floor(pc.x/15)) xsnapped = 1
	else xsnapped = 0
}

function left() {
	if (leftactive) {
		if ((check(shape,-1,0) && (ysnapped || (!ysnapped && check(shape,-1,1))))  ) {
			move(-1*xinc)
			cancelPlant()
		}
		else if (!xsnapped && !snapXactive) {
			snapXactive = 1
			snapX(-5)
		}
		if (lefthold) setTimeout("left()",xspeed)
		else leftactive = 0
	}
}

function right() {
	if (rightactive) {
		var xtemp = (xsnapped) ? 1:2
		if ((check(shape,xtemp,0) && (ysnapped || (!ysnapped && check(shape,xtemp,1)))) ) {
			move(xinc)
			cancelPlant()
		}
		else if (!xsnapped && !snapXactive) {
			snapXactive = 1
			snapX(5)
		}
		if (righthold) setTimeout("right()",xspeed)
		else rightactive = 0
	}
}

snapXactive = 0
function snapX(inc) {
	if (snapXactive && !xsnapped) {
		move(inc)
		setTimeout("snapX("+inc+")",20)
	}
	else {
		snapXactive = 0
		cancelPlant()
	}
}

snapYactive = 0
function snapY() {
	if (snapYactive && !ysnapped) {
		pc.yp = Math.floor((pc.y+5)/15)+4
		pc.y += 5
		pc.css.top = pc.y
		if (pc.y/15==Math.floor(pc.y/15)) ysnapped = 1
		else {
			ysnapped = 0
			setTimeout("snapY()",20)
		}
	}
	else {
		snapYactive = 0
	}
}

downactive = 0
plantactive = 0
planted = 0
dcount=0
function down() {
	if (downactive) {
		if (ysnapped) var vert = 1
		else var vert = 2
		if ((xsnapped && check(shape,0,vert)) || (!xsnapped && check(shape,0,vert) && (direction=='left'&&check(shape,1,vert) || (direction=='right'&&check(shape,-1,vert)) ) ) ) {
			pc.yp = Math.floor((pc.y+yinc)/15)+4
			pc.y += yinc
			pc.css.top = pc.y
			if (pc.y/15==Math.floor(pc.y/15)) ysnapped = 1
			else ysnapped = 0
			setTimeout("down()",yspeed)
		}
		else if (!plantactive && !planted) {
			snapYactive = 1
			snapY()
			xinc = 5
			downactive = 0
			plantactive = 1
			planttimer = setTimeout("checkPlantPiece()",250)
		}
		else downactive = 0
	}
}

function cancelPlant() {
	if (plantactive && !downactive && xsnapped && check(shape,0,1)) {
		clearTimeout(planttimer)
		if (level>=8 && level<=17) xinc = 10
		if (level>=18) xinc = 15
		plantactive = 0
		downactive = 1
		down()
	}
}

function checkPlantPiece() {
	downactive = 0
	setTimeout("plantPiece()",Math.max(xspeed,yspeed))
}

topmost = 22
function plantPiece() {
	if (check(shape,0,1)) {
		plantactive = 0
		downactive = 1
		down()
	}
	else {
	planted = 1
	leftactive = 0
	rightactive = 0
	leftpause = 1
	rightpause = 1
	plantactive = 0

	for (var i=0;i<=3;i++)
	for (var j=0;j<=3;j++)
	if (shape[i][j]) {
		b[pc.yp+i][pc.xp+j] = 1
		board.ref.images["b"+(pc.yp+i)+"_"+(pc.xp+j)].src = shape.color.src
	}

	var pieceline = (shape.type==9) ? 1:0

	pc.yp = Math.floor(pc.y/15)+4
	topmost = Math.min(topmost,pc.yp)

	line0 = 0
	for (var j=2;j<=13;j++) if (b[pc.yp][j]) line0++
	line0 = (line0==12) ? 1:0

	line1 = 0
	for (var j=2;j<=13;j++) if (b[pc.yp+1][j]) line1++
	line1 = (line1==12) ? 1:0

	line2 = 0
	if (pc.yp <= 20) {
	for (var j=2;j<=13;j++) if (b[pc.yp+2][j]) line2++
	line2 = (line2==12) ? 1:0
	}

	line3 = 0
	if (pieceline && pc.yp <= 19) {
	for (var j=2;j<=13;j++) if (b[pc.yp+3][j]) line3++
	line3 = (line3==12) ? 1:0
	}

	pc.hide()
	changePiece()
	
	newscore = line0+line1+line2+line3
	if (newscore==1) score+=100
	else if (newscore==2) score+=250
	else if (newscore==3) score+=400
	else if (newscore==4) score+=1000
	
	if (n && newscore==4) shake()
	else clearPiece()
	}
}

function clearPiece() {
	if (newscore==4) {
		for (var i=pc.yp+4;i>=topmost;i--) {
		for (var j=2;j<=13;j++) {
			b[i][j] = b[i-4][j]
			eval("board.ref.images['b"+i+"_"+j+"'].src = board.ref.images['b"+(i-4)+"_"+j+"'].src")
		}
		}
		topmost+=4
	}
	else if (newscore>0) {
		for (var k=0;k<=3;k++) {
			if (eval("line"+k)) {
				for (var i=pc.yp;i>=topmost-3;i--) {
				for (var j=2;j<=13;j++) {
					b[i+k][j] = b[i+k-1][j]
					eval("board.ref.images['b"+(i+k)+"_"+j+"'].src = board.ref.images['b"+(i+k-1)+"_"+j+"'].src")
				}
				}
				topmost+=1
			}
		}
	}

	lines += newscore
	level = Math.floor(lines/10)
	levelSpeed()
	displayScore()
	planted = 0
	setTimeout("nextPiece()",30)
}

function nextPiece() {
	if (topmost<=3) {
		pc.hide()
		if (confirm("Game Over\n\nmöchten Sie noch ein Spiel wagen?")) {
			startagain=1
			stopGame()
		}
		else {
			startagain = 0
			stopGame()
		}
	}
	else {
		pc.x = 60
		pc.css.left = pc.x
		pc.y = -30
		pc.css.top = pc.y
		pc.xp = Math.floor(pc.x/15)+2
		pc.yp = Math.floor(pc.y/15)+4
		leftpause = 0
		rightpause = 0
		pc.show()
		downactive = 1
		down()
		if (lefthold) {leftactive=1;left()}
		if (righthold) {rightactive=1;right()}
	}
}

shakecount = 0
function shake() {
	if (shakecount<=7) {
		if (shakecount==0) window.moveBy(5,0)
		else if (shakecount==1) window.moveBy(-7,6)
		else if (shakecount==2) window.moveBy(7,0)
		else if (shakecount==3) window.moveBy(-5,-6)
		else if (shakecount==4) window.moveBy(7,0)
		else if (shakecount==5) window.moveBy(-5,7)
		else if (shakecount==6) window.moveBy(5,0)
		else if (shakecount==7) window.moveBy(-7,-7)
		shakecount++
		setTimeout("shake()",30)
	}
	else {
		shakecount=0
		setTimeout("clearPiece()",30)
	}
}


function check(piece,x,y) {
	pc.xp = Math.floor(pc.x/15)+2
	pc.yp = Math.floor(pc.y/15)+4
	var stop = 0
	for (var i=0;i<4;i++)
	for (var j=0;j<4;j++)
	if (b[pc.yp+y+j][pc.xp+x+i] && piece[j][i]) {
		stop=1
		break
	}
	if (stop) return false
	else return true
}

function changePiece() {
	for (var i=0;i<=3;i++) {
		for (var j=0;j<=3;j++) {
			shape[i][j] = 0
			pc.ref.images['pc'+i+'_'+j].src = blank.src
			nextpc.ref.images['nextpc'+i+'_'+j].src = blank.src
		}
	}
	shape.type = nextshape
	shape.color = eval(nextshapecolor)

	nextshape = Math.ceil(9*Math.random())
	if (nextshape==1) changeNextPieceImages("lblue",0,0,0,1,0,2,1,0)
	else if (nextshape==2) changeNextPieceImages("blue",0,0,0,1,0,2,1,2)
	else if (nextshape==3) changeNextPieceImages("yellow",0,1,0,2,1,0,1,1)
	else if (nextshape==4) changeNextPieceImages("orange",0,0,0,1,1,1,1,2)
	else if (nextshape==5 || nextshape==6) changeNextPieceImages("purple",0,0,0,1,0,2,1,1)
	else if (nextshape==7 || nextshape==8) changeNextPieceImages("green",0,1,0,2,1,1,1,2)
	else if (nextshape==9) changeNextPieceImages("red",1,0,1,1,1,2,1,3)

	if (shape.type==1) changePieceImages(1,0,1,1,1,2,2,0) // L right
	else if (shape.type==2) changePieceImages(1,0,1,1,1,2,2,2) // L left
	else if (shape.type==3) changePieceImages(0,1,0,2,1,0,1,1) // skew right
	else if (shape.type==4) changePieceImages(0,0,0,1,1,1,1,2) // skew left
	else if (shape.type==5 || shape.type==6) changePieceImages(1,0,1,1,1,2,2,1) // T
	else if (shape.type==7 || shape.type==8) changePieceImages(1,1,1,2,2,1,2,2) // square
	else if (shape.type==9) changePieceImages(1,0,1,1,1,2,1,3) // line
}

function changePieceImages(r1,c1,r2,c2,r3,c3,r4,c4) {
	shape[r1][c1] = 1
	shape[r2][c2] = 1
	shape[r3][c3] = 1
	shape[r4][c4] = 1
	pc.ref.images['pc'+r1+'_'+c1].src = shape.color.src
	pc.ref.images['pc'+r2+'_'+c2].src = shape.color.src
	pc.ref.images['pc'+r3+'_'+c3].src = shape.color.src
	pc.ref.images['pc'+r4+'_'+c4].src = shape.color.src
}

function changeNextPieceImages(color,r1,c1,r2,c2,r3,c3,r4,c4) {
	nextshapecolor = color
	nextpc.ref.images['nextpc'+r1+'_'+c1].src = eval("s"+nextshapecolor+".src")
	nextpc.ref.images['nextpc'+r2+'_'+c2].src = eval("s"+nextshapecolor+".src")
	nextpc.ref.images['nextpc'+r3+'_'+c3].src = eval("s"+nextshapecolor+".src")
	nextpc.ref.images['nextpc'+r4+'_'+c4].src = eval("s"+nextshapecolor+".src")
}

function rotatePiece(direction) {
	if (shape.type!=7 && shape.type!=8) {
	for (var i=0;i<=3;i++) {
		for (var j=0;j<=3;j++) {
			shapenew[i][j] = 0
		}
	}
	if (shape.type <= 6) {
		if (direction=='left') {
			for (var i=0;i<=2;i++)
			for (var j=0;j<=2;j++)
			shapenew[i][j] = shape[j][2-i]
		}
		else {
			for (var i=0;i<=2;i++)
			for (var j=0;j<=2;j++)
			shapenew[j][2-i] = shape[i][j]
		}
	}
	else if (shape.type >= 9) {
		if (direction=='left') {
			for (var i=0;i<=3;i++)
			for (var j=0;j<=3;j++)
			shapenew[i][j] = shape[j][3-i]
		}
		else {
			for (var i=0;i<=3;i++)
			for (var j=0;j<=3;j++)
			shapenew[j][3-i] = shape[i][j]
		}
	}
	if (ysnapped) var vert = 0
	else var vert = 1
	if ((xsnapped && check(shapenew,0,vert)) || (!xsnapped && check(shapenew,0,vert) && (direction=='left'&&check(shapenew,1,vert) || (direction=='right'&&check(shapenew,-1,vert)) ) ) ) {
		for (var i=0;i<=3;i++) {
			for (var j=0;j<=3;j++) {
				shape[i][j] = shapenew[i][j]
				if (shape[i][j] == 1) pc.ref.images['pc'+i+'_'+j].src = shape.color.src
				else pc.ref.images['pc'+i+'_'+j].src = blank.src
			}
		}
		cancelPlant()
		if (lefthold && !leftactive) {
			leftactive = 1
			left()
		}
		else if (righthold && !rightactive) {
			rightactive = 1
			right()
			}
		}
	}
}

function displayScore() {
	layerWrite("scoreDiv","<SPAN>"+score+"</SPAN>")
	layerWrite("linesDiv","<SPAN>"+lines+"</SPAN>")
}
function layerWrite(id,text) {
	if (n) {
		document.layers["scoreBoard"].document.layers[id].document.write(text)
		document.layers["scoreBoard"].document.layers[id].document.close()
	}
	else if (ie) document.all[id].innerHTML = text
}

function dynLayer(id,nestref) {
	if (n) {
		if (nestref) {
			this.css = eval("document." + nestref + ".document." + id)
			this.ref = eval("document." + nestref + ".document." + id + ".document")
		}
		else {
			this.css = document.layers[id]
			this.ref = document.layers[id].document
		}
		this.x = this.css.left
		this.y = this.css.top
	}
	else if (ie) {
		this.css = document.all[id].style
		this.ref = document
		this.x = this.css.pixelLeft
		this.y = this.css.pixelTop
	}
	this.obj = id + "Object"
	eval(this.obj + "=this")
	this.moveBy = dynLayerMoveBy
	this.moveTo = dynLayerMoveTo
	this.show = dynLayerShow
	this.hide = dynLayerHide
}
function dynLayerMoveBy(x,y) {
	this.x += x
	this.css.left = this.x
	this.y += y
	this.css.top = this.y
}
function dynLayerMoveTo(x,y) {
	this.x = x
	this.css.left = this.x
	this.y = y
	this.css.top = this.y
}
function dynLayerShow() {
	if (n) this.css.visibility = "show"
	else if (ie) this.css.visibility = "visible"
}
function dynLayerHide() {
	if (n) this.css.visibility = "hide"
	else if (ie) this.css.visibility = "hidden"
}

if (n && navigator.platform=="Win32" && navigator.mimeTypes["audio/x-midi"]) soundenabled = 1
else soundenabled = 0
musicon = 1
musictrack = 1

musictimeractive = 0
function playMusic1() {
	if (soundenabled && musicon) {
		stopMusic()
		musictrack = 1
		if (n) document.music1.play(true)
		if (ie) document.music1.run()
		musictimeractive = 1
		musictimer = setTimeout('playMusic2()',137000)
	}
}
function playMusic2() {
	if (soundenabled && musicon) {
		stopMusic()
		musictrack = 2
		if (n) document.music2.play(true)
		if (ie) document.music2.run()
		musictimeractive = 1
		musictimer = setTimeout('playMusic1()',151000)
	}
}
function stopMusic() {
	if (soundenabled) {
		if (musictimeractive) {
			clearTimeout(musictimer)
			musictimeractive = 0
		}
		document.music1.stop()
		document.music2.stop()
	}
}
function toggleMusic() {
	if (soundenabled) {
		if (musicon) {
			musicon = 0
			stopMusic()
		}
		else {
			musicon = 1
			if (gameplaying) {
				if (musictrack==1) playMusic1()
				else playMusic2()
			}
		}
	}
	else if (confirm("Ihr Browser ist nicht music capabilities.\nBitte benutzen Sie einen  Netscape Browser.\n\nNun besorgen Sie sich schon einen.")) blank.location = "http://home.netscape.com/home/update.html"
}

function swap(hideobj,showobj) {
	hidenon(hideobj)
	shownon(showobj)
}
function shownon(showobj) {
	if (n) document.layers[showobj].visibility = "show"
	else if (ie) document.all[showobj].style.visibility = "visible"
}
function hidenon(hideobj) {
	if (n) document.layers[hideobj].visibility = "hide"
	else if (ie) document.all[hideobj].style.visibility = "hidden"
}