/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_1 = "pageimages/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_1 = new Array("b_home_u.jpg","b_store_u.jpg","b_gigs_u.jpg","b_video_u.jpg","b_photos_u.jpg","b_contact_u.jpg","b_afterblog_u.jpg","b_blackboard_u.jpg");

overSources_1 = new Array("b_home_o.jpg","b_store_o.jpg","b_gigs_o.jpg","b_video_o.jpg","b_photos_o.jpg","b_contact_o.jpg","b_afterblog_o.jpg","b_blackboard_o.jpg");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_1 = new Array();
subInfo_1[1] = new Array();
subInfo_1[2] = new Array();
subInfo_1[3] = new Array();
subInfo_1[4] = new Array();
subInfo_1[5] = new Array();
subInfo_1[6] = new Array();
subInfo_1[7] = new Array();
subInfo_1[8] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
//subInfo_1[1][1] = new Array("Casa Del Bernie","design1.htm","");
//subInfo_1[1][2] = new Array("Matt's Station","design1.htm","");

//subInfo_1[2][1] = new Array("Sub-Button 1","Sub-Link 1","");
//subInfo_1[2][2] = new Array("Sub-Button 2","Sub-Link 2","");

//subInfo_1[3][1] = new Array("Sub-Button 1","Sub-Link 1","");
//subInfo_1[3][2] = new Array("Sub-Button 2","Sub-Link 2","");

//subInfo_1[4][1] = new Array("Sub-Button 1","Sub-Link 1","");
//subInfo_1[4][2] = new Array("Sub-Button 2","Sub-Link 2","");

//subInfo_1[5][1] = new Array("Sub-Button 1","Sub-Link 1","");
//subInfo_1[5][2] = new Array("Sub-Button 2","Sub-Link 2","");


//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset_1 = 0;
var ySubOffset_1 = 50;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_1 = false;
var delay_1 = 1000;
totalButtons_1 = upSources_1.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_1; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_1[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_1">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_1" class="dropmenu_1" ');
		document.write('onMouseOver="overSub_1=true;');
		document.write('setOverImg_1(\'' + (x+1) + '\',\'_1\');"');
		document.write('onMouseOut="overSub_1=false;');
		document.write('setTimeout(\'hideSubMenu_1(\\\'submenu' + (x+1) + '_1\\\')\',delay_1);');
		document.write('setOutImg_1(\'' + (x+1) + '\',\'_1\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_1[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_1[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_1[x+1][k+1][2] + '">');
			document.write( subInfo_1[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_1() {
	for ( x=0; x<totalButtons_1; x++ ) {
		buttonUp_1 = new Image();
		buttonUp_1.src = buttonFolder_1 + upSources_1[x];
		buttonOver_1 = new Image();
		buttonOver_1.src = buttonFolder_1 + overSources_1[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg_1(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_1 + overSources_1[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg_1(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_1 + upSources_1[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement_1(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft_1(id) { 
	var el = getElement_1(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_1(id) {
	var el = getElement_1(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_1(objectID,x,y) {
	var el = getElement_1(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_1(subID, buttonID) {
	hideAllSubMenus_1();
	butX = getRealLeft_1(buttonID);
	butY = getRealTop_1(buttonID);
	moveObjectTo_1(subID,butX+xSubOffset_1, butY+ySubOffset_1);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_1() {
	for ( x=0; x<totalButtons_1; x++) {
		moveObjectTo_1("submenu" + (x+1) + "_1",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_1(subID) {
	if ( overSub_1 == false ) {
		moveObjectTo_1(subID,-500, -500);
	}
}



//preload_1();

