/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_cg6 = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_cg6 = new Array("button1up_cg6.png");

overSources_cg6 = new Array("button1over_cg6.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_cg6 = new Array();
subInfo_cg6[1] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo_cg6[1][1] = new Array("Turf Research","http://www.californiagcsa.org/turf_research.htm","");
subInfo_cg6[1][2] = new Array("Golf Products Directory","http://www.californiagcsa.org/newvendorsindex.html","");
subInfo_cg6[1][3] = new Array("Equipment for Sale","http://www.californiagcsa.org/equip.htm","");
subInfo_cg6[1][4] = new Array("Weather Links","http://www.californiagcsa.org/weather.htm","");
subInfo_cg6[1][5] = new Array("Industry Links","http://www.californiagcsa.org/industry.htm","");


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



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_cg6 = false;
var delay_cg6 = 1000;
totalButtons_cg6 = upSources_cg6.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_cg6; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_cg6[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_cg6">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_cg6" class="dropmenu_cg6" ');
		document.write('onMouseOver="overSub_cg6=true;');
		document.write('setOverImg_cg6(\'' + (x+1) + '\',\'_cg6\');"');
		document.write('onMouseOut="overSub_cg6=false;');
		document.write('setTimeout(\'hideSubMenu_cg6(\\\'submenu' + (x+1) + '_cg6\\\')\',delay_cg6);');
		document.write('setOutImg_cg6(\'' + (x+1) + '\',\'_cg6\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_cg6[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_cg6[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_cg6[x+1][k+1][2] + '">');
			document.write( subInfo_cg6[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_cg6() {
	for ( x=0; x<totalButtons_cg6; x++ ) {
		buttonUp_cg6 = new Image();
		buttonUp_cg6.src = buttonFolder_cg6 + upSources_cg6[x];
		buttonOver_cg6 = new Image();
		buttonOver_cg6.src = buttonFolder_cg6 + overSources_cg6[x];
	}
}

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

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



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

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

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_cg6(subID, buttonID) {
	hideAllSubMenus_cg6();
	butX = getRealLeft_cg6(buttonID);
	butY = getRealTop_cg6(buttonID);
	moveObjectTo_cg6(subID,butX+xSubOffset_cg6, butY+ySubOffset_cg6);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_cg6() {
	for ( x=0; x<totalButtons_cg6; x++) {
		moveObjectTo_cg6("submenu" + (x+1) + "_cg6",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_cg6(subID) {
	if ( overSub_cg6 == false ) {
		moveObjectTo_cg6(subID,-500, -500);
	}
}



//preload_cg6();

