
//*** NEW

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



//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//

//Menu Example. Just remove //*** to get it to work.
//*** subInfo[1][1] = new Array("<strong> Welcome to Our Practice</strong>", "../ab_welcome.php", "_self");
//*** subInfo[1][2] = new Array("<i>    • What Is Chiropractic?</i>", "../ab_chiro_01.php", "_self");
//*** subInfo[1][3] = new Array("<i>    • Who Goes to a Chiroprator?</i>", "../ab_chiro_02.php", "_self");
//*** subInfo[1][4] = new Array("<i>    • What Chiropractors Treat</i>", "../ab_chiro_03.php", "_self");
//*** subInfo[1][5] = new Array("<strong> Meet Dr. Eric Lambert</strong>", "../ab_dreric.php", "_self");
//*** subInfo[1][6] = new Array("<strong> Our Mission Statement</strong>", "../ab_mission.php", "_self");
//*** subInfo[1][7] = new Array("<strong> Our Office Information</strong>", "../about.php", "_self");
//*** subInfo[1][8] = new Array("<i>    • Staff</i>", "../ab_staff.php", "_self");
//*** subInfo[1][9] = new Array("<i>    • Hours</i>", "../ab_hours.php", "_self");
//*** subInfo[1][10] = new Array("<i>    • Map</i>", "../ab_map.php", "_self");
//*** subInfo[1][11] = new Array("<strong> Testimonials</strong>", "../ab_testimonies.php", "_self");



//Menu01
//Blank

//Menu02
//Blank

//Menu03
//Blank

//Menu04
//Blank

//Menu05
//Blank

//Menu06
//Blank

//Menu07
//Blank





//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//

var xSubOffset = 0;
var ySubOffset = 22;

var overSub = false;
var delay = 1000;
totalButtons = 7;




//*** NO MORE SETTINGS BEYOND THIS POINT ***//



// 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('onMouseOut="overSub=false;');
		document.write('setTimeout(\'hideSubMenu(\\\'submenu' + (x+1) + '\\\')\',delay);"');


		document.write('<ul>');
		for ( k=0; k<subInfo[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="menu/' + 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 ***//

//*** 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);
	}
}