function initPuzzle()
{
	var puz=lpuzzle.XMLDocument.documentElement;
	var selPuz=document.getElementById("selPuzzle");
	for (i=1; i<puz.childNodes.length+1; i++){
		var oOption = document.createElement("OPTION");
		oOption.text=i;
		oOption.value=i;
		selPuz.add(oOption);
	}
}


function fnStartInitPuzzle()
{
 	if (lpuzzle.readyState=="complete" && fullyloaded)
	{
		initPuzzle();
		var e=getCookie("Level");
		if (e==null)
			e=0;
		setPuzzle(e);
		changePuzzle();
	}
}

function setPuzzle(v){
	var selPuz=document.getElementById("selPuzzle");
	selPuz.selectedIndex=v;
}

function changePuzzle(){
	oldloc.low=loc.low;
	oldloc.high=loc.high;
	solvedMode=false;
	var selPuz=document.getElementById("selPuzzle");
	var puz;
	try{
		puz=lpuzzle.XMLDocument.childNodes.item(0).childNodes.item(selPuz.value-1).childNodes;
	}
	catch(e){
		selPuz.value=1;
		puz=lpuzzle.XMLDocument.childNodes.item(0).childNodes.item(0).childNodes;		
	}
	var i;
	loc.low=0;
	loc.high=0;
	for (i=0; i<puz.length; i++){
		locm.tog1(puz.item(i).text,loc);
	}
	setCube(true,true);
}




