function showStep(step)
{
	if(step == 2)
	{
		document.getElementById('stephead').style.backgroundPosition="left center";
	}
	else if(step == 3)
	{
		document.getElementById('stephead').style.backgroundPosition="left bottom";
	}
	else
	{
		document.getElementById('stephead').style.backgroundPosition="left top";
	}
}

function checkStatus(id)
{
	
	if(id == 1)
	{
		stepAction("secondbox", 1);
		showStep(2);
		
		jQuery.each (jQuery('div#secondbox input'), function () {
		if (jQuery(this).attr ('checked'))
		{
			stepAction("thirdbox", 1);
			showStep(3);
		}
		});
		
		return;
	}
	
	if(id == -1)
	{
		stepAction("secondbox", 0);
		stepAction("thirdbox", 0);
		showStep();
		return;
	}
	
	antalvalue = false;
	prisvalue = false;
	typvalue = false;
	
	//Antal
	antal = document.getElementById("antal");
	selected = document.getElementById("antal").selectedIndex;
	antalvalue = antal[selected].value;
	
	//Pris
	pris = document.getElementById("pris");
	selected = document.getElementById("pris").selectedIndex;
	prisvalue = pris[selected].value;
	
	//Typ
	typ = document.getElementById("typ");
	selected = document.getElementById("typ").selectedIndex;
	typvalue = typ[selected].value;
	
	var checked = false;
	jQuery.each (jQuery('div#secondbox input'), function () {
		if (jQuery(this).attr ('checked'))
		{
			checked = true;
			return;
		}
		
	});
	
	if(checked)
	{
		stepAction("thirdbox", 1);
		showStep(3);
	}
	else
	{
		stepAction("thirdbox", 0);
		showStep(2);
	}
	
}

jQuery(document).ready (function () {
	jQuery('div#secondbox input').change (function () {
		checkStatus ();
	});
});

function stepAction(id, action)
{
	//alert(id+" - "+action);
	
	if(id != "")
	{
		if(action == 1)
		{
			if(document.getElementById(id+"layer"))
			document.getElementById(id+"layer").style.display = "none";
		}
		else
		{
			if(document.getElementById(id+"layer"))
			document.getElementById(id+"layer").style.display = "block";
		}
	}
}
