

function menu1_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=menu1_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function menu1_swapImage() { //v3.0
  var i,j=0,x,a=menu1_swapImage.arguments; document.menu1_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=menu1_findObj(a[i]))!=null){document.menu1_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function menu1_swapImgRestore() { //v3.0
  var i,x,a=document.menu1_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function menu1_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.menu1_p) d.menu1_p=new Array();
   var i,j=d.menu1_p.length,a=menu1_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.menu1_p[j]=new Image; d.menu1_p[j++].src=a[i];}}
}

var menu1_topMenu = new Array();
var menu1_subMenu = new Array();

menu1_topMenu[0] = new Array("home", "/", "_top");
menu1_subMenu[0] = new Array();
menu1_subMenu[0][0] = new Array ("&raquo; The New Majority", "http://thenewmajority.com?force=1", "_top");
menu1_subMenu[0][1] = new Array ("&raquo; Orange County Chapter", "http://oc.thenewmajority.com", "_top");
menu1_subMenu[0][2] = new Array ("&raquo; Los Angeles Chapter", "http://la.thenewmajority.com", "_top");
menu1_subMenu[0][3] = new Array ("&raquo; Inland Empire Chapter", "http://ie.thenewmajority.com", "_top");
menu1_subMenu[0][4] = new Array ("&raquo; San Diego Chapter", "http://sd.thenewmajority.com", "_top");
menu1_topMenu[1] = new Array("events", "/events/", "_top");
menu1_subMenu[1] = new Array();
menu1_subMenu[1][0] = new Array ("&raquo; Calendar", "/events/upcoming.php", "_top");
menu1_subMenu[1][1] = new Array ("&raquo; Photo Gallery", "/events/gallery.php", "_top");
menu1_subMenu[1][2] = new Array ("&raquo; Past Speakers", "/events/speakers.php", "_top");
menu1_topMenu[2] = new Array("news", "/news/", "_top");
menu1_subMenu[2] = new Array();
menu1_subMenu[2][0] = new Array ("&raquo; Members in the News", "/news/members.php", "_top");
menu1_subMenu[2][1] = new Array ("&raquo; Press Releases", "/news/news.php", "_top");
menu1_subMenu[2][2] = new Array ("&raquo; Video Overview", "/resources/nmvideo.wmv", "_top");
menu1_topMenu[3] = new Array("about", "/about/", "_top");
menu1_subMenu[3] = new Array();
menu1_subMenu[3][0] = new Array ("&raquo; Mission Statement", "/about/mission.php", "_top");
menu1_subMenu[3][1] = new Array ("&raquo; History", "/about/history.php", "_top");
menu1_subMenu[3][2] = new Array ("&raquo; Founders", "/about/founders.php", "_top");
menu1_subMenu[3][3] = new Array ("&raquo; Structure", "/about/organization.php", "_top");
menu1_subMenu[3][4] = new Array ("&raquo; Committees", "/about/committees.php", "_top");
menu1_topMenu[4] = new Array("contact", "/contact/", "_top");
menu1_subMenu[4] = new Array();

menu1_preloadImages('/img_nav/home_f2.gif','/img_nav/events_f2.gif','/img_nav/news_f2.gif','/img_nav/about_f2.gif','/img_nav/contact_f2.gif');

var menu1_timer;

// Change colour or menu and submenu items when the mouse hovers over.  
function menu1_highlightSub(mainMenu, dropMenu) {
	for (x=0; x < menu1_subMenu[mainMenu].length; x++) {
		menu1_findObj("subMenu"+mainMenu+x).className = "menu1_menuUp";
	}
	
	if (dropMenu != null) {
		menu1_findObj("subMenu"+mainMenu+dropMenu).className="menu1_menuOver";
	}
}

// Change colour or menu and submenu items when the mouse hovers over.  
function menu1_highlightMain(mainMenu, state) {
	state = (state == "over") ? "_mainOver" : "_mainUp";
	menu1_findObj("cell"+mainMenu).className = "menu1" + state;
}

// Find positioning for sub menus
function menu1_getLeftOffset(id) {
	if (! id) return 0;
	var obj = menu1_findObj(id);

	var ret = obj.offsetLeft + 0;
	while(obj.offsetParent != null) {   
		oPar = obj.offsetParent;
		ret += oPar.offsetLeft;
		obj = oPar;
	}
	
	return ret;
}

// Find positioning for sub menus
function menu1_getTopOffset(id) {
	if (! id) return 0;
	var obj = menu1_findObj(id);

	var ret = obj.offsetTop + 28;
	while(obj.offsetParent != null) {
		oPar = obj.offsetParent;
		ret += oPar.offsetTop;
		obj = oPar;
	}
	return ret;
}

// Show sub menus
function menu1_popDown(param, id) {
	var n = 0;
	var mName;
	
	menu1_swapImgRestore();

	while (n < menu1_topMenu.length) {
		var menuObj = menu1_findObj("MENU" + n);
		if (param == n) {
		
			mName = menu1_topMenu[param][0];
			menu1_swapImage('menu1_main_'+mName,'','/img_nav/'+mName+'_f2.gif',1);

			if (menuObj) {
				menuObj.style.visibility = "visible";
				menuObj.style.left = menu1_getLeftOffset(id) + "px";
				menuObj.style.top = menu1_getTopOffset(id) + "px";
			}
			
			menu1_highlightMain(n, 'over');
			if (menu1_subMenu[param].length > 0) {
				for (x = 0 ; x < menu1_subMenu[param].length ; x++) {
					menu1_findObj("subMenu"+param+x).className = "menu1_menuUp";
				}
			}
		}
		else {
			if (menuObj) menuObj.style.visibility = "hidden";
			menu1_highlightMain(n, 'up');
		}
		
		n++;
	}  
}

// Re-set timer for sub menus
function menu1_hoverMenu() {
	if (menu1_timer) clearTimeout(menu1_timer);
}

// Set timer for sub menus
function menu1_clearMenu(menu) {
	menu1_highlightSub(menu);
	setDelay = 0.5 * 1000;
	delay = (menu1_subMenu[menu].length > 0) ? setDelay : 1;
	menu1_timer = setTimeout("menu1_popDown("+(menu1_topMenu.length + 1)+")", delay);
}

function menu1_clickGo(url, loc) {
	if (loc == '_blank') window.open(url);
	else window.location = url;
}

