/* Copyright 2003 by Robert Abbott -- www.logicmazes.com */

var currentMaze = maze1
var initSw = 0 // 0 = initial start-up, 1 = load in progress, 2 = normal
var bgChanged = 0 // BG changed for winning display
var bgAltered = 0 // BG changed for intermediate goal

var curRow = 6 // row currently containing circle
var curCol = 5 // column currently containing circle
var curOrient = "u" // where eyeballs currently point
var gwd = 844
var sol1 = 0  // if 1, we are currently showing a solution a maze
var board = new Array(11)

/* board: This is an array that is 11 wide and 10 high. It has information for the current maze. The display for the maze is also 11 wide and 10 high, but the playable area is only 9 wide and 8 high.

Each entry in the board is 2 characters.

If the first character is 1 thru 5, then this is a playable square, and the number means:

1--diamond
2--cross
3--star
4--flower
5--reserved for expansion

If a playable square, then the second character gives the color:

A--blue
B--red
C--yellow
D--green
E--reserved for expansion

If the first character is 6, then this is a special square that consists of a single black line. The second character is 1 if the line is horizontal or 2 if the line is vertical.

If the first character is 7, then this is a special square that is empty. The second character is a hex number that indicates which borders are present around the square. */

/* s: This is the mainline of the program. When you click on a square, it links to this routine, and it passes the coordinates for the square in the board array. */

// Global variables used by s function:

var curRow = 5

var curCol = 4
var curSq = 0 // contents of cur square
var row = 0  // row clicked on
var col = 0  // column clicked on
var sq = 0   // contents of square clicked on
var curOrient = "u"
var newOrient = "u"

rowDif = 0
abRowDif = 0
colDif = 0
abColDif = 0
curSq = 0

function s(rowx,colx,paramx3) { 


if ((initSw < 2) && (paramx3 !="a")) return

row = rowx
col = colx
rowDif = row - curRow
abRowDif = Math.abs(rowDif)
colDif = col - curCol
abColDif = Math.abs(colDif)
sq = board[row][col]
curSq = board[curRow][curCol]

if (bgChanged) restoreBG()

if (abRowDif + abColDif == 0) {alert("Tria un altre llibre.\n\rSi no et mous, no podr\u00E0s sortir de la biblioteca.");return}

if (sq > "5e") {error("Nom\u00E9s pot sortir del laberint per la casella de sortida");Track.trackFail ();return} 

if (abRowDif * abColDif != 0) {
error("Des d'on ets no pots anar a aquest llibre.\n\rNom\u00E9s pots anar a llibres de la mateixa fila o de la mateixa columna.");Track.trackFail ();return}

if (abColDif > 0) {if (testRow()) { Track.trackFail ();return }}
if (abRowDif > 0) {if (testCol()) { Track.trackFail ();return }}

if ((sq.substring(0,1) != curSq.substring(0,1)) && (sq.substring(1) != curSq.substring(1))) {Track.trackFail (); error("Des d'on ets no pots anar a aquest llibre.\n\rNom\u00E9s pots anar a llibres del mateix color o del mateix tipus.");return}

// Move is okay

Track.trackMove ();
initSw = 1 // ignore other input while update takes place

document.images["r"+curRow+"c"+curCol+"u"].src="img/juego/eyes"+newOrient+".gif"


wait = 400; if (document.forms[0].sound.checked) {wait = 1400
 document.applets[0].play(1,'door.au')}
setTimeout("moveDone()",wait)
gwe = curRow * curCol + gw
return}

function moveDone() {

// if the square we are leaving is a Goal, change to a blank
if (testGoal(curRow,curCol)) {
board[curRow][curCol] = "7f"
setSq(curRow,curCol,"x")}

document.images["r"+curRow+"c"+curCol+"u"].src="img/juego/70x.gif"


curRow = row
curCol = col
curOrient = newOrient
document.images["r"+curRow+"c"+curCol+"u"].src="img/juego/eyes"+newOrient+".gif"


if (!testGoal(curRow,curCol)) {initSw = 2-sol1; saveMove(99); return}

// A Goal was reached

goalNumb--

mostrarSortides(goalNumb);
//document.images["todo"].src="img/juego/todo"+goalNumb+".gif"

saveMove(99)

if (goalNumb == 0) {setTimeout("change1()",800); return} // final goal reached

// there are more goals to reach

bgCount = currentMaze[8] - goalNumb 
//document.bgColor = bgArray[bgCount]
bgAltered = 1
initSw = 2;return}

