/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_cg7 = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_cg7 = new Array("button1up_cg7.png");

overSources_cg7 = new Array("button1over_cg7.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_cg7 = new Array();
subInfo_cg7[1] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo_cg7[1][1] = new Array("E-Magazine","http://www.californiagcsa.org/e-magazine-current.html","");
subInfo_cg7[1][2] = new Array("Past Issues E-Magazine","http://www.californiagcsa.org/e-magazine-past.html","");
subInfo_cg7[1][3] = new Array("Industry Press Releases","http://www.californiagcsa.org/press-releases.html","");


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



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_cg7 = false;
var delay_cg7 = 1000;
totalButtons_cg7 = upSources_cg7.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_cg7; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_cg7[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_cg7">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_cg7" class="dropmenu_cg7" ');
		document.write('onMouseOver="overSub_cg7=true;');
		document.write('setOverImg_cg7(\'' + (x+1) + '\',\'_cg7\');"');
		document.write('onMouseOut="overSub_cg7=false;');
		document.write('setTimeout(\'hideSubMenu_cg7(\\\'submenu' + (x+1) + '_cg7\\\')\',delay_cg7);');
		document.write('setOutImg_cg7(\'' + (x+1) + '\',\'_cg7\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_cg7[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_cg7[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_cg7[x+1][k+1][2] + '">');
			document.write( subInfo_cg7[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_cg7() {
	for ( x=0; x<totalButtons_cg7; x++ ) {
		buttonUp_cg7 = new Image();
		buttonUp_cg7.src = buttonFolder_cg7 + upSources_cg7[x];
		buttonOver_cg7 = new Image();
		buttonOver_cg7.src = buttonFolder_cg7 + overSources_cg7[x];
	}
}

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

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



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

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

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_cg7(subID, buttonID) {
	hideAllSubMenus_cg7();
	butX = getRealLeft_cg7(buttonID);
	butY = getRealTop_cg7(buttonID);
	moveObjectTo_cg7(subID,butX+xSubOffset_cg7, butY+ySubOffset_cg7);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_cg7() {
	for ( x=0; x<totalButtons_cg7; x++) {
		moveObjectTo_cg7("submenu" + (x+1) + "_cg7",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_cg7(subID) {
	if ( overSub_cg7 == false ) {
		moveObjectTo_cg7(subID,-500, -500);
	}
}



//preload_cg7();

