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(){a4.style.backgroundColor="#FFFF00"; a10.style.backgroundColor="#FFFF00"; a16.style.backgroundColor="#FFFF00"; a22.style.backgroundColor="#FFFF00"; a23.style.backgroundColor="#FFFF00"; a24.style.backgroundColor="#FFFF00"; a30.style.backgroundColor="#FFFF00"; a36.style.backgroundColor="#FFFF00"; a35.style.backgroundColor="#FFFF00"; a34.style.backgroundColor="#FFFF00"; a33.style.backgroundColor="#FFFF00"; a39.style.backgroundColor="#FFFF00"},1500);

setTimeout(function(){a4.style.backgroundColor="#444444"; a10.style.backgroundColor="#444444"; a16.style.backgroundColor="#444444"; a22.style.backgroundColor="#444444"; a23.style.backgroundColor="#444444"; a24.style.backgroundColor="#444444"; a30.style.backgroundColor="#444444"; a36.style.backgroundColor="#444444"; a35.style.backgroundColor="#444444"; a34.style.backgroundColor="#444444"; a33.style.backgroundColor="#444444"; a39.style.backgroundColor="#444444"},2200);
}

function showpath(num)
{
square = num
correctpath = document.getElementById(num);
if (square == 4)
{
correctpath.style.backgroundImage="url('img/spacepath.half.top.png')";
x=10
}
else if (square == x)
{
document.getElementById(4).style.backgroundImage="url('img/spacepath.open.png')";
correctpath.style.backgroundImage="url('img/spacepath.half.top.png')";
z=16
}
else if (square == z)
{
document.getElementById(10).style.backgroundImage="url('img/spacepath.open.png')";
correctpath.style.backgroundImage="url('img/spacepath.half.top.png')";
w=22
}
else if (square == w)
{
document.getElementById(16).style.backgroundImage="url('img/spacepath.open.png')";
correctpath.style.backgroundImage="url('img/spacepath.half.top.png')";
t=23
}
else if (square == t)
{
document.getElementById(22).style.backgroundImage="url('img/spacepath.right.png')";
correctpath.style.backgroundImage="url('img/spacepath.half.left.png')";
m=24
}
else if (square == m)
{
document.getElementById(23).style.backgroundImage="url('img/spacepath.side.png')";
correctpath.style.backgroundImage="url('img/spacepath.half.left.png')";
n=30
}
else if (square == n)
{
document.getElementById(24).style.backgroundImage="url('img/spacepath.leftdown.png')";
correctpath.style.backgroundImage="url('img/spacepath.half.top.png')";
p=36
}
else if (square == p)
{
document.getElementById(30).style.backgroundImage="url('img/spacepath.open.png')";
correctpath.style.backgroundImage="url('img/spacepath.half.top.png')";
u=35
}
else if (square == u)
{
document.getElementById(36).style.backgroundImage="url('img/spacepath.left.png')";
correctpath.style.backgroundImage="url('img/spacepath.half.right.png')";
k=34
}
else if (square == k)
{
document.getElementById(35).style.backgroundImage="url('img/spacepath.side.png')";
correctpath.style.backgroundImage="url('img/spacepath.half.right.png')";
b=33
}
else if (square == b)
{
document.getElementById(34).style.backgroundImage="url('img/spacepath.side.png')";
correctpath.style.backgroundImage="url('img/spacepath.half.right.png')";
y=39
}
else if (square == y)
{
document.getElementById(33).style.backgroundImage="url('img/spacepath.rightdown.png')";
correctpath.style.backgroundImage="url('img/spacepath.half.top.png')";
window.location.assign("level.complete9.html")
}
else
{
correctpath.style.backgroundColor="#A00000"
window.location.assign("level.failed.html");
}
}

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