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

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("home1.png","modellauswahl1.png","neuigkeiten1.png","links1.png","kontakt1.png","agb1.png","impressum1.png","aprilla1.png","bmw1.png","honda1.png","husqvarna1.png","kawasaki1.png","ktm1.png","mz1.png","suzuki1.png","triumph1.png","yamaha1.png","koffer1.png");

overSources = new Array("home2.png","modellauswahl2.png","neuigkeiten2.png","links2.png","kontakt2.png","agb2.png","impressum2.png","aprilla2.png","bmw2.png","honda2.png","husqvarna2.png","kawasaki2.png","ktm2.png","mz2.png","suzuki2.png","triumph2.png","yamaha2.png","koffer2.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo = new Array();
subInfo[1] = new Array();  //Home//
subInfo[2] = new Array();  //Modellauswahl//
subInfo[3] = new Array();  //Zubehör//
subInfo[4] = new Array();  //Links//
subInfo[5] = new Array();  //Kontakt//
subInfo[6] = new Array();  //AGB//
subInfo[7] = new Array();  //Impressum//
subInfo[8] = new Array();    //Aprilia//
subInfo[9] = new Array();    //BMW//
subInfo[10] = new Array();   //Honda//
subInfo[11] = new Array();   //Husqvarna//
subInfo[12] = new Array();   //Kawasaki//
subInfo[13] = new Array();   //KTM//
subInfo[14] = new Array();   //MZ//
subInfo[15] = new Array();   //Suzuki//
subInfo[16] = new Array();   //Triumph//
subInfo[17] = new Array();   //Yamaha//
subInfo[18] = new Array();   //Koffer//


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

//Aprilia//
subInfo[8][1] = new Array("Pegaso","aprilia-pegaso.html","");
subInfo[8][2] = new Array("Garda","aprilia-garda.html","");
subInfo[8][3] = new Array("ETV 1000","aprilia-etv1000.html","");
subInfo[8][4] = new Array("Andere","aprilia-andere.html","");

//BMW//
subInfo[9][1] = new Array("F 650","bmw-f650.html","");
subInfo[9][2] = new Array("G 650","bmw-g650.html","");
subInfo[9][3] = new Array("F 800","bmw-f800.html","");
subInfo[9][4] = new Array("R 80","bmw-r80.html","");
subInfo[9][5] = new Array("R 850","bmw-r850.html","");
subInfo[9][6] = new Array("R 100","bmw-r100.html","");
subInfo[9][7] = new Array("R 1100","bmw-r1100.html","");
subInfo[9][8] = new Array("R 1150","bmw-r1150.html","");
subInfo[9][9] = new Array("R 1200","bmw-r1200.html","");
subInfo[9][10] = new Array("Andere","bmw-andere.html","");

//Honda//
subInfo[10][1] = new Array("XL 600","honda-xl600.html","");
subInfo[10][2] = new Array("NX 650","honda-nx650.html","");
subInfo[10][3] = new Array("SLR 650","honda-slr650.html","");
subInfo[10][4] = new Array("XL 650","honda-xl650.html","");
subInfo[10][5] = new Array("XR 650 R","honda-xr650r.html","");
subInfo[10][6] = new Array("XRV 650","honda-xrv650.html","");
subInfo[10][7] = new Array("XL 700","honda-xl700.html","");
subInfo[10][8] = new Array("XRV 750","honda-xrv750.html","");
subInfo[10][9] = new Array("XLV 1000","honda-xlv1000.html","");
subInfo[10][10] = new Array("Andere","honda-andere.html","");

//Husqvarna//
subInfo[11][1] = new Array("TE 650","husqvarna-te650.html","");
subInfo[11][2] = new Array("Andere","husqvarna-andere.html","");

//Kawasaki//
subInfo[12][1] = new Array("KLE 500","kawasaki-kle500.html","");
subInfo[12][2] = new Array("KLR 650","kawasaki-klr650.html","");
subInfo[12][3] = new Array("KLX 650","kawasaki-klx650.html","");
subInfo[12][4] = new Array("KLV 1000","kawasaki-klv1000.html","");
subInfo[12][5] = new Array("Andere","kawasaki-andere.html","");

//KTM//
subInfo[13][1] = new Array("LC4 400","ktm-lc4400.html","");
subInfo[13][2] = new Array("LC4 620","ktm-lc4620.html","");
subInfo[13][3] = new Array("LC4 620 Adventure","ktm-lc4620adventure.html","");
subInfo[13][4] = new Array("LC4 640","ktm-lc4640.html","");
subInfo[13][5] = new Array("LC4 640 Adventure","ktm-lc4640adventure.html","");
subInfo[13][6] = new Array("690","ktm-690.html","");
subInfo[13][7] = new Array("LC8 950","ktm-lc8950.html","");
subInfo[13][8] = new Array("LC8 990","ktm-lc8990.html","");
subInfo[13][9] = new Array("EXC","ktm-exc.html","");
subInfo[13][10] = new Array("Andere","ktm-andere.html","");

//MZ//
subInfo[14][1] = new Array("Baghira / Mastiff","mz-baghira.html","");
subInfo[14][2] = new Array("Andere","mz-andere.html","");

//Suzuki//
subInfo[15][1] = new Array("DR 350","suzuki-dr350.html","");
subInfo[15][2] = new Array("DR-Z 400","suzuki-drz400.html","");
subInfo[15][3] = new Array("DR 600","suzuki-dr600.html","");
subInfo[15][4] = new Array("DR 650","suzuki-dr650.html","");
subInfo[15][5] = new Array("XF 650","suzuki-xf650.html","");
subInfo[15][6] = new Array("DL 650 V-Strom","suzuki-dl650.html","");
subInfo[15][7] = new Array("DR BIG","suzuki-drbig.html","");
subInfo[15][8] = new Array("DL 1000 V-Strom","suzuki-dl1000.html","");
subInfo[15][9] = new Array("Andere","suzuki-andere.html","");

//Triumph//
subInfo[16][1] = new Array("Tiger 800","triumph-tiger800.html","");
subInfo[16][2] = new Array("Tiger 955","triumph-tiger950.html","");
subInfo[16][3] = new Array("Tiger 1050","triumph-tiger1050.html","");
subInfo[16][4] = new Array("Scrambler 900","triumph-scambler900.html","");
subInfo[16][5] = new Array("Andere","triumph-andere.html","");

//Yamaha//
subInfo[17][1] = new Array("XT 125","yamaha-xt125.html","");
subInfo[17][2] = new Array("WR ...","yamaha-wr.html","");
subInfo[17][3] = new Array("XT 350","yamaha-xt350.html","");
subInfo[17][4] = new Array("XT 500","yamaha-xt500.html","");
subInfo[17][5] = new Array("XT 550","yamaha-xt550.html","");
subInfo[17][6] = new Array("TT 600E/S","yamaha-tt600es.html","");
subInfo[17][7] = new Array("TT 600R","yamaha-tt600r.html","");
subInfo[17][8] = new Array("XT 600","yamaha-xt600.html","");
subInfo[17][9] = new Array("XTZ 660","yamaha-xtz660.html","");
subInfo[17][10] = new Array("XT 660R/X","yamaha-xt660rx.html","");
subInfo[17][11] = new Array("XT 660 Z Tenere","yamaha-xt660z.html","");
subInfo[17][12] = new Array("XTZ 750","yamaha-xtz750.html","");
subInfo[17][13] = new Array("XTZ 1200 Super Tenere","yamaha-xtz1200.html","");
subInfo[17][14] = new Array("Andere","yamaha-andere.html","");

//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 140;
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();


