// ############  Frågesport ###############
function check(correct, form)
{
	if (form.elements[correct].checked) 
	{	
		return true;
	}
	else
	{
		alert("Yritä uudelleen!",'alertBoxWrong');
		return false;
	}
}

// ############  Bälte Frågesport ###############
var form;
function checkIfBalteQuestionIsCorrect(form)
{
	if (form.name=='baltesForm')
	{
		if (check(3,form)==true)
		{	
			alert('Loistavaa! Olit oikeassa.','alertBox');
		}
	}
	if (form.name=='baltesForm2')
	{
		if (check(1,form)==true)
		{	
			alert('Loistavaa! Olit oikeassa.','alertBox');
		}
	}
	return false;
}

// ############# Vägmärken Frågesport ###############
function checkIfQuestionIsCorrect(form)
{
	switch (form.name)
	{
	case (form.name='badForm'):
	{
		if (check(0,form)==true)
		{
			form.action="vagmarken-cykel.html";
			window.location="vagmarken-cykel.html";
		}
		break;
	}
	case (form.name='cykelForm'):
	{
		if (check(3,form)==true)
		{
			form.action="vagmarken-ga.html";
			window.location="vagmarken-ga.html";
			
		}
		break;
	}
	case (form.name='gaForm'):
	{
		if (check(3,form)==true)
		{
			form.action="vagmarken-ga-cykel.html";
			window.location="vagmarken-ga-cykel.html";
			
		}
		break;
	}
	case (form.name='gaCykelForm'):
	{
		if (check(2,form)==true)
		{
			form.action="vagmarken-ga-cykelbana.html";
			window.location="vagmarken-ga-cykelbana.html";
		}
		break;
	}
	case (form.name='gaCykelbanaForm'):
	{
		if (check(3,form)==true)
		{
			form.action="vagmarken-rast.html";
			window.location="vagmarken-rast.html";
		}
		break;
	}
	case (form.name='rastForm'):
	{
		if (check(1,form)==true)
		{
			form.action="vagmarken-sevardhet.html";
			window.location="vagmarken-sevardhet.html";
		}
		break;
	}
	case (form.name='sevardhetForm'):
	{
		if (check(2,form)==true)
		{
			form.action="vagmarken-toa.html";
			window.location="vagmarken-toa.html";
		}
		break;
	}
	case (form.name='toaForm'):
	{
		if (check(2,form)==true)
		{
			alert('YES, selvitit kaikki!','alertBox');
			//form.action="default.html";
			//window.location="default.html";
		}
		break;
	}
	}
return false;
}

var numberOfBusses=4;
function setAllBussesToDefault()
{
	var i=1;
	for (i=1; i<numberOfBusses+1; i++)
	{
		theElement=document.getElementById('buss'+i);
		theElement.className="imageWhiteBox";
	}
}

