	function wopen(url, name, w, h) {
	  // Fudge factors for window decoration space.
	  // In my tests these work well on all platforms & browsers.
	  w += 32;
	  h += 96;
	  wleft = (screen.width - w) / 2;
	  wtop = (screen.height - h) / 2;
	  // IE5 and other old browsers might allow a window that is
	  // partially offscreen or wider than the screen. Fix that.
	  // (Newer browsers fix this for us, but let's be thorough.)
	  if (wleft < 0) {
	    w = screen.width;
	    wleft = 0;
	  }
	  if (wtop < 0) {
	    h = screen.height;
	    wtop = 0;
	  }
	  var win = window.open(url,
	    name,
	    'width=' + w + ', height=' + h + ', ' +
	    'left=' + wleft + ', top=' + wtop + ', ' +
	    'location=no, menubar=no, ' +
	    'status=no, toolbar=no, scrollbars=yes, resizable=yes');
	  // Just in case width and height are ignored
	  win.resizeTo(w, h);
	  // Just in case left and top are ignored
	  win.moveTo(wleft, wtop);
	  win.focus();
	}

	function submitNavItem(frmName, controllerPage, queryString,actionCmd) {
		frm = eval('document.' + frmName);
		qString = '';
		if (queryString != '') {
			qString = "?" + queryString + "&command=" + actionCmd;
		} else {
			qString = "?" + "command=" + actionCmd;
		}
		frm.action = controllerPage + qString;
		frm.submit();
	}

	function submitNavItemWithConfirm(msg, frmName, controllerPage, queryString,actionCmd) {
		if (confirm(msg)) {
			return submitNavItem(frmName, controllerPage, queryString,actionCmd);
		} else {
			return false;
		}
	}

	function unhideMessage(msg, elementIdName) {
		textElement = document.getElementById(elementIdName);
		textElement.display = "block";
		textElement.visibility = "visible";
		textElement.innerHTML = msg;
	}

	function hideMessage(msg, elementIdName) {
		textElement = document.getElementById(elementIdName);
		textElement.display = "none";
		textElement.visibility = "hidden";
	}

	/* TabNext()
	* Function to auto-tab phone field
	* Arguments:
	*   obj :  The input object (this)
	*   event: Either 'up' or 'down' depending on the keypress event
	*   len  : Max length of field - tab when input reaches this length
	*   next_field: input object to get focus after this one
	* 	<td>Phone No.:</td>
	* 	<td>
	* 	<input type=text name="Phone_1" size=3 maxlength=3 nKeyDown="TabNext(this,'down',3)" onKeyUp="TabNext(this,'up',3,this.form.Phone_2)">
	* 	-
	* 	<input type=text name="Phone_2" size=3 maxlength=3 onKeyDown="TabNext(this,'down',3)" onKeyUp="TabNext(this,'up',3,this.form.Phone_3)">
	* 	-
	* 	<input type=text name="Phone_3" size=4 maxlength=4>
	* 	</td>
	*/
	var phone_field_length=0;
	function TabNext(obj,event,len,next_field) {
		if (event == "down") {
				phone_field_length=obj.value.length;
		} else if (event == "up") {
			if (obj.value.length != phone_field_length) {
				phone_field_length=obj.value.length;
				if (phone_field_length == len) {
					next_field.focus();
				}
			}
		}
	}

	function removeItem() {
		selection = confirm ("Are you sure you want to remove this item");
		return selection;
	}	
	
	function addJavascript(jsname) {
		var th = document.getElementsByTagName('head')[0];
		var s = document.createElement('script');
		s.setAttribute('type','text/javascript');
		s.setAttribute('src',jsname);
		th.appendChild(s);
	} 
	
	function addStyleSheet(stylesheetname) {
		var th = document.getElementsByTagName('head')[0];
		var s = document.createElement('link');
		s.setAttribute('type','text/css');
		s.setAttribute('rel','stylesheet');
		s.setAttribute('href',stylesheetname);
		th.appendChild(s);
	} 
	
