// GR5-1

var expDays = 365;
var exp = new Date(); 
var lightsOutCube;

exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

onload=init;

function init() {
	lightsOutCube=document.getElementById("LightsOut");
}

// tog transparency
function TogTransparency() {
     lightsOutCube.setTransparent(document.forms.LightsOutForm.checkTran.checked);
}
// zoom cube
function zoomCube(inoutFlag) {
     lightsOutCube.zoomCube(inoutFlag);
}
// rotate left
function rotateLeft() {
     lightsOutCube.rotateLeft();
}
// rotate right
function rotateRight() {
     lightsOutCube.rotateRight();
}
// rotate up
function rotateUp() {
     lightsOutCube.rotateUp();
}
// rotate down
function rotateDown() {
     lightsOutCube.rotateDown();
}
// change puzzle
function changePuzzle() {
    lightsOutCube.setPuzzle(document.forms.LightsOutForm.selPuzzle.value-1);
}
// change puzzle
function resetCube() {
   changePuzzle();	
}

// change puzzle
function togSetup() {
    lightsOutCube.setupCube(document.forms.LightsOutForm.checkSet.checked);
}
// solve Cube
function solveCube() {
    lightsOutCube.solve();
}
// About Cube
function about() {
    lightsOutCube.about();
}
// solve Cube
function rotate() {
    lightsOutCube.rotate();
}
// change puzzle
function setPuzzleValue(v) {
    document.forms.LightsOutForm.selPuzzle.selectedIndex=v;
    setCookie("Level",v,exp);
}

function setCookie (name, value) {  
	var argv = setCookie.arguments;  
	var argc = setCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}
