/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_menu_teen = "teen/images/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_menu_teen = new Array("teen-scene-logo_03.jpg","teen-scene-logo_06.jpg","teen-scene-logo_11.jpg","teen-scene-logo_15.jpg","teen-scene-logo_19.jpg","teen-scene-logo_23.jpg");

overSources_menu_teen = new Array("teen-scene-logo_03-o.jpg","teen-scene-logo_06-o.jpg","teen-scene-logo_11-o.jpg","teen-scene-logo_15-o.jpg","teen-scene-logo_19-o.jpg","teen-scene-logo_23-o.jpg");


// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_menu_teen = new Array();
subInfo_menu_teen[1] = new Array();
subInfo_menu_teen[2] = new Array();
subInfo_menu_teen[3] = new Array();
subInfo_menu_teen[4] = new Array();
subInfo_menu_teen[5] = new Array();
subInfo_menu_teen[6] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//


subInfo_menu_teen[1][1] = new Array("TEEN ADVISORY BOARD - Find out more about the Teen Advisory Board","teen-teenadvisoryboard.html","");
subInfo_menu_teen[2][1] = new Array("WHAT'S HAPPENING","teen-whatshappening.html","");
subInfo_menu_teen[2][2] = new Array("Library","teen-whatshap_lib.html","");
subInfo_menu_teen[2][3] = new Array("TAB","teen-teenadvisoryboard.html","");
subInfo_menu_teen[2][4] = new Array("Schools","teen-whatshap_schools.html","");
subInfo_menu_teen[2][5] = new Array("Local Events - Find out more!","teen-whatshap_local.html","");
subInfo_menu_teen[3][1] = new Array("HOMEWORK","teen-homework.html","");
subInfo_menu_teen[3][2] = new Array("Homework Help Databases","info.html#homework","");
subInfo_menu_teen[4][1] = new Array("YOUR FUTURE - Going to College and more","teen-yourfuture.html","");
subInfo_menu_teen[5][1] = new Array("LINKS to Teen stuff","teen-links.html","");
subInfo_menu_teen[6][1] = new Array("TEEN READS","teen-reads.html","");
subInfo_menu_teen[6][2] = new Array("Books and Magazines","teen-reads.html","");
subInfo_menu_teen[6][3] = new Array("Movies and TV","teen-reads.html","");
subInfo_menu_teen[6][4] = new Array("Music","teen-reads.html","");



//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset_menu_teen = 40;
var ySubOffset_menu_teen = 35;

//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_menu_teen = false;
var delay_menu_teen = 1000;
totalButtons_menu_teen = upSources_menu_teen.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_menu_teen; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_menu_teen[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_menu_teen">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_menu_teen" class="dropmenu_menu_teen" ');
		document.write('onMouseOver="overSub_menu_teen=true;');
		document.write('setOverImg_menu_teen(\'' + (x+1) + '\',\'_menu_teen\');"');
		document.write('onMouseOut="overSub_menu_teen=false;');
		document.write('setTimeout(\'hideSubMenu_menu_teen(\\\'submenu' + (x+1) + '_menu_teen\\\')\',delay_menu_teen);');
		document.write('setOutImg_menu_teen(\'' + (x+1) + '\',\'_menu_teen\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_menu_teen[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_menu_teen[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_menu_teen[x+1][k+1][2] + '">');
			document.write( subInfo_menu_teen[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_menu_teen() {
	for ( x=0; x<totalButtons_menu_teen; x++ ) {
		buttonUp_menu_teen = new Image();
		buttonUp_menu_teen.src = buttonFolder_menu_teen + upSources_menu_teen[x];
		buttonOver_menu_teen = new Image();
		buttonOver_menu_teen.src = buttonFolder_menu_teen + overSources_menu_teen[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg_menu_teen(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_menu_teen + overSources_menu_teen[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg_menu_teen(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_menu_teen + upSources_menu_teen[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement_menu_teen(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft_menu_teen(id) { 
	var el = getElement_menu_teen(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_menu_teen(id) {
	var el = getElement_menu_teen(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_menu_teen(objectID,x,y) {
	var el = getElement_menu_teen(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_menu_teen(subID, buttonID) {
	hideAllSubMenus_menu_teen();
	butX = getRealLeft_menu_teen(buttonID);
	butY = getRealTop_menu_teen(buttonID);
	moveObjectTo_menu_teen(subID,butX+xSubOffset_menu_teen, butY+ySubOffset_menu_teen);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_menu_teen() {
	for ( x=0; x<totalButtons_menu_teen; x++) {
		moveObjectTo_menu_teen("submenu" + (x+1) + "_menu_teen",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_menu_teen(subID) {
	if ( overSub_menu_teen == false ) {
		moveObjectTo_menu_teen(subID,-500, -500);
	}
}



//preload_menu_teen();

