/*** 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","button18up.png","button19up.png","button20up.png","button21up.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","button18over.png","button19over.png","button20over.png","button21over.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();
subInfo[18] = new Array();
subInfo[19] = new Array();
subInfo[20] = new Array();
subInfo[21] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//






subInfo[7][1] = new Array("CV-tje:","http://www.snowfox2.com/cv1.htm","");
subInfo[7][2] = new Array("Foto:","http://www.snowfox2.com/foto1.htm","");
subInfo[7][3] = new Array("Boeken:","http://www.snowfox2.com/boeken.htm","");
subInfo[7][4] = new Array("Geboortestad:","http://www.snowfox2.com/delft.htm","");
subInfo[7][5] = new Array("Hobby Hoek:","http://www.snowfox2.com/hobbies1.htm","");
subInfo[7][6] = new Array("Muziek:","http://www.snowfox2.com/muziek.htm","");
subInfo[7][7] = new Array("Naam Snowfox:","http://www.snowfox2.com/naamsnowfox.htm","");
subInfo[7][8] = new Array("Sterrenbeeld:","http://www.snowfox2.com/astro_mijn_sterrenbeeld1.htm","");
subInfo[7][9] = new Array("Inloggen:","http://www.snowfox2.com/persoonlijk.htm","");

subInfo[8][1] = new Array("Gedichten persoonlijk:","http://www.snowfox2.com/persoonlijk1.htm","");
subInfo[8][2] = new Array("Gedichten ontvangen:","http://www.snowfox2.com/ontvangen.htm","");
subInfo[8][3] = new Array("Gedichten Passie:","http://www.snowfox2.com/passie.htm","");
subInfo[8][4] = new Array("Gedichten Plaatjes NL:","http://www.snowfox2.com/plaatjes.htm","");
subInfo[8][5] = new Array("Gedichten Plaatjes UK:","http://www.snowfox2.com/plaatjes4.htm","");
subInfo[8][6] = new Array("Ziekte","http://www.snowfox2.com/ziekte.htm","");

subInfo[9][1] = new Array("Loesje:","http://www.snowfox2.com/loesje.htm","");
subInfo[9][2] = new Array("Spreuken 1:","http://www.snowfox2.com/spreuken1.htm","");
subInfo[9][3] = new Array("Spreuken 2:","http://www.snowfox2.com/spreuken2.htm","");
subInfo[9][4] = new Array("Spreuken 3:","http://www.snowfox2.com/spreuken3.htm","");
subInfo[9][5] = new Array("Spreuken 4:","http://www.snowfox2.com/spreuken4.htm","");
subInfo[9][6] = new Array("Spreuken Tegels:","http://www.snowfox2.com/tegels.htm","");
subInfo[9][7] = new Array("Spreuken Algemeen:","http://www.snowfox2.com/tegels11.htm","");
subInfo[9][8] = new Array("Spreuken 18+:","http://www.snowfox2.com/tegels8.htm","");
subInfo[9][9] = new Array("Vrouwen vs mannen:","http://www.snowfox2.com/tegels7.htm","");

subInfo[10][1] = new Array("Deejay spelen:","http://www.snowfox2.com/DJ.htm","");
subInfo[10][2] = new Array("Muziek Band:","http://www.snowfox2.com/muziek_band1.htm","");
subInfo[10][3] = new Array("Muziek Drummen:","http://www.snowfox2.com/muziek_drums1.htm","");
subInfo[10][4] = new Array("Muziek Gitaar:","http://www.snowfox2.com/muziek_guitar1.htm","");
subInfo[10][5] = new Array("Muziek Keyboard:","http://www.snowfox2.com/muziek_keyboard.htm","");
subInfo[10][6] = new Array("Muziek Maken:","./muziek_maken.htm","");
subInfo[10][7] = new Array("Muziek Piano:","http://www.snowfox2.com/muziek_piano1.htm","");
subInfo[10][8] = new Array("Muziek QT Quartet:","http://www.snowfox2.com/hold.htm","");
subInfo[10][9] = new Array("Humor:","http://www.snowfox2.com/humor1.htm","");
subInfo[10][10] = new Array("Nooit Grappig:","http://www.snowfox2.com/nooit_grappig.htm","");
subInfo[10][11] = new Array("Noten Lezen:","./noten.htm","");

subInfo[11][1] = new Array("Amazed:","http://www.snowfox2.com/amazed.htm","");
subInfo[11][2] = new Array("Amazes:","http://www.snowfox2.com/amazes.htm","");
subInfo[11][3] = new Array("Euro's:","http://www.snowfox2.com/munten2.htm","");
subInfo[11][4] = new Array("Guldens:","http://www.snowfox2.com/munten1.htm","");
subInfo[11][5] = new Array("Houden Van:","http://www.snowfox2.com/hou.htm","");
subInfo[11][6] = new Array("Liefde is .... 1:","http://www.snowfox2.com/liefdeis01.htm","");
subInfo[11][7] = new Array("Liefde is .... 2:","http://www.snowfox2.com/liefdeis08.htm","");
subInfo[11][8] = new Array("Nostalgie:","./Foto-01.htm","");
subInfo[11][9] = new Array("Rescue Me:","http://www.snowfox2.com/rescue_me.htm","");
subInfo[11][10] = new Array("Veronica 192:","http://www.snowfox2.com/veronica4.htm","");
subInfo[11][11] = new Array("Wat als ....","http://www.snowfox2.com/watals.htm","");

subInfo[12][1] = new Array("Astrologie:","http://www.snowfox2.com/astro.htm","");
subInfo[12][2] = new Array("Kinder Hoekje:","http://www.snowfox2.com/kids-corner.htm","");
subInfo[12][3] = new Array("Mix-Tracks:","http://mix-tracks.blogspot.com","");
subInfo[12][4] = new Array("Naar de Film:","http://www.snowfox2.com/film-01.htm","");
subInfo[12][5] = new Array("Radio:","http://www.snowfox2.com/radio.htm","");
subInfo[12][6] = new Array("Spelletjes:","http://www.snowfox2.com/games1.htm","");
subInfo[12][7] = new Array("Televisie:","http://www.snowfox2.com/TV.htm","");
subInfo[12][8] = new Array("Uw Leeftijd ?","http://www.snowfox2.com/leeftijdsteller.htm","");
subInfo[12][9] = new Array("Weerstation:","http://www.snowfox2.com/weer.htm","");
subInfo[12][10] = new Array("Zee Aquarium:","http://www.snowfox2.com/aquarium.htm","");



//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = -6;
var ySubOffset = 29;



//*** 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();


