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

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("gbt01.gif","gbt02.gif","gbt03b.gif","gbt04.gif","gbt05.gif");

overSources = new Array("gbt01_1.gif","gbt02_1.gif","gbt03b_1.gif","gbt04_1.gif","gbt05_1.gif");

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




//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//


subInfo[2][1] = new Array("Tip #1 - Observe","dating_secrets_observe.htm","");
subInfo[2][2] = new Array("Tip #2 - Gauge Her Interest","dating_secrets_is_she_interested.htm","");
subInfo[2][3] = new Array("Tip #3 - Opening Lines","dating_great_opening_lines.htm","");
subInfo[2][4] = new Array("Tip #4 - The Phone Number","dating_getting_her_phone_number.htm","");
subInfo[2][5] = new Array("Tip #5 - Before the Call","dating_before_first_call.htm","");
subInfo[2][6] = new Array("Tip #6 - Internet Dating","internet_dating_first_step.htm","");
subInfo[2][7] = new Array("Tip #7 - First Phone Call","dating_successful_phone_call.htm","");
subInfo[2][8] = new Array("Tip #8 - New Relationship","advice_dating_new_relationship.htm","");
subInfo[2][9] = new Array("Tip #9 - Never Do This","guys_dating_mistakes_avoid.htm","");
subInfo[2][10] = new Array("Tip #10 - What She Really Means","dating_advice_understand_women.htm","");
subInfo[2][11] = new Array("Tip #11 - The Texting Trap","dating_advice_texting_tips.htm","");
subInfo[2][12] = new Array("Tip #12 - Think Before Speaking","dating_what_to_talk_about.htm","");
subInfo[2][13] = new Array("Tip #13 - Stay Positive","dating_conversation.htm","");
subInfo[2][14] = new Array("Tip #14 - Interview Mode","dating_confidence_conversation.htm","");
subInfo[2][15] = new Array("Tip #15 - Let Her Touch You","dating_let_her_touch_you.htm","");
subInfo[2][16] = new Array("Tip #16 - Overcoming Nerves, The Approach","how_to_meet_women.htm","");
subInfo[2][17] = new Array("Tip #17 - Meeting - Take a Chance","dating_introduction_success.htm","");
subInfo[2][18] = new Array("Tip #18 - Set Up First Date","weekend_weekday_date.htm","");
subInfo[2][19] = new Array("Tip #19 - Look,Listen,Learn","meeting_flirting_phonecall.htm","");
subInfo[2][20] = new Array("Tip #20 - Who's in Control?","level_of_interest.htm","");
subInfo[2][21] = new Array("Tip #21 - How to Text","how_to_text_message.htm","");


subInfo[3][1] = new Array("Matt's Message","dating_tips_for_guys.htm","");
subInfo[3][2] = new Array("Why Do These Secrets Work?","why_dating_secrets_work.htm","");
subInfo[3][3] = new Array("Letters to Matt","relationship_advice_letters.htm","");
subInfo[3][4] = new Array("FAQs","dating_advice_questions.htm","");

subInfo[4][1] = new Array("Contact Info","dating_secrets_contact_info.htm","");
subInfo[4][2] = new Array("Why Free?","why_free_relationship_advice.htm","");
subInfo[4][3] = new Array("Who is Matt?","better_dates_author.htm","");
subInfo[4][4] = new Array("Website Directory","better_dates_website_directory.htm","");



//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = -3;
var ySubOffset = 30;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub = false;
var delay = 500;
totalButtons = upSources.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '" class="dropmenu" ');
		document.write('onMouseOver="overSub=true;');
		document.write('setOverImg(\'' + (x+1) + '\',\'\');"');
		document.write('onMouseOut="overSub=false;');
		document.write('setTimeout(\'hideSubMenu(\\\'submenu' + (x+1) + '\\\')\',delay);');
		document.write('setOutImg(\'' + (x+1) + '\',\'\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo[x+1][k+1][2] + '">');
			document.write( subInfo[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() {
	for ( x=0; x<totalButtons; x++ ) {
		buttonUp = new Image();
		buttonUp.src = buttonFolder + upSources[x];
		buttonOver = new Image();
		buttonOver.src = buttonFolder + overSources[x];
	}
}

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

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



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

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

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu(subID, buttonID) {
	hideAllSubMenus();
	butX = getRealLeft(buttonID);
	butY = getRealTop(buttonID);
	moveObjectTo(subID,butX+xSubOffset, butY+ySubOffset);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus() {
	for ( x=0; x<totalButtons; x++) {
		moveObjectTo("submenu" + (x+1) + "",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu(subID) {
	if ( overSub == false ) {
		moveObjectTo(subID,-500, -500);
	}
}



//preload();


