
ssubInfo = new Array();
ssubInfo[1] = new Array();
ssubInfo[2] = new Array();
ssubInfo[3] = new Array();
ssubInfo[4] = new Array();
ssubInfo[5] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
ssubInfo[1][1] = new Array("Analytical Research Lab ","ARL Home.asp","");
ssubInfo[1][2] = new Array("Environmental Water Quality Lab","EWQL Home.asp","");


ssubInfo[2][1] = new Array("Telephone / e-mail","contactus.asp","");
ssubInfo[2][2] = new Array("Mailing Address","contactus.asp","");
ssubInfo[2][3] = new Array("Ask a Question","webform.asp","");
ssubInfo[2][4] = new Array("Get Directions","map.asp","");

ssubInfo[3][1] = new Array("Advisory Committee","AdvisoryCommittee.asp","");
ssubInfo[3][2] = new Array("Lab Personnel","LabPersonnel.asp","");

// ssubInfo[4][1] = new Array("Telephone / e-mail","contactus.asp","");
// ssubInfo[4][2] = new Array("Mailing Address","contactus.asp","");
// ssubInfo[4][3] = new Array("Ask a Question","webform.asp","");
// ssubInfo[4][4] = new Array("Get Directions","map.asp","");

ssubInfo[5][1] = new Array("Nutrient Management Program","http://nutrients.ifas.ufl.edu","");
ssubInfo[5][2] = new Array("Soil & Water Science Department, UFL","http://soils.ifas.ufl.edu","");
ssubInfo[5][3] = new Array("Institute of Food and Agricultural Sciences","http://ifas.ufl.edu","");
ssubInfo[5][4] = new Array("University of Florida","http://www.ufl.edu","");


//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset1 = 0;
var ySubOffset1 = 40;
var xSubOffset2 = 0;
var ySubOffset2 = 40;
var xSubOffset3 = 0;
var ySubOffset3 = 40;
var xSubOffset4 = 0;
var ySubOffset4 = 40;
var xSubOffset5 = 0;
var ySubOffset5 = 40;


//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub2 = false;
var delay = 3000;
var totButtons = 5;


// GENERATE SUB MENUS
for ( x=0; x<totButtons; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT Drop down MENU
	if ( ssubInfo[x+1].length < 1 ) { 
		document.write('<div id="side' + (x+1) + '">');
	// SET DIV FOR BUTTONS WITH Drop down MENU
	} else {
		document.write('<div id="side' + (x+1) + '" class="dropmenu2" ');
		document.write('onMouseOver="overSub2=true;');
		document.write('setOver(\'' + (x+1) + '\',\'\');"');
		document.write('onMouseOut="overSub2=false;');
		document.write('setTimeout(\'hideSide(\\\'submenu' + (x+1) + '\\\')\',delay);');
		document.write('setOut(\'' + (x+1) + '\',\'\');">');

                if(navigator.appName == 'Microsoft Internet Explorer')
                {   document.write('<br/>');}



		document.write('<ul>');
		for ( k=0; k<ssubInfo[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + ssubInfo[x+1][k+1][1] + '" ');
			document.write('target="' + ssubInfo[x+1][k+1][2] + '">');
			document.write( ssubInfo[x+1][k+1][0] + '</a>');
			document.write('</li>');
		}
		document.write('</ul>');
	}
	document.write('</div>');
}





//*** MAIN BUTTONS FUNCTIONS ***//
// PRELOAD MAIN MENU BUTTON IMAGES
function ppreload() {
	for ( x=0; x<totButtons; x++ ) {
		buttonUp = new Image();
		buttonUp.src = buttonFolder + upSources[x];
		buttonOver = new Image();
		buttonOver.src = buttonFolder + overSources[x];
	}
}

// SET MOUSEOVER BUTTON
function setOver(Butt, IDD) {

        /* alert(document.getElementById('option'+Butt).className); */
	/* document.getElementById('option' + Butt + IDD).src = buttonFolder + overSources[But-1]; */

       document.getElementById('option' + Butt + IDD).className="sideheaders1";


}

// SET MOUSEOUT BUTTON
function setOut(Butt, IDD) {

document.getElementById('option' + Butt + IDD).className = 'sideheaders';

}



//*** 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+ 10 + "px";
	el.style.top = y + 5 +  "px";
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function sideMenu(subID, buttonID) {
	hideAllSideMenus();
       
	butX = getRealLeft(buttonID);
	butY = getRealTop(buttonID);
        
        if(buttonID=='option1')
	{moveObjectTo(subID,butX+xSubOffset1, butY+ySubOffset1);}
        else if(buttonID=='option2')
        {moveObjectTo(subID,butX+xSubOffset2, butY+ySubOffset2);}
        else if(buttonID=='option3')
        {moveObjectTo(subID,butX+xSubOffset3, butY+ySubOffset3);}
        else if(buttonID=='option4')
        {moveObjectTo(subID,butX+xSubOffset4, butY+ySubOffset4);}
        else if(buttonID=='option5')
        {moveObjectTo(subID,butX+xSubOffset5, butY+ySubOffset5);}
}

// HIDE ALL SIDE MENUS
function hideAllSideMenus() {
	for ( x=0; x<totButtons; x++) {
		moveObjectTo("side" + (x+1) + "",-500, -500 );
	}
}

// HIDE ONE SIDE MENU
function hideSide(subID) {
	if ( overSub2 == false ) {
		moveObjectTo(subID,-500, -500);
	}
}



//ppreload();

