/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "http://www.pflagphoenix.org/_borders/buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("button1up.png","button2up.png","button3up.png","button4up.png","button5up.png","button6up.png","button7up.png","button8up.png","button9up.png","button10up.png","button11up.png");

overSources = new Array("button1over.png","button2over.png","button3over.png","button4over.png","button5over.png","button6over.png","button7over.png","button8over.png","button9over.png","button10over.png","button11over.png");

// 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();
subInfo[8] = new Array();
subInfo[9] = new Array();
subInfo[10] = new Array();
subInfo[11] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo[1][1] = new Array("Home","http://www.pflagphoenix.org/index.html","");
subInfo[1][2] = new Array("Welcome to PFLAG Phoenix!","http://www.pflagphoenix.org/chapter/welcome.html","");
subInfo[1][3] = new Array("What is PFLAG?","http://www.pflagphoenix.org/chapter/what_is_pflag.html","");
subInfo[1][4] = new Array("PFLAG's Vision & Mission","http://www.pflagphoenix.org/chapter/what_is_pflag.html#Vision","");
subInfo[1][5] = new Array("PFLAG: How It All Began","http://www.pflagphoenix.org/chapter/what_is_pflag.html#How_It_All_Began","");

subInfo[2][1] = new Array("Our Support Services","http://www.pflagphoenix.org/support/index.html","");
subInfo[2][2] = new Array("For Those “In Crisis”","http://www.pflagphoenix.org/support/crisis_hotlines.html","");
subInfo[2][3] = new Array("GLBTQ Youth:  Just For You","http://www.pflagphoenix.org/youth/index.html","");
subInfo[2][4] = new Array("Local PFLAG Support Meetings","http://www.pflagphoenix.org/support/meetings/meetings.html","");
subInfo[2][5] = new Array("Other Arizona PFLAG Chapters","http://www.pflagarizona.org/","");
subInfo[2][6] = new Array("PFLAG Chapters in Other States","http://community.pflag.org/Page.aspx?pid=803&srcid=194","");
subInfo[2][7] = new Array("Información en Español","http://www.pflagphoenix.org/familias/index.html","");

subInfo[3][1] = new Array("Educational Topics","http://www.pflagphoenix.org/education/index.html","");
subInfo[3][2] = new Array("   - The “Basics”","http://www.pflagphoenix.org/education/index.html#where_to_start","");
subInfo[3][3] = new Array("   - Sexual Orientation","http://www.pflagphoenix.org/education/sexual_orientation.html","");
subInfo[3][4] = new Array("   - Gender Identity & Expression","http://www.pflagphoenix.org/education/gender_identity_expression.html","");
subInfo[3][5] = new Array("   - GLBTQ-Related Issues","http://www.pflagphoenix.org/education/issues.html","");
subInfo[3][6] = new Array("   - GLBTQ Youth:  Just For You","http://www.pflagphoenix.org/youth/index.html","");
subInfo[3][7] = new Array("Personal Stories","http://www.pflagphoenix.org/stories/stories.html","");
subInfo[3][8] = new Array("Our Speakers Bureau","http://www.pflagphoenix.org/education/speakers_bureau.html","");
subInfo[3][9] = new Array("Scholarships","http://www.pflagphoenix.org/scholarships/index.html","");
subInfo[3][10] = new Array("GLBT News Briefs","http://www.pflagphoenix.org/news/index.html","");
subInfo[3][11] = new Array("“Good Reads”","http://www.pflagphoenix.org/good_reads.html","");
subInfo[3][12] = new Array("Información en Español","http://www.pflagphoenix.org/familias/index.html","");

subInfo[4][1] = new Array("Advocacy: Get Active!","http://www.pflagphoenix.org/advocacy/index.html","");
subInfo[4][2] = new Array("How To Make A Difference","http://www.pflagphoenix.org/advocacy/index.html#Make_A_Difference","");
subInfo[4][3] = new Array("What Should I Do Next?","http://www.pflagphoenix.org/advocacy/take_action.html","");
subInfo[4][4] = new Array("What Else Can I Do?","http://www.pflagphoenix.org/advocacy/index.html#What_Else","");

