function light_menu(id,menu)
{
	var the_id = id;
	var cell_id = id.substring(0, id.lastIndexOf('_'))+'_cell';
	var menu_block_id = menu;
	var the_obj = document.getElementById(the_id);
	the_obj.className = "top-menu-item-selected";
	var the_submenu = document.getElementById(menu_block_id);
	the_submenu.className = "submenu-vis";
	var the_div = document.getElementById('invis');
	the_div.className = "vis";
}

function off_menu(id,menu)
{
	var the_id = id;
	var cell_id = id.substring(0, id.lastIndexOf('_'))+'_cell';
	var menu_block_id = menu;
	var the_obj = document.getElementById(the_id);
	the_obj.className = "top-menu-item";
	var menu_block_id = menu;
	if (menu_block_id)
	{
		var menu = document.getElementById(menu_block_id);
		menu.className = "submenu-invis";	
	}
	var the_div = document.getElementById('invis');
	the_div.className = "invis";
}

function update()
{
  var children = document.forms['order'].children.value;
  var capacity = 1 * document.getElementById('places').innerHTML;
  var people = 1 * document.forms['order'].people.value;
  var quantity = 1 * document.forms['order'].quantity.value;
	var price = 1 * document.forms['order'].room_price.value;
	var room_price_atr = 1 * document.forms['order'].room_price_atr.value;
  if(isNaN(children))
  {
		alert ("ERROR! This is NOT a number");
		document.forms['order'].children.value = 0;
  }
  if(isNaN(people))
  {
		alert ("ERROR! This is NOT a number");
		document.forms['order'].people.value = 0;
  }
  if(isNaN(quantity))
  {
		alert ("ERROR! This is NOT a number");
		document.forms['order'].quantity.value = 0;
  }
  if (people > capacity)
  {
		var r = people % capacity;
			if (r == 0) quantity = people / capacity;
			else quantity  = parseInt(people / capacity) + 1;
	}
  else quantity = 1;
  document.forms['order'].quantity.value = quantity;
	if (room_price_atr == 1) var total = price * quantity;
  else var total = price * people;
  document.getElementById('total').innerHTML = total;
}

function conference()
{
  var children = document.forms['order'].children.value;
  var capacity = 1 * document.getElementById('places').innerHTML;
  var people = 1 * document.forms['order'].people.value;
  var quantity = 1 * document.forms['order'].quantity.value;
	var price = 1 * document.forms['order'].room_price.value;
  if(isNaN(children))
  {
    alert ("ERROR! This is NOT a number");
	document.forms['order'].children.value = 0;
  }
  if(isNaN(people))
  {
    alert ("ERROR! This is NOT a number");
	document.forms['order'].people.value = 0;
  }
  if(isNaN(quantity))
  {
    alert ("ERROR! This is NOT a number");
	document.forms['order'].quantity.value = 0;
  }
  if (people > capacity)
  {
	var r = people % capacity;
	if (r == 0) quantity = people / capacity;
	else quantity  = parseInt(people / capacity) + 1;
  }
  else quantity = 1;
  document.forms['order'].quantity.value = quantity;
  var total = price * quantity;
  document.getElementById('total').innerHTML = total;
}
