/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_cg1 = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_cg1 = new Array("button1up_cg1.png");

overSources_cg1 = new Array("button1over_cg1.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_cg1 = new Array();
subInfo_cg1[1] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo_cg1[1][1] = new Array("CGCSA History","http://www.californiagcsa.org/sitemap.htm","");
subInfo_cg1[1][2] = new Array("Mission-Vision-Goals","http://www.californiagcsa.org/mission-vision.htm","");
subInfo_cg1[1][3] = new Array("Articles of Incorporation","http://www.californiagcsa.org/cgcsa-art-incorp.pdf","");
subInfo_cg1[1][4] = new Array("By-Laws","http://www.californiagcsa.org/by-laws.htm","");
subInfo_cg1[1][5] = new Array("Code of Ethics","http://www.californiagcsa.org/ethics.htm","");


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



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_cg1 = false;
var delay_cg1 = 1000;
totalButtons_cg1 = upSources_cg1.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_cg1; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_cg1[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_cg1">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_cg1" class="dropmenu_cg1" ');
		document.write('onMouseOver="overSub_cg1=true;');
		document.write('setOverImg_cg1(\'' + (x+1) + '\',\'_cg1\');"');
		document.write('onMouseOut="overSub_cg1=false;');
		document.write('setTimeout(\'hideSubMenu_cg1(\\\'submenu' + (x+1) + '_cg1\\\')\',delay_cg1);');
		document.write('setOutImg_cg1(\'' + (x+1) + '\',\'_cg1\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_cg1[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_cg1[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_cg1[x+1][k+1][2] + '">');
			document.write( subInfo_cg1[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_cg1() {
	for ( x=0; x<totalButtons_cg1; x++ ) {
		buttonUp_cg1 = new Image();
		buttonUp_cg1.src = buttonFolder_cg1 + upSources_cg1[x];
		buttonOver_cg1 = new Image();
		buttonOver_cg1.src = buttonFolder_cg1 + overSources_cg1[x];
	}
}

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

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



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

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

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_cg1(subID, buttonID) {
	hideAllSubMenus_cg1();
	butX = getRealLeft_cg1(buttonID);
	butY = getRealTop_cg1(buttonID);
	moveObjectTo_cg1(subID,butX+xSubOffset_cg1, butY+ySubOffset_cg1);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_cg1() {
	for ( x=0; x<totalButtons_cg1; x++) {
		moveObjectTo_cg1("submenu" + (x+1) + "_cg1",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_cg1(subID) {
	if ( overSub_cg1 == false ) {
		moveObjectTo_cg1(subID,-500, -500);
	}
}



//preload_cg1();