var bgArray = new Array("#000000","#000000","#000000","#000000","#000000","#000000")
//  Original AliceBlue Snow  Grayish White  SpringGreenish

function change1() {
Track.endLevel ();
if (document.forms[0].sound.checked) document.applets[0].play(1,'win.au')
//document.bgColor = currentMaze[7]
bgChanged = 1
setTimeout("change2()",2000)
return}

function change2() {

if (mazeNumb == 11) alert("I don't know if you noticed this, but the solution to Maze 11 follows a certain pattern. It resembles the route through a single-path labyrinth.") 

alert("Enhorabona, has aconseguit sortir de la biblioteca!\n\rHas resolt el laberint en "+Track.totalMovements()+" moviments.\n\rSi vols millorar la teva puntuaci\u00F3, torna-ho a intentar.")

initSw = 2;return}

// * * * * * * * * * SUBROUTINES * * * * * * * * * * * * * * * * * * * * *

function error(msg) {

overlay1 = "img/juego/bigx.gif"
overlay2 = "img/juego/70x.gif"

if (testGoal(row,col)){
overlay1 = "img/juego/xgoal.gif"
overlay2 = "img/juego/goal.gif"}

document.images["r"+row+"c"+col+"u"].src=overlay1
errmsg = msg
setTimeout("error2()",1000)
initSw = 1
return}

function error2() {
alert(errmsg)
document.images["r"+row+"c"+col+"u"].src=overlay2
initSw = 2
return}



 


/* setSq:

Note, 11/1/07: A lot of this is now out of date, but I just left it

If param3 = "x" this sets a square to display its usual gif.
If param3 = "u" it displays a circle pointing up
If param3 = "d" it displays a circle pointing down
If param3 = "l" it displays a circle pointing left
If param3 = "r" it displays a circle pointing right
If param3 = "b" it displays the big x.
*/

function setSq(rown,coln,param3) {
var num = board[rown][coln]
gifName = "img/juego/"+num+param3+".gif"
if (param3 == "b") gifName = "img/juego/70x.gif"
locName = "r"+rown+"c"+coln
document.images[locName].src=gifName
return}

function testCol(){ 
if (rowDif > 0) {incr = 1;newOrient = "d"
 if (curOrient == "u") {error(faceMsg);return(1)}}
if (rowDif < 0) {incr = -1;newOrient = "u"
 if (curOrient == "d") {error(faceMsg);return(1)}}
for (var rr = curRow + incr; rr != row; rr+=incr) {
if (board[rr][curCol] > "5f") {error(blankMsg);return(1)}}
return(0)}

function testRow() {
if (colDif > 0) {incr = 1;newOrient = "r"
 if (curOrient == "l") {error(faceMsg);return(1)}}
if (colDif < 0) {incr = -1;newOrient = "l"
 if (curOrient == "r") {error(faceMsg);return(1)}}
for (var cc = curCol + incr; cc != col; cc = cc + incr) {
if (board[curRow][cc] > "5f") {error(blankMsg);return(1)}}
return(0)}

function restoreBG() {//document.bgColor="#000000"
bgChanged=0; bgAltered=0; return}

faceMsg = "Des d'on ets no pots anar a aquest llibre perqu\u00E8 no pots anar enrere.\n\rPots anar endavant o cap a un costat.\n\rRecorda que els ullets del cercle (que ets tu quan vols sortir de la biblioteca) representen la teva direcci\u00F3."

blankMsg = "You can't travel over a blank square."

function testGoal(rowj,colj) {
for (gi = 119; currentMaze[gi] != 99; gi+=2)
{if ((rowj == currentMaze[gi]) && (colj == currentMaze[gi+1])) return(1)}
return(0)}




// * * * * * * * * * START OF PROGRAM * * * * * * * * * * * * * * * * * *

/* Here is where the program starts. It's triggered when the purple lighting bolt gif loads. This sends control to purpleLoaded(). */

function purpleLoaded() {

initBoard() // initialize a blank board
initList() // initialize a blank moveList

setTimeout("startMaze(maze1,'a')",2500)

return}

