onload=function(){	
	init();
}

function init(){
	var elements = localStorage.getItem("aElements");
	var showBg = localStorage.getItem("aShowBg");
	if(!elements) localStorage.setItem("aElements", 3);
	if(!showBg) localStorage.setItem("aShowBg", "allways");
	document.getElementById("el"+localStorage.getItem('aElements')).checked = true;
	document.getElementById("bg"+localStorage.getItem('aShowBg')).checked = true;
}

function save(){
	if(document.getElementById('el3').checked)		localStorage.setItem("aElements", 3);
	else if(document.getElementById('el4').checked) localStorage.setItem("aElements", 4);
	else if(document.getElementById('el5').checked) localStorage.setItem("aElements", 5);
	else if(document.getElementById('el6').checked) localStorage.setItem("aElements", 6);
	
	if(document.getElementById('bgallways').checked) 	localStorage.setItem("aShowBg", "allways");
	else if(document.getElementById('bgnever').checked) localStorage.setItem("aShowBg", "never");
	else if(document.getElementById('bg5s').checked)	localStorage.setItem("aShowBg", "5s");

	location.href='index.html';
}