/*** 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","button16up.png","button17up.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","button16over.png","button17over.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();
subInfo[16] = new Array();
subInfo[17] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo[1][1] = new Array("Cortes Travel  ","http://cortestravel.com/index.html","");
subInfo[1][2] = new Array("welcome        ","http://cortestravel.com/welcome.html","");
subInfo[1][3] = new Array("Massage info   ","http://cortestravel.com/massageinfo.html","");

subInfo[2][1] = new Array("Store","http://www.gourmetgroceryshop.com","");
subInfo[2][2] = new Array("Activities    ","http://cortestravel.com/Activitiestore.html","");
subInfo[2][3] = new Array("Book          ","http://cortestravel.com/Bookstore.html","");
subInfo[2][4] = new Array("Luggage       ","http://cortestravel.com/luggagestore.html","");
subInfo[2][5] = new Array("Magazine      ","http://cortestravel.com/magazinestand.html","");

subInfo[3][1] = new Array("Luxury       ","http://cortestravel.com/luxurytours.html","");
subInfo[3][2] = new Array("Adventure ","http://cortestravel.com/adventuretours.html","");
subInfo[3][3] = new Array("Ghost","http://www.ghostbusterz.com","");
subInfo[3][4] = new Array("Farm","http://www.illinoisseed.com","");
subInfo[3][5] = new Array("Garden     ","http://www.payomgarden.com","");

subInfo[4][1] = new Array("Thailand Hotels ","http://cortestravel.com/thailandhotels1.html","");
subInfo[4][2] = new Array("Hotel Search    ","http://cortestravel.com/hotelsearch.html","");
subInfo[4][3] = new Array("Beach resorts   ","http://cortestravel.com/beachresorts.html","");

subInfo[5][1] = new Array("Cosplay","http://www.animeiai.com","");
subInfo[5][2] = new Array("Travel Video","http://www.filmvdo.com","");
subInfo[5][3] = new Array("Dance Video","http://www.dancevdo.com","");
subInfo[5][4] = new Array("Airplane Ticket  ","http://cortestravel.com/airplaneticket.html","");
subInfo[5][5] = new Array("Rail             ","http://cortestravel.com/Railtravel.html","");
subInfo[5][6] = new Array("Cruise Lines     ","http://cortestravel.com/Cruise.html","");
subInfo[5][7] = new Array("Student   ","http://cortestravel.com/studenttravel.html","");

subInfo[6][1] = new Array("USA Visa guide","http://www.usavisalawfirms.com","");
subInfo[6][2] = new Array("USA Visa","http://www.usvisalawfirms.com","");
subInfo[6][3] = new Array("USA Law       ","http://www.cookcountylawfirms.com","");

subInfo[7][1] = new Array("Bangkok   ","http://cortestravel.com/aboutbangkok.html","");
subInfo[7][2] = new Array("Chiang Mai ","http://cortestravel.com/chiangmai.html","");
subInfo[7][3] = new Array("Pattaya  ","http://cortestravel.com/pattayabeach.html","");
subInfo[7][4] = new Array("Phuket  ","http://cortestravel.com/phukettravel.html","");
subInfo[7][5] = new Array("Thai Dating","http://www.marrythailady.com","");
subInfo[7][6] = new Array("Thailand guide","http://www.bookthaihotel.com","");
subInfo[7][7] = new Array("Thai wife ","http://www.thaiwifeusa.com","");

subInfo[8][1] = new Array("Africa   ","http://cortestravel.com/africatravel.html","");
subInfo[8][2] = new Array("Cairo    ","http://cortestravel.com/cairotravel.html","");
subInfo[8][3] = new Array("Cape Verde  ","http://cortestravel.com/capeverdetravel.html","");
subInfo[8][4] = new Array("Casablanca ","http://cortestravel.com/casablancatravel.html","");
subInfo[8][5] = new Array("Nile     ","http://cortestravel.com/niletravel.html","");

subInfo[9][1] = new Array("China  ","http://cortestravel.com/asiapacifictravel.html","");
subInfo[9][2] = new Array("Bali   ","http://cortestravel.com/balitravel.html","");
subInfo[9][3] = new Array("Hong Kong ","http://cortestravel.com/hongkongtravel.html","");
subInfo[9][4] = new Array("Macau     ","http://cortestravel.com/macautravel.html","");
subInfo[9][5] = new Array("Maldives  ","http://cortestravel.com/maldivestravel.html","");
subInfo[9][6] = new Array("New Delhi ","http://cortestravel.com/newdelhitravel.html","");
subInfo[9][7] = new Array("Seoul  ","http://cortestravel.com/seoultravel.html","");
subInfo[9][8] = new Array("Tokyo  ","http://cortestravel.com/tokyotravel.html","");

subInfo[10][1] = new Array("Europe travel  ","http://cortestravel.com/europetravel.html","");
subInfo[10][2] = new Array("Amsterdam   ","http://www.cortestravel.com/amsterdamtravel.html","");
subInfo[10][3] = new Array("Athens      ","http://cortestravel.com/athenstravel.html","");
subInfo[10][4] = new Array("Ibiza      ","http://cortestravel.com/ibizatravel.html","");
subInfo[10][5] = new Array("Istanbul   ","http://cortestravel.com/istanbultravel.html","");
subInfo[10][6] = new Array("London     ","http://cortestravel.com/londontravel.html","");
subInfo[10][7] = new Array("Malta      ","http://cortestravel.com/maltatravel.html","");
subInfo[10][8] = new Array("Milan      ","http://cortestravel.com/milantravel.html","");
subInfo[10][9] = new Array("Monaco     ","http://cortestravel.com/monacotravel.html","");
subInfo[10][10] = new Array("Moscow     ","http://cortestravel.com/moscowtravel.html","");
subInfo[10][11] = new Array("Munich    ","http://cortestravel.com/munichtravel.html","");
subInfo[10][12] = new Array("Paris      ","http://cortestravel.com/paristravel.html","");
subInfo[10][13] = new Array("Prague     ","http://cortestravel.com/praguetravel.html","");
subInfo[10][14] = new Array("Rome       ","http://cortestravel.com/rometravel.html","");
subInfo[10][15] = new Array("Vienna  ","http://cortestravel.com/viennatravel.html","");
subInfo[10][16] = new Array("Russia Dating   ","http://www.marryrussialady.com","");

subInfo[11][1] = new Array("Calhoun","http://www.calhountravel.com","");
subInfo[11][2] = new Array("Anchorage  ","http://cortestravel.com/anchoragetravel.html","");
subInfo[11][3] = new Array("Branson    ","http://cortestravel.com/bransontravel.html","");
subInfo[11][4] = new Array("Chicago    ","http://cortestravel.com/chicagotravel.html","");
subInfo[11][5] = new Array("Las Vegas  ","http://cortestravel.com/lasvegas.html","");
subInfo[11][6] = new Array("Maui       ","http://www.cortestravel.com/mauitravel.html","");
subInfo[11][7] = new Array("New Orleans ","http://cortestravel.com/neworleans.html","");
subInfo[11][8] = new Array("New York    ","http://cortestravel.com/newyorktravel.html","");
subInfo[11][9] = new Array("Orlando     ","http://cortestravel.com/orlandotravel.html","");
subInfo[11][10] = new Array("San Fransico ","http://cortestravel.com/sanfranciscotravel.html","");
subInfo[11][11] = new Array("Vail & Aspen ","http://cortestravel.com/vailaspentravel.html","");

subInfo[12][1] = new Array("Bora Bora   ","http://cortestravel.com/boraboratravel.html","");
subInfo[12][2] = new Array("Fiji        ","http://cortestravel.com/fijitravel.html","");
subInfo[12][3] = new Array("Galapagos Islands ","http://cortestravel.com/galapagosislands.html","");

subInfo[13][1] = new Array("Sydney      ","http://cortestravel.com/sydneytravel.html","");

subInfo[14][1] = new Array("Cancun    ","http://cortestravel.com/cancuntravel.html","");
subInfo[14][2] = new Array("Cayman Islands   ","http://cortestravel.com/caymanislandstravel.html","");
subInfo[14][3] = new Array("Machu Picchu   ","http://cortestravel.com/machupicchutravel.html","");
subInfo[14][4] = new Array("Rio de Janeiro  ","http://cortestravel.com/riotravel.html","");
subInfo[14][5] = new Array("Tikal  ","http://cortestravel.com/tikaltravel.html","");

subInfo[15][1] = new Array("Car Parking  ","http://cortestravel.com/carparking.html","");
subInfo[15][2] = new Array("Car rental ","http://cortestravel.com/carrental.html","");

subInfo[16][1] = new Array("Tarot beginner","http://www.destiny4you.com","");
subInfo[16][2] = new Array("Tarot reading","http://www.destinyfuture.com","");
subInfo[16][3] = new Array("Horoscope","http://www.destinyastrology.com","");
subInfo[16][4] = new Array("Love Horoscope","http://www.destinyhoroscope.com","");
subInfo[16][5] = new Array("zodiac","http://www.destinyzodiac.com","");
subInfo[16][6] = new Array("Psychic","http://www.destinypsychic.com","");

subInfo[17][1] = new Array("Links ","http://cortestravel.com/links.html","");
subInfo[17][2] = new Array("Glitter           ","http://www.glittercool.com","");
subInfo[17][3] = new Array("Link to Cortes  ","http://cortestravel.com/linktous.html","");
subInfo[17][4] = new Array("Disclaimer","http://cortestravel.com/disclaimer.html","");


//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 123;
var ySubOffset = 0;



//*** 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();


