/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_menu1 = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_menu1 = new Array("button1up_menu1.gif","button2up_menu1.gif","button3up_menu1.gif","button4up_menu1.gif","button5up_menu1.gif","button6up_menu1.gif","button7up_menu1.gif","button8up_menu1.gif","button9up_menu1.gif","button10up_menu1.gif","button11up_menu1.gif","button12up_menu1.gif","button13up_menu1.gif","button14up_menu1.gif");

overSources_menu1 = new Array("button1over_menu1.gif","button2over_menu1.gif","button3over_menu1.gif","button4over_menu1.gif","button5over_menu1.gif","button6over_menu1.gif","button7over_menu1.gif","button8over_menu1.gif","button9over_menu1.gif","button10over_menu1.gif","button11over_menu1.gif","button12over_menu1.gif","button13over_menu1.gif","button14over_menu1.gif");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_menu1 = new Array();
subInfo_menu1[1] = new Array();
subInfo_menu1[2] = new Array();
subInfo_menu1[3] = new Array();
subInfo_menu1[4] = new Array();
subInfo_menu1[5] = new Array();
subInfo_menu1[6] = new Array();
subInfo_menu1[7] = new Array();
subInfo_menu1[8] = new Array();
subInfo_menu1[9] = new Array();
subInfo_menu1[10] = new Array();
subInfo_menu1[11] = new Array();
subInfo_menu1[12] = new Array();
subInfo_menu1[13] = new Array();
subInfo_menu1[14] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//

subInfo_menu1[2][1] = new Array("About Us","about_us.html","");
subInfo_menu1[2][2] = new Array("The Team","the_team.html","");
subInfo_menu1[2][3] = new Array("Equipment We Use","equipment.html","");
subInfo_menu1[2][4] = new Array("Contact Us","contact_us.html","");







subInfo_menu1[9][1] = new Array(" Edinburgh Vaults","photo_gallery_edinburgh_vaults.html","");
subInfo_menu1[9][2] = new Array(" Bisham Abbey","photo_gallery_bisham_abbey.html","");
subInfo_menu1[9][3] = new Array(" Bolebroke Castle","photo_gallery_bolebroke_castle.html","");
subInfo_menu1[9][4] = new Array(" USA","photo_gallery_usa.html","");
subInfo_menu1[9][5] = new Array(" St Cleres Hall","photo_gallery_st_cleres_hall.html","");
subInfo_menu1[9][6] = new Array(" Wymering Manor","photo_gallery_wymering_manor.html","");
subInfo_menu1[9][7] = new Array(" The Mill House Hotel","photo_gallery_mill_house_hotel.html","");
subInfo_menu1[9][8] = new Array(" The Cobham Lodge Hotel","photo_gallery_cobham_lodge_hotel.html","");
subInfo_menu1[9][9] = new Array(" The Maltings","photo_gallery_the_maltings.html","");
subInfo_menu1[9][10] = new Array(" Ellerslie","photo_gallery_ellerslie.html","");


subInfo_menu1[11][1] = new Array("USA","usa.html","");
subInfo_menu1[11][2] = new Array("01/10/09 The Maltings","sarah_rooke2.html","");
subInfo_menu1[11][3] = new Array("14/05/09 Wymering Manor","sarah_rooke.html","");
subInfo_menu1[11][4] = new Array("22/01/09 The Maltings","the_maltings_22_january_09.html","");
subInfo_menu1[11][5] = new Array("25/11/08 Ellerslie","ellerslie_25_november_08.html","");




//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset_menu1 = 125;
var ySubOffset_menu1 = 3;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_menu1 = false;
var delay_menu1 = 1000;
totalButtons_menu1 = upSources_menu1.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_menu1; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_menu1[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_menu1">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_menu1" class="dropmenu_menu1" ');
		document.write('onMouseOver="overSub_menu1=true;');
		document.write('setOverImg_menu1(\'' + (x+1) + '\',\'_menu1\');"');
		document.write('onMouseOut="overSub_menu1=false;');
		document.write('setTimeout(\'hideSubMenu_menu1(\\\'submenu' + (x+1) + '_menu1\\\')\',delay_menu1);');
		document.write('setOutImg_menu1(\'' + (x+1) + '\',\'_menu1\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_menu1[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_menu1[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_menu1[x+1][k+1][2] + '">');
			document.write( subInfo_menu1[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_menu1() {
	for ( x=0; x<totalButtons_menu1; x++ ) {
		buttonUp_menu1 = new Image();
		buttonUp_menu1.src = buttonFolder_menu1 + upSources_menu1[x];
		buttonOver_menu1 = new Image();
		buttonOver_menu1.src = buttonFolder_menu1 + overSources_menu1[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg_menu1(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_menu1 + overSources_menu1[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg_menu1(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_menu1 + upSources_menu1[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement_menu1(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft_menu1(id) { 
	var el = getElement_menu1(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_menu1(id) {
	var el = getElement_menu1(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_menu1(objectID,x,y) {
	var el = getElement_menu1(objectID);
	el.style.left = x+'px';
	el.style.top = y+'px';
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_menu1(subID, buttonID) {
	hideAllSubMenus_menu1();
	butX = getRealLeft_menu1(buttonID);
	butY = getRealTop_menu1(buttonID);
	moveObjectTo_menu1(subID,butX+xSubOffset_menu1, butY+ySubOffset_menu1);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_menu1() {
	for ( x=0; x<totalButtons_menu1; x++) {
		moveObjectTo_menu1("submenu" + (x+1) + "_menu1",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_menu1(subID) {
	if ( overSub_menu1 == false ) {
		moveObjectTo_menu1(subID,-500, -500);
	}
}



//preload_menu1();


