/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_ = "Buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_ = new Array("button1up_.png");

overSources_ = new Array("button1over_.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_ = new Array();
subInfo_[1] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo_[1][1] = new Array("Winter 2003","Vox%20Eliae/VOX%20ELIAE%20WINTER%202004.pdf","");
subInfo_[1][2] = new Array("Spring 2004","Vox%20Eliae/Spring%202004%20Vox.pdf","");
subInfo_[1][3] = new Array("Summer 2004","Vox%20Eliae/Summer%202004%20Vox.pdf","");
subInfo_[1][4] = new Array("Fall 2004","Vox%20Eliae/Fall%202004%20Vox.pdf","");
subInfo_[1][5] = new Array("Winter 2004-05","Vox%20Eliae/Winter 2004-05%20Vox.pdf","")
subInfo_[1][6] = new Array("Spring 2006","Vox%20Eliae/Spring 2006 VOX 2.pdf","");
subInfo_[1][7] = new Array("Summer 2006","Vox%20Eliae/summer 2006 VOXnew.pdf","")
subInfo_[1][8] = new Array("Fall-Winter 2006","Vox%20Eliae/fall-winter 2006 VOXnew.pdf","")
 

//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset_ = 126;
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_();

