/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_menu2 = "/storage/buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_menu2 = new Array("button1up_menu2.png","button2up_menu2.png","button3up_menu2.png","button4up_menu2.png","button5up_menu2.png","button6up_menu2.png","button7up_menu2.png","button8up_menu2.png","button9up_menu2.png","button10up_menu2.png","button11up_menu2.png","button12up_menu2.png");

overSources_menu2 = new Array("button1over_menu2.png","button2over_menu2.png","button3over_menu2.png","button4over_menu2.png","button5over_menu2.png","button6over_menu2.png","button7over_menu2.png","button8over_menu2.png","button9over_menu2.png","button10over_menu2.png","button11over_menu2.png","button12over_menu2.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_menu2 = new Array();
subInfo_menu2[1] = new Array();
subInfo_menu2[2] = new Array();
subInfo_menu2[3] = new Array();
subInfo_menu2[4] = new Array();
subInfo_menu2[5] = new Array();
subInfo_menu2[6] = new Array();
subInfo_menu2[7] = new Array();
subInfo_menu2[8] = new Array();
subInfo_menu2[9] = new Array();
subInfo_menu2[10] = new Array();
subInfo_menu2[11] = new Array();
subInfo_menu2[12] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//



subInfo_menu2[4][1] = new Array("Diabetes","http://www.500calorierestaurantmeals.com/diabetes/","");
subInfo_menu2[4][2] = new Array("Lower Sodium","http://www.500calorierestaurantmeals.com/lower-sodium/","");
subInfo_menu2[4][3] = new Array("Lower Fat","http://www.500calorierestaurantmeals.com/lower-fat/","");

subInfo_menu2[5][1] = new Array("Tips","http://www.500calorierestaurantmeals.com/tips/","");
subInfo_menu2[5][2] = new Array("200 Cal Bites","http://www.500calorierestaurantmeals.com/200-calorie-bites/","");
subInfo_menu2[5][3] = new Array("Low-Cal Desserts","http://www.500calorierestaurantmeals.com/low-cal-desserts/","");
subInfo_menu2[5][4] = new Array("Drinks","http://www.500calorierestaurantmeals.com/drinks/","");
subInfo_menu2[5][5] = new Array("Breakfast","http://www.500calorierestaurantmeals.com/breakfast/","");
subInfo_menu2[5][6] = new Array("Nutrition Basics","http://www.500calorierestaurantmeals.com/nutrition-basics/","");
subInfo_menu2[5][7] = new Array("What's New","http://www.500calorierestaurantmeals.com/whats-new/","");




subInfo_menu2[9][1] = new Array("Subscribe","http://www.500calorierestaurantmeals.com/newsletter-subscription/","");
subInfo_menu2[9][2] = new Array("Archive","http://www.500calorierestaurantmeals.com/newsletter-arch/","");
subInfo_menu2[9][3] = new Array("Unsubscribe","http://www.500calorierestaurantmeals.com/newsletter-unsubcribe/","");

subInfo_menu2[10][1] = new Array("Testimonials","http://www.500calorierestaurantmeals.com/testimonials/","");
subInfo_menu2[10][2] = new Array("Contributors","http://www.500calorierestaurantmeals.com/contributors/","");

subInfo_menu2[11][1] = new Array("Link 2 Us","http://www.500calorierestaurantmeals.com/link-2-us/","");



//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset_menu2 = 121;
var ySubOffset_menu2 = 0;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_menu2 = false;
var delay_menu2 = 1000;
totalButtons_menu2 = upSources_menu2.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_menu2; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_menu2[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_menu2">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_menu2" class="dropmenu_menu2" ');
		document.write('onMouseOver="overSub_menu2=true;');
		document.write('setOverImg_menu2(\'' + (x+1) + '\',\'_menu2\');"');
		document.write('onMouseOut="overSub_menu2=false;');
		document.write('setTimeout(\'hideSubMenu_menu2(\\\'submenu' + (x+1) + '_menu2\\\')\',delay_menu2);');
		document.write('setOutImg_menu2(\'' + (x+1) + '\',\'_menu2\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_menu2[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_menu2[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_menu2[x+1][k+1][2] + '">');
			document.write( subInfo_menu2[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_menu2() {
	for ( x=0; x<totalButtons_menu2; x++ ) {
		buttonUp_menu2 = new Image();
		buttonUp_menu2.src = buttonFolder_menu2 + upSources_menu2[x];
		buttonOver_menu2 = new Image();
		buttonOver_menu2.src = buttonFolder_menu2 + overSources_menu2[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg_menu2(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_menu2 + overSources_menu2[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg_menu2(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_menu2 + upSources_menu2[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement_menu2(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft_menu2(id) { 
	var el = getElement_menu2(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_menu2(id) {
	var el = getElement_menu2(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_menu2(objectID,x,y) {
	var el = getElement_menu2(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_menu2(subID, buttonID) {
	hideAllSubMenus_menu2();
	butX = getRealLeft_menu2(buttonID);
	butY = getRealTop_menu2(buttonID);
	moveObjectTo_menu2(subID,butX+xSubOffset_menu2, butY+ySubOffset_menu2);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_menu2() {
	for ( x=0; x<totalButtons_menu2; x++) {
		moveObjectTo_menu2("submenu" + (x+1) + "_menu2",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_menu2(subID) {
	if ( overSub_menu2 == false ) {
		moveObjectTo_menu2(subID,-500, -500);
	}
}



//preload_menu2();

