	// Global variables
	var cfFunctionsUrl = 'mxFunctions.cfm'; // Location of ajax functions
	var proposalSort = ''; // String to hold responses sorting option

	// Add some useful functions
	String.prototype.isDate = function(){ return /^\d{1,2}[\/]\d{1,2}[\/]\d{2,4}$/.test(this); }
	String.prototype.isTime = function(){ return /^\d{1,2}[:]\d{2}$/.test(this); }
	String.prototype.isNumeric = function(){ return /^\d+$/.test(this); }
	String.prototype.formatNumber = function(){ a = this; while (/(\d+)(\d{3})/.test(a)) a = a.replace(/(\d+)(\d{3})/, '$1,$2'); return a; }

	// Extend prototype's Element class some
	Element.addMethods({
		// Makes it easy to append a child element with the attributes needed
		// Returns the new extended child HTML node
		// Usage:  parentElement.addChild('td', { width: '75%', align: 'right' });
		addChild: function( element, tagName, attributes ) {
			var elm = Object.extend($(document.createElement(tagName)), attributes || {});
			$(element).appendChild(elm); return elm;
		},
		// Easy way to remove all child nodes from an element
		// Returns an extended reference to the parent node
		// Usage: parentElement.removeChildren(); OR Element.removeChildren( parentElement );
		removeChildren: function( element ) {
			element = $(element);
			$A(element.childNodes).each(function(node){ element.removeChild(node); });
			return element;
		}
	});

	function setupMouseovers() {
		$A($$('img[hsrc|dsrc]','input[type=image][hsrc|dsrc]')).each(function(el) {
			el.n = new Image(); el.n.src = el.src;

			var hsrc = el.getAttribute('hsrc');
			if (hsrc != null && !hsrc.blank()) { // Add hover image
				el.h = new Image(); el.h.src = hsrc;
				el.observe('mouseover', function(){ this.src = this.h.src; }.bindAsEventListener(el));
				el.observe('mouseout', function(){ this.src = this.n.src; }.bindAsEventListener(el));
			}

			var dsrc = el.getAttribute('dsrc');
			if (dsrc != null && !dsrc.blank()) { // Add down image
				el.d = new Image(); el.d.src = dsrc;
				el.observe('mousedown', function(){ this.src = this.d.src; }.bindAsEventListener(el));
				el.observe('mouseup', function(){ this.src = this.n.src; }.bindAsEventListener(el));
			}
		});
	}

	// Event.observe(window, 'load', setupMouseovers); // Sets up all image and input tags with hsrc or dsrc attributes

// Window management ---

	function showWindow( element ) {
		element = $(element).show();
		$A(element.ancestors()).invoke('show'); // Show parents
		document.getElementsByClassName('contentWindow', element).invoke('show'); // Show Children
	}

	function showMenu( element ) {
		document.getElementsByClassName('navigation').invoke('hide'); // Hide all menus
		$(element).show(); // Show selected menu
	}

	// Apply method of each member
	function invokeAllWindows( member ) { document.getElementsByClassName('contentWindow').invoke(member); }

	function showAllViewWindows( parent ) {
		invokeAllWindows('hide'); // Hide all content windows
		$A(document.getElementsByClassName('contentWindow', $(parent))).each(function(w){
			if (w.id.indexOf('VIEW_') > -1) showWindow(w); // Show all child view windows
		});
	}

	function showAllSections() {
		invokeAllWindows('hide'); // Hide all content windows
		$A(document.getElementsByClassName('contentWindow')).each(function(w){
			if (w.hasClassName('parentWindow')) w.setStyle({ position: 'static' }); // Make sure sections don't overlap
			if (w.id.indexOf('VIEW_') > -1) showWindow(w); // Show each view window
		});
	}

// End Window management ---

