// IDDAmenus copyright 2003 - 2009 - Philip Tardif and IDDA - all rights reserved// IDDAmenus default values// 8/09 moved from outer zone hover exit to timed onmouseOut exit// and removed table layout in exchange for all div menus// only primary menus in this implementation// secondary menus to come latervar browser_info = navigator.userAgent;var is_windows = true;var out_mlscnds = 125; // the time delay for closing menusvar is_IE6 = false; //  soon to be awb-sew-leet ** HOPEFULLY!var is_IE8 = false;var is_FF = false;var mac_ext = 0;var use_win_class = true; // true only if there is a matching link class with a 'b' appended to the namevar hover_class = "vertmenuactive"; // The link class for a rollover on the link cellvar menu_border_color = "#000000";var justification = "left";var margin_padding = 2;doc_url = document.URL;var visible_divs = new Array();var IDDAmenus = new Array();/* set menu values to the array as such:IDDAmenus[n] = [id_name, left_pos, top_pos, width, height, justification, border, bgcolor, position, visibility,vlgn, css_class, border-left, border-right, border-top, border-bot, link_border-bot, link_border-top,[link_name, link_text, pad_margin, ie6_pad_fill, sub_menu, sub_name, arrow_align],[...],[...]];*/var bgcoloralt = "#993399";IDDAmenus[0] = ["p1", 620, 180, 160, , "left", 1, "#fbb040", "absolute", "hidden","middle", "vertmenu", "#ffffff 1px solid", "#ffffff 1px solid", , , "#ffffff 1px solid", "#ffffff 1px solid",["/info/", "About CRC", , 16, "no sub", , , "p1_1"],["/contact/", "Contact CRC", , 12, "no sub", , , "p1_2"],["/info/#history", "History", , 24, "no sub", , , "p1_3"],["/info/donors.html", "Grantors & Donors", , 1, "no sub", , , "p1_4"],["/info/photos.html", "CRC Photos", , 12, "no sub", , , "p1_5"],["/info/need.html", "What We Need", , 8, "no sub", , , "p1_6"],["/info/newsletter.html", "Newsletter", , 16, "no sub", , , "p1_7"]];/*IDDAmenus[1] = ["p2", 540, 87, 60, , "left", 1, "#FFCC33", "absolute", "hidden","top", "vertmenu", , , ,["face_lift.html", "Facelift", , 1, "no sub", , , "p2_1"],["brow_lift.html", "Brow Lift", , 1, "no sub", , , "p2_2"]];*/function checkPlat() {	var this_doc = document.getElementById('pagebody'); // ##################	var offst_width = this_doc.offsetWidth; // ##################	var client_width = this_doc.clientWidth; // ##################	var scroll_width = this_doc.scrollWidth; // ##################	var win_reg = /Windows/;	var mac_reg = /Macintosh/;	var ff_reg = /Firefox/;	var ie6_reg = /MSIE 6/;	var ie8_reg = /MSIE 8/;	if(browser_info.search(win_reg) == -1) {		is_windows = false;		if(browser_info.search(mac_reg) > -1) {			mac_ext = 20;		}	} else if(browser_info.search(ie6_reg) > -1) {		is_IE6 = true;		out_mlscnds = 1000;	}	if(browser_info.search(ie8_reg) > -1) {		is_IE8 = true;	}	 if(browser_info.search(ff_reg) > -1) {		 is_FF = true;	 }}function adjustMenu() {	var id_name, this_menu, left_pos, div_id, left_px;	var this_doc = document.getElementById('pagebody');	var win_width = this_doc.offsetWidth;	var doc_width = page_width;//	doc_width = is_FF ? page_width - 4 : page_width;	if(is_FF) {win_width += 16;}	if(is_IE8) {win_width += 32;}	var left_shift = 0;	if(win_width > doc_width) {		var dbl_shift = (win_width - page_width);		var mod_dbl_shift = dbl_shift % 2;		if(mod_dbl_shift >= 0) {dbl_shift--;}		left_shift = dbl_shift/2;	} else {		if(is_FF) {left_shift = 8;}		else if(is_IE8) {left_shift = 16}	}	for(next_menu = 0; next_menu < IDDAmenus.length; next_menu++) {		this_menu = IDDAmenus[next_menu];		id_name = this_menu[0]; left_pos = this_menu[1];		div_id = document.getElementById(id_name);		left_pos += left_shift*1;		left_px = left_pos + "px";		div_id.style.left = left_px;	}}function loadMenus() {	var doc_width = page_width;//	doc_width = is_FF ? page_width - 4 : page_width;	var this_doc = document.getElementById('pagebody');	var win_width = this_doc.offsetWidth;	if(is_FF) {win_width += 16;}	if(is_IE8) {win_width += 32;}	var left_shift = 0;	if(win_width > doc_width) {		var dbl_shift = (win_width - page_width);		var mod_dbl_shift = dbl_shift % 2;		if(mod_dbl_shift >= 0) {dbl_shift--;}		left_shift = dbl_shift/2;	} else {		if(is_FF) {left_shift = 8;}		else if(is_IE8) {left_shift = 16}	}	var id_name, left_pos, top_pos, width, height, justification, border, position, visibility,	vlgn, css_class, bgcolor, link_name, link_text, pad_margin, pad_fill, sub_menu, sub_name,	arrow_align, img_id, border_left, border_right, border_top, border_bot, link_border_top, link_border_bot;	var layer_tag = "div";	var border_styles = "";	var link_border_styles = "";	var next_menu, next_link, pad_right, pad_left;	var margin_string = ""; fill_string = "";	var over_action;	var this_menu = new Array(); var this_link = new Array();	var this_nav4_menu; var this_layer_tag;	var close_this_layer; var nav4_menus = new Array();	for(next_menu = 0; next_menu < IDDAmenus.length; next_menu++) {		this_menu = IDDAmenus[next_menu];		id_name = this_menu[0]; left_pos = this_menu[1]; top_pos = this_menu[2]; width = this_menu[3];		height = this_menu[4]; border = this_menu[6]; bgcolor = this_menu[7];		position = this_menu[8]; visibility = this_menu[9];		width += mac_ext;		vlgn = this_menu[10];		vlgn = vlgn ? " vertical-align: " + vlgn + ";" : "";		css_class = this_menu[11];		if(use_win_class && is_windows) {css_class = css_class + "b";}		border_left = this_menu[12]; border_right = this_menu[13]; border_top = this_menu[14],  border_bot = this_menu[15];		link_border_top = this_menu[16]; link_border_bot = this_menu[17];		if (this_menu[5]) {justification = this_menu[5];}		height = height ? " height: " + height + ";" : "";		border_styles += border_left ? " border-left: " + border_left + ";" : "";		border_styles += border_right ? " border-right: " + border_right + ";" : "";		border_styles += border_top ? " border-top: " + border_top + ";" : "";		border_styles += border_bot ? " border-bottom: " + border_bot + ";" : "";		link_border_styles += link_border_top ? " border-top: " + link_border_top + ";" : "";		link_border_styles += link_border_bot ? " border-bottom: " + link_border_bot + ";" : "";		left_pos += left_shift*1;		this_layer_tag = "<div id='" + id_name + "' style='position:" + position + "; left:" + left_pos + "px; top:" + top_pos + "px; width:" + width + "px;" + height + border_styles +" z-index:9; visibility:" + visibility + "; " + vlgn + "' class='" + css_class + "' onmouseOver=\"over_menu = true; clearTimeout(exitTimer);\" onMouseOut=\"over_menu=false; timeExit(" + out_mlscnds + ");\">\n";		close_this_layer = "</div>\n";		document.write(this_layer_tag);		this_link = new Array();		for(next_link = 18; next_link < this_menu.length; next_link++) {			this_link = this_menu[next_link]; pad_margin = 0;			link_name = this_link[0]; link_text = this_link[1];			pad_fill = is_IE6 ? this_link[3] : 1;			sub_menu = this_link[4]; sub_name = this_link[5];			pad_margin = this_link[2] ? this_link[2] : margin_padding;			link_id = this_link[7];// hideSecondary() would go here if needed			over_action = " onmouseOver=\"this.style.backgroundColor='" + bgcoloralt + "'; this.className = '" + hover_class + "'; over_menu = true; clearTimeout(exitTimer);\"";			margin_string = ""; fill_string = "";			for(mgnstg = 1; mgnstg <= pad_margin; mgnstg++) {				margin_string += "&nbsp;";			}			for(flstg = 1; flstg <= pad_fill; flstg++) {				fill_string += "&nbsp;";			}			if(justification == "right") {				pad_left = fill_string;				pad_right = margin_string;			} else {				pad_right = fill_string;				pad_left = margin_string;			}// link_cell = "							<div class='" + css_class + "' style='background-color: " + bgcolor + "; cursor:pointer; border-bottom: " + bordercolor + " 1px solid; border-top: " + bordercolor + " 1px solid;'  onclick=\"location.href='" + link_name + "';\" id='" + link_id + "' " + over_action + " onMouseOut=\"this.style.backgroundColor='" + bgcolor + "'; this.className = '" + css_class + "'; over_menu=false; timeExit(" + out_mlscnds + ");\"><nobr><a href='" + link_name + "'>" + pad_left + link_text + pad_right + "</a></nobr></div>\n";link_cell = "							<div class='" + css_class + "' style='background-color: " + bgcolor + "; cursor:pointer; " + link_border_styles + "'  onclick=\"location.href='" + link_name + "';\" id='" + link_id + "' " + over_action + " onMouseOut=\"this.style.backgroundColor='" + bgcolor + "'; this.className = '" + css_class + "'; over_menu=false; timeExit(" + out_mlscnds + ");\"><nobr><a href='" + link_name + "'>" + pad_left + link_text + pad_right + "</a></nobr></div>\n";			document.write(link_cell);		}		document.write(close_this_layer);	}}var	current_left = 0;var	current_top = 0;var	current_primary = "";var	current_secondary = "";var over_menu = false;var exitTimer;function timeExit(mlscnds) {	clearTimeout(exitTimer);	exitTimer = setTimeout("closeMenus()", mlscnds);}function closeMenus() {	if(over_menu) {		clearTimeout(exitTimer);	} else {//		hideMenus("empty_layer");		hideMenus();		over_menu = false;		clearTimeout(exitTimer);	}}function primaryMenu(div_name) {	clearTimeout(exitTimer);over_menu = true;	var vis_length = visible_divs.length;	var old_primary, new_primary, old_secondary, old_obj, new_obj;	if(vis_length == 1) { // a primary menu is open		if(visible_divs[0] != div_name) {			// hide the previous primary menu			if(old_obj=getObject(visible_divs[0])) {				old_primary=(document.layers)?old_obj:old_obj.style;				 old_primary.visibility="hidden";			}			visible_divs = popOff(visible_divs);		} else {return;}	} else if(vis_length == 2) { // both a primary and a secondary menu are open		// hide the secondary menu		if(old_obj=getObject(visible_divs[1])) {			old_secondary=(document.layers)?old_obj:old_obj.style;			 old_secondary.visibility="hidden";		}		visible_divs = popOff(visible_divs);		if(visible_divs[0] != div_name) {			// hide the previous primary menu			if(old_obj=getObject(visible_divs[0])) {				old_primary=(document.layers)?old_obj:old_obj.style;				 old_primary.visibility="hidden";				visible_divs = popOff(visible_divs);			}		}	} else {} // either there are non or how did so many menus get opened?	if(visible_divs[0] != div_name) {		if(new_obj=getObject(div_name)) {			new_primary=(document.layers)?new_obj:new_obj.style;			 new_primary.visibility="visible";			 visible_divs[visible_divs.length] = div_name;		}	}}function secondaryMenu(div_name, arrow_name) {	var debug = '';	var vis_length = visible_divs.length;	var old_secondary, new_secondary, old_obj, new_obj;	if(vis_length == 1) { // the primary menu only is open		// just open the secondary menu	} else if(vis_length == 2) { // both the primary and a secondary menu are open		// hide the previous secondary menu		if(visible_divs[1] != div_name) {			if(old_obj=getObject(visible_divs[1])) {				old_secondary=(document.layers)?old_obj:old_obj.style;				 old_secondary.visibility="hidden";				 visible_divs = popOff(visible_divs);			}		} else {return true;}		// open the new secondary	} else {		} // either there are none or how did so many menus get opened?	if(new_obj=getObject(div_name)) {		if(document.layers) {			new_secondary = new_obj;		} else {			new_secondary = new_obj.style;		}//		new_secondary=(document.layers)?new_obj:new_obj.c;		if(isNav) {			current_left += new_secondary.left*1;			current_top += new_secondary.top*1;			current_secondary = div_name;		}		 new_secondary.visibility="visible";		 visible_divs[visible_divs.length] = div_name;	}return true;}//function hideMenus(div_name) {function hideMenus() {	var vis_length = visible_divs.length;	var old_menu, old_obj, next_div, next_arrow;	var this_div = "";	for(next_div = vis_length - 1; next_div >= 0 ; next_div -= 1) {		this_div = visible_divs[next_div];		if(old_obj=getObject(this_div)) {			if(document.layers) {				old_menu=old_obj;			} else {old_menu=old_obj.style;}			 old_menu.visibility="hidden";		}		if(visible_divs.length > 0) {visible_divs = popOff(visible_divs);}	}}function hideSecondary() {	var vis_length = visible_divs.length;	var old_secondary, old_obj, next_arrow, next_vis;	if(vis_length > 2) {		for(next_vis = vis_length - 1; next_vis > 1; next_vis -= 1) {			// hide the previous secondary menu			if(old_obj=getObject(visible_divs[next_vis])) {				old_secondary=(document.layers)?old_obj:old_obj.style;				 old_secondary.visibility="hidden";			}			visible_divs = popOff(visible_divs);		}	}	if(vis_length == 2) { // both the primary and a secondary menu are open		// hide the previous secondary menu		if(old_obj=getObject(visible_divs[1])) {			old_secondary=(document.layers)?old_obj:old_obj.style;			 old_secondary.visibility="hidden";			 visible_divs = popOff(visible_divs);		}	}}function getObject(n, d) {  var p,i,x;  if(!d) {d=document;}	if(isNav) {		x = d[n];	} else {		x = d.all[n];	}  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=getObject(n,d.layers[i].document);  }  if(!x && d.getElementById) {	  x=d.getElementById(n);  }  return x;}isNav = false;function set_nav() {  with (navigator) {	  if (appName == "Netscape") {		  isNav = true;  		document.page_width=innerWidth; document.page_height=innerHeight; //   		document.page_width=innerWidth; document.page_height=innerHeight; onresize=set_nav;		}	}}function popOff(in_array) {	var new_array = new Array();	var array_length = in_array.length;	for(next_el = 0; next_el < array_length-1; next_el++) {		new_array[next_el] = in_array[next_el];	}	in_array = new_array;	return new_array;}set_nav();