function initBoard() {
for (rowi = 0; rowi < 10; rowi++) {
 board[rowi] = new Array(11)
 for (coli = 0; coli < 11; coli++) {
 board[rowi][coli] = 70
 }
}
return}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

// START MAZE--this starts a particular maze:

function startMaze(mazeLoc,param2) {if ((initSw < 2) && (param2 != "a")) return
Track.startLevel ();
if (initSw == 2) initSw = 1

// If not initial load, display "loading" sign
if (initSw > 0) $("loadingDiv").show(); // document.images["loading"].src="img/juego/loading.gif"

// Clear the upper level:

for (toplevR = 1; toplevR < 9; toplevR++) { 
for (toplevC = 1; toplevC < 10; toplevC++) {
topName = "r"+toplevR+"c"+toplevC+"u"
document.images[topName].src="img/juego/70x.gif"}}

loadBoard(mazeLoc)

mazeNumb = mazeLoc[0]
currentMaze = mazeLoc
curRow = mazeLoc[1]
curCol = mazeLoc[2]
curOrient = mazeLoc[3]
goalNumb = mazeLoc[8]

saveMove(98) // save starting position in moveList

if ((bgChanged) || (bgAltered)) restoreBG()

dispGifs()

initSw = 1
setTimeout("finalize2()",1000)
gw = mazeNumb + curRow + curCol + mazeLoc[4] + mazeLoc[5] + mazeLoc[6]
return}

function finalize2() {
playSound('door.au')
$("loadingDiv").hide(); //document.images["loading"].src="img/juego/70x.gif" // Turn off "loading" sign
return}


function playSound(soundFile) { 
var param = 2; if (document.forms[0].sound.checked) param = 1
if (sol1) param = 2
initSw = document.applets[0].play(param,soundFile) - gwd
if (initSw != 0 && initSw != 1) initSw = 2 // fix 8/20/02
if (sol1) initSw=1
return}

function loadBoard(initNumbs) {
var n = 9
for (rowz = 0; rowz < 10; rowz++) {
 for (colz = 0; colz < 11; colz++) {
 board[rowz][colz] = initNumbs[n]
 n++
 }
}
return}


function dispGifs() {
digit1st = mazeNumb; digit2nd = "img/juego/70x.gif"

/*
if (mazeNumb > 9) {digit1st = 1
units = mazeNumb - 10
digit2nd = "img/juego/maze"+units+".gif"}

document.images["mazenumber"].src="img/juego/maze"+digit1st+".gif"
document.images["mazenumb2"].src=digit2nd
*/

$("titol").innerHTML = "Laberint " + mazeNumb;

for (rowu = 0; rowu < 10; rowu++) {
for (colu = 0; colu < 11; colu++) {
setSq(rowu,colu,"x")

if (testGoal(rowu,colu)) {
document.images["r"+rowu+"c"+colu+"u"].src="img/juego/goal.gif"}
if ((rowu == curRow) && (colu == curCol)) {
document.images["r"+rowu+"c"+colu+"u"].src="img/juego/eyes"+curOrient+".gif"}

}}

mostrarSortides(goalNumb);
//document.images["todo"].src="img/juego/todo"+goalNumb+".gif"

solsign = "img/juego/70x.gif";
if (mazeNumb < 3) solsign = "img/juegosolu.gif"
//document.images["sol"].src=solsign

return}


// * * * * * * * * * GO BACK FUNCTION * * * * * * * * * * * * * * * * * *

var moveList = new Array(5)

var max = 40  // moveList is large enough for this many items
var listPtr = 0 // pointer to moveList
var original = 0 

function initList() {
for (rowi = 0; rowi < max; rowi++) {
 moveList[rowi] = new Array(5)
  for (coli = 0; coli < 5; coli++) {
  moveList[rowi][coli] = 2
  }
 }
return}

function saveMove(flag) {
if (flag == 98) {listPtr = 0}
if (flag == 99) {if (moveList[listPtr][0] != 98) {moveList[listPtr][0] = 1}
 listPtr++; if (listPtr == max) {listPtr = 0}}
moveList[listPtr][0] = flag

moveList[listPtr][1] = curRow
moveList[listPtr][2] = curCol
moveList[listPtr][3] = curOrient
moveList[listPtr][4] = goalNumb
return}


