color_dark   = '#F5BC76';
color_dark1  = '#F9AF43';
color_light  = '#FFFFFF';
color_light1 = '#F9C27F';

function lighten_cell(pos)
{
	document.getElementById('t1_c'+pos).style.backgroundColor = color_light;
	document.getElementById('t2_c'+pos).style.backgroundColor = color_light;
	document.getElementById('t3_c'+pos).style.backgroundColor = color_light1;
}

function darken_cell(pos)
{
	document.getElementById('t1_c'+pos).style.backgroundColor = color_dark;
	document.getElementById('t2_c'+pos).style.backgroundColor = color_dark;
	document.getElementById('t3_c'+pos).style.backgroundColor = color_dark1;
}



color_m2_dark  = '#FBD59E';
color_m2_light = '#FDEBD0';

timer = "";

function lighten_m2(pos)
{
	//kill_submenu_timer();
	document.getElementById('m2_im'+pos).style.backgroundColor = color_m2_dark;
}

function darken_m2(pos)
{
	document.getElementById('m2_im'+pos).style.backgroundColor = color_m2_light;
}

function show_submenu(ind)
{
	//kill_submenu_timer();
	if (document.getElementById('submenu'+ind).style.visibility == "hidden")
	{
		document.getElementById('submenu'+ind).style.visibility = "visible";
	}
	
}

function hide_submenu(ind)
{
	hide_submenu_end_timer(ind);
	//run_submenu_timer();
}

function hide_submenu_end_timer(ind)
{
	if (document.getElementById('submenu'+ind).style.visibility == "visible")
	{
		document.getElementById('submenu'+ind).style.visibility = "hidden";
	}

	
}


function run_submenu_timer()
{
	timer = setTimeout("hide_submenu_end_timer()", 500);
}

function kill_submenu_timer()
{
	if (timer) clearTimeout(timer);
}