/*** 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");

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");

// 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();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo[2][1] = new Array("Kaymer auf Sky","Diverses/Sky-Programm-Kaymer.html","frame_inhalt");
subInfo[2][2] = new Array("GCU-Info's","aktuelles/GCU-Infos/GCU-Info's.htm","frame_inhalt");
subInfo[2][3] = new Array("Archiv","aktuelles/archiv.html","frame_inhalt");

subInfo[3][1] = new Array("Kontakt/Vorstand","club/Vorstand-Kontakt.html","frame_inhalt");
subInfo[3][2] = new Array("Club-Internes","clubintern/clubinternes.html","frame_inhalt");
subInfo[3][3] = new Array("Mitglieder-Aufnahme","club/aufnahme.html","frame_inhalt");
subInfo[3][4] = new Array("DGV Platzreife","club/DGV_platzreife.html","frame_inhalt");
subInfo[3][5] = new Array("hall of fame","club/hall_of_fame.html","frame_inhalt");
subInfo[3][6] = new Array("Foto-Serien","club/Picasa_Foto_Serien.html","frame_inhalt");
subInfo[3][7] = new Array("Berichte-Fotos","club/berichte_fotos.html","frame_inhalt");
subInfo[3][8] = new Array("Club-Kleidung","Diverses/Club-Blazerjacke.html","frame_inhalt");

subInfo[4][1] = new Array("Greenfee","platz/greenfee.html","frame_inhalt");
subInfo[4][2] = new Array("Golfanlage Bolle","http://www.golfanlage-uhlenberg-reken.de/", "_blank");
subInfo[4][3] = new Array("Scorekarten","service/Bilder_und_PDF/Scorecard-18-Loch-2012.pdf","_blank");
subInfo[4][4] = new Array("Spielvorgaben","service/Bilder_und_PDF/GCU-Spielvorgaben_18-Loch_2008.pdf","_blank");
subInfo[4][5] = new Array("Platzregeln","service/Bilder_und_PDF/Platzregeln-NEU-2011_12.pdf","_blank");
subInfo[4][6] = new Array("Impressionen","platz/impressionen.html","frame_inhalt");

subInfo[5][1] = new Array("Unser PRO","pro/PP_Schiffer.html","frame_inhalt");
subInfo[5][2] = new Array("Golf-Reisen","pro/Golf-Reisen/Golfreisen.htm","frame_inhalt");
subInfo[5][3] = new Array("Schnupperkurse","pro/schnupperkurse.html","frame_inhalt");
subInfo[5][4] = new Array("Regelkurse","club/Golf-Regeln.html","frame_inhalt");

subInfo[6][1] = new Array("Startliste","clubintern/Startliste.html","frame_inhalt");
subInfo[6][2] = new Array("Platzregeln","service/Bilder_und_PDF/Platzregeln-NEU-2011_12.pdf","_blank");
subInfo[6][3] = new Array("Wettspielordnung","turniere/Bilder-Buttons-PDF/PDF/GCU-Wettspielordnung-2012.pdf","_blank");
subInfo[6][4] = new Array("Turnier-Kalender","turniere/Bilder-Buttons-PDF/PDF/Turnierkalender-2012.pdf","_blank");
subInfo[6][5] = new Array("9-Loch-Turniere","turniere/9_loch.html","frame_inhalt");
subInfo[6][6] = new Array("EDS-Runden","EDS/EDS-Runden.html","frame_inhalt");
subInfo[6][7] = new Array("Pufferzonen und CBA","service/pufferzonen.html","frame_inhalt");
subInfo[6][8] = new Array("Siegerfotos","turniere/siegerfotos_2011.html","frame_inhalt");
subInfo[6][9] = new Array("Hcp-Abfrage","service/hcp_abfrage.html","frame_inhalt");

subInfo[7][1] = new Array("Verkehrslage NRW","http://autobahn.nrw.de/olsim3_6/nrw.html","_blank");
subInfo[7][2] = new Array("Spiel-Formen","Diverses/Spiel-Formen.html","frame_inhalt");

subInfo[8][1] = new Array("Spadaka-Damen","matchplays/spadaka_damen.html","frame_inhalt");
subInfo[8][2] = new Array("Spadaka-Herren","matchplays/spadaka_herren.html","frame_inhalt");
subInfo[8][3] = new Array("Spadaka-History","matchplays/spadaka_history.html","frame_inhalt");
subInfo[8][4] = new Array("Ladies only","matchplays/ladies_only.html","frame_inhalt");
subInfo[8][5] = new Array("Best Age","matchplays/best_age.html","frame_inhalt");
subInfo[8][6] = new Array("DA-HER bis 18","matchplays/DVB.html","frame_inhalt");

subInfo[9][1] = new Array("Seniorinnen","mannschaften/seniorinnen.html","frame_inhalt");
subInfo[9][2] = new Array("Senioren I + II","mannschaften/Senioren.html","frame_inhalt");
subInfo[9][3] = new Array("Jungsenioren- und Schniewind-Kader","mannschaften/JS-Schniewi-Kader.html","frame_inhalt");
subInfo[9][4] = new Array("Jungsenioren","mannschaften/jungsenioren.html","frame_inhalt");
subInfo[9][5] = new Array("Schniewind","mannschaften/schniewind.html","frame_inhalt");
subInfo[9][6] = new Array("Mannschafts-Pokal","mannschaften/mannschafts-pokal.html","frame_inhalt");


subInfo[11][1] = new Array("Kalender 2012","ladies/Bilder_und_PDF/Ladies-Kalender 2012.pdf","_blank");
subInfo[11][2] = new Array("Berichte","ladies/ladies_berichte.html","frame_inhalt");
subInfo[11][3] = new Array("Eclectic","ladies/eclectic.html","frame_inhalt");

subInfo[12][1] = new Array("GCU + WGS","senioren/WGS-GCU.html","frame_inhalt");
subInfo[12][2] = new Array("Kalender 2012","senioren/PDF/Senioren-Kalender 2012.pdf","_blank");
subInfo[12][3] = new Array("Eclectic","senioren/eclectic.html","frame_inhalt");
subInfo[12][4] = new Array("Berichte","senioren/senioren_berichte.html","frame_inhalt");
subInfo[12][5] = new Array("hall of  fame","senioren/Stiftungsurkunde.html","frame_inhalt");







//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 10;
var ySubOffset = 25;



//*** 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();