function goBack() {if (initSw < 2) return

if (moveList[listPtr][0] == 98) {alert("Ja no pots tornar enrrera. Ets a la casella d'inici"); return}

backupPtr = listPtr-1; if (backupPtr < 0) backupPtr = max-1

if (moveList[backupPtr][0] == 99) {alert("Sorry, the program can't go back any further because it forgot all your previous moves."); return}

param2 = "img/juego/70x.gif"; if (testGoal(curRow,curCol)) param2 = "img/juego/goal.gif"

// --old-- setSq(curRow,curCol,param2) // change sq we're leaving 
document.images["r"+curRow+"c"+curCol+"u"].src=param2


listPtr = backupPtr

curRow = moveList[listPtr][1]
curCol = moveList[listPtr][2]
curOrient = moveList[listPtr][3]
goalNumb = moveList[listPtr][4]

// if this was a goal, then a blank, change it back

if (testGoal(curRow,curCol)) {

  original = 9 + (curRow * 11) + curCol
  board[curRow][curCol] = currentMaze[original] 
  setSq(curRow,curCol,"x")}

document.images["r"+curRow+"c"+curCol+"u"].src="img/juego/eyes"+curOrient+".gif"

if (param2 == "x") return

// this is square leading to goal

mostrarSortides(goalNumb);
//document.images["todo"].src="img/juego/todo"+goalNumb+".gif" // change todo sign

bgCount = currentMaze[8] - goalNumb
//document.bgColor = bgArray[bgCount] // restore older BG color 
bgAltered = 1
return}

// * * * * * * * * * SOLVE1 FUNCTION * * * * * * * * * * * * * * * * * *

function solve1() {

if (initSw < 2) return
if (mazeNumb == 1) show1()
if (mazeNumb == 2) show2()
return}

function show2() {
sol1 = 1
startMaze(maze2,'u')
setTimeout("m1()",4000);return}

function m1() {s(5,5,'a');setTimeout("m2()",3000);return}
function m2() {s(3,5,'a');setTimeout("m3()",3000);return}
function m3() {s(3,6,'a');setTimeout("m4()",3000);return}
function m4() {s(4,6,'a');setTimeout("m5()",3000);return}
function m5() {s(4,4,'a');setTimeout("m6()",3000);return}
function m6() {s(3,4,'a');setTimeout("m7()",3000);return}
function m7() {s(3,7,'a');setTimeout("m8()",3000);return}
function m8() {s(4,7,'a');setTimeout("m9()",3000);return}
function m9() {s(4,6,'a');setTimeout("m10()",3000);return}
function m10() {sol1=0;s(1,6,'a');return}


function show1() {
sol1 = 1
startMaze(maze1,'u')
setTimeout("mm1()",4000);return}

function mm1() {s(4,5,'a');setTimeout("mm2()",3000);return}
function mm2() {s(4,7,'a');setTimeout("mm3()",3000);return}
function mm3() {s(2,7,'a');setTimeout("mm4()",3000);return}
function mm4() {s(2,4,'a');setTimeout("mm5()",3000);return}
function mm5() {s(5,4,'a');setTimeout("mm6()",3000);return}
function mm6() {s(5,6,'a');setTimeout("mm7()",3000);return}
function mm7() {sol1=0;s(1,6,'a');return}




// * * * * * * * * * ALL LAYOUTS * * * * * * * * * * * * * * * * * *


/* Here is the information particular to each maze. It is:

0: The maze number
1: The row number of the start square
2: The column number of the start square
3: The orientation of the circle at the start--u, d, l, r.
4: Not used
5: Not used
6: A number used in generating the completion code
7: The hex number of the BG color to show when maze is solved
8: The number of goals

9 thru 118: The array of 110 numbeers that are moved to board

119: The row number of the first goal
120: The column number of the first goal
121: Additional pairs for additional goals, or 99 meaning end */

// yellow (modified)
var maze1 = new Array(1,6,5,"u",1,1,25,"#FFFF10",1,
"70","70","70","70","70","70","74","70","70","70","70",
"70","70","70","70","74","76","4b","7c","70","70","70",
"70","70","70","72","2a","4c","1c","2d","78","70","70",
"70","70","70","72","4d","3b","3d","1c","78","70","70",
"70","70","70","72","4b","4a","3b","4d","78","70","70",
"70","70","70","72","3a","1b","4a","1a","78","70","70",
"70","70","70","70","73","1a","79","71","70","70","70",
"70","70","70","70","70","71","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
1,6,99)

