<!--
function SubmitInfo(sendElement, submitValue, autoDisable, inf, target, sendTab, swo, sendParams, cid, wid, wsq, chk) {
	this.sendElement = null;
	this.submitValue = submitValue;
	this.autoDisable = autoDisable;
	this.inf = inf;
	this.target = target;
	this.sendTab = sendTab;
	this.swo = swo;
	this.sendParams = sendParams;
	this.cid = null;
	this.wid = null;
	this.wsq = null;
	this.chk = null;
	this.eventId = null;
	this.eventValue = null;
	this.callbackFunction = null;
	this.setSendElement = function(sendElement) {
		this.sendElement = sendElement;
		if (sendElement == null) {
			this.setEventValue('');
			this.setEventId(null);
		} else {
			var _value = sendElement.value;
			if (sendElement.type == 'checkbox' && !sendElement.checked) {
		  	_value = '';
			}
			this.setEventValue(_value);
			if (sendElement.tagName == 'SPAN' && isNotNullString(sendElement.id)) {
				this.setEventId(sendElement.id);
			} else {
				var _parent = getParentTag(sendElement, 'SPAN', null);
				while (_parent != null && isNullString(_parent.id)) {
					_parent = getParentTag(_parent, 'SPAN', null);
				}
				if (_parent == null) {
					this.setEventId(null);
				} else {
					this.setEventId(_parent.id);
				}
			}
		}
	}
	this.getSendElement = function() {
		return this.sendElement;
	}
	this.getSubmitValue = function() {
		return this.submitValue;
	}
	this.isAutoDisable = function() {
		return this.autoDisable;
	}
	this.getInf = function() {
		return this.inf;
	}
	this.getTarget = function() {
		return this.target;
	}
	this.getSendTab = function() {
		if (this.sendTab == undefined) return null;
		return this.sendTab;
	}
	this.setSWO = function(swo) {
		this.swo = swo;
	}
	this.getSWO = function() {
		return this.swo;
	}
	this.setSendParams = function(sendParams) {
		this.sendParams = sendParams;
	}
	this.isSendParams = function() {
		return this.sendParams;
	}
	this.setCid = function(cid) {
		this.cid = cid;
	}
	this.getCid = function() {
		return this.cid;
	}
	this.setWid = function(wid) {
		this.wid = wid;
	}
	this.getWid = function() {
		return this.wid;
	}
	this.setWsq = function(wsq) {
		this.wsq = wsq;
	}
	this.getWsq = function() {
		return this.wsq;
	}
	this.setChk = function(chk) {
		this.chk = chk;
	}
	this.getChk = function() {
		return this.chk;
	}
	this.setEventId = function(eventId) {
		this.eventId = eventId;
	}
	this.getEventId = function() {
		return this.eventId;
	}
	this.setEventValue = function(eventValue) {
		this.eventValue = eventValue;
	}
	this.getEventValue = function() {
		return this.eventValue;
	}
	this.setCallbackFunction = function(callbackFunction) {
		this.callbackFunction = callbackFunction;
	}
	this.getCallbackFunction = function() {
		return this.callbackFunction;
	}
	this.setSendElement(sendElement);
	this.setCid(cid);
	this.setWid(wid);
	this.setWsq(wsq);
	this.setChk(chk);
	if (isNullString(this.cid)) {
		var _formTag = getParentTag(this.sendElement, 'FORM', null);
		var _params;
		if (_formTag != null) {
			var _hidden = _formTag.elements['_CID'];
			this.cid = _hidden.value;
			_hidden = _formTag.elements['_WID'];
			this.wid = _hidden.value;
			_hidden = _formTag.elements['_WSQ'];
			this.wsq = _hidden.value;
			_hidden = _formTag.elements['_CHK'];
			if (_hidden == null) {
				this.chk = '';
			} else {
				this.chk = _hidden.value;
			}
		}
	}
	return this;
}
function doNinjavaSubmit(button, submitValue, useJsCheck, autoDisable, dummy,
 inf, confirmMsg, target, checkNullable, sendDataInTab, callbackFunction) {
	if (isNotNullString(confirmMsg)) {
		if (!confirm(confirmMsg)) return false;
	}
	if (checkNullable == null || checkNullable != false) {
	  checkNullable = true;
	}
	if (sendDataInTab == null || sendDataInTab != false) {
		sendDataInTab = true;
	} else {
		sendDataInTab = false;
	}
	if (CONST.DEBUG) {
		logger.write('sendDataInTab = ' + sendDataInTab);
		logger.write('button = ' + button);
	}
	//if (isNullString(submitValue)) submitValue = '';
	//var submitValues = submitValue.split(',');
  //var _submitInfos = new Array();
  //for (var i=0; i<submitValues.length; i++) {
  //	if (isNotNullString(submitValues[i], true)) {
	//		var _submitInfo = new SubmitInfo(button, submitValues[i], autoDisable, inf, target, null, null, true, null, null, null, null);
	//		_submitInfos.push(_submitInfo);
	//	}
	//}
	var _submitInfos = splitSubmitInfo(button, submitValue, autoDisable, inf, target, true);
	var _parentIsTab = false;
	var _parentTag = getParentTag(button, 'DIV', 'nj:tab_contents');
	var _defaultSWO = null;
	if (_parentTag != null) {
//		if (isNotNullString(submitValue) && !startsWith(submitValue, 'Ajax:')) {
//			alert(MSG.JS_TAB_AJAX_ACTION_ONLY_IN_TAB);
//			return false;
//		}
		_parentIsTab = true;
		_defaultSWO = TAG_ATTRIBUTE.getNjSwo(_parentTag);
		if (isNullString(_defaultSWO)) {
			var _parentParentTab = _parentTag;
			while (_parentParentTab != null) {
				_parentParentTab = getParentTag(_parentParentTab , 'DIV', 'nj:tab_contents');
				if (_parentParentTab != null) {
					_defaultSWO = TAG_ATTRIBUTE.getNjSwo(_parentParentTab);
					if (isNotNullString(_defaultSWO)) break;
				}
			}
		}
		if (isNotNullString(_defaultSWO)) {
			if (CONST.DEBUG) logger.write('target SWO = ' + _defaultSWO);
			for (var i=0; i<_submitInfos.length; i++) {
				_submitInfos[i].setSWO(_defaultSWO);
			}
		}
	} else {
		_parentTag = getParentTag(button, 'SPAN', 'nj:htmlDataView');
	}
	var _parentFormTag = getParentTag(_parentTag, 'FORM', null);
	if (CONST.DEBUG) {
		logger.write('parent Tag = ' + _parentTag);
		logger.write('parent Form Tag = ' + _parentFormTag.name);
	}
	if (startsWith(inf, 'tab:')) {
		_submitInfos[0].setSendParams(false);
		var _tab = getParentTag(button, 'SPAN', 'nj:tab');
		insertTabAction(_submitInfos, button, _defaultSWO, TAG_ATTRIBUTE.NJ_CLOSE_ACTION, _tab);
		var _tabOpenAction = null;
		if (button != null) {
			_tabOpenAction = button.getAttribute(TAG_ATTRIBUTE.NJ_OPEN_ACTION, 1);
		}
		var _openSWO = TAG_ATTRIBUTE.getNjSwo(button);
		if (isNotNullString(_tabOpenAction)) {
			if (isNullString(_openSWO)) _openSWO = _defaultSWO;			
			var _openSubmitInfo = new SubmitInfo(button, _tabOpenAction, false, null, null, button, _openSWO, false,
				_submitInfos[0].getCid(), _submitInfos[0].getWid(), _submitInfos[0].getWsq(), _submitInfos[0].getChk());
			_submitInfos.push(_openSubmitInfo);
		}
	} else if (sendDataInTab) {
		insertTabAction(_submitInfos, button, _defaultSWO, TAG_ATTRIBUTE.NJ_SUBMIT_ACTION, _parentTag);
	}
	if (CONST.DEBUG) {
		logger.write('submitValue = ' + submitValue);
		for (var i=0; i<_submitInfos.length; i++) {
			logger.write('i = ' + i);
			logger.write('_submitInfos[' + i + '] = ' + _submitInfos[i]);
			logger.write('_submitInfos[' + i + '].getSendTab = ' + _submitInfos[i].getSendTab());
		}
	}
	
	//Add Try catch by Juno for DrawingCanpas Runtime Error on IE.
	try {
		if (useJsCheck) {
		  var _checkDatas = new Array();
		  for (var i=0; i<_submitInfos.length; i++) {
				var _wkSubmitValue = _submitInfos[i].getSubmitValue();
				if (isNotNullString(_wkSubmitValue)) {
					var _swo = _submitInfos[i].getSWO();
					var _checkData = new CheckData(_swo, _wkSubmitValue);
					_checkData.addTo(_checkDatas);
			  	if(!checkNinjavaInputValue(_checkDatas, checkNullable)) return false;
			  }
		  }
	  }
  } catch (e) {	}
	
	if (callbackFunction != null) {
  	_submitInfos[_submitInfos.length - 1].setCallbackFunction(callbackFunction);
  }
	doNinjavaSubmitSub(_submitInfos);
	return true;
}
function doNinjavaSubmitSub(submitInfos) {
	if (CONST.DEBUG) {
		logger.write('doNinjavaSubmitSub is called. submitInfos = ' + submitInfos);
		logger.write('submitInfos[0] = ' + submitInfos[0]);
	}
	var submitValue = submitInfos[0].getSubmitValue();
	if (CONST.DEBUG) logger.write('submitValue = ' + submitValue);
	if (startsWith(submitValue, "Ajax:")) {
	  // Ajax	  
	  var _nextSubmitInfos = null;
		if (submitInfos.length > 1) {
			_nextSubmitInfos = new Array(submitInfos.length - 1);
			for (var i=0; i<_nextSubmitInfos.length; i++) {
				_nextSubmitInfos[i] = submitInfos[i+1];
			}
			if (CONST.DEBUG) {
				for (var i=0; i<_nextSubmitInfos.length; i++) {
					logger.write('_nextSubmitInfos[' + i + '] = ' + _nextSubmitInfos[i]);
				}
			}
		}
		var callBackFunction = null;
		var callBackFunctionArgs = null;
		if (_nextSubmitInfos != null) {
			callBackFunction = doNinjavaSubmitSub;
			callBackFunctionArgs = _nextSubmitInfos;
		} else {
			callBackFunction = submitInfos[0].getCallbackFunction();
		}
		if (CONST.DEBUG) {
			logger.write('submitInfos[0].sendTab = ', submitInfos[0].getSendTab());
			logger.write('submitInfos[0].callBackFunction = ', callBackFunction);
		}
		doNinjavaAjaxAction(submitInfos[0], callBackFunction, callBackFunctionArgs);
	} else {
	  // Submit
		var _sendElement = submitInfos[0].getSendElement();
		var formTag = getParentTag(_sendElement, 'FORM', null);
		if (formTag == null) {
			alert('Error!: <form> is not found.');
			return;
		}
		var _target = submitInfos[0].getTarget();
		if (_target == null) {
			// reset
			formTag.target = '';
		} else {
			formTag.target = _target;
		}
		formTag._SUB.value = submitValue;
		formTag._INF.value = submitInfos[0].getInf();
		if (submitInfos[0].isAutoDisable() && isNullString(_target)) {
			// if target is specified, buttons keep disabled status.
			disableButtonLinks(formTag);
		}
		formTag.submit();
	}
}
function insertTabAction(submitInfos, button, defaultSWO, actionAttributeName, tab) {
	if (tab == null) return;
	var _selectedTabs = getChildTags(tab, 'DIV', 'nj:tab_contents', false);
	if (_selectedTabs == null || _selectedTabs.length == 0) return;
	for (var i=_selectedTabs.length-1; i>=0; i--) {
		var _selectedTab = _selectedTabs[i];
		var _tabCloseAction = _selectedTab.getAttribute(actionAttributeName, 1);
		var _nextSWO = defaultSWO;
		if (isNotNullString(_tabCloseAction)) {
			var _closeSWO = TAG_ATTRIBUTE.getNjSwo(_selectedTab);
			if (isNotNullString(_closeSWO)) {
				_nextSWO = _closeSWO;
			}
			if (CONST.DEBUG) {
				logger.write('_tabCloseAction = ' + _tabCloseAction);
				logger.write('_nextSWO = ' + _nextSWO);
			}
			var _closeSubmitInfo = new SubmitInfo(button, _tabCloseAction, false, null, null, _selectedTab, _nextSWO, true,
				 submitInfos[0].getCid(), submitInfos[0].getWid(), submitInfos[0].getWsq(), submitInfos[0].getChk());
			for (var i=submitInfos.length; i>0; i--) {
				submitInfos[i] = submitInfos[i-1];
			}
			submitInfos[0] = _closeSubmitInfo;
		}
		
		//Add Try catch by Juno for DrawingCanpas Runtime Error on IE.
		try {
			var _childTabs = getChildTags(_selectedTab, 'SPAN', 'nj:tab', false);
		} catch (e) {}
		
		if (CONST.DEBUG) logger.write('_childTabs = ' + _childTabs);
		if (_childTabs == null) return;
		for (var i=_childTabs.length-1; i>=0; i--) {
			insertTabAction(submitInfos, button, _nextSWO, actionAttributeName, _childTabs[i]);
		}
	}
}
function disableButtonLinks(formTag) {
	if (formTag == null) return;
	for (var i=0; i<formTag.elements.length; i++) {
		var el = formTag.elements[i];
		if (el.tagName == 'INPUT') {
			if (el.type == 'button' || el.type == 'submit' || el.type == 'reset') {
				el.disabled = true;
			}	
		}
	}
	disableLinks(formTag, false);
}
function disableLinks(parent, searchSelectOptions) {
	if (parent.tagName == 'SELECT' && searchSelectOptions != true) {
		return;
	}
	for (var i=0; i<parent.childNodes.length; i++) {
		var _child = parent.childNodes[i];
		if (_child.tagName != undefined && _child.tagName != 'INPUT') {
			try {
				if (isNotNullString(_child.getAttribute('onclick', 0))) {
					if (CONST.DEBUG) logger.write('_child = ' + _child.tagName + ', type = ' + _child.type + ', onclick=' + _child.onclick);
					_child.setAttribute('onclick', 'return false;');
				}
			} catch (e) {
			}
			disableLinks(_child, searchSelectOptions);
		}
	}
}
function disableButtonLinksSub(el) {
	if (el != null) {
		el.disabled = true;
		for (var i=0; i<el.length; i++) {
			el[i].disabled = true;
		}
	}
}
function splitSubmitInfo(button, submitValue, autoDisable, inf, target, sendParams) {
	if (isNullString(submitValue)) submitValue = '';
	var submitValues = submitValue.split(',');
  var _submitInfos = new Array();
  for (var i=0; i<submitValues.length; i++) {
  	if (isNotNullString(submitValues[i], true)) {
			var _submitInfo = new SubmitInfo(button, submitValues[i], autoDisable, inf, target, null, null, sendParams, null, null, null, null);
			_submitInfos.push(_submitInfo);
		}
	}
	return _submitInfos;
}
//-->

