/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_sidebar = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_sidebar = new Array("button1up_sidebar.png","button2up_sidebar.png","button3up_sidebar.png","button4up_sidebar.png","button5up_sidebar.png","button6up_sidebar.png","button7up_sidebar.png","button8up_sidebar.png","button9up_sidebar.png","button10up_sidebar.png");

overSources_sidebar = new Array("button1over_sidebar.png","button2over_sidebar.png","button3over_sidebar.png","button4over_sidebar.png","button5over_sidebar.png","button6over_sidebar.png","button7over_sidebar.png","button8over_sidebar.png","button9over_sidebar.png","button10over_sidebar.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_sidebar = new Array();
subInfo_sidebar[1] = new Array();
subInfo_sidebar[2] = new Array();
subInfo_sidebar[3] = new Array();
subInfo_sidebar[4] = new Array();
subInfo_sidebar[5] = new Array();
subInfo_sidebar[6] = new Array();
subInfo_sidebar[7] = new Array();
subInfo_sidebar[8] = new Array();
subInfo_sidebar[9] = new Array();
subInfo_sidebar[10] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//








subInfo_sidebar[9][1] = new Array("Blog","http://blog.britewhite.com","");
subInfo_sidebar[9][2] = new Array("About Us","professional-teeth-whitening-history.html","");
subInfo_sidebar[9][3] = new Array("Returns","teeth-whitening-return-policy.html","");
subInfo_sidebar[9][4] = new Array("Shipping","tooth-whitening-shipping-policy.html","");
subInfo_sidebar[9][5] = new Array("Privacy","teeth-whitener-privacy-policy.html","");
subInfo_sidebar[9][6] = new Array("Links","teeth-bleaching-links.html","");
subInfo_sidebar[9][7] = new Array("Articles","teeth-bleaching-articles.html","");
subInfo_sidebar[9][8] = new Array("Contact Us","contact-professoinal-teeth-whitening.html","");



//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset_sidebar = 116;
var ySubOffset_sidebar = 3;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_sidebar = false;
var delay_sidebar = 1000;
totalButtons_sidebar = upSources_sidebar.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_sidebar; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_sidebar[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_sidebar">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_sidebar" class="dropmenu_sidebar" ');
		document.write('onMouseOver="overSub_sidebar=true;');
		document.write('setOverImg_sidebar(\'' + (x+1) + '\',\'_sidebar\');"');
		document.write('onMouseOut="overSub_sidebar=false;');
		document.write('setTimeout(\'hideSubMenu_sidebar(\\\'submenu' + (x+1) + '_sidebar\\\')\',delay_sidebar);');
		document.write('setOutImg_sidebar(\'' + (x+1) + '\',\'_sidebar\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_sidebar[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_sidebar[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_sidebar[x+1][k+1][2] + '">');
			document.write( subInfo_sidebar[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_sidebar() {
	for ( x=0; x<totalButtons_sidebar; x++ ) {
		buttonUp_sidebar = new Image();
		buttonUp_sidebar.src = buttonFolder_sidebar + upSources_sidebar[x];
		buttonOver_sidebar = new Image();
		buttonOver_sidebar.src = buttonFolder_sidebar + overSources_sidebar[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg_sidebar(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_sidebar + overSources_sidebar[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg_sidebar(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_sidebar + upSources_sidebar[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement_sidebar(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft_sidebar(id) { 
	var el = getElement_sidebar(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_sidebar(id) {
	var el = getElement_sidebar(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_sidebar(objectID,x,y) {
	var el = getElement_sidebar(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_sidebar(subID, buttonID) {
	hideAllSubMenus_sidebar();
	butX = getRealLeft_sidebar(buttonID);
	butY = getRealTop_sidebar(buttonID);
	moveObjectTo_sidebar(subID,butX+xSubOffset_sidebar, butY+ySubOffset_sidebar);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_sidebar() {
	for ( x=0; x<totalButtons_sidebar; x++) {
		moveObjectTo_sidebar("submenu" + (x+1) + "_sidebar",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_sidebar(subID) {
	if ( overSub_sidebar == false ) {
		moveObjectTo_sidebar(subID,-500, -500);
	}
}



//preload_sidebar();

/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_bottombar = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_bottombar = new Array("button1up_bottombar.png","button2up_bottombar.png","button3up_bottombar.png","button4up_bottombar.png","button5up_bottombar.png","button6up_bottombar.png","button7up_bottombar.png","button8up_bottombar.png","button9up_bottombar.png");

overSources_bottombar = new Array("button1over_bottombar.png","button2over_bottombar.png","button3over_bottombar.png","button4over_bottombar.png","button5over_bottombar.png","button6over_bottombar.png","button7over_bottombar.png","button8over_bottombar.png","button9over_bottombar.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_bottombar = new Array();
subInfo_bottombar[1] = new Array();
subInfo_bottombar[2] = new Array();
subInfo_bottombar[3] = new Array();
subInfo_bottombar[4] = new Array();
subInfo_bottombar[5] = new Array();
subInfo_bottombar[6] = new Array();
subInfo_bottombar[7] = new Array();
subInfo_bottombar[8] = new Array();
subInfo_bottombar[9] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//








subInfo_bottombar[9][1] = new Array("Home","index-teeth-whitening.html","");
subInfo_bottombar[9][2] = new Array("Procedure","tooth-whitening-procedure.html","");
subInfo_bottombar[9][3] = new Array("Trays","teeth-bleaching-trays.html","");
subInfo_bottombar[9][4] = new Array("Whitener","teeth-whitener.html","");
subInfo_bottombar[9][5] = new Array("Applying","tooth-whitener-application.html","");
subInfo_bottombar[9][6] = new Array("Photo","white-teeth-photos.html","");
subInfo_bottombar[9][7] = new Array("Reviews","tooth-bleaching-reviews.html","");


//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset_bottombar = 116;
var ySubOffset_bottombar = 3;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_bottombar = false;
var delay_bottombar = 1000;
totalButtons_bottombar = upSources_bottombar.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_bottombar; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_bottombar[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_bottombar">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_bottombar" class="dropmenu_bottombar" ');
		document.write('onMouseOver="overSub_bottombar=true;');
		document.write('setOverImg_bottombar(\'' + (x+1) + '\',\'_bottombar\');"');
		document.write('onMouseOut="overSub_bottombar=false;');
		document.write('setTimeout(\'hideSubMenu_bottombar(\\\'submenu' + (x+1) + '_bottombar\\\')\',delay_bottombar);');
		document.write('setOutImg_bottombar(\'' + (x+1) + '\',\'_bottombar\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_bottombar[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_bottombar[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_bottombar[x+1][k+1][2] + '">');
			document.write( subInfo_bottombar[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_bottombar() {
	for ( x=0; x<totalButtons_bottombar; x++ ) {
		buttonUp_bottombar = new Image();
		buttonUp_bottombar.src = buttonFolder_bottombar + upSources_bottombar[x];
		buttonOver_bottombar = new Image();
		buttonOver_bottombar.src = buttonFolder_bottombar + overSources_bottombar[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg_bottombar(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_bottombar + overSources_bottombar[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg_bottombar(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_bottombar + upSources_bottombar[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement_bottombar(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft_bottombar(id) { 
	var el = getElement_bottombar(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_bottombar(id) {
	var el = getElement_bottombar(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_bottombar(objectID,x,y) {
	var el = getElement_bottombar(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_bottombar(subID, buttonID) {
	hideAllSubMenus_bottombar();
	butX = getRealLeft_bottombar(buttonID);
	butY = getRealTop_bottombar(buttonID);
	moveObjectTo_bottombar(subID,butX+xSubOffset_bottombar, butY+ySubOffset_bottombar);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_bottombar() {
	for ( x=0; x<totalButtons_bottombar; x++) {
		moveObjectTo_bottombar("submenu" + (x+1) + "_bottombar",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_bottombar(subID) {
	if ( overSub_bottombar == false ) {
		moveObjectTo_bottombar(subID,-500, -500);
	}
}



//preload_bottombar();