// chartruse
var maze2 = new Array(2,6,5,"u",1,1,25,"#7FFF00",1,
"70","70","70","70","70","70","74","70","70","70","70",
"70","70","70","70","74","76","4b","7c","70","70","70",
"70","70","70","72","2a","4a","1a","2d","78","70","70",
"70","70","70","72","4d","3b","3d","4c","78","70","70",
"70","70","70","72","4b","1d","3b","3c","78","70","70",
"70","70","70","72","2d","1b","4a","1d","78","70","70",
"70","70","70","70","73","1a","79","71","70","70","70",
"70","70","70","70","70","71","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
1,6,99)

// aqua
var maze3 = new Array(3,6,4,"u",1,1,50,"#00FFFF",1,
"70","70","70","70","70","70","74","70","70","70","70",
"70","70","70","74","74","76","2b","7c","70","70","70",
"70","70","72","2b","1d","2a","3d","4a","78","70","70",
"70","70","72","4d","1b","1d","3c","3a","78","70","70",
"70","70","72","1d","1c","2d","3b","2c","78","70","70",
"70","70","72","4b","2c","4a","2d","3c","78","70","70",
"70","70","70","73","1a","79","71","71","70","70","70",
"70","70","70","70","71","70","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
1,6,99)

//lime
var maze4 = new Array(4,7,4,"u",1,1,75,"#00FF00",1,
"70","70","70","70","70","70","74","70","70","70","70",
"70","70","70","74","74","76","2d","7c","70","70","70",
"70","70","72","1b","4d","4b","3a","1a","78","70","70",
"70","70","72","3b","4a","3d","2a","1d","78","70","70",
"70","70","70","75","77","3a","7d","75","70","70","70",
"70","70","72","2d","3c","4d","3d","2b","78","70","70",
"70","70","72","2b","3d","2a","1d","2d","78","70","70",
"70","70","70","73","1c","79","71","71","70","70","70",
"70","70","70","70","71","70","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
1,6,99)

// sort of a light magenta
var maze5 = new Array(5,6,5,"u",1,1,25,"#FF80FF",1,
"70","70","70","70","70","70","74","70","70","70","70",
"70","70","70","70","74","76","3b","7c","70","70","70",
"70","70","70","72","1b","4b","4c","2c","78","70","70",
"70","70","70","72","4d","1c","1a","3d","78","70","70",
"70","70","70","72","3d","1d","3a","1d","78","70","70",
"70","70","70","72","1c","1b","2c","2a","78","70","70",
"70","70","70","70","73","3c","79","71","70","70","70",
"70","70","70","70","70","71","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
1,6,99)

// SORT OF A LIGHT BLUE
var maze6 = new Array(6,6,5,"u",1,1,25,"#ADE8FF",1,
"70","70","70","70","70","70","74","70","70","70","70",
"70","70","70","70","74","76","3c","7c","70","70","70",
"70","70","70","72","1b","2a","2b","1d","78","70","70",
"70","70","70","72","4a","4b","1c","2a","78","70","70",
"70","70","70","72","3a","4a","2d","4d","78","70","70",
"70","70","70","72","4b","2d","1d","2b","78","70","70",
"70","70","70","70","73","4a","79","71","70","70","70",
"70","70","70","70","70","71","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
1,6,99)

// RED ORANGE ALTERED
var maze7 = new Array(7,6,5,"u",1,1,75,"#FF8C00",2,
"70","70","70","74","74","74","74","74","70","70","70",
"70","70","72","1a","1b","2a","3a","2c","78","70","70",
"70","70","72","2c","3b","3c","4a","4c","78","70","70",
"70","70","72","2b","7d","75","77","4d","78","70","70",
"70","70","72","1b","3b","2d","1c","2b","78","70","70",
"70","70","72","4c","1b","4d","1a","2c","78","70","70",
"70","70","70","71","73","4a","79","71","70","70","70",
"70","70","70","70","70","71","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
1,4,1,6,99)