subInfo[5][1] = new Array("About Our Chapter","http://www.pflagphoenix.org/chapter/index.html","");
subInfo[5][2] = new Array("Local PFLAG Support Meetings","http://www.pflagphoenix.org/support/meetings/meetings.html","");
subInfo[5][3] = new Array("Volunteering","http://www.pflagphoenix.org/volunteering/index.html","");
subInfo[5][4] = new Array("Donations & Memberships","http://www.pflagphoenix.org/chapter/membership.html","");
subInfo[5][5] = new Array("Join Our Email List","http://www.pflagphoenix.org/chapter/email_list.html","");
subInfo[5][6] = new Array("Our Board of Directors","http://www.pflagphoenix.org/chapter/board_of_directors.html","");
subInfo[5][7] = new Array("Our Sponsors","http://www.pflagphoenix.org/chapter/sponsors.html","");
subInfo[5][8] = new Array("Our “Wish List”","http://www.pflagphoenix.org/chapter/wish_list.html","");
subInfo[5][9] = new Array("Previous Announcements","http://www.pflagphoenix.org/announcements.html","");
subInfo[5][10] = new Array("Chapter/Member Recognition","http://www.pflagphoenix.org/chapter/recognition.html","");
subInfo[5][11] = new Array("Our Chapter Logo","http://www.pflagphoenix.org/chapter/logo.html","");
subInfo[5][12] = new Array("Our Administrative Area","http://www.pflagphoenix.org/admin/index.html","");
subInfo[5][13] = new Array("Contact Us","http://www.pflagphoenix.org/chapter/index.html#Contact%20Us","");

subInfo[6][1] = new Array("PFLAG & Community Events","http://www.pflagphoenix.org/calendar/index.html","");
subInfo[6][2] = new Array("Local PFLAG Support Meetings","http://www.pflagphoenix.org/support/meetings/meetings.html","");
subInfo[6][3] = new Array("Our Board of Directors Meetings","http://www.pflagphoenix.org/chapter/board_of_directors.html","");

subInfo[7][1] = new Array("Volunteering","http://www.pflagphoenix.org/volunteering/index.html","");
subInfo[7][2] = new Array("Simple Ways to Volunteer","http://www.pflagphoenix.org/volunteering/index.html","");
subInfo[7][3] = new Array("Open Volunteer Roles","http://www.pflagphoenix.org/volunteering/volunteering_more.html","");

subInfo[8][1] = new Array("Community Organizations:","http://www.pflagphoenix.org/community/index.html","");
subInfo[8][2] = new Array("   - Businesses","http://www.pflagphoenix.org/community/businesses.html","");
subInfo[8][3] = new Array("   - Churches & Religious Centers","http://www.pflagphoenix.org/community/churches.html","");
subInfo[8][4] = new Array("   - Community Center","http://www.1vcc.org/","");
subInfo[8][5] = new Array("   - Counseling & Grief Services","http://www.pflagphoenix.org/community/counseling.html","");
subInfo[8][6] = new Array("   - Crime Prevention & Reporting","http://www.pflagphoenix.org/community/crime.html","");
subInfo[8][7] = new Array("   - Health/Mental Health Services","http://www.pflagphoenix.org/community/health.html","");
subInfo[8][8] = new Array("   - Information & Referral","http://www.pflagphoenix.org/community/info&referral.html","");
subInfo[8][9] = new Array("   - Political Organizations","http://www.pflagphoenix.org/community/political.html","");
subInfo[8][10] = new Array("   - Professional Organizations","http://www.pflagphoenix.org/community/professional.html","");
subInfo[8][11] = new Array("   - Publications (GLBT)","http://www.pflagphoenix.org/community/publications.html","");
subInfo[8][12] = new Array("   - Recreational Groups","http://www.pflagphoenix.org/community/recreation.html","");
subInfo[8][13] = new Array("   - Religious/Spiritual Groups","http://www.pflagphoenix.org/community/religious.html","");
subInfo[8][14] = new Array("   - Social & Support Groups","http://www.pflagphoenix.org/community/social.html","");
subInfo[8][15] = new Array("   - Substance Abuse & Recovery","http://www.pflagphoenix.org/community/recovery.html","");
subInfo[8][16] = new Array("-----------------","http://www.pflagphoenix.org/community/index.html","");
subInfo[8][17] = new Array("New to Arizona?","http://www.pflagphoenix.org/chapter/new_to_arizona.html","");
subInfo[8][18] = new Array("Around Our State","http://www.pflagphoenix.org/community/around_arizona.html","");
subInfo[8][19] = new Array("PFLAG Arizona","http://www.pflagarizona.org/","");

