// tree_menu_setup.js// ------------------// C. Ryan Deardorff (ryandear@ucar.edu)// April, 2001var SITE_BASE = "/communications/gcip/",		IMAGES_BASE = SITE_BASE + "images/",		ENTRY_HEIGHT = 19,	// NS4 must be told just how tall each menu entry is (pixels)		NS_TOP_OFFSET = 5,  // If NS4 isn't aligning correctly with top image, adjust this		SWITCH_MENU_CALL = null,		THOROUGH_BULLET_DOCUMENT_CHECK = true,		NEW_WINDOW_ID = '',		BulStick = new Image(),		Bullet = new Image(),		BulEmpt = new Image(),		BulEmptSub = new Image(),		BulEmptSubUp = new Image(),		BulUp = new Image(),		BulDown = new Image(),		BulBot = new Image(),		BulBotSub = new Image(),		BulIndent = new Image(),		BulIndentLine = new Image(),		BulTreeTop = new Image(),		BulletStick = null,			BulletOverride = null,		TreeStateOverride = null;Bullet.src = IMAGES_BASE + "tree_bullet.gif";BulEmpt.src = IMAGES_BASE + "tree_bullet_empty.gif";BulEmptSub.src = IMAGES_BASE + "tree_bullet_empty_sub.gif";BulEmptSubUp.src = IMAGES_BASE + "tree_bullet_empty_sub_up.gif";BulUp.src = IMAGES_BASE + "tree_bullet_up.gif";BulDown.src = IMAGES_BASE + "tree_bullet_down.gif";BulStick.src = IMAGES_BASE + "tree_bullet_stick.gif";BulBot.src = IMAGES_BASE + "tree_bullet_empty_last.gif";BulBotSub.src = IMAGES_BASE + "tree_bullet_empty_last_sub.gif";BulIndent.src = IMAGES_BASE + "tree_bullet_indent.gif";BulIndentLine.src = IMAGES_BASE + "tree_bullet_indent_line.gif";BulTreeTop.src = IMAGES_BASE + "tree_top.gif";var IS_DHTML_BROWSER = true,		MENU_Y = 32,		CurrentDocument,		theAgent = navigator.userAgent.toLowerCase(),		isAOL = ( theAgent.indexOf( "aol" ) != -1 ) || ( theAgent.indexOf( "iweng" ) != -1 ),		isOpera = ( theAgent.indexOf( "opera" ) != -1 ),		isWebTV = ( theAgent.indexOf( "webtv" ) != -1 ),		IS_STANDARD = false,		IS_NS4 = false,		IS_IE4 = false,		ONE_AT_A_TIME = true,		BACK_IMG = null,		COLLAPSE_DELAY = 333,									   		indent = 0,		topmenu,		BULLET_IMG_WIDTH = 0,		BULLET_IMG_HEIGHT = 0,		IMG_SIZE = '';// NS4 specific vars:var indownt = 0,		didhide = false;if ( isWebTV )	IS_DHTML_BROWSER = false;if ( isOpera )	IS_STANDARD = true;	if ( ( navigator.appVersion.indexOf( "3." ) != 0 ) &&	  ( navigator.appVersion.indexOf( "2." ) != 0 ) &&	  ( navigator.appVersion.indexOf( "1." ) != 0 ) &&	  IS_DHTML_BROWSER ) {	if ( ( navigator.appName.indexOf( 'Netscape' ) == 0 ) && 	  	  ( navigator.appVersion.indexOf( "4." ) == 0 ) ) 		IS_NS4 = true;	// Include the broswer-specific code:	if ( navigator.userAgent.indexOf( "MSIE 4" ) == -1 ) {		if ( IS_NS4 == false ) {			if ( document.getElementsByTagName("*") )				IS_STANDARD = true;			else {				window.onerror = DoNothing;				IS_IE4 = true;			}		}		else {			document.writeln( "<meta http-equiv='pragma' content='no-cache'>" ); // N4 is sluggish when it uses its cache!		}	}	else { // IE4:		window.onerror = DoNothing;		IS_IE4 = true;	}}else {	IS_DHTML_BROWSER = false;}var IS_FOUR_BROWSER = IS_DHTML_BROWSER; if ( ( navigator.appName.indexOf( 'Netscape' ) == 0 ) && 		 ( parseInt( navigator.appVersion ) < 5 ) )  {	if ( !window.saveInnerWidth ) { // NS4 must reload on resize of window		window.onresize = resize;		window.saveInnerWidth = window.innerWidth;		window.saveInnerHeight = window.innerHeight;	}}function TreeEntries() {	this.link = new Array();	this.menu = new Array();	this.label = new Array();	this.bul = new Array();	this.vis = new Array();	this.target = new Array();	this.emptbullet = new Array();	this.blank = new Array();	// NS4:	this.height = new Array();}function TreeMenu( name ) {	this.name = name;	this.open = false;	this.entries = new TreeEntries();	this.level = 0;	this.parent = null;	this.islast = false;	this.blank = false;}// AddTreeEntry			function ATE( winmenu, link, label, menu, target, emptbullet ) {	if ( menu ) {		winmenu.entries.menu[ winmenu.entries.menu.length ] = menu;		menu.parent = winmenu;	}	else		winmenu.entries.menu[ winmenu.entries.menu.length ] = null;			winmenu.entries.link[ winmenu.entries.link.length ] = link;	winmenu.entries.label[ winmenu.entries.label.length ] = label;	winmenu.entries.bul[ winmenu.entries.bul.length ] = winmenu.name 		+ winmenu.entries.bul.length.toString();	winmenu.entries.target[ winmenu.entries.target.length ] = target;	if ( emptbullet )		winmenu.entries.emptbullet[ winmenu.entries.emptbullet.length ] = emptbullet;	else		winmenu.entries.emptbullet[ winmenu.entries.emptbullet.length ] = null;	winmenu.entries.blank[ winmenu.entries.blank.length ] = false;	winmenu.entries.height[ winmenu.entries.height.length ] = ENTRY_HEIGHT;}// BlankTreeEntryfunction BTE( winmenu, label, height ) {	ATE( winmenu, '', label );	winmenu.entries.blank[ winmenu.entries.blank.length-1 ] = true;	if ( height )		winmenu.entries.height[ winmenu.entries.height.length-1 ] = height;}function WriteMenuNoLayers( menu, indent )  {	var INDENT_HTML = "&nbsp;&nbsp;&nbsp;&nbsp;",			BOLD_TOP_S = "",			BOLD_TOP_E = "";	if ( !indent )  {			indent = 0;		BOLD_TOP_S = "<b>",		BOLD_TOP_E = "</b>";	}	document.writeln( "<nobr>" );		for ( var i = 0; i < menu.entries.link.length; i++ ) {		for ( var j = 0; j < indent; j++ )			document.writeln( INDENT_HTML );		document.writeln( BOLD_TOP_S );			if ( menu.entries.link[ i ] )				document.writeln( "<a href='" + SITE_BASE + menu.entries.link[ i ] + "'>" + menu.entries.label[ i ] + "</a><br>" );		else			document.writeln( menu.entries.label[ i ] + "<br>" );		document.writeln( BOLD_TOP_E );		if ( menu.entries.menu[ i ] )			WriteMenuNoLayers( menu.entries.menu[ i ], indent + 1 );	}	document.writeln( "</nobr>" );	}// GetMenuHeight returns the pixel height of the menu in it's current state--this would// ------------- be used if you need to move some other layer in relation to the menu.function GetMenuHeight( menu, from )  {	if ( !from )		from = 0;	for ( var i = 0; i < menu.entries.link.length; i++ ) {		from += menu.entries.height[ i ]; //ENTRY_HEIGHT;		if ( menu.entries.menu[ i ] && menu.entries.menu[ i ].open )			from = GetMenuHeight( menu.entries.menu[ i ], from );	}	return from;}function Display( m, old ) {	if ( BULLET_IMG_WIDTH )		IMG_SIZE = " width='" + BULLET_IMG_WIDTH + "'";	if ( BULLET_IMG_HEIGHT )		IMG_SIZE += " height='" + BULLET_IMG_HEIGHT + "'";				if ( old && !IS_DHTML_BROWSER )			WriteMenuNoLayers( m );	else {				if ( TreeStateOverride != null ) {			CloseNotStuckOpen( m, TreeStateOverride );		}		DetermineIsLast( m );		BulletStick = ( BulletOverride != null ) ? BulletOverride : GetBulletStick( m );		if ( BulletStick == '' )			BulletStick = null;		else if ( IS_IE4 )			BulletStick = "DIV" + BulletStick;		m.open = true;		SetIndents( m );		if ( !IS_NS4 ) {			document.writeln( "<div class='MenuPos' style='visibility: visible' id='MPos'>" );			document.writeln( "<div style='position: relative; margin: 0px; padding: 0px; left: 0px;'><img src='" + BulTreeTop.src + "' vspace=0 hspace=0 border=0></div>" );		}		else			document.writeln( "<div class='MenuPos' id='MenuTopImg'><img src='" + BulTreeTop.src + "'></div>" );		if ( IS_STANDARD )			WriteMenu( m, m );		else if ( IS_NS4 )			NSWriteMenu( m, m ); 		else if ( IS_IE4 )			IEWriteMenu( m, m );		if ( !IS_NS4 ) {			document.writeln( "</div>" );			if ( IS_STANDARD )				Hide( m );			else if ( IS_IE4 )				IEHide( m );		}		if ( IS_STANDARD )			Reposition( m );		else if ( IS_NS4 ) {			MENU_Y = eval( "document.MenuTopImg.top" ) + NS_TOP_OFFSET;			document.MenuTopImg.visibility = 'visible';			NSReposition( m );				}		else if ( IS_IE4 )			IEReposition( m );		if ( ( navigator.appName.indexOf( 'Netscape' ) == 0 ) && 				 ( document.location.href.indexOf( "#" ) > -1 ) ) {			document.onLoad = AnchorFix();		}	}}var SI = 0;function SetIndents( menu ) {	SI++;	for ( var i = 0; i < menu.entries.menu.length; i++ ) {		 		if ( menu.entries.menu[ i ] ) {			menu.entries.menu[ i ].level = SI;			SetIndents( menu.entries.menu[ i ] );		}	}	SI--;}function IndentImgs( m ) {	var ret = '';	if ( m.parent ) {		if ( m.islast )			ret = IndentImgs( m.parent ) + "<img" + IMG_SIZE + " align=absmiddle border=0 hspace=0 vspace=0 src='" + BulIndent.src + "'>";		else			ret = IndentImgs( m.parent ) + "<img" + IMG_SIZE + " align=absmiddle border=0 hspace=0 vspace=0 src='" + BulIndentLine.src + "'>";	}	return ret;}function DetermineIsLast( m ) {	for ( var i = 0; i < m.entries.menu.length; i++ )		if ( m.entries.menu[ i ] ) {			if ( i == ( m.entries.menu.length - 1 ) || ( m.entries.emptbullet[ i ] ) )				m.entries.menu[ i ].islast = true;			DetermineIsLast( m.entries.menu[ i ] );		}}// Any link targeted to 'nw' will use this function:var newWin;function LinkNewWindow( link ) {	var winProps = "width=" + SizeOfScreenPerc( 0.5, true, 300 )   	+ ",height=" + SizeOfScreenPerc( 0.75, false, 500 )   	+ ",menubar=1,status=1,toolbar=1,directories=1,location=1,resizable=1,scrollbars=1";	newWin = window.open( link, NEW_WINDOW_ID + "nw", winProps );	setTimeout( "newWin.focus();", 250 );}function SizeOfScreenPerc( perc, wide, def ) {	var ret = def;	if ( window.screen ) {		if ( wide )			ret = screen.width;		else if ( screen.availHeight )			ret = screen.availHeight;		else			ret = screen.height;		ret = Math.round( ret * perc );	}	return ret;}function emptyLink( i ) { }// ********************************// Functions external to the menus:var pfScript = "/cgi-bin/print_friendly.cgi"; // Location of "Print Friendly" filtering scriptfunction PrintFriendlyURL() { // Return the URL to the current page filtered through the script	var loc = document.location.href,			ind = loc.indexOf( "//" );		ind = loc.indexOf( "/", ind + 2 );	loc = loc.substring( ind, loc.length );	if ( loc.lastIndexOf( "/" ) == loc.length - 1 )		loc += "index.html";	return pfScript + loc;	}function PrintFriendlyLink( label, target ) { // Return a string that is a link to filtered current page	if ( document.location.href.indexOf( pfScript ) > -1 )		return '';	if ( ( navigator.userAgent.indexOf( "MSIE" ) > -1 ) || IS_NS4 )	{			var targCode = '';			if ( !label )			label = "Print Friendly Version";		if ( target )			targCode = ' target="' + target + '"';		return '<a href="' + PrintFriendlyURL() + '"' + targCode + '>' + label + '</a>';			}	return '';}function WritePrintFriendly( label, target ) { // Write a "Print Friendly" link within "content" layer	if ( IS_NS4 )		document.cont.document.writeln( PrintFriendlyLink( label, target ) );	else		document.writeln( PrintFriendlyLink( label, target ) );}// ******************************// Bullet stick/Tree state code:var StuckOpen = '';function GetBulletStick( m ) {	var ret,			checkAgainst,			ind;				if ( !CurrentDocument ) {		var loc;		if ( top )			loc = top.location.href;		else			loc = document.location.href; 	   CurrentDocument = loc.substring( loc.indexOf( "/", 8 ) + SITE_BASE.length, loc.length );	}	ret = BulletDocumentCheck( m, CurrentDocument, true );	if ( !ret && THOROUGH_BULLET_DOCUMENT_CHECK )  {		checkAgainst = CurrentDocument;			ind = checkAgainst.lastIndexOf( "/" );		while ( !ret && ( ind > 0 ) )  {				checkAgainst = checkAgainst.substring( 0, ind + 1 );			ret = BulletDocumentCheck( m, checkAgainst );			checkAgainst = checkAgainst.substring( 0, checkAgainst.length - 1 );			ind = checkAgainst.lastIndexOf( "/" );				}	}	if ( ret && ONE_AT_A_TIME ) {		CloseNotStuckOpen( m, StuckOpen );	}	return ret;} function BulletDocumentCheck( m, against, exact ) {	var i = 0,		 ret = null;	while ( ( i < m.entries.link.length ) && ( ret == null ) ) {		if ( ( !exact && ( m.entries.link[ i ].indexOf( against ) == 0 ) ) ||			( m.entries.link[ i ] == against ) ) {			ret = m.name + i.toString();			m.open = true;			StuckOpen += '|' + m.name + '=1';			if ( m.entries.menu[ i ] )				StuckOpen += '|' + m.entries.menu[ i ].name + '=1';		}		else if ( m.entries.menu[ i ] ) {			ret = BulletDocumentCheck( m.entries.menu[ i ], against, exact );			if ( ret ) {				m.open = true;				StuckOpen += '|' + m.name + '=1';			}		}		i++;	}	return ret;}function CloseNotStuckOpen( m, state ) {	if ( state.indexOf( '|' + m.name + '=1' ) == -1 )		m.open = false;	else		m.open = true;	for ( var i = 0; i < m.entries.menu.length; i++ )		if ( m.entries.menu[ i ] )			CloseNotStuckOpen( m.entries.menu[ i ], state );}// ******************************// Browser-specific patches:// For IE4:function DoNothing() { return true; }// For NS4:function resize() {	if ( ( saveInnerWidth < window.innerWidth ) ||         ( saveInnerWidth > window.innerWidth ) ||         ( saveInnerHeight > window.innerHeight ) ||         ( saveInnerHeight < window.innerHeight ) ) {		window.history.go( 0 );   }}// For NS:var machineSpeedCount = true,	 machineSpeed = 6500;setTimeout( "machineSpeedCount = false", 100 );MachineInc();function MachineInc() {	if ( machineSpeedCount ) {		for ( var i = 0; i < 10; i++ )			machineSpeed -= 100;		setTimeout( "MachineInc()", 0 );	}}function AnchorFixOld() {	if ( machineSpeedCount )		setTimeout( "AnchorFix()", 1 );	else {		if ( machineSpeed < 10 )			machineSpeed = 10;		setTimeout( "document.location.href = '" + document.location.href + "'", machineSpeed );	}}function AnchorFix()  {	setTimeout( "document.location.href = '" + document.location.href + "'", 500 );}// ******************************// Standards compliant functions:function SwitchMenu( menutop, menu, thenLink ) {	var didhide = false,			timeo = 1;	if ( thenLink && ( thenLink != CurrentDocument ) ) {			setTimeout( "window.open( '" + SITE_BASE + thenLink + "', '_top' )", 0 );  // timeo + 100	}	else {			if ( !thenLink || ( thenLink == CurrentDocument ) || !menu.open )			menu.open = !menu.open;		if ( !menu.open )			Hide( menu );		else if ( ONE_AT_A_TIME && menu.parent ) {			for ( var i = 0; i < menu.parent.entries.link.length; i++ )				if ( menu.parent.entries.menu[ i ] && menu.parent.entries.menu[ i ].open 					 && ( menu.parent.entries.menu[ i ] != menu ) ) {					menu.parent.entries.menu[ i ].open = false;					Hide( menu.parent.entries.menu[ i ] );					didhide = true;			}		}		if ( didhide ) 			timeo = COLLAPSE_DELAY;		if ( SWITCH_MENU_CALL != null )			setTimeout( 'eval( SWITCH_MENU_CALL )', timeo );				setTimeout( "Reposition( " + menu.parent.name + " )", timeo );	}}function Hide( menu ) {	SetLayerVis( menu.name, "none" );	for ( var i = 0; i < menu.entries.link.length; i++ ) {		if ( menu.entries.menu[ i ] )			Hide( menu.entries.menu[ i ] );	}}function Reposition( menu, dontCall ) {	SetLayerVis( menu.name, '' );	 	for ( var i = 0; i < menu.entries.link.length; i++ ) {		if ( ( menu.entries.menu[ i ] ) && ( menu.entries.menu[ i ].open ) )			Reposition( menu.entries.menu[ i ], true );	}		} function SetLayerVis( lay, vis ) {									eval( "document.getElementById( '" + lay + "' ).style.display = '" + vis + "';" );}function BulletOver( lay, ismen ) {	if ( ismen ) {		if ( ismen.open )			document.images[ 'Bul' + lay ].src = BulUp.src;		else			document.images[ 'Bul' + lay ].src = BulDown.src;	}	else		document.images[ 'Bul' + lay ].src = Bullet.src;}function BulletOut( menu, lay, stickBullet ) {	if ( stickBullet ) {		if ( BulletStick != null )			setTimeout( "document.images[ 'Bul' + '" + BulletStick + "' ].src = '" + eval( "emptBul" + menu.name + BulletStick ) + "';", 1 );//			document.images[ 'Bul' + BulletStick ].src = eval( "emptBul" + menu.name + BulletStick );		BulletStick = lay;	}	if ( BulletStick != lay ) {			setTimeout( "document.images[ 'Bul' + '" + lay + "' ].src = '" + eval( 'emptBul' + menu.name + lay ) + "';", 1 );//		document.images[ 'Bul' + lay ].src = eval( "emptBul" + menu.name + lay );	}	else {			if ( document.images[ 'Bul' + lay ].src != BulStick.src ) {					setTimeout( "document.images[ 'Bul' + '" + lay + "' ].src = BulStick.src;", 1 );//			document.images[ 'Bul' + lay ].src = BulStick.src;				}	}}function doNothing() { }function WriteMenu( menu, menutop, levPrefix ) {	var thelink,			thehref;	indent++;		if ( !levPrefix ) 		levPrefix = "0_";	document.writeln( "<div id='" + menu.name + "'>" );		for ( var i = 0; i < menu.entries.link.length; i++ ) {		var indspc = '', 				oncl = '', onb = '', onbe = '',				tclass = '', bulimy = '', hreftarg = '', bulSrc,				bulletTxt = '', stickBullet = ', false', bulLast = '', 				mouseOut = "BulletOut( " + menutop.name + ", " + '"' + menu.entries.bul[ i ] + '"' + " )";		if ( menu.entries.emptbullet[ i ] )			document.writeln( "<script language='javascript'>var emptBul" + menutop.name + menu.name + i.toString() + " = '" + menu.entries.emptbullet[ i ] + "';</" + "script>" );		else if ( menu.entries.bul.length == ( i + 1 ) ) {			if ( menu.entries.menu[ i ] != null )				document.writeln( "<script language='javascript'>var emptBul" + menutop.name + menu.name + i.toString() + " = '" + BulBotSub.src + "';</" + "script>" );			else				document.writeln( "<script language='javascript'>var emptBul" + menutop.name + menu.name + i.toString() + " = '" + BulBot.src + "';</" + "script>" );		}		else if ( menu.entries.menu[ i ] != null )			document.writeln( "<script language='javascript'>var emptBul" + menutop.name + menu.name + i.toString() + " = '" + BulEmptSub.src + "';</" + "script>" );		else			document.writeln( "<script language='javascript'>var emptBul" + menutop.name + menu.name + i.toString() + " = '" + BulEmpt.src + "';</" + "script>" );			if ( menu.entries.link[ i ] ) {			if ( menu.entries.link[ i ].indexOf( ":" ) == -1 ) {							thelink = SITE_BASE + menu.entries.link[ i ];				if ( menu.entries.target[ i ] != 'nw' )					stickBullet = ", true";			}			else							thelink = menu.entries.link[ i ];		}		else			thelink = 'javascript:emptyLink( "' + levPrefix + i + '" )';							oncl = "BulletOut( " + menutop.name + ", " + '"' + menu.entries.bul[ i ] + '"' + stickBullet + " ); ";		if ( menu.entries.menu[ i ] ) {			var thenLink = '';			if ( menu.entries.link[ i ] && ( menu.entries.target[ i ] == null ) ) {				thenLink = ', "' + menu.entries.link[ i ] + '"';				thelink = 'javascript:emptyLink( "' + levPrefix + i + '" )';					}					oncl += " SwitchMenu( " + menutop.name + ", " + menu.entries.menu[ i ].name + thenLink + " );";			bulimy = ", " + menu.entries.menu[ i ].name;		}		if ( menu.level == 0 ) {			onb = "<span class='MenuTopText' align='absmiddle'>"; 			onbe = "</span>";		}		else {			onb = "<span class='MenuText' align='absmiddle'>"; 			onbe = "</span>";		}		if ( menu.entries.target[ i ] != null ) {			if ( menu.entries.target[ i ] == 'nw' ) {				thelink = 'javascript:emptyLink( "' + levPrefix + i + '" )';					if ( menu.entries.link[ i ].indexOf( ":" ) > -1 )					oncl += ' LinkNewWindow( "' + menu.entries.link[ i ] + '" );';				else					oncl += ' LinkNewWindow( "' + SITE_BASE + menu.entries.link[ i ] + '" );';			}				else				hreftarg = " target='" + menu.entries.target[ i ] + "'";		}		var statusCodeOver = '';		if ( menu.entries.link[ i ].indexOf( '"' ) == -1 )			statusCodeOver =  "window.status = " + '"' + menu.entries.link[ i ] + '"' + "; return true;";		var statusCodeOut =  "window.status = " + '""' + "; return true;";		bulletTxt = " onMouseOver='BulletOver( "				+ '"' + menu.entries.bul[ i ] + '"' + bulimy + " );" + statusCodeOver + "'"				+ " onMouseOut='" + mouseOut + ";" + statusCodeOut + "'";		thehref = "<a href='" + thelink + "' onClick='" 			+ oncl + "'" + bulletTxt + hreftarg + " style='text-decoration: none; padding-top: 0px; margin-top: 0px; padding-bottom: 0px; margin-bottom: 0px;'>";		if ( ( indent == 1 ) && ( BACK_IMG != null ) )			document.writeln( "<div class='Back'>" + thehref + "<img border=0 src='" + BACK_IMG + "'>"				+ thehref + "</div>" );		if ( menu.entries.bul[ i ] == BulletStick )			bulSrc = BulStick.src;		else if ( menu.entries.emptbullet[ i ] )			bulSrc = menu.entries.emptbullet[ i ];		else if ( menu.entries.bul.length == ( i + 1 ) ) {			if ( menu.entries.menu[ i ] != null )				bulSrc = BulBotSub.src;						else				bulSrc = BulBot.src;		}		else if ( menu.entries.menu[ i ] != null )			bulSrc = BulEmptSub.src;				else			bulSrc = BulEmpt.src;		if ( menu.entries.blank[ i ] )			document.writeln( "<div class='MenuEntry'>" + menu.entries.label[ i ] + "</div>" );		else			document.writeln( "<div class='MenuEntry'>"  				+ IndentImgs( menu ) + "<img" + IMG_SIZE + " vspace=0 hspace=0 align=absmiddle border=0 src='" + bulSrc 				+ "' name='Bul" + menu.entries.bul[ i ] 				+ "'>" + thehref + onb				+ menu.entries.label[ i ] + onbe + "</a></div>" );		if ( menu.entries.menu[ i ] )			WriteMenu( menu.entries.menu[ i ], menutop, levPrefix + i + "_" );	}	document.writeln( "</div>" );	indent--;}function dbTest( a ) { alert( a ); document.writeln( a ); }// ******************************// Netscape 4 functions:function NSSwitchMenu( menu, thenLink ) {	var hideother = false;	if ( !thenLink || ( thenLink == CurrentDocument ) || !menu.open ) {		if ( !menu.open && ONE_AT_A_TIME && menu.parent ) {			for ( var i = 0; i < menu.parent.entries.link.length; i++ )				if ( menu.parent.entries.menu[ i ] && menu.parent.entries.menu[ i ].open 					 && ( menu.parent.entries.menu[ i ] != menu ) ) {					menu.parent.entries.menu[ i ].open = false;					NSHide( menu.parent.entries.menu[ i ] );					hideother = true;			}			if ( hideother ) {				indownt = 0;				NSReposition( topmenu, topmenu );					didhide = true;			}		}		menu.open = !menu.open;		if ( !menu.open )			NSHide( menu );	}	if ( thenLink && ( thenLink != CurrentDocument ) )		setTimeout( "window.open( '" + SITE_BASE + thenLink + "', '_self' )", COLLAPSE_DELAY + 100 );	if ( SWITCH_MENU_CALL != null )		setTimeout( 'eval( "' + SWITCH_MENU_CALL + '" )', COLLAPSE_DELAY + 5 );}function NSHide( menu ) {	for ( var i = 0; i < menu.entries.link.length; i++ ) {		NSSetLayerVis( menu.entries.bul[ i ], 'hidden' );		if ( menu.entries.menu[ i ] )			 NSHide( menu.entries.menu[ i ] );	}}function NSReposition( menu ) {	if ( didhide ) {		didhide = false;		setTimeout( "NSReposition( " + menu.name + " )", COLLAPSE_DELAY );	}	else {		for ( var i = 0; i < menu.entries.link.length; i++ ) {			//indownt += menu.entries.height[ i ]; //ENTRY_HEIGHT;			SetLayerPos( menu.entries.bul[ i ], menu.xpos, indownt + MENU_Y );			NSSetLayerVis( menu.entries.bul[ i ], 'visible' );  			if ( ( BACK_IMG != null ) && ( menu.level == 0 ) ) {				SetLayerPos( "B" + menu.entries.bul[ i ], menu.xpos, indownt + MENU_Y );				NSSetLayerVis( "B" + menu.entries.bul[ i ], 'visible' );			}			indownt += menu.entries.height[ i ]; //ENTRY_HEIGHT;			if ( menu.entries.menu[ i ] ) {						if ( menu.entries.menu[ i ].open )					NSReposition( menu.entries.menu[ i ] );			}		}			}} function NSSetLayerVis( lay, vis ) {		eval( "document." + lay + ".visibility = '" + vis + "';" );}function SetLayerPos( lay, x, y ) {	eval( "document." + lay + ".top = " + y + ";" );}function NSBulletOver( lay, ismen ) {	if ( ismen ) {		if ( ismen.open )			eval( "document." + lay + ".document.images[ 'BUL' ].src = BulUp.src;" );		else			eval( "document." + lay + ".document.images[ 'BUL' ].src = BulDown.src;" );	}   	else		eval( "document." + lay + ".document.images[ 'BUL' ].src = Bullet.src;" );}function NSBulletOut( menu, lay, stickBullet ) {	if ( stickBullet ) {		if ( BulletStick != null )			eval( "document." + BulletStick + ".document.images[ 'BUL' ].src = '" 					+ eval( "emptBul" + menu.name + BulletStick ) + "'" );		BulletStick = lay;	}	if ( BulletStick != lay )		eval( "document." + lay + ".document.images[ 'BUL' ].src = '" 				+ eval( "emptBul" + menu.name + lay ) + "'" );	else		eval( "document." + lay + ".document.images[ 'BUL' ].src = BulStick.src;" );}function NSWriteMenu( menu, menutop ) {	var thelink;	indent++;	topmenu = menutop;	for ( var i = 0; i < menu.entries.link.length; i++ ) {		var	indspc = '', 				oncl = '',				onb = '',				onbe = '',            tclass = '', bulimy = '', bulSrc = '',            bimg, hreftarg = '',				bulletTxt = '', stickBullet = ', false',				mouseOut = "NSBulletOut( " + menutop.name + ", " + '"' + menu.entries.bul[ i ] + '"' + " )";		if ( menu.entries.emptbullet[ i ] )			setTimeout( "var emptBul" + menutop.name + menu.name + i.toString() + " = '" + menu.entries.emptbullet[ i ] + "'", 0 );		else if ( menu.entries.bul.length == ( i + 1 ) ) {			if ( menu.entries.menu[ i ] != null )				setTimeout( "var emptBul" + menutop.name + menu.name + i.toString() + " = '" + BulBotSub.src + "'", 0 );			else				setTimeout( "var emptBul" + menutop.name + menu.name + i.toString() + " = '" + BulBot.src + "'", 0 );		}		else if ( menu.entries.menu[ i ] != null )			setTimeout( "var emptBul" + menutop.name + menu.name + i.toString() + " = '" + BulEmptSub.src + "'", 0 );		else			setTimeout( "var emptBul" + menutop.name + menu.name + i.toString() + " = '" + BulEmpt.src + "'", 0 );			if ( menu.entries.link[ i ] ) {			if ( menu.entries.link[ i ].indexOf( ":" ) == -1 )  {							thelink = SITE_BASE + menu.entries.link[ i ];				if ( menu.entries.target[ i ] != 'nw' )					stickBullet = ", true";							}			else 				thelink = menu.entries.link[ i ];		}		else			thelink = 'javascript:;';		 		oncl = "NSBulletOut( " + menutop.name + ", " + '"' + menu.entries.bul[ i ] + '"' + stickBullet + " ); ";			if ( menu.entries.menu[ i ] ) {			var thenLink = '';			if ( menu.entries.link[ i ] && ( menu.entries.target[ i ] == null ) ) {				thenLink = ', "' + menu.entries.link[ i ] + '"';				thelink = 'javascript:;';			}						oncl += " NSSwitchMenu( " + menu.entries.menu[ i ].name + thenLink + " ); "				+ "indownt = 0; NSReposition( " + menutop.name + " );";			bulimy = ", " + menu.entries.menu[ i ].name;		}		if ( menu.level == 0 ) {			onb += "<span class='MenuTopText'>"; 			onbe += "</span>";		}		else  {					onb += "<span class='MenuText'>"; 			onbe += "</span>";				}		if ( menu.entries.target[ i ] != null ) {			if ( menu.entries.target[ i ] == 'nw' ) {				thelink = "javascript:;";				if ( menu.entries.link[ i ].indexOf( ":" ) > -1 )					oncl += ' LinkNewWindow( "' + menu.entries.link[ i ] + '" );';				else					oncl += ' LinkNewWindow( "' + SITE_BASE + menu.entries.link[ i ] + '" );';			}			else				hreftarg = " target='" + menu.entries.target[ i ] + "'";		}		bulletTxt = " onMouseOver='NSBulletOver( "					+ '"' + menu.entries.bul[ i ] + '"' + bulimy + " )'"					+ " onMouseOut='" + mouseOut + "'";		if ( menu.level == 0 ) {			if ( BACK_IMG != null ) {				document.writeln( "<div class='Back' id='B" + menu.entries.bul[ i ]					+ "'><div class='NSOffset'><a href='" + thelink + "' onClick='" 					+ oncl + "'" + bulletTxt + hreftarg + ">"					+ "<img src='" + BACK_IMG + "' border=0 hspace=0></a></div></div>" );			}			tclass = "";		}		else tclass = "class='MenuPos' ";		if ( menu.entries.bul[ i ] == BulletStick )			bulSrc = BulStick.src;		else if ( menu.entries.emptbullet[ i ] )			bulSrc = menu.entries.emptbullet[ i ];		else if ( menu.entries.bul.length == ( i + 1 ) ) {			if ( menu.entries.menu[ i ] != null )				bulSrc = BulBotSub.src;						else				bulSrc = BulBot.src;		}		else if ( menu.entries.menu[ i ] != null )			bulSrc = BulEmptSub.src;				else			bulSrc = BulEmpt.src;		if ( menu.entries.blank[ i ] ) {			document.writeln( "<div class='MenuPos' id='" + menu.entries.bul[ i ] + "'>" );					document.writeln( menu.entries.label[ i ] + "</div>" );		}		else {					document.writeln( "<div class='MenuPos' id='" + menu.entries.bul[ i ] + "'>"				+ "<a href='" + thelink + "' onClick='" + oncl + "'" + bulletTxt + hreftarg + ">"				+ IndentImgs( menu ) + "<img vspace=0 hspace=0 border=0 align=absmiddle src='" + bulSrc + "' name='BUL'>"				+ onb + "<span class='NSOffset' id='NSO'>" + menu.entries.label[ i ] + "</span>" + onbe				+ "</a></div>" );		}		document.writeln();				if ( menu.entries.menu[ i ] )			NSWriteMenu( menu.entries.menu[ i ], menutop );	}	indent--;}// ******************************// Internet Explorer functions:function IESwitchMenu( menu, thenLink ) {	var didhide = false,			timeo = 1;	if ( !thenLink || ( thenLink == CurrentDocument ) || !menu.open )		menu.open = !menu.open;	if ( !menu.open )		IEHide( menu );	else if ( ONE_AT_A_TIME && menu.parent ) {		for ( var i = 0; i < menu.parent.entries.link.length; i++ )			if ( menu.parent.entries.menu[ i ] && menu.parent.entries.menu[ i ].open 				 && ( menu.parent.entries.menu[ i ] != menu ) ) {				menu.parent.entries.menu[ i ].open = false;				IEHide( menu.parent.entries.menu[ i ] );				didhide = true;		}	}	if ( didhide ) 		timeo = COLLAPSE_DELAY;	setTimeout( "IEReposition( " + menu.parent.name + " )", timeo );	if ( thenLink && ( thenLink != CurrentDocument ) )		setTimeout( "window.open( '" + SITE_BASE + thenLink + "', '_self' )", timeo + 100 );	if ( SWITCH_MENU_CALL != null )		setTimeout( 'eval( "' + SWITCH_MENU_CALL + '" )', timeo );}function IEHide( menu ) {	IESetLayerVis( "DIV" + menu.name, "none" );	for ( var i = 0; i < menu.entries.link.length; i++ ) {		if ( menu.entries.menu[ i ] )			IEHide( menu.entries.menu[ i ] );	}}function IEReposition( menu ) {	IESetLayerVis( "DIV" + menu.name, '' );	 	for ( var i = 0; i < menu.entries.link.length; i++ ) {		if ( ( menu.entries.menu[ i ] ) && ( menu.entries.menu[ i ].open ) )			IEReposition( menu.entries.menu[ i ] );	}		}function IESetLayerVis( lay, vis ) {									eval( "document.all." + lay + ".style.display = '" + vis + "';" );} function IEBulletOver( lay, ismen ) {	if ( ismen ) {		if ( ismen.open )			eval( "document.images[ 'Bul" + lay + "' ].src = BulUp.src;" );		else			eval( "document.images[ 'Bul" + lay + "' ].src = BulDown.src;" );	}	else		eval( "document.images[ 'Bul" + lay + "' ].src = Bullet.src;" );}function IEBulletOut( menu, lay, stickBullet ) {	if ( stickBullet ) {		if ( BulletStick != null )			eval( "document.images[ 'Bul' + BulletStick ].src = '" + eval( 'emptBul' + menu.name + BulletStick ) + "'" );		BulletStick = lay;	}	if ( BulletStick != lay )		eval( "document.images[ 'Bul" + lay + "' ].src = '" + eval( 'emptBul' + menu.name + lay ) + "'" );	else		eval( "document.images[ 'Bul" + lay + "' ].src = BulStick.src;" );}function IEWriteMenu( menu, menutop ) {	var thelink,			thehref;	indent++;				document.writeln( "<div id='DIV" + menu.name + "'>" );		for ( var i = 0; i < menu.entries.link.length; i++ ) {		var indspc = '', 				oncl = '', onb = '', onbe = '',				tclass = '', bulimy = '', hreftarg = '', bulSrc,				bulletTxt = '', stickBullet = ', false', bulLast = '', 				mouseOut = "IEBulletOut( " + menutop.name + ", " + '"DIV' + menu.entries.bul[ i ] + '"' + " )";		if ( menu.entries.emptbullet[ i ] )			document.writeln( "<script language='javascript'>var emptBul" + menutop.name + "DIV" + menu.name + i.toString() + " = '" + menu.entries.emptbullet[ i ] + "';</" + "script>" );		else if ( menu.entries.bul.length == ( i + 1 ) ) {			if ( menu.entries.menu[ i ] != null )				document.writeln( "<script language='javascript'>var emptBul" + menutop.name + "DIV" + menu.name + i.toString() + " = '" + BulBotSub.src + "';</" + "script>" );			else				document.writeln( "<script language='javascript'>var emptBul" + menutop.name + "DIV" + menu.name + i.toString() + " = '" + BulBot.src + "';</" + "script>" );		}		else if ( menu.entries.menu[ i ] != null )			document.writeln( "<script language='javascript'>var emptBul" + menutop.name + "DIV" + menu.name + i.toString() + " = '" + BulEmptSub.src + "';</" + "script>" );		else			document.writeln( "<script language='javascript'>var emptBul" + menutop.name + "DIV" + menu.name + i.toString() + " = '" + BulEmpt.src + "';</" + "script>" );		if ( menu.entries.link[ i ] ) {			if ( menu.entries.link[ i ].indexOf( ":" ) == -1 ) {							thelink = SITE_BASE + menu.entries.link[ i ];				if ( menu.entries.target[ i ] != 'nw' )					stickBullet = ", true";							}			else 				thelink = menu.entries.link[ i ];		}		else			thelink = 'javascript:;';				oncl = "IEBulletOut( " + menutop.name + ', "DIV' + menu.entries.bul[ i ] + '"' + stickBullet + " ); ";		if ( menu.entries.menu[ i ] ) {					var thenLink = '';			if ( menu.entries.link[ i ] && ( menu.entries.target[ i ] == null ) ) {				thenLink = ', "' + menu.entries.link[ i ] + '"';				thelink = 'javascript:;';			}			oncl += " IESwitchMenu( " + menu.entries.menu[ i ].name + thenLink + " );"; 			bulimy = ", " + menu.entries.menu[ i ].name;		}		if ( menu.level == 0 ) {			onb = "<span class='MenuTopText' align='absmiddle'>"; 			onbe = "</span>";		}		else {			onb = "<span class='MenuText' align='absmiddle'>"; 			onbe = "</span>";		}		if ( menu.entries.target[ i ] != null ) {			if ( menu.entries.target[ i ] == 'nw' ) {				thelink = "javascript:;";				if ( menu.entries.link[ i ].indexOf( ":" ) > -1 )					oncl += ' LinkNewWindow( "' + menu.entries.link[ i ] + '" );';				else					oncl += ' LinkNewWindow( "' + SITE_BASE + menu.entries.link[ i ] + '" );';			}				else				hreftarg = " target='" + menu.entries.target[ i ] + "'";		}		bulletTxt = " onMouseOver='IEBulletOver( "				+ '"DIV' + menu.entries.bul[ i ] + '"' + bulimy + " )'"				+ " onMouseOut='" + mouseOut + "'";		thehref = "<a href='" + thelink + "' onClick='" 			+ oncl + "'" + bulletTxt + hreftarg + ">";		if ( ( indent == 1 ) && ( BACK_IMG != null ) )		 document.writeln( "<div class='Back'>" + thehref + "<img border=0 src='" + BACK_IMG + "'>"				+ thehref + "</div>" );		if ( "DIV" + menu.entries.bul[ i ] == BulletStick )			bulSrc = BulStick.src;		else if ( menu.entries.emptbullet[ i ] )			bulSrc = menu.entries.emptbullet[ i ];		else if ( menu.entries.bul.length == ( i + 1 ) ) {			if ( menu.entries.menu[ i ] != null )				bulSrc = BulBotSub.src;						else				bulSrc = BulBot.src;				}		else if ( menu.entries.menu[ i ] != null )			bulSrc = BulEmptSub.src;				else			bulSrc = BulEmpt.src;		if ( menu.entries.blank[ i ] )			document.writeln( "<div class='MenuEntry'>" + menu.entries.label[ i ] + "</div>" );		else					document.writeln( "<div class='MenuEntry'>" 			+ IndentImgs( menu ) + "<img align=absmiddle vspace=0 hspace=0 border=0 src='" + bulSrc + "' name='BulDIV" + menu.entries.bul[ i ] 			+ "'>" + thehref + onb + menu.entries.label[ i ] + onbe + "</a></div>" );		if ( menu.entries.menu[ i ] )			IEWriteMenu( menu.entries.menu[ i ], menutop );	}	document.writeln( "</div>" );	indent--;}