// PINK ALTERED
var maze8 = new Array(8,6,4,"u",1,1,50,"#FF69F4",1,
"70","70","70","70","70","74","70","70","70","70","70",
"70","70","70","74","76","2d","7c","74","74","70","70",
"70","70","72","2b","3b","1c","1a","1b","3c","78","70",
"70","70","72","3c","1c","3b","2d","3d","4d","78","70",
"70","70","72","4b","2b","3d","4a","1c","2c","78","70",
"70","70","72","3d","1b","2c","1c","4d","4a","78","70",
"70","70","70","73","4c","79","71","71","71","70","70",
"70","70","70","70","71","70","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
1,5,99)

// ORCHID MODIFIED
var maze9 = new Array(9,6,3,"u",1,1,120,"#F970E7",3,
"70","70","70","74","74","74","74","74","70","70","70",
"70","70","72","4a","3c","4d","3a","4c","78","70","70",
"70","70","72","1b","2c","2b","2a","1d","78","70","70",
"70","70","72","3b","7f","3b","7f","3d","78","70","70",
"70","70","72","1c","4d","3d","3b","1a","78","70","70",
"70","70","72","3c","4b","2a","1b","2c","78","70","70",
"70","70","72","2b","79","71","71","71","70","70","70",
"70","70","70","71","70","70","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
"70","70","70","70","70","70","70","70","70","70","70",
3,3,3,5,3,7,99)

// LawnGreen
var maze10 = new Array(10,8,4,"u",1,1,175,"#7CFF00",5,
"70","70","70","74","74","74","74","74","74","70","70",
"70","70","72","1b","3c","4a","2b","4b","2a","78","70",
"70","70","72","1c","4a","3c","3a","2a","3c","78","70",
"70","70","72","4b","3a","1a","4d","2b","1c","78","70",
"70","70","70","75","75","77","1b","7d","75","74","70",
"70","70","72","2a","1b","4d","3d","2c","1b","3d","62",
"70","70","72","2c","3a","1c","4c","4b","3d","2a","62",
"70","70","72","2b","1d","4a","1c","2b","1c","3a","62",
"70","70","70","73","3c","79","71","71","71","71","70",
"70","70","70","70","61","70","70","70","70","70","70",
2,5,2,7,4,6,6,5,6,7,99)

// MY OWN TANGLEWOOD SKY BLUE
var maze11 = new Array(11,8,6,"u",1,1,207,"#C4FAFE",3,
"70","70","70","74","74","74","74","74","74","74","70",
"70","70","72","3c","4a","1d","3b","3d","5e","2b","62",
"70","70","72","1d","2b","4a","5e","3c","2b","3d","62",
"70","70","72","5e","3c","1a","2a","1a","3d","4c","62",
"70","70","72","3b","1d","4c","1a","5e","1d","2c","62",
"70","70","72","3d","2c","1b","4c","1a","3c","5e","62",
"70","70","72","1a","4b","5e","2b","3c","2a","1d","62",
"70","70","72","2c","5e","3d","1d","3b","4d","2a","62",
"70","70","70","71","71","73","3d","79","71","71","70",
"70","70","70","70","70","70","61","70","70","70","70",
4,3,4,9,7,6,99)

// yellow again
var maze12 = new Array(12,8,4,"u",1,1,207,"#FFFF20",6,
"70","70","70","74","74","74","74","74","74","74","70",
"70","70","72","4a","1b","5e","2c","5e","3d","4a","62",
"70","70","72","3d","4c","3c","2b","2a","4b","1d","62",
"70","70","72","2c","3b","2d","3d","1d","5e","3a","62",
"70","70","72","3d","4c","3b","1a","1c","5e","2a","62",
"70","70","72","2c","3b","4d","5e","4c","3a","1d","62",
"70","70","72","1b","4d","3c","1a","3a","4c","2b","62",
"70","70","72","4b","1a","2d","1c","2b","1d","4a","62",
"70","70","70","73","2a","79","71","71","71","71","70",
"70","70","70","70","61","70","70","70","70","70","70",
1,3,3,5,3,7,4,3,5,5,6,8,99)


function mostrarSortides(goalNumb){
	if(goalNumb > 1){
		$("sortides").innerHTML = + goalNumb	+ " sortides";
	}else{
		$("sortides").innerHTML = "1 sortida";
	}
}
