﻿// Version 2 dated 14.11.03 by PS
var page = document.location.href;
// each element of array made up of:
// [Name,Link,External Link?,Sub menu?]
var Menu 	= new Array();
Menu[0] 	= 
["menu","",0,1,
["Photo Gallery","gallery.php",0,0],
["Video","video.php",0,0],
["Village Map","villagemap.php",0,0],
["GO's & Entertainment","go_entertainment.php",0,0]
];

Menu[1] 	= ["spacer","",0,0,["","",0,0]];

Menu[2] 	= 
["menu","",0,1,
["Suites & Rooms","superior.php",0,0],
["Restaurants & Bars","bar_res.php",0,0],
["Spa Village","spa_village.php",0,0]
];

Menu[3] 	= ["spacer","",0,0,["","",0,0]];

Menu[4] 	= 
["menu0","",0,1,
["Family","family.php",0,0],
["Leisure Activities","leisure_pool.php",0,0],
["Excursions","excursion.php",0,0]
];

Menu[5] 	= ["spacer","",0,0,["","",0,0]];

Menu[6] 	= 
["menu","",0,1,
["Club Med Business","clubmedbusiness.php",0,0],
["Destination Guide","destination_guide.php",0,0]
];




// -------------------------------------------------------------------------
// do not edit below this line!!
// Last Update 27/11/03

// variables for highlighting section/subsection
var showSection = true;
var showSubSection = true;
var output = output2 = output3 = "";
var breadcrumbs = "";
var sectionLink = "";

var next_link = "";
var next_text = "";
for (i=0; i<Menu.length;i++)
	{
	showSection = comparePage(Menu[i][1],page) ? true : false;
	if (Menu[i][3]==1 && Menu[i][4]!="undefined") // sub nav
	{
	for (j=4; j<Menu[i].length;j++)
	//for (j=4; j>=0;j--)
		{
			//breadcrumbsSec="<span class=\"darkgreen1\"> > </span><a href=\"" + Menu[i][j][1] + "\" class=\"darkgreenlink1\">" + Menu[i][j][0] + "</a> " + breadcrumbs;
			showSubSection = comparePage(Menu[i][j][1],page) ? true : false;
			output2="";	
			if (comparePage(Menu[i][j][1],page))
			{	
				showSubSection=showSection=true;
				
				
				output2 += showTable(Menu[i][j][0],Menu[i][j][1],showSection,5,true,"",Menu[i][j][2]);
				output2 = output2.replace("replace"," bgcolor='#9999cc'");
				
			}
		}
	if (!showSubSection && !showSection)
		{
			output2="";
		}
	}
	
	///////////////////////////////tryyyyyyyyyyyyyyyyyyyyyy
	if (Menu[i][1]=="")
	sectionLink = Menu[i][4][1];
	else 
	sectionLink = Menu[i][1];
	showSection = comparePage(Menu[i][1],page) ? true : false;
	
	for (j=4; j<Menu[i].length;j++){
				
				//showSubSection = comparePage(Menu[i][j][1],page) ? true : false;
				//output += showTable(Menu[i][0], sectionLink, showSection,10, comparePage(Menu[i][1],page) ? true : false, showSubSection || showSection ? "" : "bgcolor='#ffffff'",Menu[i][2]) + output3;
				output += showTable(Menu[i][j][0],Menu[i][j][1],comparePage(Menu[i][j][1],page) ? true : false,8,"",Menu[i][j][2]);
				//alert("name"+output);
		}

	showSubSection=false; // added 02.03.04 by PS
}

output = output.replace ("replace"," ");


function comparePage (check,current)
{
	//suite is special case
	if(check=="go_entertainment.php"){
		var returnValue = false;
		if (current.match("go_entertainment")) returnValue=true;
		if (current.match("go_entertainment2")) returnValue=true;
		if (check==current) returnValue=true;
		if (check=="") returnValue=false;
		return returnValue;
	}
	if(check=="leisure_pool.php"){
		var returnValue = false;
		if (current.match("leisure_pool.php")) returnValue=true;
		if (current.match("leisure_sport")) returnValue=true;
		if (current.match("leisure_golf")) returnValue=true;
		if (current.match("leisure_circus")) returnValue=true;
		if (current.match("leisure_boutique")) returnValue=true;
		if (check==current) returnValue=true;
		if (check=="") returnValue=false;
		return returnValue;
	}
	if(check=="superior.php"){
		var returnValue = false;
		if (current.match("superior_barramundi.php")){
			returnValue=true;
		}
		if (current.match("superior.php")){
			returnValue=true;
		}
			
		if (check==current) returnValue=true;
		if (check=="") returnValue=false;
		return returnValue;
	}
	var returnValue = false;
	check = check.replace ("\.\.\/","");
	if (current.match(check)) returnValue=true;
	if (check==current) returnValue=true;
	if (check=="") returnValue=false;
	return returnValue;
}

function showNext()
{
	if (next_link!="")
	return "<a href=\"" + next_link + "\" class=\"greenlink1\"><b>" + next_text + "</b><img src=\"../_includes/sitewide_images/arrow_next.gif\" width=\"7\" height=\"6\" alt=\"\" border=\"0\"/></a>";
	else
	return "";
}

function showTable(name,link,show,pixels,highlight,bgcolor2,target)
{	
	bgcolor = show ? "bgcolor='#30A4C0'" : "replace";
	nav 	= highlight ? "mainnav" : "mainnav";
	target 	= target==1 ? "target=_new" : "";
	isOn 	= highlight ? "_on" : "";

	if(name=="")//cheating!
	{
		return  "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\"><img src=\"/images/x.gif\" height=\"10\" alt=\"\" border=\"0\"/></table>"
	}
	else{
	return  "<table "+bgcolor+" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" " + bgcolor + "><tr>" +
	"<td width=\"10\"><img src=\"/images/x.gif\" width=\"20px" + pixels + "\" height=\"1\" alt=\"\" border=\"0\"/></td>" + 
	"<td width=\"166\" height=\"18\" valign=\"middle\"><a class=\"" + nav + "\" href=\"" + link + "\" " + target + " class=\"" + nav + "\"><b>" + name + "</b></a></td>" +
	"<td width=14><a href=\"" + link + "\" " + target + " class=\"" + nav + "\"></a>" + 
	"<img src=\"/images/x.gif\" width=\"5\" height=\"1\" alt=\"\" border=\"0\"/></td>" + 
	"</tr></table>"
	}
}
next = showNext();