/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_cg3 = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_cg3 = new Array("button1up_cg3.png");

overSources_cg3 = new Array("button1over_cg3.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_cg3 = new Array();
subInfo_cg3[1] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo_cg3[1][1] = new Array("Members Forum","http://www.californiagcsa.org/cgi-bin/webbbs_config.pl","");
subInfo_cg3[1][2] = new Array("Membership Directory","http://www.calgcsadir.org/index.html","");
subInfo_cg3[1][3] = new Array("Government Relations","http://www.californiagcsa.org/enviro.htm","");
subInfo_cg3[1][4] = new Array("Annual Conference & Golf","http://www.californiagcsa.org/annual_mtg.htm","");
subInfo_cg3[1][5] = new Array("California Room","http://www.californiagcsa.org/hospitality.html","");


//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset_cg3 = 2;
var ySubOffset_cg3 = 24;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_cg3 = false;
var delay_cg3 = 1000;
totalButtons_cg3 = upSources_cg3.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_cg3; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_cg3[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_cg3">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_cg3" class="dropmenu_cg3" ');
		document.write('onMouseOver="overSub_cg3=true;');
		document.write('setOverImg_cg3(\'' + (x+1) + '\',\'_cg3\');"');
		document.write('onMouseOut="overSub_cg3=false;');
		document.write('setTimeout(\'hideSubMenu_cg3(\\\'submenu' + (x+1) + '_cg3\\\')\',delay_cg3);');
		document.write('setOutImg_cg3(\'' + (x+1) + '\',\'_cg3\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_cg3[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_cg3[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_cg3[x+1][k+1][2] + '">');
			document.write( subInfo_cg3[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_cg3() {
	for ( x=0; x<totalButtons_cg3; x++ ) {
		buttonUp_cg3 = new Image();
		buttonUp_cg3.src = buttonFolder_cg3 + upSources_cg3[x];
		buttonOver_cg3 = new Image();
		buttonOver_cg3.src = buttonFolder_cg3 + overSources_cg3[x];
	}
}

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

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



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

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

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_cg3(subID, buttonID) {
	hideAllSubMenus_cg3();
	butX = getRealLeft_cg3(buttonID);
	butY = getRealTop_cg3(buttonID);
	moveObjectTo_cg3(subID,butX+xSubOffset_cg3, butY+ySubOffset_cg3);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_cg3() {
	for ( x=0; x<totalButtons_cg3; x++) {
		moveObjectTo_cg3("submenu" + (x+1) + "_cg3",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_cg3(subID) {
	if ( overSub_cg3 == false ) {
		moveObjectTo_cg3(subID,-500, -500);
	}
}



//preload_cg3();