subInfo[9][1] = new Array("National/Internet Resources:","http://www.pflagphoenix.org/resources/index.html","");
subInfo[9][2] = new Array("   - For Parents/Family/Friends","http://www.pflagphoenix.org/resources/parents.html","");
subInfo[9][3] = new Array("   - For GLBTQ Youth","http://www.pflagphoenix.org/youth/index.html","");
subInfo[9][4] = new Array("   - For GLBTQ Adults","http://www.pflagphoenix.org/resources/glbt_adults.html","");
subInfo[9][5] = new Array("   - For Gay Men","http://www.pflagphoenix.org/resources/index.html","");
subInfo[9][6] = new Array("   - For Lesbian Women","http://www.pflagphoenix.org/resources/lesbian.html","");
subInfo[9][7] = new Array("   - For Bisexual Individuals","http://www.pflagphoenix.org/resources/bisexual.html","");
subInfo[9][8] = new Array("   - For Transgender Individuals","http://www.pflagphoenix.org/resources/transgender.html","");
subInfo[9][9] = new Array("   - For Spouses (Straight/Gay)","http://www.pflagphoenix.org/resources/spouses.html","");
subInfo[9][10] = new Array("   - For GLBT Parents","http://www.pflagphoenix.org/resources/glbt_parents.html","");
subInfo[9][11] = new Array("   - For Children of GLBTs","http://www.pflagphoenix.org/resources/child_of_glbt_parent.html","");
subInfo[9][12] = new Array("   - For GLBT Students & Educators","http://www.pflagphoenix.org/resources/students.html","");
subInfo[9][13] = new Array("   - For Disabled GLBTs","http://www.pflagphoenix.org/resources/disabled.html","");
subInfo[9][14] = new Array("   - For Minority GLBTs","http://www.pflagphoenix.org/resources/minorities.html","");
subInfo[9][15] = new Array("   - For Senior GLBTs","http://www.pflagphoenix.org/resources/minorities.html","");
subInfo[9][16] = new Array("-----------------","http://www.pflagphoenix.org/resources/index.html","");
subInfo[9][17] = new Array("Crisis Info/Links","http://www.pflagphoenix.org/resources/crisis_info.html","");
subInfo[9][18] = new Array("Employment Issues","http://www.pflagphoenix.org/resources/employment.html","");
subInfo[9][19] = new Array("GLBT History","http://www.pflagphoenix.org/resources/history.html","");
subInfo[9][20] = new Array("Health/Mental Health","http://www.pflagphoenix.org/resources/health.html","");
subInfo[9][21] = new Array("Information & Reference","http://www.pflagphoenix.org/resources/info_and_referral.html","");
subInfo[9][22] = new Array("Political/Legal Info.","http://www.pflagphoenix.org/resources/political&legal.html","");
subInfo[9][23] = new Array("Religious/Spiritual Info.","http://www.pflagphoenix.org/resources/religious.html","");
subInfo[9][24] = new Array("-----------------","http://www.pflagphoenix.org/resources/index.html","");
subInfo[9][25] = new Array("PFLAG Arizona","http://www.pflagarizona.org/","");
subInfo[9][26] = new Array("PFLAG “National”","http://www.pflag.org/","");
subInfo[9][27] = new Array("Find Other State PFLAG Chapters","http://community.pflag.org/Page.aspx?pid=803&srcid=194","");

subInfo[10][1] = new Array("Our Online Store","http://shop.pflagphoenix.org/","");

subInfo[11][1] = new Array("Información en Español","http://www.pflagphoenix.org/familias/index.html","");
subInfo[11][2] = new Array("GLBT News Briefs","http://www.pflagphoenix.org/news/index.html","");
subInfo[11][3] = new Array("“Good Reads”","http://www.pflagphoenix.org/good_reads.html","");
subInfo[11][4] = new Array("New “Finds”","http://www.pflagphoenix.org/new_finds.html","");
subInfo[11][5] = new Array("Internet “Gems”","http://www.pflagphoenix.org/gems.html","");
subInfo[11][6] = new Array("Just for Laughs","http://www.pflagphoenix.org/laughs.html","");
subInfo[11][7] = new Array("Search Our Website","http://www.pflagphoenix.org/chapter/search.html","");


//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 0;
var ySubOffset = 22;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub = false;
var delay = 1000;
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();


