/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_M1 = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_M1 = new Array("button1up_M1.png","button2up_M1.png","button3up_M1.png","button4up_M1.png","button5up_M1.png","button6up_M1.png","button7up_M1.png","button8up_M1.png");

overSources_M1 = new Array("button1over_M1.png","button2over_M1.png","button3over_M1.png","button4over_M1.png","button5over_M1.png","button6over_M1.png","button7over_M1.png","button8over_M1.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_M1 = new Array();
subInfo_M1[1] = new Array();
subInfo_M1[2] = new Array();
subInfo_M1[3] = new Array();
subInfo_M1[4] = new Array();
subInfo_M1[5] = new Array();
subInfo_M1[6] = new Array();
subInfo_M1[7] = new Array();
subInfo_M1[8] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo_M1[1][1] = new Array("Current","http://www.gulfcoastraider.com/currentnews.html","");
subInfo_M1[1][2] = new Array("Regattas","http://www.gulfcoastraider.com/regattas.html","");
subInfo_M1[1][3] = new Array("Show Schedule","http://www.gulfcoastraider.com/showschedule.html","");
subInfo_M1[1][4] = new Array("Archives","http://www.gulfcoastraider.com/archives.html","");

subInfo_M1[2][1] = new Array("FL Gulf Coast","http://www.gulfcoastraider.com/dealerwestfl.html","");
subInfo_M1[2][2] = new Array("FL East Coast","http://www.gulfcoastraider.com/dealereastfl.html","");
subInfo_M1[2][3] = new Array("Georgia","http://www.gulfcoastraider.com/dealerga.html","");
subInfo_M1[2][4] = new Array("South Carolina","http://www.gulfcoastraider.com/dealersc.html","");
subInfo_M1[2][5] = new Array("Northwest","http://www.gulfcoastraider.com/dealerid.html","");
subInfo_M1[2][6] = new Array("Other Areas","http://www.gulfcoastraider.com/dealerwestfl.html","");
subInfo_M1[2][7] = new Array("Dealer Map","http://www.gulfcoastraider.com/sales.html","");

subInfo_M1[3][1] = new Array("Raider","http://www.gulfcoastraider.com/galore.html","");
subInfo_M1[3][2] = new Array("Racing","http://www.gulfcoastraider.com/Racing.html","");
subInfo_M1[3][3] = new Array("Spinnaker","http://www.gulfcoastraider.com/spin.html","");
subInfo_M1[3][4] = new Array("Factory","http://www.gulfcoastraider.com/raider_factory.html","");

subInfo_M1[4][1] = new Array("Raider Sport","http://www.gulfcoastraider.com/pricing.html","");
//subInfo_M1[4][2] = new Array("Raider 16","http://www.gulfcoastraider.com/pricing.html#16","");
subInfo_M1[4][2] = new Array("Options","http://www.gulfcoastraider.com/options.html","");

subInfo_M1[5][1] = new Array("Raider Team","http://www.gulfcoastraider.com/team.html","");
subInfo_M1[5][2] = new Array("Designer\'s Notes","http://www.gulfcoastraider.com/notes.html","");
subInfo_M1[5][3] = new Array("Owners\' Comments","http://www.gulfcoastraider.com/owner.html","");

subInfo_M1[6][1] = new Array("Rigging Details","http://www.gulfcoastraider.com/rig.html","");
subInfo_M1[6][2] = new Array("Raider DVD","mailto:info@gulfcoastraider.com?subject=Raider DVD&amp;body=Please enter your mailing address below. We respect your privacy and we will not provide your email or mailing address to any other party without your consent. Thank you for your interest in the Raider.","");

//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset_M1 = 0;
var ySubOffset_M1 = 22;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_M1 = false;
var delay_M1 = 100;
totalButtons_M1 = upSources_M1.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_M1; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_M1[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_M1">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_M1" class="dropmenu_M1" ');
		document.write('onMouseOver="overSub_M1=true;');
		document.write('setOverImg_M1(\'' + (x+1) + '\',\'_M1\');"');
		document.write('onMouseOut="overSub_M1=false;');
		document.write('setTimeout(\'hideSubMenu_M1(\\\'submenu' + (x+1) + '_M1\\\')\',delay_M1);');
		document.write('setOutImg_M1(\'' + (x+1) + '\',\'_M1\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_M1[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_M1[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_M1[x+1][k+1][2] + '">');
			document.write( subInfo_M1[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_M1() {
	for ( x=0; x<totalButtons_M1; x++ ) {
		buttonUp_M1 = new Image();
		buttonUp_M1.src = buttonFolder_M1 + upSources_M1[x];
		buttonOver_M1 = new Image();
		buttonOver_M1.src = buttonFolder_M1 + overSources_M1[x];
	}
}

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

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



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

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

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_M1(subID, buttonID) {
	hideAllSubMenus_M1();
	butX = getRealLeft_M1(buttonID);
	butY = getRealTop_M1(buttonID);
	moveObjectTo_M1(subID,butX+xSubOffset_M1, butY+ySubOffset_M1);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_M1() {
	for ( x=0; x<totalButtons_M1; x++) {
		moveObjectTo_M1("submenu" + (x+1) + "_M1",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_M1(subID) {
	if ( overSub_M1 == false ) {
		moveObjectTo_M1(subID,-500, -500);
	}
}



//preload_M1();

