/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_opd3 = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_opd3 = new Array("button1up_opd3.png","button2up_opd3.png","button3up_opd3.png","button4up_opd3.png","button5up_opd3.png");

overSources_opd3 = new Array("button1over_opd3.png","button2over_opd3.png","button3over_opd3.png","button4over_opd3.png","button5over_opd3.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_opd3 = new Array();
subInfo_opd3[1] = new Array();
subInfo_opd3[2] = new Array();
subInfo_opd3[3] = new Array();
subInfo_opd3[4] = new Array();
subInfo_opd3[5] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//

subInfo_opd3[2][1] = new Array("Contact Us","contact.htm","");
subInfo_opd3[2][2] = new Array("About Us","about.htm","");
subInfo_opd3[2][3] = new Array("Employment","employment.htm","");
subInfo_opd3[2][4] = new Array("Services","services.htm","");
subInfo_opd3[2][5] = new Array("Patch Request","patch.htm","");

subInfo_opd3[3][1] = new Array("Patrol & Investigations","patrol.htm","");
subInfo_opd3[3][2] = new Array("Big Game Check In","game.htm","");
subInfo_opd3[3][3] = new Array("Extra Watch Service","extrawatch.htm","");
subInfo_opd3[3][4] = new Array("Meals on Wheeels","meals.htm","");
subInfo_opd3[3][5] = new Array("Education Services","education.htm","");
subInfo_opd3[3][6] = new Array("Click It or Ticket","clickit.htm","");
subInfo_opd3[3][7] = new Array("Booze It & Lose It","loseit.htm","");
subInfo_opd3[3][8] = new Array("Gun Lock Program","gunlocks.htm","");

subInfo_opd3[4][1] = new Array("Official Town Website","http://www.obiontn.com","blank");
subInfo_opd3[4][2] = new Array("Tn Sex Offenders","http://www.ticic.state.tn.us/sorinternet/sosearch.aspx","blank");
subInfo_opd3[4][3] = new Array("Meth Information","http://www.methfreetn.org/","blank");
subInfo_opd3[4][4] = new Array("Meth Offenders","http://www.tennesseeanytime.org/methor/","blank");
subInfo_opd3[4][5] = new Array("Missing Children","http://www.ticic.state.tn.us/Missing_Children/miss_child.htm","blank");
subInfo_opd3[4][6] = new Array("Out of State Parole","http://www.ticic.state.tn.us/Database/ISC_search.htm","blank");
subInfo_opd3[4][7] = new Array("Tn Most Wanted","http://www.tbi.state.tn.us/Fugitives/TBI_MWD4.HTM","blank");
subInfo_opd3[4][8] = new Array("Elder Abuse Registry","http://www2.state.tn.us/health/abuseregistry/index.html","blank");
subInfo_opd3[4][9] = new Array("Tn Back Ground Checks","http://www.tbi.state.tn.us/tbibackgrounds/background_checks.htm","blank");



//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset_opd3 = 5;
var ySubOffset_opd3 = 21;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_opd3 = false;
var delay_opd3 = 1000;
totalButtons_opd3 = upSources_opd3.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_opd3; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_opd3[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_opd3">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_opd3" class="dropmenu_opd3" ');
		document.write('onMouseOver="overSub_opd3=true;');
		document.write('setOverImg_opd3(\'' + (x+1) + '\',\'_opd3\');"');
		document.write('onMouseOut="overSub_opd3=false;');
		document.write('setTimeout(\'hideSubMenu_opd3(\\\'submenu' + (x+1) + '_opd3\\\')\',delay_opd3);');
		document.write('setOutImg_opd3(\'' + (x+1) + '\',\'_opd3\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_opd3[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_opd3[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_opd3[x+1][k+1][2] + '">');
			document.write( subInfo_opd3[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_opd3() {
	for ( x=0; x<totalButtons_opd3; x++ ) {
		buttonUp_opd3 = new Image();
		buttonUp_opd3.src = buttonFolder_opd3 + upSources_opd3[x];
		buttonOver_opd3 = new Image();
		buttonOver_opd3.src = buttonFolder_opd3 + overSources_opd3[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg_opd3(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_opd3 + overSources_opd3[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg_opd3(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_opd3 + upSources_opd3[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement_opd3(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft_opd3(id) { 
	var el = getElement_opd3(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_opd3(id) {
	var el = getElement_opd3(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_opd3(objectID,x,y) {
	var el = getElement_opd3(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_opd3(subID, buttonID) {
	hideAllSubMenus_opd3();
	butX = getRealLeft_opd3(buttonID);
	butY = getRealTop_opd3(buttonID);
	moveObjectTo_opd3(subID,butX+xSubOffset_opd3, butY+ySubOffset_opd3);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_opd3() {
	for ( x=0; x<totalButtons_opd3; x++) {
		moveObjectTo_opd3("submenu" + (x+1) + "_opd3",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_opd3(subID) {
	if ( overSub_opd3 == false ) {
		moveObjectTo_opd3(subID,-500, -500);
	}
}



//preload_opd3();

