// dyna.js v1.2.1 by David Kearns
// copyright 2000,2001,2003 by Doceus, Inc.
//
// These routines should provide a framework for
// commonly used DHTML functions, in a way that should
// divorce the browser from the code, so that the 
// developer need not worry about what platform the
// user is using.
//

// For purposes of the Intranet, we will attempt to guess
// what browser is being used.
//
// There are obvious problems with this scheme, as browsers
// are constantly changing, but I feel that in this case
// this should be sufficient
//
var NN = (document.layers) ? 1 : 0;
var IE = (document.all) ? 1 : 0;
var D2 = (document.getElementById ) ? 1 : 0;

var dynaJsDebug = 0;

if (dynaJsDebug) window.status = 'Start debug info...';

// Capture events for cursor tracking. Setup global variables
var cursorX = 0;
var cursorY = 0;
document.onmousemove = mouseTrack;
if (NN) {
	document.captureEvents(Event.MOUSEMOVE);
}

// Debug info. Uncomment if you wish to use it.
// window.defaultStatus = 'NN:'+NN+' IE:'+IE+' D2:'+D2;

// Return a pointer to the object specified by the ID "reference".
// In netscape 4 this must be a layer.
// The Object reference returned by this is suitable for passing
// to any function below that has an obj attribute.
//
// In order to assure this, you can use CF_DHTMLContainer
function dyObject(reference) {
	if (D2) {
		return document.getElementById(reference);
	} else if (IE) {
		return document.all[reference];
	} else if (NN) {
		return document.layers[reference];
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

////////////////////////////////////////////////////////////////////////////////////////////

// Provide a method for error reporting, in the odd case that a user
// is not using one of the approved browsers
// NN 4.x, IE 4.x or higher, NN 6.x
function err(msg) {
	alert(msg);
	exit;
}

// Cursor move triggers event to set global variables
function mouseTrack(e) {
	if (NN) {
		cursorX=e.pageX;
		cursorY=e.pageY;
	} else if (D2 && IE) {
		cursorX=event.x+document.body.scrollLeft; 
		cursorY=event.y+document.body.scrollTop;
	} else if (IE)  {
		cursorX=event.x; 
		cursorY=event.y;
	} else if (D2) {
		cursorX=e.clientX + parseInt(window.scrollX);
		cursorY=e.clientY + parseInt(window.scrollY);
	}
	// debug info
	// window.status = cursorX + ' ' + cursorY;
}

// Return the y coordinate of the object
function dyTop(obj) {
	if (IE) {
		return(parseInt(obj.style.pixelTop));
	} else if (D2) {
		return(parseInt(obj.style.top));
	} else if (NN) {
		return(obj.top);
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

// Return the x coordinate of the object
function dyLeft(obj) {
	if (IE) {
		return(parseInt(obj.style.pixelLeft));
	} else if (D2) {
		return (parseInt(obj.style.left));
	} else if (NN) {
		return(obj.left);
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

// Return the height of the object in pixels
function dyHeight(obj) {
	if (IE) {
		return(parseInt(obj.clientHeight));
	} else if (D2) {
		return (parseInt(obj.style.height));
	} else if (NN) {
		return obj.clip.height;
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

// Return the width of the object in pixels
function dyWidth(obj) {
	if (IE) {
		return(parseInt(obj.clientWidth));
	} else if (D2) {
		return(parseInt(obj.style.width));
	} else if (NN) {
		return(obj.clip.width);
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

// Moves the object to the specified X Y coordinates
function dyMoveTo(obj,x,y) {
	if (D2) {
		obj.style.left = x;
		obj.style.top = y;
	} else if (IE) {
		obj.style.pixelLeft = x;
		obj.style.pixelTop = y;
	} else if (NN) {
		obj.moveTo(x,y);
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

// Moves the object by x,y pixels. Use negative numbers for up or right
function dyMoveBy(obj,x,y) {
	if (IE) {
		obj.style.pixelLeft = dyLeft(obj) + x;
		obj.style.pixelTop = dyTop(obj) + y;
	} else if (D2) {
		obj.style.left += x;
		obj.style.top += y;
	} else if (NN) {
		obj.moveBy(x,y);
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

// Make the object visible.
function dyShow(obj) {
	if (D2) {
		obj.style.display = '';
		obj.style.visibility = 'visible';
	} else if (IE) {
		obj.style.visibility = 'visible';
	} else if (NN) {
		obj.visibility = 'visible';
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

// Hide the object
function dyHide(obj) {
	if (D2) {
		obj.style.display = 'none';
		//obj.style.visibility = 'hidden';
	} else if (IE) {
		obj.style.visibility = 'hidden';
	} else if (NN) {
		obj.visibility = 'hidden';
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

// Resize the height and width of the object to h,w. The upper right hand corner
// of the object will remain static.
function dyResizeTo(obj,h,w) {
	if (D2) {
		obj.style.height=h;
		obj.style.width=w;
	} else if (IE) {
		obj.style.height=h;
		obj.style.width=w;
	} else if (NN) {
		obj.clip.height = h;
		obj.clip.width = w;
	} else {
	err('IE 4+ or Navigator 4+ is required');
	}
}

//Change the background color of the object. This might not always work, depending on other factors.
function dyColor(obj,color) {
	if (D2) {
		obj.style.backgroundColor = color;
		obj.bgColor = color;
	} else if (IE) {
		obj.style.backgroundColor = color;
	} else if (NN) {
		obj.bgColor = color;
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

//This should return the width of the browser page. 
function dyFieldWidth() {
	if (IE) {
		return(document.body.clientWidth);
	} else if (D2) {
		return(window.innerWidth);
	} else if (NN) {
		return(window.innerWidth);
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

//This should return the height of the browser page. 
function dyFieldHeight() {
	if (IE) {
		return(document.body.clientHeight);
	} else if (D2) {
		return(window.innerHeight);
	} else if (NN) {
		return(window.innerHeight);
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

////////////////////////////////////////////////////////////////////////////////////////////
// Dynamic Rewriting functions.
// Previously thought to not work on NN6/Mozilla. I was wrong.

//Dynamically rewrite the object.
function dyRewrite(obj,text) {
	if (dynaJsDebug) window.status = 'dyRewrite called on object ['+obj.name+']...';
	if (IE || D2) {
		obj.innerHTML = text;
		if (dynaJsDebug) window.status = 'IE or D2: obj.innerHTML set...';
	} else if (NN) {
		obj.document.open();
		if (dynaJsDebug) window.status = 'NN: about to writeln the text ['+text+']';
		obj.document.writeln(text);
		if (dynaJsDebug) window.status = 'NN: obj.document.writeln()...';
		obj.document.close();
		if (dynaJsDebug) window.status = 'NN: obj.document.close()...';
	} else {
		err('IE 4+ or Navigator 4+ is required');
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////
// Dynamic popup menus
//

// Setup global variable for use in PopUpMenus
if (!D2 && IE) {
	if (dynaJsDebug) window.status = 'Creating Layer...';
	document.write('<span style="visibility:hidden;display:none;position:absolute;top:100;left:100;z-index:99;" id="dyPUM"></span>');
} else if (!D2 && NN){
	if (dynaJsDebug) window.status = 'Creating Layer...';
	document.write('<layer name="dyPUM" visibility="hide" left="0" top="0" z-index="99" bgcolor="#ffff00"><P></layer>\n');
}

/* pop up the menu
   accepts the following:
	labels
	links
	x y coords (auto)
	h w (auto)
	style - bgcolor
			textcolor
			overflow
			hovercolor
			hoverbgcolor
			bordersize
			bordercolor
			linkclass
	usage: dyPopMenu(labels,links,options);
		lables - comma seperated list of labels
		links - comma seperated list of links
		options - comma seperated list of options (see above)
*/
function dyPopMenu(labels,links,options) {
	var dyPUM = dyObject('dyPUM');
	var dyPUMmenu = '';
	var PUMlabels = labels.split(',');
	var PUMlinks = links.split(',');
	var PUMoptions = options.split(',');
	var PUMx = cursorX;
	var PUMy = cursorY;
	var PUMz = 1;
	var PUMh = (1==0);
	var PUMw = (1==0);
	var PUMbgcolor = 'white';
	var PUMcolor = 'black';
	var PUMborder = 0;
	var PUMbordercolor = 'silver';
	var PUMhoverbgcolor = 'yellow';
	var PUMhovercolor = 'black';
	var PUMoverflow = 'visible';
	var PUMlinkclass = (1==0);
	
	if (dynaJsDebug) window.status = 'Global variables created...';
	
	// Make sure timer isn't still running from before.
	if (typeof hidePUM != 'undefined') dyPUMKillTimeout();
		
	if (dynaJsDebug) window.status = 'Previous timer killed...';
	
	if (D2) {
		if (!dyPUM) {
			document.body.innerHTML += '<span style="visibility:hidden;display:none;position:absolute;top:100;left:100;z-index:99;" id="dyPUM"></span>';
			dyPUM = dyObject('dyPUM');
		}
	}
	
	// Resize the menu small
	dyResizeTo(dyPUM,1,1);
	
	if (dynaJsDebug) window.status = 'Menu resized small...';
	
	// Analyze the options
	for (j=0; j<PUMoptions.length; j++) {
		var PUMoption = PUMoptions[j].split('=');
		switch(PUMoption[0].toLowerCase()) {
			case "x":
				PUMx = PUMoption[1];
				break;
			case "y":
				PUMy = PUMoption[1];
				break;
			case "z":
				PUMz = parseInt(PUMoption[1]);
				break;
			case "h":
				PUMh = parseInt(PUMoption[1]);
				break;
			case "w":
				PUMw = parseInt(PUMoption[1]);
				break;
			case "bgcolor":
				PUMbgcolor = PUMoption[1];
				break;
			case "textcolor":
				PUMcolor = PUMoption[1];
				break;
			case "bordersize":
				PUMborder = parseInt(PUMoption[1]);
				break;
			case "bordercolor":
				PUMbordercolor = PUMoption[1];
				break;
			case "hoverbgcolor":
				PUMhoverbgcolor = PUMoption[1];
				break;
			case "hovercolor":
				PUMhovercolor = PUMoption[1];
				break;
			case "overflow":
				PUMoverflow = PUMoption[1];
				break;
			case "linkclass":
				PUMlinkclass = PUMoption[1];
				break;
		}
	}
	
	if (dynaJsDebug) window.status = 'Options parsed...';
	
	// Insert ILayer in NN
	if (NN) dyPUMmenu = dyPUMmenu + '<ilayer name="PUMILayer" bgcolor="'+PUMbordercolor+'" height="0" width="0">';
		
//	if (dynaJsDebug) window.status = 'ILayer inserted in NN...';
	
	// Insert border if it exists
	if (IE || D2) {
		dyPUMmenu = dyPUMmenu + '<table cellpadding="'+PUMborder+'" cellspacing="0" bgcolor="'+PUMbordercolor+'" border="0" id="PUMoutertable"';
		if (PUMh) {
			dyPUMmenu = dyPUMmenu + ' height="'+PUMh+'"';
		}
		if (PUMh) {
			dyPUMmenu = dyPUMmenu + ' width="'+PUMw+'"';
		}
		dyPUMmenu = dyPUMmenu + '>';
		if (PUMw) {
			dyPUMmenu = dyPUMmenu + '<COLGROUP><COL width="'+PUMw+'">';
		}
		dyPUMmenu = dyPUMmenu + '<tr><td valign="top">';
	}
	// HTML the menu
	dyPUMmenu = dyPUMmenu + '<table bgcolor="'+PUMbgcolor+'" cellpadding="4" cellspacing="0" id="PUMtable" border="0"';
	if (!NN) {
		dyPUMmenu += ' height="100%" width="100%" style="position:relative;"';
	}
	dyPUMmenu += '>';
	for (i=0; i<PUMlabels.length; i++) {
		if (PUMlinks[i].search(/javascript:/i) == 0) {
			dyPUMmenu += '<tr><td nowrap valign="top" id="PUM'+i+'"';
			if (IE)	{
				dyPUMmenu += ' style="cursor:hand;"';
			}
			if (!NN) {
				dyPUMmenu += ' onmouseover="dyPUMHiliteMenuItem('+i+',this,\''+PUMhoverbgcolor+'\',\''+PUMhovercolor+'\','+PUMlabels.length+',\''+PUMbgcolor+'\',\''+PUMcolor+'\')" onmouseout="dyPUMLoliteMenuItem('+i+',this,\''+PUMbgcolor+'\',\''+PUMcolor+'\')" onclick="'+PUMlinks[i].replace(/javascript:/i,'')+';return false;"';
			}
			dyPUMmenu += '><P><A HREF=""';
			if (!NN) {
				dyPUMmenu += ' ONMOUSEOVER="dyPUMKillTimeout();" ONMOUSEOUT="dyPUMResetTimer();dyPUMCancelBubble();"';
			}
			dyPUMmenu += ' id="PUM'+i+'link" style="text-decoration:none!important;color:'+PUMcolor+'"';
		} else {
			dyPUMmenu += '<tr><td nowrap valign="top" id="PUM'+i+'"';
			if (IE) {
				dyPUMmenu += ' style="cursor:hand;"';
			}
			if (!NN) {
				dyPUMmenu += ' onmouseover="dyPUMHiliteMenuItem('+i+',this,\''+PUMhoverbgcolor+'\',\''+PUMhovercolor+'\','+PUMlabels.length+',\''+PUMbgcolor+'\',\''+PUMcolor+'\')" onmouseout="dyPUMLoliteMenuItem('+i+',this,\''+PUMbgcolor+'\',\''+PUMcolor+'\')" onclick="dyObject(\'PUM'+i+'link\').click();"';
			}
			dyPUMmenu += '><P><A HREF="'+PUMlinks[i]+'"';
			if (!NN) {
				dyPUMmenu += ' ONMOUSEOVER="dyPUMKillTimeout();" ONMOUSEOUT="dyPUMResetTimer();dyPUMCancelBubble();"';
			}
			dyPUMmenu += ' id="PUM'+i+'link" style="text-decoration:none!important;color:'+PUMcolor+'"';
		}
		if (PUMlinkclass) {
			dyPUMmenu += ' class="'+PUMlinkclass+'"';
		}
		dyPUMmenu += '>'+PUMlabels[i]+'</A></P></td>';
		dyPUMmenu += '</tr>';
	}
	dyPUMmenu = dyPUMmenu + '</table>';
	
	if (IE || D2) dyPUMmenu = dyPUMmenu + '</td></tr></table>';

	// close ilayer if necessary
	if (NN) dyPUMmenu = dyPUMmenu + '</ilayer>';

	if (dynaJsDebug) window.status = 'Menu created in HTML...';
	
	// Set overflow
	if (IE) {
		if (PUMoverflow == 'x') {
			if (dyPUM.style.overflowX) dyPUM.style.overflowX = 'auto';
			if (dyPUM.style.overflowY) dyPUM.style.overflowY = 'visible';
		}
		else if (PUMoverflow == 'y') {
			if (dyPUM.style.overflowY) dyPUM.style.overflowY = 'auto';
			if (dyPUM.style.overflowX) dyPUM.style.overflowX = 'visible';
		}
		else {
			if (dyPUM.style.overflow) dyPUM.style.overflow = PUMoverflow;
			if (dyPUM.style.overflowX) dyPUM.style.overflowX = 'visible';
			if (dyPUM.style.overflowY) dyPUM.style.overflowY = 'visible';
		}
	}
	
	if (dynaJsDebug) window.status = 'Overflow set...';
	
	// Resize the menu small
	dyResizeTo(dyPUM,1,1);
	
	if (dynaJsDebug) window.status = 'Menu resized small (part 2)...';
	
	// Put HTML inside
	dyRewrite(dyPUM,dyPUMmenu);
	
	if (dynaJsDebug) window.status = 'Menu object rewritten with menu...';
	
	// If Height and/or Width exist, use them.
	if (!NN) {
		if (!isNaN(dyHeight(dyObject('PUMtable')))) {
			if (PUMh && PUMw) {
				dyResizeTo(dyPUM,PUMh,PUMw);
			} else if (PUMh) {
				dyResizeTo(dyPUM,PUMh,dyWidth(dyObject('PUMtable')));
			} else if (PUMw) {
				dyResizeTo(dyPUM,dyHeight(dyObject('PUMtable')),PUMw);
			} else {
				dyResizeTo(dyPUM,dyHeight(dyObject('PUMtable')),dyWidth(dyObject('PUMtable')));
			}
		}
	} else {
		dyPUM.document.PUMILayer.clip.left = -PUMborder;
		dyPUM.document.PUMILayer.clip.right = dyWidth(dyPUM.document.PUMILayer) + PUMborder;
		var ILH = dyHeight(dyPUM.document.PUMILayer);
		var ILW = dyWidth(dyPUM.document.PUMILayer);
		if (PUMh) {
			ILH = PUMh;
		}
		if (PUMw) {
			ILW = PUMw;
		}
		var kludge = 18;
		dyResizeTo(dyPUM,ILH,ILW);
		/*dyPUM.clip.top = kludge - PUMborder;
		dyPUM.clip.bottom = ILH - kludge + PUMborder;
		dyPUM.clip.right = ILW-PUMborder;
		dyPUM.clip.left = -PUMborder;
		PUMy = PUMy - kludge;*/
	}
	
	if (dynaJsDebug) window.status = 'Menu resized correctly...';
	
	// Color the background
	dyColor(dyPUM,PUMbgcolor);
	
	if (dynaJsDebug) window.status = 'Menu recolored correctly...';
	
	// Move to the spot where it should live
	dyMoveTo(dyPUM,PUMx,PUMy);
	if (IE || D2) dyPUM.style.zIndex = PUMz;
		
	if (dynaJsDebug) window.status = 'Menu moved to ultimate location...';
		
	// Kill select boxes on IE
	if (IE) {
		allsel = document.all.tags("SELECT");
		for (var s=0; s<allsel.length; s++) {
			allsel[s].style.visibility = 'hidden';	
		}
	}
	// Show it.
	dyShow(dyPUM);
	
	if (dynaJsDebug) window.status = 'Menu displayed...';
	
	// Check to ensure it's "in the field"
	if (parseInt(PUMx)+dyWidth(dyPUM) > dyFieldWidth()) {
		PUMx = PUMx - dyWidth(dyPUM);
		dyMoveTo(dyPUM,PUMx,PUMy);
	}
	if (parseInt(PUMy)+dyHeight(dyPUM) > dyFieldHeight()) {
		PUMy = PUMy - dyHeight(dyPUM);
		dyMoveTo(dyPUM,PUMx,PUMy);
	}
	
	if (dynaJsDebug) window.status = 'Menu moved if off-screen...';
	
	// Install event handlers
	hidePUM = setTimeout('dyPUMHideForGood();',1000);
	dyPUM.onmouseover = dyPUMKillTimeout;
	dyPUM.onmouseout = dyPUMResetTimer;
	
	if (dynaJsDebug) window.status = 'Event handlers installed...';
}

function dyPUMResetTimer() {
	clearTimeout(hidePUM);
	hidePUM = setTimeout('dyPUMHideForGood();',100);
}

function dyPUMHideForGood() {
	clearTimeout(hidePUM);
	dyHide(dyObject('dyPUM'));
	// Restore select boxes on IE
	if (IE) {
		allsel = document.all.tags("SELECT");
		for (var s=0; s<allsel.length; s++) {
			allsel[s].style.visibility = 'visible';	
		}
	}
}

function dyPUMKillTimeout() {
	clearTimeout(hidePUM);
}

function dyPUMCancelBubble() {
	if (IE || D2) {
		window.event.cancelBubble=true;
	}
}

function dyPUMHiliteMenuItem(i,trowobj,hoverbgcolor,hovercolor,maxI,bgcolor,linkcolor) {
	var PUMt = dyObject('PUMtable');
	for (var x=0; x<PUMt.rows.length; x++) {
		dyColor(PUMt.rows[x].cells[0],bgcolor);
	}
	for (var y=0; y<maxI; y++) {
		dyObject('PUM'+y+'link').style.color = linkcolor;
	}
	dyColor(trowobj,hoverbgcolor);
	dyObject('PUM'+i+'link').style.color = hovercolor;
}

function dyPUMLoliteMenuItem(i,trowobj,bgcolor,linkcolor) {
	dyColor(trowobj,bgcolor);
	dyObject('PUM'+i+'link').style.color = linkcolor;
}

/* pop up text
   accepts the following:
   text
   options
	x y coords (auto)
	h w (auto)
	style - bgcolor
			textcolor
			overflow
			hovercolor
			hoverbgcolor
			bordersize
			bordercolor
			textclass
	usage: dyPopTest(text,options);
		text - html
		options - comma seperated list of options (see above)
*/
function dyPopText(passedintext,options) {
	var dyPUM = dyObject('dyPUM');
	var dyPUMtext = '';
	var PUMoptions = options.split(',');
	var PUMx = cursorX;
	var PUMy = cursorY + 15;
	var PUMz = 1;
	var PUMh = (1==0);
	var PUMw = (1==0);
	var PUMbgcolor = 'white';
	var PUMcolor = 'black';
	var PUMborder = 0;
	var PUMbordercolor = 'silver';
	var PUMhoverbgcolor = 'yellow';
	var PUMhovercolor = 'black';
	var PUMoverflow = 'visible';
	var PUMtextclass = (1==0);
	
	// Make sure timer isn't still running from before.
	if (typeof hidePUM != 'undefined') dyPUMKillTimeout();

	if (D2) {
		if (!dyPUM) {
			document.body.innerHTML += '<span style="visibility:hidden;display:none;position:absolute;top:100;left:100;" id="dyPUM"></span>';
			dyPUM = dyObject('dyPUM');
		}
	}
	
	// Hide PUM just in case
	dyHide(dyPUM);
	
	// Wipe previous text
	dyRewrite(dyPUM,'');
	
	// Resize the pum small
	dyResizeTo(dyPUM,1,1);
	
	// Analyze the options
	for (j=0; j<PUMoptions.length; j++) {
		var PUMoption = PUMoptions[j].split('=');
		switch(PUMoption[0].toLowerCase()) {
			case "x":
				PUMx = PUMoption[1];
				break;
			case "y":
				PUMy = PUMoption[1];
				break;
			case "z":
				PUMz = parseInt(PUMoption[1]);
				break;
			case "h":
				PUMh = PUMoption[1];
				break;
			case "w":
				PUMw = PUMoption[1];
				break;
			case "bgcolor":
				PUMbgcolor = PUMoption[1];
				break;
			case "textcolor":
				PUMcolor = PUMoption[1];
				break;
			case "bordersize":
				PUMborder = parseInt(PUMoption[1]);
				break;
			case "bordercolor":
				PUMbordercolor = PUMoption[1];
				break;
			case "hoverbgcolor":
				PUMhoverbgcolor = PUMoption[1];
				break;
			case "hovercolor":
				PUMhovercolor = PUMoption[1];
				break;
			case "overflow":
				PUMoverflow = PUMoption[1];
				break;
			case "textclass":
				PUMtextclass = PUMoption[1];
				break;
		}
	}
	
	// Insert ILayer in NN
	if (NN) dyPUMtext = dyPUMtext + '<ilayer name="PUMILayer" bgcolor="'+PUMbordercolor+'" height="0" width="0">';
	
	// Insert border if it exists
	if (IE || D2) dyPUMtext = dyPUMtext + '<table cellpadding="'+PUMborder+'" cellspacing="0" bgcolor="'+PUMbordercolor+'" border="0" id="PUMoutertable"><tr><td valign="top">';
	// HTML the menu
	dyPUMtext = dyPUMtext + '<table bgcolor="'+PUMbgcolor+'" cellpadding="4" cellspacing="0" id="PUMtable" style="position:relative;" border="0">';
	
	dyPUMtext = dyPUMtext + '<tr><td><p';
	if (PUMtextclass) dyPUMtext = dyPUMtext + ' class="'+PUMtextclass+'"';
	dyPUMtext = dyPUMtext + '>'+passedintext+'</td></tr>';
	
	dyPUMtext = dyPUMtext + '</table>';

	if (IE || D2) dyPUMtext = dyPUMtext + '</td></tr></table>';
	
	// close ilayer if necessary
	if (NN) dyPUMtext = dyPUMtext + '</ilayer>';
	
	// Set overflow
	if (IE) {

		if (PUMoverflow == 'x') {
			if (dyPUM.style.overflowX) dyPUM.style.overflowX = 'auto';
			if (dyPUM.style.overflowY) dyPUM.style.overflowY = 'visible';
		}
		else if (PUMoverflow == 'y') {
			if (dyPUM.style.overflowY) dyPUM.style.overflowY = 'auto';
			if (dyPUM.style.overflowX) dyPUM.style.overflowX = 'visible';
		}
		else {
			if (dyPUM.style.overflow) dyPUM.style.overflow = PUMoverflow;
			if (dyPUM.style.overflowX) dyPUM.style.overflowX = 'visible';
			if (dyPUM.style.overflowY) dyPUM.style.overflowY = 'visible';
		}
	}
	// Resize the menu small
	dyResizeTo(dyPUM,1,1);
	// Put HTML inside
	dyRewrite(dyPUM,dyPUMtext);
	// If Height and Width exist, use them.
	if (PUMh && PUMw) {
		dyResizeTo(dyPUM,PUMh,PUMw);
		if (NN) {
			var ILH = dyHeight(dyPUM.document.PUMILayer);
			var ILW = dyWidth(dyPUM.document.PUMILayer);
			var kludge = 18;
			dyResizeTo(dyPUM,ILH,ILW);
			dyPUM.clip.top = kludge + PUMborder;
			dyPUM.clip.bottom = ILH - kludge + PUMborder;
			PUMy = PUMy - kludge;
		}
	} else {
		if (!NN) {
			if (!isNaN(dyHeight(dyObject('PUMtable')))) dyResizeTo(dyPUM,dyHeight(dyObject('PUMtable')),dyWidth(dyObject('PUMtable')));
		} else {
			dyPUM.document.PUMILayer.clip.left = -PUMborder;
			dyPUM.document.PUMILayer.clip.right = dyWidth(dyPUM.document.PUMILayer) + PUMborder;
			var ILH = dyHeight(dyPUM.document.PUMILayer);
			var ILW = dyWidth(dyPUM.document.PUMILayer);
			var kludge = 18;
			dyResizeTo(dyPUM,ILH,ILW);
			dyPUM.clip.top = kludge - PUMborder;
			dyPUM.clip.bottom = ILH - kludge + PUMborder;
			dyPUM.clip.right = ILW-PUMborder;
			dyPUM.clip.left = -PUMborder;
			PUMy = PUMy - kludge;
		}
	}
	// Color the background
	dyColor(dyPUM,PUMbgcolor);
	// Move to the spot where it should live
	dyMoveTo(dyPUM,PUMx,PUMy);
	if (IE || D2) dyPUM.style.zIndex = PUMz;
	// Show it.
	dyShow(dyPUM);

	// Check to ensure it's "in the field"
	if (parseInt(PUMx)+dyWidth(dyPUM) > dyFieldWidth()) {
		PUMx = PUMx - dyWidth(dyPUM);
		dyMoveTo(dyPUM,PUMx,PUMy);
	}
	if (parseInt(PUMy)+dyHeight(dyPUM) > dyFieldHeight()) {
		PUMy = PUMy - dyHeight(dyPUM);
		dyMoveTo(dyPUM,PUMx,PUMy);
	}

	// Install event handlers
	hidePUM = setTimeout('dyHide(dyObject("dyPUM"));',5000);
	dyPUM.onmouseover = dyPUMKillTimeout;
	dyPUM.onmouseout = dyPUMResetTimer;
}

if (dynaJsDebug) window.status = 'Intial file load done...';
