// JavaScript Document
function add_menu(itemstr,target,itemtype) {
	menurow = document.createElement("TR");
	menucell = document.createElement("TD");

	menucell.className = 'normal_cell';
  cellcontent = document.createTextNode(itemstr);	
	menucell.appendChild(cellcontent);
	if (itemtype==0) 
		menucell.onclick = function() { location.href = target; }
	else if (itemtype==1)
	  menucell.onclick = function() { window.open(target, 'newwindow'); }
	menurow.appendChild(menucell);
	mytablebody.appendChild(menurow);
}

function add_menudiv(itemstr) {
	menurow = document.createElement("TR");
	menucell = document.createElement("TD");
	cellcontent = document.createTextNode(itemstr);
	menucell.className = 'top_cell';
	menucell.appendChild(cellcontent);	
	menurow.appendChild(menucell);
	mytablebody.appendChild(menurow);
}

function createmenu() {
  var mybody=document.getElementsByTagName("body").item(0);
  mydiv = document.createElement("DIV");
	mydiv.className = 'menu_container';
  mytable = document.createElement("TABLE");
  mytable.cellPadding = 0;
  mytable.cellSpacing = 0;
  mytable.width = 136;
  mytablebody = document.createElement("TBODY");
	
	tablerow = document.createElement("TR");
	tablecell = document.createElement("TD");
	tablecell.className = 'toptop_cell';
	tablerow.appendChild(tablecell);
	tablerow.appendChild(tablecell);
	mytablebody.appendChild(tablerow);
	
  mytable.appendChild(mytablebody);
  mydiv.appendChild(mytable);
  mybody.appendChild(mydiv);
	
  add_menu("Home","/",0);
  add_menu("Contact Us","/contact.php",0);
  add_menudiv("Accommodation");
  add_menu("Apartments","/listing.php",0);
	add_menu("Map of Apartments","/allaptmap.php",0);
	add_menu("Last Minute","/offers.php",0);  // special
  add_menu("Hotels","/barcelona_hotels/",0);
  add_menu("Groups & Activities","/groups/",0);
	add_menu("Monthly Rentals","/monthly.php",0);
  add_menu("FAQ","/terms.php",0);
  add_menudiv("Barcelona Tourism");  // div
  add_menu("Barcelona Guide","/tourism.php",0); // special
  add_menu("Virtual Tour","/virtualtour/virtualtour.php",0);
  add_menu("The Weather","/weather.php",0);  
  add_menu("Restaurants","/restaurants.php",0);
  add_menudiv("Destinations");  //div
  add_menu("Rome","/rome/",1); // blank
  add_menu("Costa Brava","http://www.northspainvillas.com",1); // blank
  add_menu("Budapest","http://www.budpocketguide.com",1); // blank
	add_menu("Paris","http://www.welcome2france.com",1); // blank
	
	tablerow = document.createElement("TR");
	tablecell = document.createElement("TD");
	tablecell.height = 15;
	tablecell.className = 'last_cell';
	tablerow.appendChild(tablecell);
	mytablebody.appendChild(tablerow);
}

