<!--
var logger = null;
	function debug() {
		if (CONST.DEBUG && arguments.length > 0) {
			var _msg = "DEBUG:";
			for (var i=0; i<arguments.length; i++) {
				if (i > 0) _msg = _msg + ',';
				_msg = _msg + arguments[i];
			}
			if (_msg.length > 4000) {
				_msg = _msg.substring(0,4000);
			}
			alert(_msg);
		}
	}
	function dummyListener() {
		return false;
	}
	function doNinjavaShowMessage() {
		Swo.showNinjavaMessage();
	}
	function doNinjavaSetFocus() {
		Swo.setFocus();
	}
	function logoff(str_url, force) {
		logout(str_url, force);
	}
	function logout(str_url, force) {
		if (force) {
			// for IE only
			if (navigator.appName == 'Microsoft Internet Explorer') {
				if (event != null && event.clientY < -2000) {
					top.location = Swo.SelfLinkURL + '&' + CONST.HTML_LOGOFF + '=' + str_url;
					// If this line does note exist, browser will be closed before sending request.
					alert(MSG.JS_LOGOUT_DONE);
				}
			}
		} else {
			if (confirm(MSG.JS_LOGOUT_CONFIRM)) {
				top.location = Swo.SelfLinkURL + '&' + CONST.HTML_LOGOFF + '=' + str_url;
			}
		}
	}
	function getFormElement(formName) {
		if (isNullString(formName)) {
		  return document.forms[0];
		} else if (formName.length > 5 && formName.substring(0,5) == 'form:') {
		  return document.forms[formName];
		} else {
		  return document.forms['form:' + formName];
		}
	}
	// Returns element by name.
	// @param formTag
	// @param elementName
	// @return element
	function getElementByName(formTag, elementName) {
		//var _formElement = getFormElement(formName);
		if (formTag == null) return null;
		return formTag.elements[elementName];
	}
	// Returns index of element.
	// @param formTag
	// @param elementName
	// @param startIdx
	// @param useRegexp
	// @param includeHidden
	// @return index of element
	function getElementIndex(formTag, elementName, startIdx, useRegexp, includeHidden) {
		if (formTag == null) return -1;
		var e = formTag.elements;
		var searchElementName;
		if (useRegexp) {
			searchElementName = '^' + elementName;
		} else {
			searchElementName = elementName;
		}
		for (var i=startIdx; i<e.length; i++) {
			if (e[i].name != null) {
				if (includeHidden || e[i].type != 'hidden') {
					if (useRegexp && e[i].name.match(searchElementName)) {
						return i;
					} else if (e[i].name == searchElementName) {
						return i;
					}
				}
			}
		}
		return -1;
	}
	// Returns input data element.
	// @param formName
	// @param dataName
	// @param fieldName
	// @param rowIndex
	// @param internalRecordId
	// @return input data element
	// @deprecated please use getSpanElement
	function getDataElement(formName, dataName, fieldName, rowIndex, internalRecordId) {
		var formTag = getFormElement(formName);
		elementName = CONST.INPUT_NAME_PREFIX + '\\S+::' + dataName + CONST.DELIMITER1 + fieldName + CONST.DELIMITER2;
		if (rowIndex != 0 && (rowIndex == null || rowIndex == '' || rowIndex < 0)) {
			if (internalRecordId == null || internalRecordId == '') {
				// DataMap
				var idx = getElementIndex(formTag, elementName, 0, true, false);
				if (idx < 0)
					return null;
				return formTag.elements[idx];
			} else {
				// search by InternalRecordId
				elementName = elementName + '\\d+' + CONST.DELIMITER3 + internalRecordId;	
			}
		} else {
			elementName = elementName + rowIndex;
			if (internalRecordId != null && internalRecordId != '' && internalRecordId >= 0) {
				// search by rowIndex && InternalRecordId
				elementName = elementName + CONST.DELIMITER3 + internalRecordId;	
			}
		}
		// search element
		var idx = getElementIndex(formTag, elementName, 0, true, false);
		if (idx < 0)
			return null;
		return formTag.elements[idx];
	}
	function getSpanElementId(swoName, sdvName, hdvName, fieldName, rowIndex) {
		var _spanId = swoName + '::Root:';
		if (isNotNullString(sdvName)) {
			_spanId = _spanId + sdvName + '__';
		}
		_spanId = _spanId + hdvName;
		if (fieldName != null && isNotNullString(fieldName)) {
			_spanId = _spanId + '__' + fieldName;
		}
		if (rowIndex != null && rowIndex >= 0) {
			_spanId = _spanId + ':' + rowIndex;
		}
		return _spanId;
	}
	function getSpanElement(swoName, sdvName, hdvName, fieldName, rowIndex) {
		var _spanId = getSpanElementId(swoName, sdvName, hdvName, fieldName, rowIndex);
		return document.getElementById(_spanId);
	}
	function doNinjavaAppendProgressImage() {		
		// append null image to body tag
		var div = document.createElement('DIV');
		var img = document.createElement('IMG');
		div.id = "NINJAVA_NULL_IMG_DIV";
		div.style.display = 'none';
		div.style.visibility = 'hidden';
		div.style.position = 'absolute';
		div.style.top = 0;
		div.style.left = 0;
		div.style.zIndex = CONST.NULLIMAGE_ZINDEX;
		img.src = 'images/nj_null1200x900.gif';
		img.width = 0;
		img.height = 0;
		div.appendChild(img);
		document.body.appendChild(div);
		addListener(img, 'mousedown', dummyListener, false);
		// append progress bar image to body tag
		div = document.createElement('DIV');
		img = document.createElement('IMG');
		div.id = "NINJAVA_PROGRESS_IMG_DIV";
		div.style.display = 'none';
		div.style.visibility = 'hidden';
		div.style.position = 'absolute';
		div.style.top = 0;
		div.style.left = 0;
		div.style.zIndex = CONST.PROGRESSBAR_ZINDEX;
		img.src = "images/nj_progress.gif";
		img.alt = "Wait...";
		img.width = 125;
		img.height = 125;
		div.appendChild(img);
		document.body.appendChild(div);
	}
	function doNinjavaAppendCheckDataTag() {
		var _span = document.createElement('SPAN');
		_span.setAttribute(TAG_ATTRIBUTE.NJ_TYPE, 'nj:checkdatas');
		if (isNotNullString(Swo.CHECK_DATA)) {
			_span.innerHTML = Swo.CHECK_DATA;
		}
		document.body.appendChild(_span);		
	}
	function doNinjavaOnLoad() {
		if (CONST.DEBUG) {
			logger = new Logger('log001');
		}
		doNinjavaAppendProgressImage(); 
		doNinjavaAppendCheckDataTag(); 
		Popup.initialize(); 
		var _bodyInnerHTML = document.body.innerHTML;
		if (_bodyInnerHTML.indexOf('nj:tab')>0) {
			initTabs(document.body);
		}
		if (_bodyInnerHTML.indexOf('nj:scrollPane')>0) {
			initScrollPanes(document.body);
		}
		if (_bodyInnerHTML.indexOf('nj:tree')>0) {
			initTrees(document.body);
		}
		Swo.showNinjavaMessage();
		Swo.setFocus();
	}
	function isNullString(s, trim) {
	  if (s == null || s.length == 0) {
	    return true;
	  } else {
	  	if (trim == true) {
	  		if (s.match(CONST.EMPTY_REGEXP)) {
		    	return true;
		    }
	    }
	    return false;
	  }
	}
	function isNotNullString(s, trim) {
		return !(isNullString(s,trim));
	}
	function setMouseCursor(element, mouseCursor) {
		if (element != null && element.style != null)
			element.style.cursor = mouseCursor;
	  document.body.style.cursor = mouseCursor;
	}
	function WidthHeight() {
		this.width = 0;
		this.height = 0;
		return this;
	}
	function getWindowSize() {
	 	var widthHeight = new WidthHeight();
		if (document.all) {
			// IE
			widthHeight.width  = document.body.clientWidth;
			widthHeight.height = document.body.clientHeight;
		} else {
			//NN
			widthHeight.width  = window.innerWidth;
			widthHeight.height = window.innerHeight;
		}
		return widthHeight;
	}
	function getFrameSize() {
		var widthHeight = new WidthHeight();
		if (document.documentElement && document.documentElement.clientWidth) {
			// IE
			widthHeight.width  = document.documentElement.clientWidth;
			widthHeight.height = document.documentElement.clientHeight;
		} else if (window.innerWidth) {
			// Mozilla
			widthHeight.width  = window.innerWidth;
			widthHeight.height = window.innerHeight;
		} else if (document.body && document.body.clientWidth) {
			widthHeight.width  = document.body.clientWidth;
			widthHeight.height = document.body.clientHeight;
		}
		return widthHeight;
	}
	function getScrollSize() {
		var widthHeight = new WidthHeight();
		widthHeight.width  = document.body.scrollWidth;
		widthHeight.height = document.body.scrollHeight;
		return widthHeight;
	}
	function Pos() {
		this.x = 0;
		this.y = 0;
		return this;
	}
  function getWindowOffset() {
  	var pos = new Pos();
   if (document.documentElement && document.documentElement.scrollLeft){
     // IE
     pos.x = document.documentElement.scrollLeft;
     pos.y = document.documentElement.scrollTop;
   } else if(document.body && document.body.scrollLeft){
     pos.x = document.body.scrollLeft;
     pos.y = document.body.scrollTop;
   } else if (window.scrollX) {
      // Mozilla
      pos.x = window.scrollX;
      pos.y = window.scrollY;
   } else if(window.pageXOffset) {
      // Opera, NN4
      pos.x = window.pageXOffset;
      pos.y = window.pageYOffset;
   }
   return pos;
  }
  function isChild(child, parent) {
  	var _p = child.parentNode;
  	if (_p == parent) {
  		return true;
  	} else if (_p == null) {
  		return false;
  	} else {
  		return isChild(_p, parent);
  	}
  }
  function isChildOfParents(child, parents) {
  	if (parents == null) return false;
  	for (var i=0; i<parents.length; i++) {
  		if (isChild(child, parents[i])) {
  			return true;
  		}
  	}
  	return false;
  }
  function getParentTag(element, parentTagName, parentType) {
  	if (element == null) return null;
    var _parent = element.parentNode;
    if (_parent == null) return null;
    try {
      if (_parent.tagName == parentTagName) {
      	if (parentType == null || TAG_ATTRIBUTE.getNjType(_parent) == parentType) {
	        return _parent;
				}
      }
    } catch (e) {
    	logger.writeHTML(errordescription(e));
    }
    return getParentTag(_parent, parentTagName, parentType);
  }
	function getChildTag(rootElement, childTagName, childType, getSelectOptions) {
		if (rootElement == null || rootElement.childNodes.length == 0) {
			return null;
		}
		if (rootElement.tagName == 'SELECT' && getSelectOptions != true) {
			return null;
		}
  	for (var i=0; i<rootElement.childNodes.length; i++) {
  		var _child = rootElement.childNodes[i];
  		try {
  			if (_child.tagName == childTagName) {
  			  if (childType == null || TAG_ATTRIBUTE.getNjType(_child) == childType) {
	  				return _child;	
	  			}
  			}
  		} catch (e) {
  			logger.writeHTML(errorDescription(e));
  		}
 			var _found = getChildTag(_child, childTagName, childType, getSelectOptions);
 			if (_found != null) {
 				return _found;
  		}
  	}
  	return null;
  }
  function getChildTags(rootElement, childTagName, childType, getSelectOptions) {
  	if (rootElement == null || rootElement.childNodes.length == 0) {
  		return null;
  	}
		if (rootElement.tagName == 'SELECT' && getSelectOptions != true) {
			return null;
		}
  	var _children = new Array();
  	var _childrenCount = 0;
  	for (var i=0; i<rootElement.childNodes.length; i++) {
  		var _child = rootElement.childNodes[i];
  		var _found = false;
  		try {
  			if (_child.tagName == childTagName) {
  			  if (childType == null || TAG_ATTRIBUTE.getNjType(_child) == childType) {
	  				_children[_childrenCount++] = _child;
	  				_found = true;
	  			}
  			}
  		} catch (e) {
  			logger.writeHTML(errorDescription(e));
  		}
  		if (!_found) {
  			var _foundChildren = getChildTags(_child, childTagName, childType, getSelectOptions);
  			if (_foundChildren != null) {
  				for (var j=0; j<_foundChildren.length; j++) {
  					_children[_childrenCount++] = _foundChildren[j];
  				}
  			}
  		}
  	}
  	if (_childrenCount == 0) return null;
  	return _children;
  }
  function startsWith(str, startStr) {
    if (str == null || startStr == null || startStr.length == 0) {
      return false;
    }
    if (str.length < startStr.length) {
      return false;
    }
    if (str.substring(0, startStr.length) == startStr) {
      return true;
    } else {
      return false;
    }
  }
	function contains(ary, obj) {
		if (ary == null || ary.length == 0) return false;
		for (var i=0; i<ary.length; i++) {
			if (ary[i] == obj) return true;
		}
		return false;
	}
	function setFocus(inputName, searchByInternalRecordId) {
		if (isNullString(inputName)) return;
		var _inputElements = null;
		if (searchByInternalRecordId) {
			searchByInternalRecordId = false;
			if (inputName.match(CONST.INPUT_NAME_REGEXP)) {
				var _internalRecordId = RegExp.$3;
				if (_internalRecordId != '-1') {
					searchByInternalRecordId = true;
					var _foundElements = new Array();
					var _searchInputName = new RegExp('^' + RegExp.$1 + '(-?\\d+):' + _internalRecordId + '$');
					for (var i=0; i<document.forms.length; i++) {
						var _form = document.forms[i];
						for (var j=0; j<_form.elements.length; j++) {
							var _inputElement = _form.elements[j];
							var _inputName = _inputElement.name;
							if (isNotNullString(_inputName) && _inputName.match(_searchInputName)) {
								_foundElements.push(_inputElement);
							}
						}
						if (_foundElements.length > 0) break;
					}
				}
				if (_foundElements.length > 0) _inputElements = _foundElements;
			}
		}
		if (!searchByInternalRecordId) {
			for (var i=0; i<document.forms.length; i++) {
				var _form = document.forms[i];
				_inputElements = _form.elements[inputName];
				if (_inputElements != null) break;
			}
		}
		if (_inputElements == null) return;
		if ((_inputElements.tagName == null || _inputElements.tagName == 'radio')
		  && _inputElements.length > 0) {
			for (var i=0; i<_inputElements.length; i++) {
				var _child = _inputElements[i];
				if (_child.type == 'hidden') continue;
				if (_child.disabled) continue;
				setFocusInternal(_child);
				break;
			}
		} else {
			setFocusInternal(_inputElements);
		}
	}
	function setFocusInternal(inputField) {
		for (var i=0; i<10; i++) {
			inputField.focus();
			if (inputField == document.activeElement) {
				if (inputField.type == 'text') {
					inputField.select();
				}
				break;
			}
		}
	}
	function EmptyLogger() {
		this.write = function() {
		}
		this.writeInnerHTML = function() {
		}
		this.writeHTML = function() {
		}
		return this;
	}
	function Browser() {
		this.UNKNOWN = -1;
		this.MSIE = 0;
		this.MSIE6 = 6;
		this.MSIE7 = 7;
		this.NN  = 1000;
		this.FIREFOX = 2000;
		this.MOZILLA   = 3000;
		this.OPERA   = 4000;
		this.type = -1;
		this.initialize = function() {
	    var _agent=navigator.userAgent.toLowerCase();
  		//var appVersion = navigator.appVersion;
			if (_agent.indexOf('mozilla') >= 0) {
				if (_agent.indexOf('opera') >= 0) {
					this.type = this.OPERA;
				} else if (_agent.indexOf("msie") >= 0) {
					this.type = this.MSIE;
					if (_agent.match('msie (\\d+\\.\\d+)')) {
						var _version = RegExp.$1;
						if (_version == '6.0') {
							this.type = this.MSIE6;
						} else if (_version == '7.0') {
//							this.type = this.MSIE7;
							this.type = this.MSIE6;
						}
					}
				} else if (_agent.indexOf('firefox') >= 0) {
					this.type = this.FIREFOX;
				} else if (_agent.indexOf('netscape') >= 0) {
					this.type = this.NN;
				} else {
					this.type = this.MOZILLA;
				}
			}
		}
		this.isMSIE = function() {
			return (this.type == this.MSIE6 || this.type == this.MSIE7 || this.type == this.MSIE);
		}
		this.initialize();
		return this;
	}
	function OS() {
		this.OTHER = 0;
		this.WINDOWS = 1;
		this.type = this.OTHER;
		this.initialize = function() {
	    var _agent=navigator.userAgent.toLowerCase();
			if (_agent.indexOf('windows') >= 0) {
				this.type = this.WINDOWS;
			}
		}
		this.isWindows = function() {
			return (this.type == this.WINDOWS);
		}
		this.initialize();
		return this;
	}
	function getElementPos(element) {
		var o = new Object();
		o.x = element.offsetLeft;
		o.y = element.offsetTop;
		if (Browser.isMSIE()) {
			var njType = TAG_ATTRIBUTE.getNjType(element.parentNode);
			if (njType == 'nj:treeNode') {
				o.x = 0;
				o.y = 0;
			}
			while (true) {
				var _offsetParent;
				try {
					_offsetParent = element.offsetParent;
				} catch (e) {
					_offsetParent = null;
				}
				if (_offsetParent == null) break;
				element = _offsetParent;
				o.x += element.offsetLeft;
				o.y += element.offsetTop;
				o.x -= element.scrollLeft;
				o.y -= element.scrollTop;
			}
		} else {
			while (element.offsetParent != null) {
				element = element.offsetParent;
				o.x += element.offsetLeft;
				o.y += element.offsetTop;
				o.x -= element.scrollLeft;
				o.y -= element.scrollTop;
			}
		}
		return o;
	}
	function addListener(el, evtType, func, cap) {
		if (el.addEventListener) {
			el.addEventListener(evtType, func, cap);
		} else if (el.attachEvent) {
			el.attachEvent('on' + evtType, func);
		} else {
			return false;
		}
	}
	function removeListener(el, evtType, func, cap) {
		if (el.removeEventListener) {
			el.removeEventListener(evtType, func, cap);
		} else if (el.detachEvent) {
			el.detachEvent('on' + evtType, func);
		} else {
			return false;
		}
	}
	function getPixelValue(pixel) {
		if (pixel.match(CONST.PIXEL_REGEXP)) {
			return RegExp.$1;
		} else {
			return 0;
		} 		
	}
  function errorDescription(e) {
    if (Browser.isMSIE()) {
      return e.description;
    } else {
      return e;
    }
  }
	function disableSelectionList(exceptParent) {
		var _selectAry = document.getElementsByTagName('SELECT');
		if (_selectAry == null || _selectAry.length < 1) {
			return;
		}
		var _select;
		for (var i=0; i<_selectAry.length; i++) {
			_select = _selectAry[i];
			if (exceptParent != null && isChild(_select, exceptParent)) continue;
			if (_select.disabled != true) {
				_select.disabled = true;
				_select._njDisabled = 'true';
			}
		}
	}
	function enableSelectionList(exceptParent) {
		var _selectAry = document.getElementsByTagName('SELECT');
		if (_selectAry == null || _selectAry.length < 1) {
			return;
		}
		var _select;
		for (var i=0; i<_selectAry.length; i++) {
			_select = _selectAry[i];
			if (exceptParent != null && isChild(_select, exceptParent)) continue;
			if (_select.disabled == true && _select._njDisabled == 'true') {
				_select.disabled = false;
				_select._njDisabled = '';
			}
		}
	}
//-->
