/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_cg5 = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_cg5 = new Array("button1up_cg5.png");

overSources_cg5 = new Array("button1over_cg5.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_cg5 = new Array();
subInfo_cg5[1] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo_cg5[1][1] = new Array("Regional Seminars","http://www.californiagcsa.org/regional_seminars.htm","");
subInfo_cg5[1][2] = new Array("Online Learning","http://www.californiagcsa.org/edu-opportuntites.html","");
subInfo_cg5[1][3] = new Array("GCSAA Webcasts","http://www.gcsaa.org/education/webcast/webcast.aspx","");


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



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_cg5 = false;
var delay_cg5 = 1000;
totalButtons_cg5 = upSources_cg5.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_cg5; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_cg5[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_cg5">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_cg5" class="dropmenu_cg5" ');
		document.write('onMouseOver="overSub_cg5=true;');
		document.write('setOverImg_cg5(\'' + (x+1) + '\',\'_cg5\');"');
		document.write('onMouseOut="overSub_cg5=false;');
		document.write('setTimeout(\'hideSubMenu_cg5(\\\'submenu' + (x+1) + '_cg5\\\')\',delay_cg5);');
		document.write('setOutImg_cg5(\'' + (x+1) + '\',\'_cg5\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_cg5[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_cg5[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_cg5[x+1][k+1][2] + '">');
			document.write( subInfo_cg5[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_cg5() {
	for ( x=0; x<totalButtons_cg5; x++ ) {
		buttonUp_cg5 = new Image();
		buttonUp_cg5.src = buttonFolder_cg5 + upSources_cg5[x];
		buttonOver_cg5 = new Image();
		buttonOver_cg5.src = buttonFolder_cg5 + overSources_cg5[x];
	}
}

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

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



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

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

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_cg5(subID, buttonID) {
	hideAllSubMenus_cg5();
	butX = getRealLeft_cg5(buttonID);
	butY = getRealTop_cg5(buttonID);
	moveObjectTo_cg5(subID,butX+xSubOffset_cg5, butY+ySubOffset_cg5);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_cg5() {
	for ( x=0; x<totalButtons_cg5; x++) {
		moveObjectTo_cg5("submenu" + (x+1) + "_cg5",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_cg5(subID) {
	if ( overSub_cg5 == false ) {
		moveObjectTo_cg5(subID,-500, -500);
	}
}



//preload_cg5();

