/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("button1up.png","button2up.png","button3up.png","button4up.png","button5up.png","button6up.png","button7up.png","button8up.png","button9up.png","button10up.png","button11up.png","button12up.png","button13up.png","button14up.png","button15up.png");

overSources = new Array("button1over.png","button2over.png","button3over.png","button4over.png","button5over.png","button6over.png","button7over.png","button8over.png","button9over.png","button10over.png","button11over.png","button12over.png","button13over.png","button14over.png","button15over.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo = new Array();
subInfo[1] = new Array();
subInfo[2] = new Array();
subInfo[3] = new Array();
subInfo[4] = new Array();
subInfo[5] = new Array();
subInfo[6] = new Array();
subInfo[7] = new Array();
subInfo[8] = new Array();
subInfo[9] = new Array();
subInfo[10] = new Array();
subInfo[11] = new Array();
subInfo[12] = new Array();
subInfo[13] = new Array();
subInfo[14] = new Array();
subInfo[15] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//





subInfo[6][1] = new Array("Amboseli Lodge","http://www.ahotsun.com/ambomodge_e.html","");
subInfo[6][2] = new Array("Ngulia Lodge","http://www.ahotsun.com/ngulia_e.html","");
subInfo[6][3] = new Array("Ol Tukai Lodge","http://www.ahotsun.com/oltukai_e.html","");
subInfo[6][4] = new Array("Patterson\'s Camp","http://www.ahotsun.com/patterson_e.html","");
subInfo[6][5] = new Array("Voi Safari Lodge","http://www.ahotsun.com/voi_e.html","");
subInfo[6][6] = new Array("Ndololo Camp","http://www.ahotsun.com/ndololo_e.html","");
subInfo[6][7] = new Array("Figtree","http://www.ahotsun.com/figtree_e.html","");
subInfo[6][8] = new Array("Mara Paradise","http://www.ahotsun.com/maraparadise_e.html","");
subInfo[6][9] = new Array("Mara Sopa","http://www.ahotsun.com/marasopa_e.html","");
subInfo[6][10] = new Array("Mara Intrepids","http://www.ahotsun.com/maraintrepids_e.html","");
subInfo[6][11] = new Array("Mara Hippo Camp","http://www.ahotsun.com/marahippo_e.html","");
subInfo[6][12] = new Array("Lake Nakuru Lodge","http://www.ahotsun.com/nakurulodge_e.html","");
subInfo[6][13] = new Array("Sarova Lion Hill","http://www.ahotsun.com/sarova_e.html","");
subInfo[6][14] = new Array("Shimba Lodge","http://www.ahotsun.com/shimbalodge_e.html","");
subInfo[6][15] = new Array("Hilton Saltlick","http://www.ahotsun.com/hiltonsaltlick_e.html","");
subInfo[6][16] = new Array("Hilton Taita","http://www.ahotsun.com/hiltontaitalodge_e.html","");
subInfo[6][17] = new Array("Ziwani Camp","http://www.ahotsun.com/ziwani_e.html","");
subInfo[6][18] = new Array("Larsen\'s Samburu","http://www.ahotsun.com/larsens_e.html","");
subInfo[6][19] = new Array("Mbweha Camp","http://www.ahotsun.com/mbweha_e.html","");
subInfo[6][20] = new Array("Samburu Intrepids","http://www.ahotsun.com/intrepids_e.html","");
subInfo[6][21] = new Array("Samburu Serena","http://www.ahotsun.com/samburuserena_e.html","");
subInfo[6][22] = new Array("Elsa\'s Kopje, Bush/Game Lodge","http://www.ahotsun.com/elsaskopje_e.html","");
subInfo[6][23] = new Array("Leopard Rock","http://www.ahotsun.com/leopardrock_e.html","");
subInfo[6][24] = new Array("The Ark  ","http://www.ahotsun.com/ark_e.html","");
subInfo[6][25] = new Array("Rusinga Island Lodge","http://www.ahotsun.com/rusingalodge_e.html","");
subInfo[6][26] = new Array("Lake Bogoria Hotel","http://www.ahotsun.com/bogoriahotel_e.html","");

subInfo[7][1] = new Array("7 days Nairobi & Maasai Mara & Lake Nakuru & Amboseli & Tsavo East & Malindi","http://www.ahotsun.com/7daysnairobi_e.html","");
subInfo[7][2] = new Array("7 days Nairobi & Samburu  & Lake Nakuru & Maasai Mara & Tsavo East & Malindi ","http://www.ahotsun.com/7jkiamalindi_e.html","");

subInfo[8][1] = new Array("1 day Tsavo East","http://www.ahotsun.com/1day_e.html","");
subInfo[8][2] = new Array("2 days Tsavo East","http://www.ahotsun.com/2east_e.html","");
subInfo[8][3] = new Array("2 days Tsavo East & Taita Hills","http://www.ahotsun.com/2easttaita_e.html","");
subInfo[8][4] = new Array("2 days Tsavo East &Tsavo West","http://www.ahotsun.com/2eastwest_e.html","");
subInfo[8][5] = new Array("3 days Tsavo East & Tsavo West","http://www.ahotsun.com/3eastwest_e.html","");
subInfo[8][6] = new Array("3 days Tsavo East or Tsavo West & Amboseli","http://www.ahotsun.com/3tsavoambo_e.html","");
subInfo[8][7] = new Array("3 days Tsavo East & Tsavo West & Amboseli","http://www.ahotsun.com/3tsavoewambo_e.html","");
subInfo[8][8] = new Array("3 days Tsavo East & Tsavo West & Taita Hills","http://www.ahotsun.com/3tsavoewtaita_e.html","");
subInfo[8][9] = new Array("4 days Tsavo East & Tsavo West & Shimba Hills","http://www.ahotsun.com/4days_e.html","");
subInfo[8][10] = new Array("5 days Lake Nakuru & Maasai Mara & Amboseli","http://www.ahotsun.com/5days_e.html","");
subInfo[8][11] = new Array("7 days Tsavo West & Lake Nakuru & Maasai Mara & Amboseli & Tsavo East","http://www.ahotsun.com/7days_e.html","");

subInfo[9][1] = new Array("4 days Nakuru & Maasai Mara & Olorgesailie","http://www.ahotsun.com/4jkia_e.html","");
subInfo[9][2] = new Array("5 days Nakuru & Samburu & Masai Mara","http://www.ahotsun.com/5jkia_e.html","");
subInfo[9][3] = new Array("8 days Nairobi & Olorgersailie & Lake Nakuru & Lake Bogoria & Kisumu & Maasai Mara","http://www.ahotsun.com/8jkia_e.html","");
subInfo[9][4] = new Array("9 days Nairobi & Aberdares & Meru & Samburu & Lake Nakuru & Naivasha & Maasai Mara","http://www.ahotsun.com/9jkia_e.html","");
subInfo[9][5] = new Array("10 days Mount Kenya & Meru & Sambburu & Aberdares & Maasai Mara","http://www.ahotsun.com/10jkia_e.html","");

subInfo[10][1] = new Array("2 days Lamu island","http://www.ahotsun.com/2lamu_e.html","");
subInfo[10][2] = new Array("2 days Maasai Mara","http://www.ahotsun.com/2massaimara_e.html","");
subInfo[10][3] = new Array("3 days Maasai Mara","http://www.ahotsun.com/3massaimara_e.html","");

subInfo[11][1] = new Array("citytrips","http://www.ahotsun.com/excursions_e.html","");
subInfo[11][2] = new Array("deepsea fishing","http://www.ahotsun.com/deepsea_e.html","");
subInfo[11][3] = new Array("diving","http://www.ahotsun.com/diving_e.html","");

subInfo[12][1] = new Array("Tsavo West National Park","http://www.ahotsun.com/tsavow_e.html","");
subInfo[12][2] = new Array("Tsavo East National Park","http://www.ahotsun.com/tsavoe_e.html","");
subInfo[12][3] = new Array("Amboseli National Park","http://www.ahotsun.com/amboseli_e.html","");
subInfo[12][4] = new Array("Lake Nakuru National Park","http://www.ahotsun.com/nakuru_e.html","");
subInfo[12][5] = new Array("Shimba Hills National Reserve","http://www.ahotsun.com/shimba_e.html","");
subInfo[12][6] = new Array("Maasai Mara National Reserve","http://www.ahotsun.com/mara_e.html","");
subInfo[12][7] = new Array("Samburu National Reserve","http://www.ahotsun.com/samburu_e.html","");
subInfo[12][8] = new Array("Mount Kenya National Park","http://www.ahotsun.com/mntkenya_e.html","");
subInfo[12][9] = new Array("Meru Natinal Park","http://www.ahotsun.com/meru_e.html","");
subInfo[12][10] = new Array("Aberdare National Park","http://www.ahotsun.com/aberdares_e.html","");
subInfo[12][11] = new Array("Lake Bogoria National Park","http://www.ahotsun.com/bogoria_e.html","");
subInfo[12][12] = new Array("Rusinga Island","http://www.ahotsun.com/rusinga_e.html","");
subInfo[12][13] = new Array("Kakamega Forest National Reserve","http://www.ahotsun.com/kakamega_e.html","");
subInfo[12][14] = new Array("Olorgesailie Prehistoric Site","http://www.ahotsun.com/olorgesailie_e.html","");
subInfo[12][15] = new Array("Malindi / Watamu Marine park","http://www.ahotsun.com/marine_e.html","");

subInfo[13][1] = new Array("Lamu Palace Hotel","http://www.ahotsun.com/lamupalace_e.html","");
subInfo[13][2] = new Array("The Stanley Nairobi","http://www.ahotsun.com/stanley_e.html","");
subInfo[13][3] = new Array("The Heron Nairobi","http://www.ahotsun.com/heron_e.html","");
subInfo[13][4] = new Array("The Carnivore restaurant Nairobi ","http://www.ahotsun.com/carnivore_e.html","");

subInfo[14][1] = new Array("Nairobi","http://www.ahotsun.com/nairobi_e.html","");
subInfo[14][2] = new Array("Mombasa","http://www.ahotsun.com/mombasa_e.html","");
subInfo[14][3] = new Array("Malindi","http://www.ahotsun.com/malindi_e.html","");
subInfo[14][4] = new Array("Gede","http://www.ahotsun.com/gede_e.html","");
subInfo[14][5] = new Array("Lamu Island","http://www.ahotsun.com/lamu_e.html","");
subInfo[14][6] = new Array("Kisumu","http://www.ahotsun.com/kisumu_e.html","");



//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 21;
var ySubOffset = 23;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub = false;
var delay = 1000;
totalButtons = upSources.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '" class="dropmenu" ');
		document.write('onMouseOver="overSub=true;');
		document.write('setOverImg(\'' + (x+1) + '\',\'\');"');
		document.write('onMouseOut="overSub=false;');
		document.write('setTimeout(\'hideSubMenu(\\\'submenu' + (x+1) + '\\\')\',delay);');
		document.write('setOutImg(\'' + (x+1) + '\',\'\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo[x+1][k+1][2] + '">');
			document.write( subInfo[x+1][k+1][0] + '</a>');
			document.write('</li>');
		}
		document.write('</ul>');
	}
	document.write('</div>');
}





