/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("Home.jpg","Features.jpg","Products.jpg","Gallery.jpg","4_Fun.jpg","120_club.jpg","Ingo.jpg","Contact.jpg");

overSources = new Array("Home.jpg","Features.jpg","Products.jpg","Gallery.jpg","4_Fun.jpg","120_club.jpg","Ingo.jpg","Contact.jpg");

// 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();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//


//* Product Links
subInfo[3][1] = new Array("Suspension & Handling","UFOProducts.php?cat=1","");
subInfo[3][2] = new Array("Wheels, Brakes & Tires", "UFOProducts.php?cat=2","");
subInfo[3][3] = new Array("Handlebar Accessories","UFOProducts.php?cat=3","");
subInfo[3][4] = new Array("Motor & Exhaust","UFOProducts.php?cat=4","");
subInfo[3][5] = new Array("Seats","UFOProducts.php?cat=5","");
subInfo[3][6] = new Array("Lights & Electronics","UFOProducts.php?cat=6","");
subInfo[3][7] = new Array("Miscellaneous","UFOProducts.php?cat=7","");
subInfo[3][8] = new Array("Chrome and Polish","UFO_Vmax_chrome_&_polish.htm","");
subInfo[3][9] = new Array("Used Parts","UFO_used_parts.htm","");
subInfo[3][10] = new Array("All Products","UFOProducts.php","");
/*
subInfo[3][1] = new Array("VGAS Carburetion System","UFO_V-gas.htm","");
subInfo[3][2] = new Array("VGAS Air Filters", "UFO_Page.php?title=VGAS%20Air%20Filters&type=product","");
subInfo[3][3] = new Array("MaxDaddy Rear Wheel","UFO_Page.php?title=UFO Vmax MaxDaddy Rear Wheel&type=product","");
subInfo[3][4] = new Array("UFO Vmax Shift Light","UFO_Page.php?title=UFO%20Vmax%20Shift%20Light&type=product","");
subInfo[3][5] = new Array("Vmax Wheels","UFO_Vmax_wheels.php","");
subInfo[3][6] = new Array("UFO Vmax Exhaust","UFO_Vmax_exhaust.htm","");
subInfo[3][7] = new Array("Chrome and Polish","UFO_Vmax_chrome_&_polish.htm","");
subInfo[3][8] = new Array("Vmax Starfighter Seat","UFO_Vmax_starfighter_seat.htm","");
subInfo[3][9] = new Array("Vmax Clear Clutch Covers","UFO_Vmax_clear_clutch_cover.htm","");
subInfo[3][10] = new Array("UFO Vmax Fork Braces","UFO_Vmax_fork_braces.htm","");
subInfo[3][11] = new Array("UFO Vmax Drag Bars","UFO_Page.php?title=UFO Vmax Drag Bars&type=product","");
subInfo[3][12] = new Array("Vmax Turn Signals","UFO_Vmax_turnsignals.htm","");
subInfo[3][13] = new Array("Vmax Rear Taillights","UFO_Vmax_taillight.htm","");
subInfo[3][14] = new Array("Vmax License Plate Frame","UFO_Page.php?title=UFO%20Vmax%20License%20Plate%20Frame&type=product","");
subInfo[3][15] = new Array("Vmax Dyna Ignition", "UFO_Page.php?title=Vmax%20Dyna%20Ignition&type=product","");
subInfo[3][16] = new Array("Flying Saucer Spinner Wheels", "UFO_Spinner_Wheels.php","");
subInfo[3][17] = new Array("UFO Custom Billet Shocks","UFO_billet_shocks.htm","");
subInfo[3][18] = new Array("UFO V-Twin Motor","UFO_Page.php?title=127 Inch Big Twin&type=product","");
subInfo[3][19] = new Array("Used Parts","UFO_used_parts.htm","");
subInfo[3][20] = new Array("All Products","UFOProducts.php","");
*/
//* Gallery links
subInfo[4][1] = new Array("Jon Cornell's Vmax","UFO_Page.php?title=Jon Cornell's Vmax&type=gallery","");
subInfo[4][2] = new Array("2001 Champion Harley","UFO_Page.php?title=UFO 2001 Champion Harley Dyna Glide&type=gallery","");
subInfo[4][3] = new Array("Honda VTX 1800","UFO_Page.php?title=UFO VTX&type=gallery","");
subInfo[4][4] = new Array("UFO Honda Valkyrie","UFO_Page.php?title=UFO Valkyrie&type=gallery","");
subInfo[4][5] = new Array("UFO ZX_11","UFO_Page.php?title=UFO ZX 11&type=gallery","");
subInfo[4][6] = new Array("UFO Suzuki Intruder","UFO_Page.php?title=UFO Suzuki Intruder&type=gallery","");
subInfo[4][7] = new Array("VGAS Ingenuity","UFO_Page.php?title=VGAS Ingenuity&type=gallery","");

//* Just 4 fun links
subInfo[5][1] = new Array("Article","magazine_art.htm","");
subInfo[5][2] = new Array("Tech Tips","/Sayegh/sayegh/Tip & Tricks.htm","");
subInfo[5][3] = new Array("Vmaxed - Unlimited Class Vmaxes","vmaxed.htm","");
subInfo[5][4] = new Array("Little Ones","little_ones!.htm","");
subInfo[5][5] = new Array("Hot Rides","customers_rides.htm","");
subInfo[5][6] = new Array("UFO Pictures","ufo_pics!.htm","");
subInfo[5][7] = new Array("Daytona 2001","daytona_2001!.htm","");
subInfo[5][8] = new Array("Grape Ape","old_webmasters_bike!.htm","");
subInfo[5][9] = new Array("Dyno_Runs","dyno_runs.htm","");
subInfo[5][10] = new Array("Scott and Kyle at UFO","Scott_Kyle_at_UFO.htm","");
subInfo[5][11] = new Array("Burnouts!","burnouts.htm","");
subInfo[5][12] = new Array("New Alien","tc.htm","");
subInfo[5][13] = new Array("Links","links.htm","");

/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "images/buttons/";


//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 50;
var ySubOffset = 15;



//*** 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>');
}



// PRELOAD MAIN MENU BUTTON IMAGES
for ( x=0; x<totalButtons; x++ ) {
	buttonUp = new Image();
	buttonUp.src = buttonFolder + upSources[x];
	buttonOver = new Image();
	buttonOver.src = buttonFolder + overSources[x];
}




//*** MAIN BUTTONS FUNCTIONS ***//
// 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);
	}
}

