/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("button1_m01up.gif","button2_m02up.gif","button3_m03up.gif","button4_m04up.gif","button5_m05up.gif","button6_m06up.gif","button7_m07up.gif","button8_m08up.gif","button9_m09up.gif","button10_m10up.gif","button11_m11up.gif","button12_m12up.gif","button13_m13up.gif","button14_m14up.gif","button15_m15up.gif","button16_m16up.gif","button17_m17up.gif","button18_m18up.gif","button19_m19up.gif","button20_m20up.gif","button21aup.gif","button22aup.gif","button23aup.gif","button24aup.gif","button25aup.gif","button26aup.gif","button27aup.gif","button28up.gif");

overSources = new Array("button1_m01over.gif","button2_m02over.gif","button3_m03over.gif","button4_m04over.gif","button5_m05over.gif","button6_m06over.gif","button7_m07over.gif","button8_m08over.gif","button9_m09over.gif","button10_m10over.gif","button11_m11over.gif","button12_m12over.gif","button13_m13over.gif","button14_m14over.gif","button15_m15over.gif","button16_m16over.gif","button17_m17over.gif","button18_m18over.gif","button19_m19over.gif","button20_m20over.gif","button21aover.gif","button22aover.gif","button23aover.gif","button24aover.gif","button25aover.gif","button26aover.gif","button27aover.gif","button28over.gif");

// 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();
subInfo[16] = new Array();
subInfo[17] = new Array();
subInfo[18] = new Array();
subInfo[19] = new Array();
subInfo[20] = new Array();
subInfo[21] = new Array();
subInfo[22] = new Array();
subInfo[23] = new Array();
subInfo[24] = new Array();
subInfo[25] = new Array();
subInfo[26] = new Array();
subInfo[27] = new Array();
subInfo[28] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//

<!--

subInfo[1][1] = new Array("English","LangEng.htm","");
subInfo[1][2] = new Array("Chinese","LangCn.htm","");
subInfo[1][3] = new Array("Spanish","LangSpan.htm","");
subInfo[1][4] = new Array("Indian","LangInd.htm","");
subInfo[1][5] = new Array("Latin","LangLatin.htm","");
subInfo[1][6] = new Array("Polish","LangPolish.htm","");
subInfo[1][7] = new Array("Portuguese","LangPort.htm","");
subInfo[1][8] = new Array("Russian","LangUkraine.htm","");
subInfo[1][9] = new Array("Vietnamese","LangViet.htm","");
subInfo[1][10] = new Array("Other","LangOther.htm","");

subInfo[2][1] = new Array("UK","LangEng_Courses.htm","");
subInfo[2][2] = new Array("China","LangCn_Courses.htm","");
subInfo[2][3] = new Array("Peru","LangSpan_Courses.htm","");
subInfo[2][4] = new Array("France","saFrance.htm","");
subInfo[2][5] = new Array("India","LangInd_Courses.htm","");
subInfo[2][6] = new Array("Macao","LangPort_Courses.htm","");
subInfo[2][7] = new Array("Poland","LangPoland_Courses.htm","");
subInfo[2][8] = new Array("Singapore","LangSing_Courses.htm","");
subInfo[2][9] = new Array("Ukraine","LangUkraine_Courses.htm","");
subInfo[2][10] = new Array("Vietnam","LangViet_Courses.htm","");
subInfo[2][11] = new Array("Other","LangOther_Courses.htm","");

subInfo[3][1] = new Array("UK","sa_uk2.htm","");
subInfo[3][2] = new Array("China","sacn2.htm","");
subInfo[3][3] = new Array("Peru","sa_peru.htm","");
subInfo[3][4] = new Array("France","saFrance.htm","");
subInfo[3][5] = new Array("India","saIndia.htm","");
subInfo[3][6] = new Array("Macao","saMacao.htm","");
subInfo[3][7] = new Array("Poland","saPoland.htm","");
subInfo[3][8] = new Array("Singapore","saSing.htm","");
subInfo[3][9] = new Array("Ukraine","saUkraine.htm","");
subInfo[3][10] = new Array("Vietnam","saViet.htm","");
subInfo[3][11] = new Array("Other","saOther.htm","");

//subInfo[4][1] = new Array("What Is It","emp2.htm","");
//subInfo[4][2] = new Array("What Excel Offer","emp3.htm","");

subInfo[5][1] = new Array("UK","scuk.htm","");
subInfo[5][2] = new Array("Africa","scbot.htm","");
subInfo[5][3] = new Array("China","sccn.htm","");
subInfo[5][4] = new Array("Earth Sciences","sces.htm","");
subInfo[5][5] = new Array("Nepal","scnepal.htm","");
subInfo[5][6] = new Array("Peru","scperu.htm","");
subInfo[5][7] = new Array("Thailand","scthai.htm","");

subInfo[10][1] = new Array("Down The Road","dtr.htm","");


subInfo[12][1] = new Array("Au Pair","ap.htm","");
subInfo[12][2] = new Array("Excel Projects","Projects.htm","");
subInfo[12][3] = new Array("Trade Visits","trade.htm","");
subInfo[12][4] = new Array("World Cup 2010","scwc.htm","");
subInfo[12][5] = new Array("Testimonials","test.htm","");

subInfo[22][1] = new Array("British Foreign Office","http://www.fco.gov.uk/servlet/Front?pagename=OpenMarket/Xcelerate/ShowPage&c=Page&cid=1007029395231","");
subInfo[22][2] = new Array("Chinese Embassy in UK","http://www.chinese-embassy.org.uk/eng/lsyw/default.htm","");
subInfo[22][3] = new Array("British Embassy in China","http://www.uk.cn/bj/visa_index.asp?lang=e&menu_id=430&artid=1196","");

subInfo[27][1] = new Array("Cantonese Sheik","http://www.cantonese.sheik.co.uk/","");
subInfo[27][2] = new Array("CantoDict","http://www.cantonese.sheik.co.uk/scripts/wordlist.htm","");
subInfo[27][3] = new Array("English Dictionary","http://dictionary.reference.com/","");

subInfo[28][1] = new Array("Excel Trading","http://www.excel-trading.com","");
subInfo[28][2] = new Array("Debonaire Jewellery","http://www.debonaire-gems.com","");
subInfo[28][2] = new Array("Down The Road","http://www.dtr.org","");
subInfo[28][3] = new Array("Online Cupid","http://www.online-cupid.com","");
subInfo[28][4] = new Array("Pearl Dragon","http://www.pearl-dragon.co.uk","");

//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 110;
var ySubOffset = 2;



//*** 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();

