// Rollover Button code
//
// This code automatically generates the rollover code necessary for each menu item.
// In addition, the code figures out which button is in the pressed state, and 
// Doesn't roll the button over if it is. 
// For information on how to use this code, please read "RollOver-Documentation.txt".

// ________Menu Creation (MODIFIABLE)______________________________________________________________


// ________Constants_______________
//  Button Image Size and File Type
var BUTTON_WIDTH = 208, BUTTON_HEIGHT = 29 ;

//  Paths
var buttonPath_ForwardSlash = "img/";  // Must include '/' at the end of the path
var buttonPath_BackSlash = "img\\";    // Must include '\\' at the end of the path

//  Subpaths
var normalButtonSubPath  = "normal";   // If using the "buttonPaths for one of the subpaths, set it to: ""
var hoverButtonSubPath   = "pressed";
var pressedButtonSubPath = "pressed";   // NOTE: you need to specify BOTH hover and pressed

//  Names of the buttons
//  Must be the same as the "name" parameters in the anchor tags for the menu buttons.
var buttonNames = new Array("home","order","juice","coffee","ezgo","thwater","equip","food","service","about","contact");

// _______End of Constants__________


// _______Code for Menu Creation_____

if (((navigator.appName.charAt(0)=="N") && (navigator.appVersion.charAt(0)>=3))
	|| (navigator.appVersion.charAt(0)>=4)) 

{

	// This is where the buttons are created. 
	for (var i = 0; i < buttonNames.length; ++i) {
		createButtonVar(buttonNames[i], buttonPath_ForwardSlash, BUTTON_WIDTH, BUTTON_HEIGHT);
	}

	// CUSTOM SIZE BUTTON CREATION:
	// sample:
	// createButtonVar("back", buttonPath_ForwardSlash, 55, 23); // NOTE: must use button paths with 
											 //       FORWARD SLASHES
}

// _______End of Menu Creation__________________________________________


//____ BEGINNING OF NON_MODIFIABLE CODE  (However you might change the ".gif" or ".jpg" file extenstion) _______

// activeButton_Name variable created if using Method 2 (findPressedButtton).

if (!window.activeButton_Name) {
	eval('var activeButton_Name = "NONE";');
}


// _______Helper Functions_______________________________________________

function createButtonVar(name, buttonPath_ForwardSlash, width, height)
{
	eval("window." + name + "_Norm = new Image(" + width + ", " + height + ");");

	// adding path to normal image to src

	var temp1 = name + '_Norm.src = "'+ buttonPath_ForwardSlash;

	if (normalButtonSubPath != "")
		temp1 += normalButtonSubPath + '/';
	    temp1 += name + '.jpg";' ;
  	    eval(temp1);
		eval("window." + name + "_Act = new Image(" + width + ", " + height + ");");

	var temp2 = name + '_Act.src = "'+ buttonPath_ForwardSlash;

	if (hoverButtonSubPath != "")
		temp2 += hoverButtonSubPath + '/' ;
    	temp2 += name + '.jpg";';
    	eval(temp2);
}

function img_on(buttonName, actionType)
{
	if (((navigator.appName.charAt(0)=="N") && (navigator.appVersion.charAt(0)>=3))
   		|| (navigator.appVersion.charAt(0)>=4)) 
	{
		 if (buttonName != activeButton_Name) {
	 		imgOn = eval(buttonName + actionType + ".src");
			document[buttonName].src = imgOn;
		}
	 }
}

