/*** 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");

overSources = new Array("button1over.png","button2over.png","button3over.png","button4over.png","button5over.png","button6over.png","button7over.png","button8over.png","button9over.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();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo[1][1] = new Array("Home","http://www.pflagphoenix.org/index.html","");

subInfo[2][1] = new Array("Welcome to PFLAG Phoenix!","http://www.pflagphoenix.org/chapter/welcome.html","");
subInfo[2][2] = new Array("What is PFLAG?","http://www.pflagphoenix.org/chapter/what_is_pflag.html","");
subInfo[2][3] = new Array("PFLAG's Vision & Mission","http://www.pflagphoenix.org/chapter/what_is_pflag.html#Vision","");
subInfo[2][4] = new Array("PFLAG: How It All Began","http://www.pflagphoenix.org/chapter/what_is_pflag.html#How_It_All_Began","");
subInfo[2][5] = new Array("Our Support Services","http://www.pflagphoenix.org/support/index.html","");
subInfo[2][6] = new Array("For Those “In Crisis”","http://www.pflagphoenix.org/support/crisis_hotlines.html","");
subInfo[2][7] = new Array("Support Meetings","http://www.pflagphoenix.org/support/meetings/meetings.html","");
subInfo[2][8] = new Array("Our GLBTQ Youth Page","http://www.pflagphoenix.org/youth/index.html","");
subInfo[2][9] = new Array("Familias Del Arco Iris","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("Personal Stories","http://www.pflagphoenix.org/stories/stories.html","");
subInfo[3][3] = new Array("Our Speakers Bureau","http://www.pflagphoenix.org/education/speakers_bureau.html","");
subInfo[3][4] = new Array("Project Safe Space","http://www.pflagphoenix.org/education/project_safe_space.html","");
subInfo[3][5] = new Array("Scholarships","http://www.pflagphoenix.org/scholarships/index.html","");
subInfo[3][6] = new Array("GLBT News Briefs","http://www.pflagphoenix.org/news/index.html","");
subInfo[3][7] = new Array("“Good Reads”","http://www.pflagphoenix.org/good_reads.html","");
subInfo[3][8] = 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/advocacy.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/advocacy.html#What_Else","");

subInfo[5][1] = new Array("About Our Chapter","http://www.pflagphoenix.org/chapter/index.html","");
subInfo[5][2] = new Array("Calendar","http://www.pflagphoenix.org/calendar/index.html","");
subInfo[5][3] = new Array("Volunteering","http://www.pflagphoenix.org/volunteering/index.html","");
subInfo[5][4] = new Array("Membership","http://www.pflagphoenix.org/chapter/membership.html","");
subInfo[5][5] = new Array("Donations","http://www.pflagphoenix.org/chapter/membership.html","");
subInfo[5][6] = new Array("Join Our Email List","http://www.pflagphoenix.org/chapter/email_list.html","");
subInfo[5][7] = new Array("Our Newsletter Archive","http://www.pflagphoenix.org/newsletters/newsletter.html","");
subInfo[5][8] = new Array("Newsletter Advertising","http://www.pflagphoenix.org/chapter/newsletter_ads.html","");
subInfo[5][9] = new Array("Our Board of Directors","http://www.pflagphoenix.org/chapter/board_of_directors.html","");
subInfo[5][10] = new Array("Our Sponsors","http://www.pflagphoenix.org/chapter/sponsors.html","");
subInfo[5][11] = new Array("Our “Wish List”","http://www.pflagphoenix.org/chapter/wish_list.html","");
subInfo[5][12] = new Array("Previous Announcements","http://www.pflagphoenix.org/announcements.html","");
subInfo[5][13] = new Array("Chapter/Member Recognition","http://www.pflagphoenix.org/chapter/recognition.html","");
subInfo[5][14] = new Array("Our Chapter Logo","http://www.pflagphoenix.org/chapter/logo.html","");
subInfo[5][15] = new Array("Our Administrative Area","http://www.pflagphoenix.org/admin/index.html","");
subInfo[5][16] = new Array("Contact Us","http://www.pflagphoenix.org/chapter/chapter.html#Contact%20Us","");

subInfo[6][1] = new Array("Volunteering","http://www.pflagphoenix.org/volunteering/index.html","");

subInfo[7][1] = new Array("Community Organizations:","http://www.pflagphoenix.org/community/index.html","");
subInfo[7][2] = new Array("- Businesses","http://www.pflagphoenix.org/community/businesses.html","");
subInfo[7][3] = new Array("- Churches & Religious Centers","http://www.pflagphoenix.org/community/churches.html","");
subInfo[7][4] = new Array("- Community Center","http://www.1vcc.org/","");
subInfo[7][5] = new Array("- Counseling & Grief Services","http://www.pflagphoenix.org/community/counseling.html","");
subInfo[7][6] = new Array("- Crime Prevention & Reporting","http://www.pflagphoenix.org/community/crime.html","");
subInfo[7][7] = new Array("- Health/Mental Health Services","http://www.pflagphoenix.org/community/health.html","");
subInfo[7][8] = new Array("- Information & Referral","http://www.pflagphoenix.org/community/info&referral.html","");
subInfo[7][9] = new Array("- Political Organizations","http://www.pflagphoenix.org/community/political.html","");
subInfo[7][10] = new Array("- Professional Organizations","http://www.pflagphoenix.org/community/professional.html","");
subInfo[7][11] = new Array("- Publications (GLBT)","http://www.pflagphoenix.org/community/publications.html","");
subInfo[7][12] = new Array("- Recreational Groups","http://www.pflagphoenix.org/community/recreation.html","");
subInfo[7][13] = new Array("- Religious/Spiritual Groups","http://www.pflagphoenix.org/community/religious.html","");
subInfo[7][14] = new Array("- Social & Support Groups","http://www.pflagphoenix.org/community/social.html","");
subInfo[7][15] = new Array("- Substance Abuse & Recovery","http://www.pflagphoenix.org/community/recovery.html","");
subInfo[7][16] = new Array("-----------------","http://www.pflagphoenix.org/community/index.html","");
subInfo[7][17] = new Array("New to Arizona?","http://www.pflagphoenix.org/chapter/new_to_arizona.html","");
subInfo[7][18] = new Array("Around Our State","http://www.pflagphoenix.org/community/around_arizona.html","");
subInfo[7][19] = new Array("PFLAG Arizona","http://www.pflagarizona.org/","");

subInfo[8][1] = new Array("National/Internet Resources:","http://www.pflagphoenix.org/resources/index.html","");
subInfo[8][2] = new Array("- For Parents/Family/Friends","http://www.pflagphoenix.org/resources/parents.html","");
subInfo[8][3] = new Array("- For GLBTQ Youth","http://www.pflagphoenix.org/youth/index.html","");
subInfo[8][4] = new Array("- For GLBTQ Adults","http://www.pflagphoenix.org/resources/glbt_adults.html","");
subInfo[8][5] = new Array("- For Gay Men","http://www.pflagphoenix.org/resources/lesbian.html","");
subInfo[8][6] = new Array("- For Lesbian Women","http://www.pflagphoenix.org/resources/parents.html","");
subInfo[8][7] = new Array("- For Bisexual Individuals","http://www.pflagphoenix.org/resources/bisexual.html","");
subInfo[8][8] = new Array("- For Transgender Individuals","http://www.pflagphoenix.org/resources/transgender.html","");
subInfo[8][9] = new Array("- For Spouses (Straight/Gay)","http://www.pflagphoenix.org/resources/spouses.html","");
subInfo[8][10] = new Array("- For GLBT Parents","http://www.pflagphoenix.org/resources/glbt_parents.html","");
subInfo[8][11] = new Array("- For Children of GLBTs","http://www.pflagphoenix.org/resources/child_of_glbt_parent.html","");
subInfo[8][12] = new Array("- For GLBT Students & Educators","http://www.pflagphoenix.org/resources/students.html","");
subInfo[8][13] = new Array("- For Disabled GLBTs","http://www.pflagphoenix.org/resources/disabled.html","");
subInfo[8][14] = new Array("- For Minority GLBTs","http://www.pflagphoenix.org/resources/minorities.html","");
subInfo[8][15] = new Array("-----------------","http://www.pflagphoenix.org/resources/index.html","");
subInfo[8][16] = new Array("Crisis Info/Links","http://www.pflagphoenix.org/resources/crisis_info.html","");
subInfo[8][17] = new Array("Employment Issues","http://www.pflagphoenix.org/resources/employment.html","");
subInfo[8][18] = new Array("GLBT History","http://www.pflagphoenix.org/resources/history.html","");
subInfo[8][19] = new Array("Health/Mental Health","http://www.pflagphoenix.org/resources/health.html","");
subInfo[8][20] = new Array("Information & Reference","http://www.pflagphoenix.org/resources/info_and_referral.html","");
subInfo[8][21] = new Array("Political/Legal Info.","http://www.pflagphoenix.org/resources/political&legal.html","");
subInfo[8][22] = new Array("Religious/Spiritual Info.","http://www.pflagphoenix.org/resources/religious.html","");
subInfo[8][23] = new Array("-----------------","http://www.pflagphoenix.org/resources/index.html","");
subInfo[8][24] = new Array("PFLAG Arizona","http://www.pflagarizona.org/","");
subInfo[8][25] = new Array("PFLAG “National”","http://www.pflag.org/","");
subInfo[8][26] = new Array("Find Other PFLAG Chapters","http://community.pflag.org/NETCOMMUNITY/Page.aspx?pid=803&srcid=194","");

subInfo[9][1] = new Array("Calendar","http://www.pflagphoenix.org/calendar/index.html","");
subInfo[9][2] = new Array("GLBT News Briefs","http://www.pflagphoenix.org/news/index.html","");
subInfo[9][3] = new Array("“Good Reads”","http://www.pflagphoenix.org/good_reads.html","");
subInfo[9][4] = new Array("New “Finds”","http://www.pflagphoenix.org/new_finds.html","");
subInfo[9][5] = new Array("Internet “Gems”","http://www.pflagphoenix.org/gems.html","");
subInfo[9][6] = new Array("Just for Laughs","http://www.pflagphoenix.org/laughs.html","");
subInfo[9][7] = new Array("What's New?","http://www.pflagphoenix.org/whats_new.html","");
subInfo[9][8] = new Array("Información en Español","http://www.pflagphoenix.org/familias/index.html","");
subInfo[9][9] = 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();