//*** MAIN BUTTONS FUNCTIONS ***//
// PRELOAD MAIN MENU BUTTON IMAGES
function preload() {
	for ( x=0; x<totalButtons; x++ ) {
		buttonUp = new Image();
		buttonUp.src = buttonFolder + upSources[x];
		buttonOver = new Image();
		buttonOver.src = buttonFolder + overSources[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder + overSources[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder + upSources[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft(id) { 
	var el = getElement(id);
	if (el) { 
		xPos = el.offsetLeft;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		} 
		return xPos;
	} 
} 

// GET Y COORDINATE
function getRealTop(id) {
	var el = getElement(id);
	if (el) { 
		yPos = el.offsetTop;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			yPos += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		return yPos;
	}
}

// MOVE OBJECT TO COORDINATE
function moveObjectTo(objectID,x,y) {
	var el = getElement(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu(subID, buttonID) {
	hideAllSubMenus();
	butX = getRealLeft(buttonID);
	butY = getRealTop(buttonID);
	moveObjectTo(subID,butX+xSubOffset, butY+ySubOffset);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus() {
	for ( x=0; x<totalButtons; x++) {
		moveObjectTo("submenu" + (x+1) + "",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu(subID) {
	if ( overSub == false ) {
		moveObjectTo(subID,-500, -500);
	}
}



//preload();

