var a1 = document.getElementById(1);
var a2 = document.getElementById(2);
var a3 = document.getElementById(3);
var a4 = document.getElementById(4);
var a5 = document.getElementById(5);
var a6 = document.getElementById(6);
var a7 = document.getElementById(7);
var a8 = document.getElementById(8);
var a9 = document.getElementById(9);

var a10 = document.getElementById(10);
var a11 = document.getElementById(11);
var a12 = document.getElementById(12);
var a13 = document.getElementById(13);
var a14 = document.getElementById(14);
var a15 = document.getElementById(15);
var a16 = document.getElementById(16);
var a17 = document.getElementById(17);
var a18 = document.getElementById(18);
var a19 = document.getElementById(19);
var a20 = document.getElementById(20);

var a21 = document.getElementById(21);
var a22 = document.getElementById(22);
var a23 = document.getElementById(23);
var a24 = document.getElementById(24);
var a25 = document.getElementById(25);
var a26 = document.getElementById(26);
var a27 = document.getElementById(27);
var a28 = document.getElementById(28);
var a29 = document.getElementById(29);

var a30 = document.getElementById(30);
var a31 = document.getElementById(31);
var a32 = document.getElementById(32);
var a33 = document.getElementById(33);
var a34 = document.getElementById(34);
var a35 = document.getElementById(35);
var a36 = document.getElementById(36);
var a37 = document.getElementById(37);
var a38 = document.getElementById(38);
var a39 = document.getElementById(39);
var a40 = document.getElementById(40);
var a41 = document.getElementById(41);
var a42 = document.getElementById(42);

function flashpath()
{
setTimeout(function(){a6.style.backgroundColor="#FFFFFF"; a12.style.backgroundColor="#FFFFFF"; a18.style.backgroundColor="#FFFFFF"; a17.style.backgroundColor="#FFFFFF"; a16.style.backgroundColor="#FFFFFF"; a10.style.backgroundColor="#FFFFFF"; a9.style.backgroundColor="#FFFFFF"; a8.style.backgroundColor="#FFFFFF"; a14.style.backgroundColor="#FFFFFF"; a13.style.backgroundColor="#FFFFFF"; a19.style.backgroundColor="#FFFFFF"; a25.style.backgroundColor="#FFFFFF"; a31.style.backgroundColor="#FFFFFF"; a37.style.backgroundColor="#FFFFFF"; a38.style.backgroundColor="#FFFFFF"; a39.style.backgroundColor="#FFFFFF"; a33.style.backgroundColor="#FFFFFF"; a34.style.backgroundColor="#FFFFFF"; a28.style.backgroundColor="#FFFFFF"; a29.style.backgroundColor="#FFFFFF"; a30.style.backgroundColor="#FFFFFF"; a36.style.backgroundColor="#FFFFFF"; a42.style.backgroundColor="#FFFFFF"; a41.style.backgroundColor="#FFFFFF"},1500);

setTimeout(function(){a6.style.backgroundColor="#57007F"; a12.style.backgroundColor="#57007F"; a18.style.backgroundColor="#57007F"; a17.style.backgroundColor="#0000FF"; a16.style.backgroundColor="#2DB000"; a10.style.backgroundColor="#2DB000"; a9.style.backgroundColor="#FFE200"; a8.style.backgroundColor="#FF6A00"; a14.style.backgroundColor="#FF6A00"; a13.style.backgroundColor="#FF0000"; a19.style.backgroundColor="#FF0000"; a25.style.backgroundColor="#FF0000"; a31.style.backgroundColor="#FF0000"; a37.style.backgroundColor="#FF0000"; a38.style.backgroundColor="#FF6A00"; a39.style.backgroundColor="#FFE200"; a33.style.backgroundColor="#FFE200"; a34.style.backgroundColor="#2DB000"; a28.style.backgroundColor="#2DB000"; a29.style.backgroundColor="#0000FF"; a30.style.backgroundColor="#57007F"; a36.style.backgroundColor="#57007F"; a42.style.backgroundColor="#57007F"; a41.style.backgroundColor="#0000FF"},1900);
}

function showpath(num)
{
square = num
correctpath = document.getElementById(num);
if (square == 6)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
a=12
}
else if (square == a)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
b=18
}
else if (square == b)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
c=17
}
else if (square == c)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
d=16
}
else if (square == d)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
e=10
}
else if (square == e)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
f=9
}
else if (square == f)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
g=8
}
else if (square == g)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
h=14
}
else if (square == h)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
i=13
}
else if (square == i)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
j=19
}
else if (square == j)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
k=25
}
else if (square == k)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
l=31
}
else if (square == l)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
m=37
}
else if (square == m)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
n=38
}
else if (square == n)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
o=39
}
else if (square == o)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
p=33
}
else if (square == p)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
q=34
}
else if (square == q)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
r=28
}
else if (square == r)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
s=29
}
else if (square == s)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
t=30
}
else if (square == t)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
u=36
}
else if (square == u)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
v=42
}
else if (square == v)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
w=41
}
else if (square == w)
{
correctpath.style.backgroundImage="url('img/rainbow.open.png')";
window.location.assign("maze.complete.html")
}
else
{
correctpath.style.backgroundColor="#A00000"
window.location.assign("level.failed.html");
}
}

function gameover()
{
correctpath.style.backgroundColor="#A00000"
window.location.assign("level.failed.html");
}
