
function upForm()
{
	this.upType = "upForm";
	this.validateRequired = FormValidateRequired;
	this.validateValue = FormValidateValue;
	this.validatePattern = FormValidatePattern;	
	this.setFocusOn = FormSetFocusOn;	
	this.oFuncPart = null;
}
upForm.prototype = new upContainer();
function FormValidateRequired(p_strMessage)
{
	var fmValidated = true;
	var eleValidated = false;
	var eleName = "";
	var eleNoValList = "";
	var firstNoVal = "";
	var aDoneControls = new Array();
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.FORM_CONSTR_REQUIRED;
	}
	else
	{
		l_strMessage = p_strMessage;
	}
	for (var i=0; i < this.oHtml.length; i++)
	{
		eleUp = null;
		if ((this.oHtml.elements[i].type=="checkbox" && this.oHtml.elements[i].oUp && this.oHtml.elements[i].oUp.group) || (this.oHtml.elements[i].type=="radio" && this.oHtml.elements[i].oUp))
		{
			if (this.oHtml.elements[i].oUp.group.id && !alreadyDone(aDoneControls,this.oHtml.elements[i].oUp.group.id))
			{
				eleUp = this.oHtml.elements[i].oUp.group;
				aDoneControls[aDoneControls.length] = this.oHtml.elements[i].oUp.group.id;
			}
		}
		else if (this.oHtml.elements[i].oUp)
		{
			eleUp = this.oHtml.elements[i].oUp;
			aDoneControls[aDoneControls.length] = this.oHtml.elements[i].name;	 
		}
		else
		{
			continue;
		}
		if (eleUp!=null && eleUp.required && eleUp.required=="1")
		{
			eleValidated = eleUp.validateRequiredDo();
			if (eleValidated==false)
			{
				eleUp.oHtml.className = "SCUP_" + eleUp.styleType + "_notvalid";
				if (eleUp.userName && eleUp.userName !="")
				{
					eleName = eleUp.userName;
				}
				else
				{
					eleName = eleUp.oHtml.id;
				}
				eleNoValList += "\n" + eleName;
				if (firstNoVal=="" && this.oHtml.elements[i].type!="hidden")
				{
					firstNoVal = this.oHtml.elements[i];
				}
				fmValidated = false;
			}
			else
			{
				eleUp.oHtml.className = "SCUP_" + eleUp.styleType + "_normal";		
			}
		}
	}
	if (fmValidated == false)
	{
		alert (l_strMessage + eleNoValList);
		if(firstNoVal!="")
		{
			this.setFocusOn(firstNoVal);
		}
		return false;
	}
	else
	{
		return true;
	}
}
function FormSetFocusOn(oHtml)
{
	if(oHtml.oUp && oHtml.oUp.upType=="upTextareaControl" && document.all && oHtml.oUp.editor && oHtml.oUp.editor=="1")
	{
		editor_focus(document.all["_"+oHtml.name+"_editor"]);
	}	
	else
	{
		oHtml.focus();
	}	
	return true;
}
function FormValidatePattern(p_strMessage)
{
 var isFmValidated = true;
 var isValidated = false;
 var name = "";
 var listOfFailed = "";
 var firstFailed = "";
 var l_strMessage = "";
 var oUp = null;
 if (!p_strMessage || p_strMessage=="")
 {
	l_strMessage = self.oUp.oMessage.FORM_CONSTR_VALUE;
 }
 else
 {
	l_strMessage = p_strMessage;
 }
 for (var i=0; i<this.oHtml.length; i++)
 {
	if (this.oHtml.elements[i].oUp && this.oHtml.elements[i].type=="text" && this.oHtml.elements[i].oUp.pattern && this.oHtml.elements[i].oUp.pattern!="" )
	{
		oUp = this.oHtml.elements[i].oUp;
		isValidated = oUp.matchPattern();
		if (!isValidated)
		{
			oUp.oHtml.className = "SCUP_" + oUp.styleType + "_notvalid";
			if (oUp.userName && oUp.userName !="")
			{
				name = oUp.userName;
			}
			else
			{
				name = oUp.oHtml.id;
			}
			listOfFailed += "\n" + name;
			if (firstFailed=="")
			{
				firstFailed = this.oHtml.elements[i];
			}
			isFmValidated = false;
		}
		else
		{
			oUp.oHtml.className = "SCUP_" + oUp.styleType + "_normal";		
		}
	}
 }
 if (isFmValidated == false)
 {
	alert (l_strMessage + listOfFailed);
	this.setFocusOn(firstFailed);
	return false;
 }
 else
 {
	return true;
 }
}
function FormValidateValue(p_strMessage)
{
 var fmValidated = true;
 var eleValidated = false;
 var eleName = "";
 var eleNoValList = "";
 var firstNoVal = "";
 var aDoneControls = new Array();
 var l_strMessage = "";
 if (!p_strMessage || p_strMessage=="")
 {
	l_strMessage = self.oUp.oMessage.FORM_CONSTR_VALUE;
 }
 else
 {
	l_strMessage = p_strMessage;
 }
 for (var i=0; i<this.oHtml.length; i++)
 {
	if (!this.oHtml.elements[i].oUp || this.oHtml.elements[i].type.substr(0,6)=="select" || this.oHtml.elements[i].oUp.upType=="upMultiSelectControl")
	{
		continue;
	}
	else if(this.oHtml.elements[i].type=="checkbox")
	{
		if(this.oHtml.elements[i].oUp.group && (this.oHtml.elements[i].oUp.group.id && !alreadyDone(aDoneControls,this.oHtml.elements[i].oUp.group.id)))
		{
			eleUp = this.oHtml.elements[i].oUp.group;
			aDoneControls[aDoneControls.length] = this.oHtml.elements[i].oUp.group.id;
		}
		else
		{
			continue;
		}
	}
	else
	{
		eleUp = null;
		if (this.oHtml.elements[i].oUp)
		{
			eleUp = this.oHtml.elements[i].oUp;
		}
		aDoneControls[aDoneControls.length] = this.oHtml.elements[i].name;
	}
	if (eleUp && ((eleUp.min && eleUp.min!="") || (eleUp.max && eleUp.max!="")))
	{
		eleValidated = eleUp.validateValueDo();
		if (!eleValidated)
		{
			eleUp.oHtml.className = "SCUP_" + eleUp.styleType + "_notvalid";
			if (eleUp.userName && eleUp.userName !="")
			{
				eleName = eleUp.userName;
			}
			else
			{
				eleName = eleUp.oHtml.id;
			}
			eleNoValList += "\n" + eleName;
			if (firstNoVal=="")
			{
				firstNoVal = this.oHtml.elements[i];
			}
			fmValidated = false;
		}
		else
		{
			eleUp.oHtml.className = "SCUP_" + eleUp.styleType + "_normal";		
		}
	}
 }
 if (fmValidated == false)
 {
	alert (l_strMessage + eleNoValList);
	this.setFocusOn(firstNoVal);
	return false;
 }
 else
 {
	return true;
 }
}
function alreadyDone(aDoneControls,controlName)
{
 for (var i=0;i<aDoneControls.length;i++)
 {
	 if(aDoneControls[i]==controlName)
	 {
		return true;
	 }
 }
 return false;
}
function upDataControl()
{
 this.pattern = "";
 this.required = "0";
 this.inputLegalChars = "";
 this.formula = "";
 this.readonly = false;
 this.unit = "";
 this.maxlength = "";
 this.bEdit = true;
 this.bVariable = false;
 this.skipReadonlyControl = ControlSkipReadonlyControl;
 this.validateInput = ControlValidateInput;
 this.matchInput = ControlMatchInput;
 this.validateInputLength = ControlValidateInputLength;
 this.validateRequired = ControlValidateRequired;
 this.validateRequiredDo = ControlValidateRequiredDo;
 this.validatePattern = ControlValidatePattern;
 this.matchPattern = ControlMatchPattern;
 this.calcValue = ControlCalcValue;
 this._calcValue = Control_CalcValue;
 this.setRequiredStyle = ControlSetRequiredStyle;
}
upDataControl.prototype = new upControl();
function ControlSetRequiredStyle()
{
	if(!(this.required==1) || !this.oStyle || !self.oUp.oRootWin ||!self.oUp.oRootWin.oFormatInfo.oRequiredStyle)
	{
		return false;
	}
	var oRequiredStyle = self.oUp.oRootWin.oFormatInfo.oRequiredStyle;
	this.oStyle["backgroundRepeat"] = oRequiredStyle["backgroundRepeat"];
	this.oStyle["backgroundImage"] = oRequiredStyle["backgroundImage"];
	this.oStyle["backgroundPosition"] = oRequiredStyle["backgroundPosition"];	
}
function ControlSkipReadonlyControl()
{
	var fm = this.oHtml.form;
	var fmLength = fm.length;
	var start;
	for (i=0;i<fmLength;i++)
	{
	 if (this.oHtml.name == fm.elements[i].name)
	 {
		if (i+1 >= fmLength)
		{
			start = 0;
		}
		else
		{
			start = i+1;
		}
		for(j=start; j<fmLength; j++)
		{
			oHtml = fm.elements[j];
			if(!oHtml.oUp)
				continue;	
			if(oHtml.type != "hidden" && oHtml.style.display!="none" && oHtml.oUp.readonly==false)
			{
				if(fm.oUp.setFocusOn(oHtml))
					return true;
				else
					continue;	
			}
		}
		self.oUp.setFocus();
		return true;
	 }
	}
	return false;
}
function ControlValidateInput()
{
	return this.matchInput();
}
function ControlMatchInput()
{
	var key = Browser.getEventKeyCode();
	if (key==13)
	{
		var rv = true;
		if(this.format)rv = this.format();
		if(rv)return true;
		return false;
	}
	else if (key==0 ||  key==8 ||  key==9 || (key >= 33 && key <= 40) || key==45)
	{
		return true;
	}
	else
	{
		var keyChar = Browser.getEventKeyChar();
		var legalChars = this.inputLegalChars;
		if (legalChars.indexOf(keyChar)>-1 || legalChars.toLowerCase().indexOf(keyChar)>-1)
		{
			return true;
		}
		else
		{
			return false;
		}
	}	
}
function ControlValidateInputLength(p_strMessage)
{
 var l_strMessage = "";
 if (!p_strMessage || p_strMessage=="")
 {
	l_strMessage = self.oUp.oMessage.CTRL_CONSTR_LENGTH;
 }
 else
 {
	l_strMessage = p_strMessage;
 }
 if (!this.inputLength || this.inputLength=="")
 {
	return true;
 }
 if (this.inputLength < this.oHtml.value.length)
 {
	alert(l_strMessage);
	this.oHtml.value = this.oHtml.value.substring(0,this.inputLength);
	return false;
 }
 return true;
}
function ControlValidatePattern(p_strMessage)
{
 var l_strMessage = "";
 if (arguments.length > 0)l_strMessage = p_strMessage;
  else l_strMessage = self.oUp.oMessage.CTRL_CONSTR_PATTERN;
 return this.matchPattern(l_strMessage);
}
function ControlMatchPattern(p_strMessage)
{
   if(arguments.length < 1)l_strMessage="";
   else l_strMessage = p_strMessage;
   var value = this.oHtml.value;
   var pattern = this.pattern;
   if (value == "")
   {
	  return true;
   }
   if (!pattern || pattern == "")
   {
	  return true;
   }
   if (pattern.toString().substr(0,1)== "/")
   {
	  pattern = pattern.toString().substr(1,pattern.toString().length-1);
   }
   if (pattern.toString().substr(pattern.length-1,1)== "/")
   {
	  pattern = pattern.toString().substring(0,pattern.toString().length-1);
   }
  reg = new RegExp(pattern,"i");
  if(reg.test(value))
  {
	 return true;
  }
  else
  {
	 if(l_strMessage!="")alert(l_strMessage);
	 return false;
  }
}
function ControlValidateRequired(p_strMessage)
{
 var l_strMessage = "";
 if (!p_strMessage || p_strMessage=="")
 {
	l_strMessage = self.oUp.oMessage.CTRL_CONSTR_PATTERN;
 }
 else
 {
	l_strMessage = p_strMessage;
 }
 if (!this.validateRequiredDo())
 {
	alert(l_strMessage);
	return false;
 }
 return true;
}
function ControlValidateRequiredDo()
{
	var value = this.oHtml.value;
	if (value == "")
	{
		return false;
	}
	return true;
}
function ControlCalcValue(pFormula, bDuration)
{
	if(arguments.length < 2)bDuration=false;
	var result = this._calcValue(pFormula, bDuration);
	return Browser.setValue(this, result);
	return true;
}
function Control_CalcValue(pFormula, bDuration)
{
	var formula = "";
	var bDT = false;
	aFormula = pFormula.split("|");
	for (var i=0;i<aFormula.length;i++)
	{
		var item = aFormula[i];
		var value = "";
		var result = "";
		var result_iso = "";
		var oControl = null;  
		var oVariable = null;
		var oDate = null;
		if (item.substr(0,1) == "F")
		{
			oControl = eval("o" + item.substr(1,item.length));
			value = Browser.getValue(oControl);
			if(oControl.upType=='upFloatControl' || oControl.upType=='upIntegerControl' || oControl.upType=='upCurrencyControl')
			{
				value = oControl.toJSNumber(value);
				if ((isNaN(value) || !isFinite(value)) && Browser.handleException)
				{
					throw new upException("N_NaN",oControl,self.oUp.oMessage.CALC_ERR_FLD_NO_VALID_NUMBER,"");
				}
			}	
			if(oControl.upType=='upDateControl' || oControl.upType=='upTimeControl' || oControl.upType=='upDateTimeControl')
			{ 
				bDT = true;
				oDate =	oControl.setDateObjectFromLocal(value);
				value = Date.parse(oDate);
				if ((isNaN(value) || !isFinite(value)) && Browser.handleException)	
				{
					throw new upException("DT_NaN",oControl,self.oUp.oMessage.CALC_ERR_FLD_NO_VALID_DATE,"");
				}
			}	
		}
		else if (item.substr(0,1) == "V")
		{
			oVariable = eval("self.oUp.oPage.oVariables." + item.substr(1,item.length));
			value = oVariable.value;
			if(oVariable.upType=='upFloatControl' || oVariable.upType=='upIntegerControl')
			{
				value = oVariable.toJSNumber(value);
				if ((isNaN(value) || !isFinite(value)) && Browser.handleException,"")
				{
					throw new upException("N_NaN",oVariable,self.oUp.oMessage.CALC_ERR_VAR_NO_VALID_NUMBER,"");
				}
			}	
			if(oVariable.upType=='upDateControl' || oVariable.upType=='upTimeControl' || oVariable.upType=='upDateTimeControl')
			{
				bDT = true;
				oDate =	oVariable.setDateObjectFromLocal(value);
				value = Date.parse(oDate);
				if ((isNaN(value) || !isFinite(value)) && Browser.handleException)
				{
					throw new upException("DT_NaN",oVariable,self.oUp.oMessage.CALC_ERR_VAR_NO_VALID_DATE,"");
				}
			}	
		}
		else if (item.substr(0,1) == "J")
		{
			if(this.upType=='upDateControl' || this.upType=='upDateTimeControl' || this.upType=='upTimeControl')
				bDT = true;
			oVariable = eval("self.oUp.oPage.oVariables." + item.substr(1,item.length));
			oDate =	oVariable;
				value = Date.parse(oDate);
				if ((isNaN(value) || !isFinite(value)) && Browser.handleException)
				{
					throw new upException("DT_NaN",oVariable,self.oUp.oMessage.CALC_ERR_VAR_NO_VALID_DATE,"");
				}
		}
		else
		{
			value = item;
		}
		formula = formula + value + ' ';
	}
	result = eval(formula);
	if(bDT)
	{
		if(this.upType=='upIntegerControl')
		{
			result = parseInt(Math.round(result),10);
			if ((isNaN(result) || !isFinite(result)) && Browser.handleException)
			{
				throw new upException("N_NaN","",self.oUp.oMessage.CALC_ERR_RESULT_NO_VALID_NUMBER,formula);
			}
			result = this.toLocalFormat(result);			
		}
		else if(this.upType=='upTextControl')
		{
			if ((isNaN(result) || !isFinite(result)) && Browser.handleException)
			{
				throw new upException("DT_NaN","",self.oUp.oMessage.CALC_ERR_RESULT_NO_VALID_DATE,formula);
			}
			oDate = new Date();
			oDate.setTime(Math.abs(result));
			var oTempDateTimeControl = new upDateTimeControl();
			if(bDuration)result = oTempDateTimeControl.toLocalDurationString(oDate);
			else result = oTempDateTimeControl.toLocalHourMinString(oDate);
		}
		else if(this.upType=='upDateControl' || this.upType=='upDateTimeControl' || this.upType=='upTimeControl')
		{
			if ((isNaN(result) || !isFinite(result)) && Browser.handleException)
			{
				throw new upException("DT_NaN","",self.oUp.oMessage.CALC_ERR_RESULT_NO_VALID_DATE,formula);
			}
			oDate = new Date();
			oDate.setTime(Math.abs(result));
			result = this.toLocalFormat(oDate);
		}
		else
		{
			result = "";
		}	
	}
	else
	{
		if ((isNaN(result) || !isFinite(result)) && Browser.handleException)
		{
			throw new upException("N_NaN","",self.oUp.oMessage.CALC_ERR_RESULT_NO_VALID_NUMBER,formula);
		}
		result = this.toLocalFormat(result);			
	}
	return result;
}
function upNumericsMainControl()
{
 this.min = "";
 this.max = "";
 this.fracDigits = 2;
 this.styleType = "Editfield_Number";	
 this.groupSep = "";
 this.getLastZeros = NumericsGetLastZeros;
 this.correctNumberGroup = NumericsCorrectNumberGroup;
 this.correctDecimalValue = NumericsCorrectDecimalValue;
 this.validateValue = NumericsValidateValue;
 this.validateValueDo = NumericsValidateValueDo;
 this.round = NumericsRound;
 this.correctValue = NumericsCorrectValue;
}
upNumericsMainControl.prototype = new upDataControl();
function NumericsCorrectValue(input)
{
	var output = "";
	output = this.toJSNumber(input);
	if(isNaN(output))
	{
		return false;	 
	}
	else
	{
		return this.toLocalFormat(output);	 
	}
}
function NumericsRound(number,decs)
{
	var decimal;
	if (!number || number=='')
	{
		return '0';
	}
	var value = 0;
	if (!decs || decs=='')
	{	
		decimal = 2;
	}	
	else
	{
		decimal = decs;
	}
	value = Math.round(number * Math.pow(10,decimal))/Math.pow(10,decimal);
	return value;
}
function NumericsGetLastZeros(decs)
{
	var strDec = "";
	for (var i=1; i<=decs; i++)
	{
		strDec = strDec + "0";
	}
	return strDec;
}
function NumericsCorrectNumberGroup(input)
{
   var value = input.toString();
   var groupSep = this.groupSep;
   if(value=="")
   {
		value = "0";
   }
   var checkEnd = 0;
   // Ende des Parsens finden;"+" oder "-" vorhanden?
   if (value.substr(0,1)=='+' | value.substr(0,1)=='-')
   {
	  checkEnd = 1;
   }
   else
   {
	  checkEnd = 0;
   }
   var checkStart = value.length-1;
   var j = 0;
   for(i=checkStart;i>=checkEnd;i--)
   {
	if(j==3)
	{
		if(value.charAt(i) != groupSep)
		{
			value = value.substring(0,i+1) + groupSep + value.substring(i+1,value.length);
			i++;
		}
		j = 0;
	}
	else
	{
		j++;
	}	
   }
	if(this.leadingNulls==false && value=="0")
	{
		value = ""; 
	}
	else if(this.leadingNulls==false && value=="-0")
	{
		value = "-"; 
	}
	return value;
}
function NumericsCorrectDecimalValue(value)
{
	var decimal = this.fracDigits;
	var out = "";
	value = value.toString();
	if (! value || value.length == 0)
	{
	   out= this.getLastZeros(decimal);
	   return out;
	}
	if(value.length > decimal)
	{
		return value.substr(0,decimal);
	}
	else
	{
		return value + this.getLastZeros(decimal - value.length);
	}
}
function NumericsValidateValue(p_strMessage)
{
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.NUMERIC_CONSTR_VALUE;
	}
	else
	{
		l_strMessage = p_strMessage;
	}
	if (!this.validateValueDo())
	{
		alert(l_strMessage);
		return false;
	}
	return true;
	}
function NumericsValidateValueDo()
{
 var bNotInRange = false;
 var htmlValue;
 htmlValue = Browser.getValue(this);
 if (htmlValue.length == 0)
 {
   return true;
 }
 var value = this.toJSNumber(htmlValue);
 if(isNaN(value))
 {
   return false;
 }
   if (this.max!="" && !isNaN(this.max) && value > this.max)
 {
	bNotInRange = true;
 }
 if (this.min!="" && !isNaN(this.min) && value < this.min)
 {
	bNotInRange = true;
 }
 if (bNotInRange)
 {
  return false;
 }
 return true;
}
function upIntegerControl()
{
 this.groupSep = self.oUp.oFormatInfo.numGroupSep;
 this.upType = "upIntegerControl";
 this.fracDigits = 0;
 this.allowEmpty = true;
 this.toJSNumber = IntegerToJSNumber;
 this.toLocalFormat = IntegerToLocalFormat;
 this.format = IntegerFormat;
 this.validateInput = IntegerValidateInput;
}
upIntegerControl.prototype = new upNumericsMainControl();
function IntegerToJSNumber(input)
{
 if (input.length == 0)
 {
  return parseInt("0",10);
 }
 var output = input;
 if(this.groupSep!='')
 {
  output = Helper.replaceSubstring(output,this.groupSep,"")
 }
 return parseInt(output,10);
}
function IntegerToLocalFormat(input)
{
 var value = parseInt(input,10);
 if(isNaN(value))
 {
	return false;
 }
 value = value.toString();
 value = this.correctNumberGroup(value);
 return value;
}
function IntegerValidateInput()
{
 this.inputLegalChars = "-+0123456789" + this.groupSep;
  var keyChar = Browser.getEventKeyChar();
 if (keyChar=="-" && this.oHtml.value.indexOf("-")>-1)
 {
  return false;
 }
 return this.matchInput();
}
function IntegerFormat(p_strMessage)
{
 var l_strMessage = "";
 if (!p_strMessage || p_strMessage=="")
 {
	l_strMessage = self.oUp.oMessage.INT_CONSTR_PATTERN;
 }
 else
 {
	l_strMessage = p_strMessage;
	return false;
 }
 var value = Browser.getValue(this);
 if(value=="" && this.allowEmpty)return true;
 value = this.correctValue(value);
 if(!value)
 {
	alert(l_strMessage);
 }
 else 	
 {
	Browser.setValue(this,value);
 }
 return true;
}
function upCurrencyControl()
{
 this.upType = "upCurrencyControl";
 this.groupSep = self.oUp.oFormatInfo.currGroupSep;
 this.decSep = self.oUp.oFormatInfo.currDecSep;
 this.fracDigits = self.oUp.oFormatInfo.currFracDigits;
 this.leadingNulls = self.oUp.oFormatInfo.currLeadNulls;
 this.inputLegalChars = "-+0123456789" + this.groupSep + this.decSep;
 this.allowEmpty = true; 
 this.toJSNumber = CurrencyToJSNumber;
 this.toLocalFormat = CurrencyToLocalFormat;
 this.format = CurrencyFormat;
 this.validateInput = CurrencyValidateInput;
}
upCurrencyControl.prototype = new upNumericsMainControl();
function CurrencyToJSNumber(input)
{
 if (input.length == 0)
 {
  return "0";
 }
 var output = input;
 if(this.groupSep!='')
 {
  output = Helper.replaceSubstring(output,this.groupSep,"")
 }
 output = output.toString().replace(this.decSep,".");
 return parseFloat(output);
}
function CurrencyToLocalFormat(input)
{
 var value = parseFloat(input);
 var preDec = "";
 var postDec = "";
 if(isNaN(value))
 {
	return false;
 }
 value = this.round(value,this.fracDigits);
 value = value.toString();
 if(value.indexOf(".")>-1)
 {
	preDec = this.correctNumberGroup(value.substring(0,value.indexOf(".")));
 }
 else
 {
	preDec = this.correctNumberGroup(value);
 }	
 if(value.indexOf(".")>-1)
 {
	 postDec = this.correctDecimalValue(value.substring(value.indexOf(".")+1));
 }
 else	 
 {
	 postDec = this.correctDecimalValue("");
 }
 value = preDec;
 if(postDec!="")value = value  + this.decSep + postDec;
 return value;
}
function CurrencyValidateInput()
{
 this.inputLegalChars = "-+0123456789" + this.groupSep + this.decSep;
 var keyChar = Browser.getEventKeyChar();
 if (this.decSep && keyChar==this.decSep && this.oHtml.value.indexOf(this.decSep)>-1)
 {
  return false;
 }
 if (keyChar=="-" && this.oHtml.value.indexOf("-")>-1)
 {
  return false;
 }
 return this.matchInput();
}
function CurrencyFormat(p_strMessage)
{
 var l_strMessage = "";
 if (!p_strMessage || p_strMessage=="")
 {
	l_strMessage = self.oUp.oMessage.CURRENCY_CONSTR_PATTERN;
 }
 else
 {
	l_strMessage = p_strMessage;
 }
 var value = Browser.getValue(this);
 if(value=="" && this.allowEmpty)return true;
 value = this.correctValue(value);
 if(!value)
 {
	alert(l_strMessage);
	return false;
 }
 else 	
 {
	Browser.setValue(this,value);
 }
 return true; 
}
function upFloatControl()
{
 this.upType = "upFloatControl";
 this.groupSep = self.oUp.oFormatInfo.numGroupSep;
 this.decSep = self.oUp.oFormatInfo.numDecSep;
 this.fracDigits = self.oUp.oFormatInfo.numFracDigits;
 this.leadingNulls = self.oUp.oFormatInfo.numLeadNulls;
 this.inputLegalChars = "-+0123456789" + this.groupSep + this.decSep;
 this.allowEmpty = true; 
 this.toJSNumber = FloatToJSNumber;
 this.toLocalFormat = FloatToLocalFormat;
 this.format = FloatFormat;
 this.validateInput = FloatValidateInput;
}
upFloatControl.prototype = new upNumericsMainControl();
function FloatToJSNumber(input)
{
 if (input.length == 0)
 {
  return "0";
 }
 var output = input;
 if(this.groupSep!='')
 {
  output = Helper.replaceSubstring(output,this.groupSep,"")
 }
 output = output.toString().replace(this.decSep,".");
 return parseFloat(output);
}
function FloatToLocalFormat(input)
{
 var value = parseFloat(input);
 var preDec = "";
 var postDec = "";
 if(isNaN(value))
 {
	return false;
 }
 value = this.round(value,this.fracDigits);
 value = value.toString();
 if(value.indexOf(".")>-1)
 {
	preDec = this.correctNumberGroup(value.substring(0,value.indexOf(".")));
 }
 else
 {
	preDec = this.correctNumberGroup(value);
 }	
 if(value.indexOf(".")>-1)
 {
	 postDec = this.correctDecimalValue(value.substring(value.indexOf(".")+1));
 }
 else	 
 {
	 postDec = this.correctDecimalValue("");
 }
 value = preDec;
 if(postDec!="")value = value  + this.decSep + postDec;
 return value;
}
function FloatValidateInput()
{
 this.inputLegalChars = "-+0123456789" + this.groupSep + this.decSep;
 var keyChar = Browser.getEventKeyChar();
 if (this.decSep && keyChar==this.decSep && this.oHtml.value.indexOf(this.decSep)>-1)
 {
  return false;
 }
 if (keyChar=="-" && this.oHtml.value.indexOf("-")>-1)
 {
  return false;
 }
 return this.matchInput();
}
function FloatFormat(p_strMessage)
{
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.FLOAT_CONSTR_PATTERN;
	}
	else
	{
		l_strMessage = p_strMessage;
		return false;
	}
	var value = Browser.getValue(this);
	if(value=="" && this.allowEmpty)return true;
	value = this.correctValue(value);
	if(!value)
	{
		alert(l_strMessage);
	}
	else 	
	{
		Browser.setValue(this,value);
	}
	return true;
}
function upDateTimeMainControl()
{
	this.min = "";
	this.max = "";
	this.inputLegalChars = "";
	this.pattern = "";
	this.styleType = "Editfield_Date";	
	this.initDateObject = DateTimeInitDateObject;
	this.setDateObjectFromLocalDate = DateTimeSetDateObjectFromLocalDate;
	this.setDateObjectFromLocalTime = DateTimeSetDateObjectFromLocalTime;
	this.validateDate = DateTimeValidateDate;
	this.validateTime = DateTimeValidateTime;
	this.validateDateValue = DateTimeValidateDateValue;
	this.validateTimeValue = DateTimeValidateTimeValue;
	this.getCurrDateTime = DateTimeGetCurrDateTime;
	this.getCurrTime = DateTimeGetCurrTime;
	this.getCurrDate = DateTimeGetCurrDate;
	this.getDatePart = DateTimeGetDatePart; 
	this.getTimePart = DateTimeGetTimePart;  
	this.isDateInMonth = DateTimeIsDateInMonth;
	this.daysInFebruary = DateTimeDaysInFebruary;
	this.isMonth = DateTimeIsMonth;
	this.isIntegerInRange = DateTimeIsIntegerInRange;
	this.getbHours24 = DateTimeGetbHours24;
	this.getTimeSep = DateTimeGetTimeSep;
	this.getTimeMarker = DateTimeGetTimeMarker;
	this.getbSeconds = DateTimeGetbSeconds;
	this.getbFillHours = DateTimeGetbFillHours;
	this.getTimeString = DateTimeGetTimeString;
	this.toLocalDateString = DateTimeToLocalDateString;
	this.toISODateString = DateTimeToISODateString;
	this.toLocalTimeString = DateTimeToLocalTimeString;
	this.toISOTimeString = DateTimeToISOTimeString;	
	this.toLocalDurationString = DateTimeToLocalDurationString;
	this.toLocalHourMinString = DateTimeToLocalHourMinString;
}
upDateTimeMainControl.prototype = new upDataControl();
function DateTimeInitDateObject()
{
	var oDate = new Date();
	oDate.setHours('00');
	oDate.setMinutes('00');
	oDate.setSeconds('00');
	oDate.setFullYear('1970');
	oDate.setMonth('0');
	oDate.setDate('1');		
	return oDate;
}
function DateTimeSetDateObjectFromLocalDate(oDate,strDate)
{
	if(arguments.length < 2)
	{
		return false;
	}
	oDate.setFullYear(this.getDatePart(strDate,"y"));	
	oDate.setMonth(this.getDatePart(strDate,"M")-1);	
	oDate.setDate(this.getDatePart(strDate,"d"));	
	return oDate;
}
function DateTimeSetDateObjectFromLocalTime(oDate,strTime)
{
	if(arguments.length < 2)
	{
		return false;
	}
	oDate.setHours(this.getTimePart(strTime,"h"));
	oDate.setMinutes(this.getTimePart(strTime,"m"));
	oDate.setSeconds(this.getTimePart(strTime,"s"));
	return oDate;
}
function DateTimeGetDatePart(strDate,partSymbol)
{
	if(arguments.length < 2)
	{
		return strDate;
	}
	var partString = "";
	aDate = Helper.trim(strDate).split(this.dateSep);
	var aDateFormatTemp = this.dateFormat.split(this.dateSep);
	var aDateFormat = new Array();
	for( var i=0; i < aDateFormatTemp.length; i++)
	{
		aDateFormat[aDateFormatTemp[i].substring(0,1)] = i;
	}	
	partString = aDate[aDateFormat[partSymbol]];
	return parseInt(partString,10);
}
function DateTimeGetTimePart(strTime,partSymbol)
{
	if(arguments.length < 2)
	{
		return strTime;
	}
	var dayTimeAdd = 0;
	var seconds,minutes,hours,timeMarker,result,reg,output;
	var dtCurrDate = new Date();
	reg = new RegExp(this.timePattern,"i")
	result = Helper.trim(strTime).match(reg);
	if (!result)
	{
		output = strTime;
	}
	if(partSymbol=="h")
	{
		hour = parseInt(Helper.trim(result[1]),10);
		if (this.bSeconds)
		{
			timeMarker = result[7];
		}
		else
		{
			timeMarker = result[5];
		}
		if (timeMarker != null)
		{
			timeMarker = timeMarker.toLowerCase();
		}
		else
		{
			timeMarker = "";
		}
		if (this.bHours24 != 1)
		{
			var pos = this.timeFormat.indexOf('a');
			pos = pos;
			var timeMarker = strTime.substr(pos,2);
			if(timeMarker && (timeMarker == "pm" || timeMarker == "PM") && hour=="12")
			{
				hour = 12;
			}
			else if(timeMarker && (timeMarker == "pm" || timeMarker == "PM"))
			{
				hour = parseInt(hour)
				hour += 12;
			}
			if(timeMarker && (timeMarker == "am" || timeMarker == "AM") && hour=="12")
			{
				hour = 0;
			}
		}
		if(isNaN(hour) || !this.isIntegerInRange(hour,0,23))
		{
			hour = dtCurrDate.getHours();
		}
		output =  hour;
	}	
	if(partSymbol=="m")
	{
		minutes = parseInt(Helper.trim(result[3]),10);
		if(isNaN(minutes) || !this.isIntegerInRange(minutes,0,59))
		{
			minutes = "00";
		}
		output =  minutes;
	}	
	if(partSymbol=="s")
	{
		if (this.bSeconds)
		{
			seconds = parseInt(Helper.trim(result[5]),10);
		}
		if(isNaN(seconds) || !this.isIntegerInRange(seconds,0,59))
		{
			seconds = "00";
		}
		output =  seconds;
	}	
	return parseInt(output,10);
}
function DateTimeToLocalDateString(oDate)
{
	var dateSep = this.dateSep;
	var df = this.dateFormat;
	var output = "";
	aDf = df.split(dateSep);
	for(i=0;i<aDf.length;i++)
	{
		if(aDf[i]=="dd")
		{
			output = output + this.fillLeading(oDate.getDate());
		}
		else if(aDf[i]=="yyyy")
		{
			output = output + oDate.getFullYear();
		}
		else if(aDf[i]=="MM")
		{
			output = output + this.fillLeading(oDate.getMonth()+1);
		}
		if(i<aDf.length-1)
		{
			output = output + dateSep;
		}
	}
	return output;
}
function DateTimeToISODateString(oDate)
{
	if(!oDate)return false;
	var output = "";
	output = oDate.getFullYear() + "-" + this.fillLeading(oDate.getMonth()+1) + "-"+ this.fillLeading(oDate.getDate());
	return output;
}
function DateTimeToLocalHourMinString(oDate)
{
	var output = "";
	var marker = "";
	this.setDateTimeProps();
	oDateTemp = new Date();
	oDateTemp.setFullYear(1970);
	oDateTemp.setMonth(0);				
	oDateTemp.setDate(1);
	oDateTemp.setUTCHours(oDate.getUTCHours());
	oDateTemp.setUTCMinutes(oDate.getUTCMinutes());
	oDateTemp.setUTCSeconds(oDate.getUTCSeconds());
	oDateTemp.setTime(Date.parse(oDate) - Date.parse(oDateTemp));
	var hours = Math.round(oDateTemp.getTime()/(1000*60*60));
	hours = parseInt(hours, 10) + oDate.getUTCHours();
	output = hours;
	output = output + this.aTimeSep[0] + this.fillLeading(oDate.getUTCMinutes());
	if(this.bSeconds)
	{
		output = output + this.aTimeSep[1] + this.fillLeading(oDate.getUTCSeconds());
	}
	return output;
}
function DateTimeToLocalDurationString(oDate)
{
	var output = "";
	var value = "";
	var marker = "";
	this.setDateTimeProps();
	oDateTemp = new Date();
	oDateTemp.setFullYear(1970);
	oDateTemp.setMonth(0);				
	oDateTemp.setDate(1);
	oDateTemp.setUTCHours(oDate.getUTCHours());
	oDateTemp.setUTCMinutes(oDate.getUTCMinutes());
	oDateTemp.setUTCSeconds(oDate.getUTCSeconds());
	oDateTemp.setTime(Date.parse(oDate) - Date.parse(oDateTemp));
	var days = Math.round(oDateTemp.getTime()/(1000*60*60*24));
	value = days;
	if(value > 0)
	{
		output = output + value + " ";
		if(value == 1)
		{
			marker = self.oUp.oMessage.CAL_DAY;
		}
		else
		{
			marker = self.oUp.oMessage.CAL_DAYS;				
		}
		output = output + marker + "  ";
	}
	value = oDate.getUTCHours();
	if(value > 0)
	{
		output = output + value + " ";
		if(value == 1)
		{
			marker = self.oUp.oMessage.CAL_HOUR;
		}
		else
		{
			marker = self.oUp.oMessage.CAL_HOURS;				
		}
		output = output + marker + "  ";
	}
	value = oDate.getMinutes();
	if(value > 0)
	{
		output = output + value + " ";
		if(value == 1)
		{
			marker = self.oUp.oMessage.CAL_MINUTE;
		}
		else
		{
			marker = self.oUp.oMessage.CAL_MINUTES;				
		}
		output = output + marker + "  ";
	}
	value = oDate.getSeconds();
	if(value > 0)
	{
		output = output + value + " ";
		if(value == 1)
		{
			marker = self.oUp.oMessage.CAL_SECOND;
		}
		else
		{
			marker = self.oUp.oMessage.CAL_SECONDS;				
		}
		output = output + marker + "  ";
	}
	return output;
}
function DateTimeToLocalTimeString(oDate)
{
	var output = "";
	output = this.getTimeString(oDate.getHours(),this.fillLeading(oDate.getMinutes()),this.fillLeading(oDate.getSeconds()));
	return output;
}
function DateTimeToISOTimeString(oDate)
{
	var output = "";
	output = oDate.getHours() + ":" + this.fillLeading(oDate.getMinutes()) + ":" + this.fillLeading(oDate.getSeconds());
	return output;
}
function DateTimeGetTimeString(hour,minutes,seconds,p_strTimeMarker)
{
	var timeString = "";
	var timeMarker = "";	
	this.bFillHours = this.getbFillHours();
	if(this.bHours24 == 0)
	{
		if(!p_strTimeMarker)
		{
			if(hour > 11)
			{
				timeMarker = "pm";
			}
			else
			{
				timeMarker = "am";
			}
		}
		else
		{
			timeMarker = p_strTimeMarker;
		}	
		if (hour == 0) 
		{
			hour = 12;
		}
		if(hour > 12)
		{
			hour = hour - 12;
		}
	}
	if(this.bFillHours)
	{
		timeString = Helper.trim(this.fillLeading(hour));
	}
	else
	{
		timeString = Helper.trim(hour);	
	}
	timeString = timeString + this.aTimeSep[0] + this.fillLeading(minutes);
	var ind = 1;
	if (this.bSeconds)
	{
		timeString = timeString + this.aTimeSep[ind] + Helper.trim(this.fillLeading(seconds));
		ind++;
	}
	if (this.bTimeMarker)
	{
		timeString = timeString + this.aTimeSep[ind] + timeMarker;
	}
	return timeString;
}
function DateTimeGetTimeSep()
{
	var startPos = 0;
	var strLegalTimeSymbols = "Hhmsa";
	var timeFormat = this.timeFormat;
	if(typeof timeFormat == "undefined") 
		timeFormat = self.oUp.oFormatInfo.timeFormat;
	var aTimeSep = new Array();
	var j = 0;
	for(var i=0; i < timeFormat.length; i++)
	{
		if(strLegalTimeSymbols.indexOf(timeFormat.substr(i,1)) > -1)
		{
			if(i > startPos)
			{
				aTimeSep[j] = timeFormat.substring(startPos,i);					
				j++;
				startPos = i + 1;
			}
			else
			{
				startPos++;	
			}
		}
	}
	return aTimeSep;
}
function DateTimeGetbSeconds()
{
	var format = this.timeFormat;
	var bSeconds = false;
	if (format.indexOf('ss') > -1)
	{
		bSeconds = true;
	}
	return bSeconds;
}
function DateTimeGetbFillHours()
{
	var format = this.timeFormat;
	var bFillHours = false;
	if (format.toLowerCase().indexOf('hh') > -1)
	{
		bFillHours = true;
	}
	return bFillHours;
}
function DateTimeGetTimeMarker()
{
 var format = this.timeFormat;
 var bTimeMarker = false;
 if (format.indexOf('aa') > -1 || format.indexOf('a') > -1 )
 {
  bTimeMarker = true;
 }
 return bTimeMarker;
}
function DateTimeGetbHours24()
{
	var format = this.timeFormat;
	var bHours24 = 1;
	if (format.indexOf('h') > -1)
	{
		bHours24 = 0;
	}
	else
	{
		bHours24 = 1;
	}
	return bHours24;
}
function DateTimeValidateDate(strDate)
{
	var day,month,year;
	var dtCurrDate = new Date();
	var dateSep = this.dateSep;
	var newValue = "";
	strDate = Helper.trim(new String(strDate));
	day = this.getDatePart(strDate,"d");
	month = this.getDatePart(strDate,"M");
	year = this.getDatePart(strDate,"y");
	if(month=="" || isNaN(month) || !this.isMonth(month))
	{
		month = dtCurrDate.getMonth() + 1;
	}
	if (day=="" || isNaN(day) || !this.isDateInMonth(day,month,year) || day < 1)
	{
		day = dtCurrDate.getDate();
	}
	if (year=="" || isNaN(year) || year > 9999)
	{
		year = dtCurrDate.getFullYear();
	}
	else
	{
		if (year < 100 && year > 30 )
		{
			year = 1900 + year;
		}
		if(year <= 30)
		{
			year = 2000 + year;
		}
	}
	if ( month==2  &&  day > this.daysInFebruary(year))
	{
		day = this.daysInFebruary(year);
	}
	var oDate = this.initDateObject();
	oDate.setFullYear(year);	
	oDate.setMonth(parseInt(month,10) - 1);	
	oDate.setDate(day);
	newValue = this.toLocalDateString(oDate);
	return newValue;
}
function DateTimeValidateDateValue(date)
{
	var day,month,year;
	var bNotInRange = false;
	var dateInRange = "between";
	var input = Helper.trim(date);
	day = this.getDatePart(input,"d");
	month = this.getDatePart(input,"M");
	year = this.getDatePart(input,"y");
	var dateInt = parseInt(this.fillLeading(year).toString() + this.fillLeading(month).toString() + this.fillLeading(day).toString());
	var regMinMax = new RegExp("^\\s*((\\d{1,4})(\\-)(\\d{1,2})(\\-)(\\d{1,2}) ?){1}\\s*((\\d{1,2})?(:)?(\\d{1,2})?(:)?(\\d{1,2})? *((A|P)M)?)?\\s*$")
	var min = Helper.trim(this.min); 
	if(min!="")
	{
		if(this.utc && this.utc=='1')
		{
			var oDateMin =	this.setUTCDateObjectFromISO(min);
		}
		else
		{
			var oDateMin =	this.setDateObjectFromISO(min);	
		}	
		var dayMin = this.fillLeading(oDateMin.getDate());
		var monthMin = this.fillLeading(oDateMin.getMonth()+1);
		var yearMin =  this.fillLeading(oDateMin.getFullYear());	
		dateMinInt = parseInt(yearMin.toString() + monthMin.toString() + dayMin.toString());
	}	
	var max = Helper.trim(this.max);
	if(max!="")
	{
		if (this.utc && this.utc=='1')
		{
			var oDateMax =	this.setUTCDateObjectFromISO(max);
		}
		else
		{
			var oDateMax =	this.setDateObjectFromISO(max);	
		}	
		var dayMax = this.fillLeading(oDateMax.getDate());
		var monthMax = this.fillLeading(oDateMax.getMonth()+1);
		var yearMax =  this.fillLeading(oDateMax.getFullYear());	
		dateMaxInt = parseInt(this.fillLeading(yearMax).toString() + this.fillLeading(monthMax).toString() + this.fillLeading(dayMax).toString());
	}	
	if ((max != "" && isNaN(dateMaxInt)) || (min != "" && isNaN(dateMinInt)))
	{
	   return false;
	}
	if (max != "" && dateInt > dateMaxInt)
	{
	   bNotInRange = true;
	}
	if (max != "" && dateInt == dateMaxInt)
	{
	   dateInRange = "max";
	}
	if (min != "" && dateInt < dateMinInt)
	{
	   bNotInRange = true;
	}
	if (min != "" && dateInt == dateMinInt)
	{
	   dateInRange = "min";
	}
	if (max != "" && dateInt == dateMaxInt && min != "" && dateInt == dateMinInt)
	{
	   dateInRange = "minmax";
	}
	if (bNotInRange)
	{
		return false;
	}
	return dateInRange;
}
function DateTimeValidateTimeValue(strTime,what)
{
	var timeMarker;
	if (!strTime)
	{
		return false;
	}
	if (!what)
	{
		what = "range";
	}
	switch (what)
	{
		case "min":
			 var bCheckMax = false;
			 var bCheckMin = true;
			 break;
		case "max":
			 var bCheckMax = true;
			 var bCheckMin = false;
			 break;
		default:
			 var bCheckMin = true;
			 var bCheckMax = true;
			 break;
	}
	var newValue = "";
	var input = Helper.trim(strTime);
	var seconds = "";
	var bNotInRange = false;
	var reg = new RegExp(this.timePattern,"i")
	var result = input.match(reg);
	if (!result)
	{
		return false;
	}
	var hour = parseInt(Helper.trim(result[1]),10);
	var minutes = parseInt(Helper.trim(result[3]),10);
	if (this.bSeconds)
	{
	  seconds = parseInt(Helper.trim(result[5]),10);
	}
	if (this.bTimeMarker)
	{
		if (this.bSeconds && result[7])
		{
		  timeMarker = result[7].toLowerCase();
		}
		else if(result[5])
		{
		  timeMarker = result[5].toLowerCase();
		}
	}
	if (this.bHours24 != 1)
	{
		if(timeMarker && timeMarker == "pm")
		{
			hour = parseInt(hour);
			hour += 12;
		}
	}
	// Datum als Integer HHMMSS neu zusammenbauen; Sekunden werden IMMER benutzt
	var timeInt = this.fillLeading(hour) + this.fillLeading(minutes);
	if (this.bSeconds)
	{
		timeInt = timeInt + this.fillLeading(seconds);
	}
	else
	{
		timeInt = timeInt + '00';
	}
	timeInt = parseInt(Helper.trim(timeInt),10);
	var min = Helper.trim(this.min);
	if(min!="")
	{
		if(this.utc && this.utc=='1')
		{
			var oTimeMin =	this.setUTCDateObjectFromISO(min);
		}
		else
		{
			var oTimeMin =	this.setDateObjectFromISO(min);	
		}	
		var hourMin = this.fillLeading(oTimeMin.getHours());
		var minutesMin = this.fillLeading(oTimeMin.getMinutes());
		var secondsMin =  this.fillLeading(oTimeMin.getSeconds());	
		timeMinInt = parseInt(hourMin.toString() + minutesMin.toString() + secondsMin.toString(),10);
	}	
	var max = Helper.trim(this.max);
	if(max!="")
	{
		if(this.utc && this.utc=='1')
		{
			var oTimeMax =	this.setUTCDateObjectFromISO(max);
		}
		else
		{
			var oTimeMax =	this.setDateObjectFromISO(max);	
		}	
		var hourMax = this.fillLeading(oTimeMax.getHours());
		var minutesMax = this.fillLeading(oTimeMax.getMinutes());
		var secondsMax =  this.fillLeading(oTimeMax.getSeconds());	
		timeMaxInt = parseInt(hourMax.toString() + minutesMax.toString()+ secondsMax.toString(),10);
	}
	if (max!="" && !isNaN(timeMaxInt) && bCheckMax && timeInt > timeMaxInt)
	{
	   bNotInRange = true;
	}
	if (min!="" && !isNaN(timeMinInt) && bCheckMin && timeInt < timeMinInt)
	{
	   bNotInRange = true;
	}
	if (bNotInRange)
	{
	 return false;
	}
	return true;
}
function DateTimeValidateTime(time)
{
	var dayTimeAdd = 0;
	var newValue = "";
	var seconds = "";
	var dtCurrDate = new Date();
	var input = new String(time);
	input = Helper.trim(input);
	var reg = new RegExp(this.timePattern,"i")
	var result = input.match(reg);
	if (!result)
	{
		return this.getCurrTime();
	}
	var hour = parseInt(Helper.trim(result[1]),10);
	var minutes = parseInt(Helper.trim(result[3]),10);
	if (this.bSeconds)
	{
	  seconds = parseInt(Helper.trim(result[5]),10);
	  var timeMarker = result[7];
	}
	else
	{
	  var timeMarker = result[5];
	}
	if (timeMarker != null)
	{
		timeMarker = timeMarker.toLowerCase();
	}
	else
	{
		timeMarker = "";
	}
	if(isNaN(hour) || !this.isIntegerInRange(hour,0,23))
	{
		hour = dtCurrDate.getHours();
	}
	if (this.bHours24 != 1)
	{
		var pos = this.timeFormat.indexOf('a');
		pos = pos;
		var timeMarker = time.substr(pos,2);
		if(timeMarker && (timeMarker == "pm" || timeMarker == "PM") && hour=="12")
		{
			hour = 12;
		}
		else if(timeMarker && (timeMarker == "pm" || timeMarker == "PM"))
		{
			hour = parseInt(hour)
			hour += 12;
		}
		if(timeMarker && (timeMarker == "am" || timeMarker == "AM") && hour=="12")
		{
			hour = 0;
		}
	}
	if(isNaN(minutes) || !this.isIntegerInRange(minutes,0,59))
	{
		minutes = "00";
	}
	if(this.bSeconds && (isNaN(seconds) || !this.isIntegerInRange(seconds,0,59)))
	{
		seconds = "00";
	}
	var oDate = this.initDateObject();
	oDate.setHours(hour);
	oDate.setMinutes(minutes);
	oDate.setSeconds(seconds);
	newValue = this.toLocalTimeString(oDate);
	return newValue;
}
function DateTimeValidateFromIso(strDate, bReturn)
{
	var day,month,year;
	var dtCurrDate = new Date();
	var dateSep = "-";
	this.aTimeSep = this.getTimeSep();
	var newValue = "";
	strDate = Helper.trim(new String(strDate));
	var day = strDate.substring(8,10);
	var month = strDate.substring(5,7);
	var year = strDate.substring(0,4);
	var hour = strDate.substring(11,13);
	var minutes = strDate.substring(14,16);
	var seconds = strDate.substring(17,19);
	if(month=="" || isNaN(month) || !this.isMonth(month))
	{
		month = dtCurrDate.getMonth() + 1;
	}
	if (day=="" || isNaN(day) || !this.isDateInMonth(day,month,year) || day < 1)
	{
		day = dtCurrDate.getDate();
	}
	if (year=="" || isNaN(year) || year > 9999)
	{
		year = dtCurrDate.getFullYear();
	}
	else
	{
		if (year < 100 && year > 30 )
		{
			year = 1900 + year;
		}
		if(year <= 30)
		{
			year = 2000 + year;
		}
	}
	if ( month==2  &&  day > this.daysInFebruary(year))
	{
		day = this.daysInFebruary(year);
	}
	var oDate = this.initDateObject();
	oDate.setFullYear(year);	
	oDate.setMonth(parseInt(month,10) - 1);	
	oDate.setDate(day);
	newDateValue = this.toLocalDateString(oDate);
	var oDate = this.initDateObject();
	oDate.setHours(hour);
	oDate.setMinutes(minutes);
	oDate.setSeconds(seconds);
	newTimeValue = this.toLocalTimeString(oDate);
	if(bReturn)
		return newDateValue + ' ' + newTimeValue;
	else
		Browser.setValue(this, newDateValue + ' ' + newTimeValue);
}
function TimeValidateFromIso(strDate, bReturn)
{
	var day,month,year;
	var dtCurrDate = new Date();
	var dateSep = "-";
	this.aTimeSep = this.getTimeSep();
	var newValue = "";
	strDate = Helper.trim(new String(strDate));
	var hour = strDate.substring(11,13);
	var minutes = strDate.substring(14,16);
	var seconds = strDate.substring(17,19);
	var oDate = this.initDateObject();
	oDate.setHours(hour);
	oDate.setMinutes(minutes);
	oDate.setSeconds(seconds);
	newTimeValue = this.toLocalTimeString(oDate);
	if(bReturn)
		return newTimeValue;
	else
		Browser.setValue(this, newTimeValue);
}
function DateValidateFromIso(strDate, bReturn)
{
	var day,month,year;
	var dtCurrDate = new Date();
	var dateSep = "-";
	this.aTimeSep = this.getTimeSep();
	var newValue = "";
	strDate = Helper.trim(new String(strDate));
	var day = strDate.substring(8,10);
	var month = strDate.substring(5,7);
	var year = strDate.substring(0,4);
	if(month=="" || isNaN(month) || !this.isMonth(month))
	{
		month = dtCurrDate.getMonth() + 1;
	}
	if (day=="" || isNaN(day) || !this.isDateInMonth(day,month,year) || day < 1)
	{
		day = dtCurrDate.getDate();
	}
	if (year=="" || isNaN(year) || year > 9999)
	{
		year = dtCurrDate.getFullYear();
	}
	else
	{
		if (year < 100 && year > 30 )
		{
			year = 1900 + year;
		}
		if(year <= 30)
		{
			year = 2000 + year;
		}
	}
	if ( month==2  &&  day > this.daysInFebruary(year))
	{
		day = this.daysInFebruary(year);
	}
	var oDate = this.initDateObject();
	oDate.setFullYear(year);	
	oDate.setMonth(parseInt(month,10) - 1);	
	oDate.setDate(day);
	newDateValue = this.toLocalDateString(oDate);
	if(bReturn)
		return newDateValue;
	else
		Browser.setValue(this, newDateValue);
}
function DateTimeGetCurrTime()
{
	var dateTime = new Date();
	var hour = this.fillLeading(dateTime.getHours());
	var minutes = this.fillLeading(dateTime.getMinutes());
	var seconds = this.fillLeading(dateTime.getSeconds());
	time = this.getTimeString(hour,minutes,seconds);
	return time;
}
function DateTimeGetCurrDate()
{
	var oDate = new Date();
	oDate.setFullYear(oDate.getFullYear());	
	oDate.setMonth(oDate.getMonth());	
	oDate.setDate(oDate.getDate());
	newValue = this.toLocalDateString(oDate);
	return newValue;
}
function DateTimeGetCurrDateTime()
{
	this.setDateTimeProps();
	this.oHtml.value =  this.getCurrDate() + ' ' + this.getCurrTime();
}
function DateTimeIsDateInMonth(day,month,year)
{
	if(year=="")
	{
	 return false;
	}
	var daysInMonth = Helper.makeArray(12);
	daysInMonth[1] = 31;
	daysInMonth[2] = 29;
	daysInMonth[3] = 31;
	daysInMonth[4] = 30;
	daysInMonth[5] = 31;
	daysInMonth[6] = 30;
	daysInMonth[7] = 31;
	daysInMonth[8] = 31;
	daysInMonth[9] = 30;
	daysInMonth[10] = 31;
	daysInMonth[11] = 30;
	daysInMonth[12] = 31;
	var intDay = parseInt(day,10);
	var intMonth = parseInt(month,10);
	var intYear = parseInt(year,10);
	if (intDay > daysInMonth[intMonth])
	{
	  return false;
	}
	if ((intMonth == 2) && (intDay > this.daysInFebruary(intYear)))
	{
	 return false;
	}
	return true;
}
function DateTimeDaysInFebruary(year)
{
 if(((year % 4 == 0) && (!(year % 100 == 0)) || (year % 400 == 0)))
   {
	return 29;
   }
 else
   {
	return 28;
   }
}
function DateTimeIsIntegerInRange(s, a, b)
{
		if (!Helper.isInteger(s))
		{
		  return false;
		}
		var num = parseInt(s,10);
		return ( ( num >= a ) && ( num <= b ) );
}
function DateTimeIsMonth(s)
{
   return this.isIntegerInRange(s, 1, 12);
}
function upDateTimeControl()
{
	this.upType ="upDateTimeControl";
	this.dateSep = self.oUp.oFormatInfo.dateSep;
	this.dateFormat = self.oUp.oFormatInfo.dateFormat;
	this.timeFormat = self.oUp.oFormatInfo.timeFormat;
	this.getIsolatedDateTime = DateTimeGetIsolatedDateTime;
	this.validateValue = DateTimeValidateValue;
	this.validateValueDo = DateTimeValidateValueDo;
	this.format = DateTimeFormat;
	this.setDateTimeProps = DateTimeSetDateTimeProps;
	this.validateInput = DateTimeValidateInput;
	this.toLocalFormat = DateTimeToLocalFormat; 
	this.setDateObjectFromLocal = DateTimeSetDateObjectFromLocal; 
	this.setDateObjectFromISO = DateTimeSetDateObjectFromISO;  
	this.setUTCDateObjectFromISO = DateTimeSetUTCDateObjectFromISO;   
	this.validateFromIso = DateTimeValidateFromIso;  
}
upDateTimeControl.prototype = new upDateTimeMainControl();
function DateTimeSetDateObjectFromLocal(input)
{
	this.setDateTimeProps();
	var oDate = this.initDateObject();
	var aDateTime = this.getIsolatedDateTime(input);
	if(!aDateTime)
	{
		return false;
	}
	if(aDateTime[0])
	{
		oDate = this.setDateObjectFromLocalDate(oDate,aDateTime[0]);
	}
	if(aDateTime[1])
	{
		oDate = this.setDateObjectFromLocalTime(oDate,aDateTime[1]);
	}
	return oDate;
}
function DateTimeSetDateObjectFromISO(input)
{
	var oDate = new Date();
	oDate.setFullYear(input.substr(0,4));
	oDate.setMonth(input.substr(5,2)-1);
	oDate.setDate(input.substr(8,2));		
	oDate.setHours(input.substr(11,2));
	oDate.setMinutes(input.substr(14,2));
	oDate.setSeconds(input.substr(17,2));
	return oDate;
}
function DateTimeSetUTCDateObjectFromISO(input)
{
	var oDate = new Date();
	oDate.setUTCFullYear(input.substr(0,4));
	oDate.setUTCMonth(input.substr(5,2)-1);
	oDate.setUTCDate(input.substr(8,2));		
	oDate.setUTCHours(input.substr(11,2));
	oDate.setUTCMinutes(input.substr(14,2));
	oDate.setUTCSeconds(input.substr(17,2));
	return oDate;
}
function DateTimeToLocalFormat(oDate)
{
	if(!oDate)
	{
		return false;
	}
	this.setDateTimeProps();
	var output = "";
	var date = this.toLocalDateString(oDate);
	var time = this.toLocalTimeString(oDate);
	output = date + " " + time;
	return output;	
}
function DateTimeSetDateTimeProps()
{
 var df = this.dateFormat;
 var dateLength1 = df.substring(0,df.indexOf(this.dateSep)).length;
 var dateLength2 = df.substring(dateLength1+1,df.indexOf(this.dateSep,dateLength1+1)).length;
 var dateLength3 = df.substring(dateLength1+dateLength2+1,df.length-1).length;
 this.datePattern ="^(\\d{1," + dateLength1 + "})?(\\" + this.dateSep;
 this.datePattern = this.datePattern + ")?(\\d{1," + dateLength2;
 this.datePattern = this.datePattern + "})?(\\" + this.dateSep + ")?(\\d{1,";
 this.datePattern = this.datePattern + dateLength3 + "})? *$";
 this.aTimeSep = this.getTimeSep();
 this.bTimeMarker = this.getTimeMarker();
 this.bSeconds = this.getbSeconds();
 this.bHours24 = this.getbHours24();
 this.timePattern = "^(\\d{1,2})?(\\" + this.aTimeSep[0] + ")?(\\d{1,2})?";
 var ind = 1;
 if(this.bSeconds)
 {
  this.timePattern = this.timePattern + "(\\" + this.aTimeSep[ind] + ")?(\\d{1,2})?";
  ind++;
 }
 if(this.bTimeMarker)
 {
  this.timePattern = this.timePattern + "(\\" + this.aTimeSep[ind] + ")?((A|P)M)?";
 }
 this.timePattern = this.timePattern + " *$";
 this.timePatternMinMax = "^\\s*((\\d{1,4})?(\\-)?(\\d{1,2})?(\\-)?(\\d{1,2}) +)?((\\d{1,2})?(:)?(\\d{1,2})?(:)?(\\d{1,2})? *((A|P)M)?)?\\s*$"
}
function DateTimeValidateInput()
{
	this.inputLegalChars = "0123456789 " + this.dateSep;
	this.aTimeSep = this.getTimeSep();
	for(i=0;i<this.aTimeSep.length;i++)
	{
		this.inputLegalChars = this.inputLegalChars + this.aTimeSep[i];
	}
	if(this.bTimeMarker)
	{
		this.inputLegalChars = this.inputLegalChars + "apmAPM";
	}
	return this.matchInput();
}
function DateTimeGetIsolatedDateTime(input)
{
	if(!input)
	{
		var value = new String(this.oHtml.value);
	}
	else
	{
		var value = input;
	}	
	this.aTimeSep = this.getTimeSep();
	this.bTimeMarker = this.getTimeMarker();
	this.bSeconds = this.getbSeconds();
	var df = this.dateFormat;
	var dateLength1 = df.substring(0,df.indexOf(this.dateSep)).length;
	var dateLength2 = df.substring(dateLength1+1,df.indexOf(this.dateSep,dateLength1+1)).length;
	var dateLength3 = df.substring(dateLength1+dateLength2+1,df.length-1).length;
	var dateTimePattern ="^((\\d{1," + dateLength1 + "})?(\\" + this.dateSep;
	dateTimePattern = dateTimePattern + ")?(\\d{1," + dateLength2;
	dateTimePattern = dateTimePattern + "})?(\\" + this.dateSep + ")?(\\d{1,";
	dateTimePattern = dateTimePattern + dateLength3 + "})?)? *";
	dateTimePattern = dateTimePattern + "((\\d{1,2})?(\\" + this.aTimeSep[0] + ")?(\\d{1,2})?";
	var ind = 1;
	if(this.bSeconds)
	{
	  dateTimePattern = dateTimePattern + "(\\" + this.aTimeSep[ind] + ")?(\\d{1,2})?";
	  ind++;
	}
	if(this.bTimeMarker)
	{
	  dateTimePattern = dateTimePattern + "(\\" + this.aTimeSep[ind] + ")?((A|P)M)?";
	}
	dateTimePattern = dateTimePattern + ") *$";
	var regExpDate = new RegExp(dateTimePattern,"i");
	var resultDateTime = value.match(regExpDate);
	var aDateTime = new Array(2);
	if(resultDateTime && resultDateTime[1])
	{
		aDateTime[0] = resultDateTime[1];
	}
	else
	{
		aDateTime[1] = false;	
	}	
	if(resultDateTime && resultDateTime[7])
	{
		aDateTime[1] = resultDateTime[7];
	}
	else
	{
		aDateTime[1] = false;	
	}	
	return aDateTime;	
}
function DateTimeValidateValue(p_strMessage)
{
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.DATETIME_CONSTR_VALUE;
	}
	else
	{
		l_strMessage = p_strMessage;
	}
	if (!this.validateValueDo())
	{
		alert(l_strMessage);
		return false;
	}
	return true;
}
function DateTimeValidateValueDo()
{
	this.setDateTimeProps();
	var value = new String(Browser.getValue(this));
	if(value.length==0)
	{
		return true;
	}
	var dateInRange = false;
	var bIsValid = false;
	var aDateTime = this.getIsolatedDateTime();
	if(aDateTime)
	{
		var date = Helper.trim(aDateTime[0]);
		dateInRange = this.validateDateValue(date);
	}
	switch (dateInRange)
	{
		case false:
			bIsValid = false;
			break;
		case "between":
			bIsValid = true;
			break;
		default:
			if(aDateTime[1])
			{
				bIsValid = this.validateTimeValue(aDateTime[1],dateInRange);
			}	
			break;
	}
	if (bIsValid)
	{
		return true;
	}
	return false;
}
function DateTimeFormat(p_strMessage)
{
	this.setDateTimeProps();
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.DATETIME_CONSTR_PATTERN;
	}
	else
	{
		l_strMessage = p_strMessage;
	}
	var value = new String(Browser.getValue(this));
	if(value.length==0)
	{
		return true;
	}
	var newValue = "";
	var aDateTime = this.getIsolatedDateTime();
	if(aDateTime && aDateTime[0])
	{
		strDate = aDateTime[0];
		newValue = Helper.trim(this.validateDate(strDate));
	}
	else
	{
		newValue = this.getCurrDate();
	}
	if(aDateTime && aDateTime[1])
	{
		strTime = aDateTime[1];
		newValue += ' ' + Helper.trim(this.validateTime(strTime));
	}
	else
	{
		newValue += ' ' + this.getCurrTime();
	}
	Browser.setValue(this, newValue);
	return true;
}
function upDateControl()
{
	this.upType ="upDateControl";
	this.dateSep = self.oUp.oFormatInfo.dateSep;
	this.dateFormat = self.oUp.oFormatInfo.dateFormat;
	this.validateValue = DateValidateValue;
	this.validateValueDo = DateValidateValueDo;
	this.format= DateFormat;
	this.validateInput = DateValidateInput;
	this.setDateProps = DateSetDateProps;
	this.toLocalFormat = DateToLocalFormat; 
	this.setDateObjectFromLocal = DateSetDateObjectFromLocal; 
	this.setDateObjectFromISO = DateSetDateObjectFromISO; 
	this.validateFromIso = DateValidateFromIso; 
}
upDateControl.prototype = new upDateTimeMainControl();
function DateSetDateObjectFromLocal(strDate)
{
	this.setDateProps();
	var oDate = this.initDateObject();
	oDate = this.setDateObjectFromLocalDate(oDate,strDate);
	return oDate;
}
function DateSetDateObjectFromISO(strDate)
{
	this.setDateProps();
	var oDate = this.initDateObject();
	oDate.setFullYear(strDate.substr(0,4));
	oDate.setMonth(strDate.substr(5,2)-1);
	oDate.setDate(strDate.substr(8,2));		
	return oDate;
}
function DateToLocalFormat(oDate)
{
	this.setDateProps();
	var output = "";
	if(oDate)
	{
		output = this.toLocalDateString(oDate);
	}
	return output;	
}
function DateSetDateProps()
{
	//datePattern aufbauen; Länge der Segmente ist verschieden
	var df = this.dateFormat;
	var dateLength1 = df.substring(0,df.indexOf(this.dateSep)).length;
	var dateLength2 = df.substring(dateLength1+1,df.indexOf(this.dateSep,dateLength1+1)).length;
	var dateLength3 = df.substring(dateLength1+dateLength2+1,df.length-1).length;
	this.datePattern ="^(\\d{1," + dateLength1 + "})?(\\" + this.dateSep;
	this.datePattern = this.datePattern + ")?(\\d{1," + dateLength2;
	this.datePattern = this.datePattern + "})?(\\" + this.dateSep + ")?(\\d{1,";
	this.datePattern = this.datePattern + dateLength3 + "})? *$";
}
function DateValidateInput()
{
	this.inputLegalChars = "0123456789 " + this.dateSep;
	return this.matchInput();
}
function DateValidateValue(p_strMessage)
{
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.DATE_CONSTR_VALUE;
	}
	else
	{
		l_strMessage = p_strMessage;
	}
	if (!this.validateValueDo())
	{
	 alert(l_strMessage);
	 return false;
	}
	return true;
}
function DateValidateValueDo()
{
	this.setDateProps();
	var strDate = new String(Browser.getValue(this));
	if(strDate.length==0)
	{
		return true;
	}
	if (!this.validateDateValue(strDate))
	{
		return false;
	}
	else
	{
	   return true;
	}
}
function DateFormat()
{
	this.setDateProps();
	var date = new String(Browser.getValue(this));
	if(date.length==0)
	{
		return true;
	}
	Browser.setValue(this,Helper.trim(this.validateDate(date)));
	return true;
}
function upTimeControl()
{
 this.upType ="upTimeControl";
 this.timeFormat = self.oUp.oFormatInfo.timeFormat;
 this.validateValue = TimeValidateValue;
 this.validateValueDo = TimeValidateValueDo;
 this.format = TimeFormat;
 this.validateInput = TimeValidateInput;
 this.setTimeProps = TimeSetTimeProps;
 this.toLocalFormat = TimeToLocalFormat;  
 this.setDateObjectFromLocal = TimeSetDateObjectFromLocal; 
 this.setDateObjectFromISO = TimeSetDateObjectFromISO;  
 this.validateFromIso = TimeValidateFromIso; 
}
upTimeControl.prototype = new upDateTimeMainControl();
function TimeSetDateObjectFromLocal(strTime)
{
	this.setTimeProps();
	var oDate = this.initDateObject();
	oDate = this.setDateObjectFromLocalTime(oDate,strTime);
	return oDate;
}
function TimeSetDateObjectFromISO(strTime)
{
	var oDate = this.initDateObject();
	oDate.setHours(strTime.substr(11,2));
	oDate.setMinutes(strTime.substr(14,2));
	oDate.setSeconds(strTime.substr(17,2));
	return oDate;
}
function TimeToLocalFormat(oDate)
{
	this.setTimeProps();
	var output = "";
	if(oDate)
	{
		output = this.toLocalTimeString(oDate);
	}
	return output;	
}
function TimeSetTimeProps()
{
	this.aTimeSep = this.getTimeSep();
	this.bTimeMarker = this.getTimeMarker();
	this.bSeconds = this.getbSeconds();
	this.bHours24 = this.getbHours24();
	this.timePattern = "^(\\d{1,2})?(\\" + this.aTimeSep[0] + ")?(\\d{1,2})?";
	var ind = 1;
	if(this.bSeconds)
	{
		this.timePattern = this.timePattern + "(\\" + this.aTimeSep[ind] + ")?(\\d{1,2})?";
		ind++;
	}
	if(this.bTimeMarker)
	{
	this.timePattern = this.timePattern + "(\\" + this.aTimeSep[ind] + ")?((A|P)M)?";
	}
	this.timePattern = this.timePattern + " *$";
	this.timePatternMinMax = "^\\s*((\\d{1,4})?(\\-)?(\\d{1,2})?(\\-)?(\\d{1,2}) +)?((\\d{1,2})?(:)?(\\d{1,2})?(:)?(\\d{1,2})? *((A|P)M)?)?\\s*$"
}
function TimeValidateInput()
{
	this.bTimeMarker = this.getTimeMarker();
	this.aTimeSep = this.getTimeSep();
	this.inputLegalChars = "0123456789 ";
	for(i=0;i<this.aTimeSep.length;i++)
	{
		this.inputLegalChars = this.inputLegalChars + this.aTimeSep[i];
	}
	if(this.bTimeMarker)
	{
		this.inputLegalChars = this.inputLegalChars + "apmAPM";
	}
	return this.matchInput();
}
function TimeValidateValue(p_strMessage)
{
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.TIME_CONSTR_VALUE;
	}
	else
	{
		l_strMessage = p_strMessage;
	}
	if (!this.validateValueDo())
	{
		alert(l_strMessage);
		return false;
	}
	return true;
}
function TimeValidateValueDo()
{
	this.setTimeProps();
	var strTime = new String(Browser.getValue(this));
	if(strTime.length==0)
	{
		return true;
	}
	var bIsTimeValid = true;
	bIsTimeValid = this.validateTimeValue(strTime);
	if (bIsTimeValid)
	{
	   return true;
	}
	else
	{
		return false;
	}
}
function TimeFormat()
{
	this.setTimeProps();
	var time = new String(Browser.getValue(this));
	if(time.length==0)
	{
		return true;
	}
	Browser.setValue(this,Helper.trim(this.validateTime(time)));
	return true;
}
function upTextareaControl()
{
 this.upType ="upTextareaControl";
 this.styleType = "Textarea_Standard";	 
 this.encoding = false;
 this.editor = false; 
}
upTextareaControl.prototype = new upDataControl();
function upTextMainControl()
{
}
upTextMainControl.prototype = new upDataControl();
function upTextControl()
{
	this.upType = "upTextControl";
	this.styleType = "Editfield_Standard";
	this.textTransform = 0;
 this.transformTextByInput = TextTransformTextByInput;
}
upTextControl.prototype = new upTextMainControl();
function upDurationControl()
{
	this.upType = "upDurationControl";
	this.styleType = "Editfield_Standard";
	this.textTransform = 0;
	this.UNIT_MINUTE	= new Array("MIN", "MINUTE", "MINUTES", "MINUTEN");
	this.UNIT_HOUR		= new Array("H", "S", "HOUR", "STUNDE", "HOURS", "STUNDEN");
	this.UNIT_DAY		= new Array("D", "T", "DAY", "TAG", "DAYS", "TAGE");
	this.UNIT_WEEK		= new Array("W", "WEEK", "WOCHE", "WEEKS", "WOCHEN");
	this.UNIT_MONTH		= new Array("M", "MONTH", "MONAT", "MONTHS", "MONATE");
	this.UNIT_MINUTE[this.UNIT_MINUTE.length] = self.oUp.oMessage.CAL_MINUTE;
	this.UNIT_MINUTE[this.UNIT_MINUTE.length] = self.oUp.oMessage.CAL_MINUTES;
	this.UNIT_HOUR[this.UNIT_HOUR.length] = self.oUp.oMessage.CAL_HOUR;
	this.UNIT_HOUR[this.UNIT_HOUR.length] = self.oUp.oMessage.CAL_HOURS;
	this.UNIT_DAY[this.UNIT_DAY.length] = self.oUp.oMessage.CAL_DAY;
	this.UNIT_DAY[this.UNIT_DAY.length] = self.oUp.oMessage.CAL_DAY;
	this.UNIT_WEEK[this.UNIT_WEEK.length] = self.oUp.oMessage.CAL_WEEK;
	this.UNIT_WEEK[this.UNIT_WEEK.length] = self.oUp.oMessage.CAL_WEEKS;
	this.UNIT_MONTH[this.UNIT_MONTH.length] = self.oUp.oMessage.CAL_MONTH;
	this.UNIT_MONTH[this.UNIT_MONTH.length] = self.oUp.oMessage.CAL_MONTHS;
	this.transformTextByInput = TextTransformTextByInput;
	this.validate = funcValidateDuration;
	this.getDurationInMilliseconds = funcGetDurationInMilliseconds;
	this.format = funcFormatDuration;
	this._arrayContainsVal = funcArrayContainsVal;
}
upDurationControl.prototype = new upTextMainControl();
function funcGetDurationInMilliseconds()
{
	var l_lMilliseconds = -1;
	pattern = "^([0-9]{1,6})([a-zA-Z]{1,7})$";
	reg = new RegExp(pattern,"i")
	var strInput = new String(Browser.getValue(this));
	strInput = strInput.replace(/ /,"");
	if(reg.test(strInput))
	{
		var aUserInput = reg.exec(strInput)
		if(aUserInput.length==3)
		{
			l_lNumber = aUserInput[1];
			l_strUnit = aUserInput[2];
			if(l_lNumber!='' && l_strUnit!='')
			{
				if(this._arrayContainsVal(this.UNIT_MINUTE,l_strUnit))
				{
					l_lMilliseconds = 60000;
				}
				else if(this._arrayContainsVal(this.UNIT_HOUR,l_strUnit))
				{
					l_lMilliseconds = 3600000;
				}
				else if(this._arrayContainsVal(this.UNIT_DAY,l_strUnit))
				{
					l_lMilliseconds = 86400000;
				}
				else if(this._arrayContainsVal(this.UNIT_WEEK,l_strUnit))
				{
					l_lMilliseconds = 604800000;
				}
				else if(this._arrayContainsVal(this.UNIT_MONTH,l_strUnit))
				{
					l_lMilliseconds = 2592000000;
				}
				if(l_lMilliseconds != -1)	
					return (l_lMilliseconds * l_lNumber);
			}
		}
	}
	return false;
}
function funcFormatDuration()
{
	var l_lMilliseconds = -1;
	pattern = "^([0-9]{1,6})([a-zA-Z]{1,7})$";
	reg = new RegExp(pattern,"i")
	var strInput = new String(Browser.getValue(this));
	strInput = strInput.replace(/ /,"");
	if(reg.test(strInput))
	{
		var aUserInput = reg.exec(strInput)
		if(aUserInput.length==3)
		{
			l_lNumber = aUserInput[1];
			l_strUnit = aUserInput[2];
			if(l_lNumber!='' && l_strUnit!='')
			{
				if(this._arrayContainsVal(this.UNIT_MINUTE,l_strUnit))
				{
					l_lMilliseconds = 60000;
					if(l_lNumber > 1)
						l_strUnitFormated = self.oUp.oMessage.CAL_MINUTES;
					else
						l_strUnitFormated = self.oUp.oMessage.CAL_MINUTE;
					Browser.setValue(this,l_lNumber + ' ' + l_strUnitFormated);
				}
				else if(this._arrayContainsVal(this.UNIT_HOUR,l_strUnit))
				{
					l_lMilliseconds = 3600000;
					if(l_lNumber > 1)
						l_strUnitFormated = self.oUp.oMessage.CAL_HOURS;
					else
						l_strUnitFormated = self.oUp.oMessage.CAL_HOUR;
					Browser.setValue(this,l_lNumber + ' ' + l_strUnitFormated);
				}
				else if(this._arrayContainsVal(this.UNIT_DAY,l_strUnit))
				{
					l_lMilliseconds = 86400000;
					if(l_lNumber > 1)
						l_strUnitFormated = self.oUp.oMessage.CAL_DAYS;
					else
						l_strUnitFormated = self.oUp.oMessage.CAL_DAY;
					Browser.setValue(this,l_lNumber + ' ' + l_strUnitFormated);
				}
				else if(this._arrayContainsVal(this.UNIT_WEEK,l_strUnit))
				{
					l_lMilliseconds = 604800000;
					if(l_lNumber > 1)
						l_strUnitFormated = self.oUp.oMessage.CAL_WEEKS;
					else
						l_strUnitFormated = self.oUp.oMessage.CAL_WEEK;
					Browser.setValue(this,l_lNumber + ' ' + l_strUnitFormated);
				}
				else if(this._arrayContainsVal(this.UNIT_MONTH,l_strUnit))
				{
					l_lMilliseconds = 2592000000;
					if(l_lNumber > 1)
						l_strUnitFormated = self.oUp.oMessage.CAL_MONTHS;
					else
						l_strUnitFormated = self.oUp.oMessage.CAL_MONTH;
					Browser.setValue(this,l_lNumber + ' ' + l_strUnitFormated);
				}
				if(l_lMilliseconds != -1)	
					return (l_lMilliseconds * l_lNumber);
			}
		}
	}
	return false;
}
function funcValidateDuration()
{
	var l_lMilliseconds = -1;
	pattern = "^([0-9]{1,6})([a-zA-Z]{1,7})$";
	reg = new RegExp(pattern,"i")
	var strInput = new String(Browser.getValue(this));
	strInput = strInput.replace(/ /,"");
	if(reg.test(strInput))
	{
		var aUserInput = reg.exec(strInput)
		if(aUserInput.length==3)
		{
			l_lNumber = aUserInput[1];
			l_strUnit = aUserInput[2];
			if(l_lNumber!='' && l_strUnit!='')
			{
				if(this._arrayContainsVal(this.UNIT_MINUTE,l_strUnit))
				{
					return true;
				}
				else if(this._arrayContainsVal(this.UNIT_HOUR,l_strUnit))
				{
					return true;
				}
				else if(this._arrayContainsVal(this.UNIT_DAY,l_strUnit))
				{
					return true;
				}
				else if(this._arrayContainsVal(this.UNIT_WEEK,l_strUnit))
				{
					return true;
				}
				else if(this._arrayContainsVal(this.UNIT_MONTH,l_strUnit))
				{
					return true;
				}
			}
		}
	}
	return false;
}
function funcArrayContainsVal(p_Array, p_val)
{
   if(typeof p_Array=='object' && p_val)
   {
      if(typeof p_val=='string')
		p_val = p_val.toUpperCase();
	  for(i=0;i<p_Array.length;i++)
	  {
	  if(typeof p_Array[i]=='string')
		l_strArray = p_Array[i].toUpperCase();
	  else
	     l_strArray = p_Array[i];
	  if(p_Array[i]==p_val)
	     return true;
	  }
   }
   return false;
}
function TextTransformTextByInput()
{
	var key = "";
	var textTransform = this.textTransform;
	var oldValue = this.oHtml.value;
	key = Browser.getEventKeyCode();
	if (key==0 ||  key==8 ||  key==9 ||  key==13 || (key >= 33 && key <= 40) || key==45 || key==46)
	{
		return true;
	}
	strInput = String.fromCharCode(key);
	this.oHtml.value = oldValue + (TextTransformText(strInput,textTransform));
	return false;
}
function TextTransformText(strInput,textTransform)
{
 switch (textTransform)
 {
  case "1":
	strOutput = strInput.toUpperCase();
	break;
  case "2":
	strOutput = strInput.toLowerCase();
	break;
  default:
	strOutput = strInput;
	break;
 }
 return strOutput;
}
function upEmailControl()
{
	this.upType = "upEmailControl";
	this.styleType = "Editfield_Email"; 
	this.protocol = "mailto:";
	this.internetFormat = 1;
	this.validatePattern = EmailValidatePattern;
}
upEmailControl.prototype = new upTextMainControl();
function EmailValidatePattern(p_strMessage)
{
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.MAIL_CONSTR_PATTERN;
	}
	else
	{
		l_strMessage = p_strMessage;
	}
	if (this.internetFormat=="1")
	{
		this.pattern = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,6}|[0-9]{1,3})(\\]?)$";
	}
	return this.matchPattern(l_strMessage)
}
function upUriControl()
{
	this.upType = "upUriControl";
	this.styleType = "Editfield_Link";
	this.protocol = "http://";
}
upUriControl.prototype = new upTextMainControl();
function upSelectMainControl()
{
	this.upType = "upSelectMainControl";
	this.width = "";
	this.max = "1";
	this.min = "1";
	this.sourceType = "0";
	this.validateRequired = SelectValidateRequired;
	this.validateRequiredDo = SelectValidateRequiredDo;
	this.insertOption = SelectInsertOption;
	this.clearOptions = SelectClearOptions;	
	this.setFocusStyle = SelectSetFocusStyle;	
	this.refreshSelect = SelectRefreshSelect;		
	this._refreshSelect = Select_RefreshSelect;		
	this.__refreshSelect = Select__RefreshSelect;			
}
upSelectMainControl.prototype = new upDataControl();
function SelectSetFocusStyle(p_bFocus)
{
	if(Browser.mozilla && Browser.linux)
		return true;
	this._setFocusStyle(p_bFocus);
	return true;
}
function SelectRefreshSelect(p_bEmptyEntry)
{
	var guid;
	if(this.targetCtrlGUID && this.targetCtrlGUID!="")guid = this.targetCtrlGUID;
	else guid = Helper.getQsValueByParam("rq_RefreshSelect_Control");
	var l_bEmptyEntry = true;
	if(arguments.length > 0)l_bEmptyEntry = p_bEmptyEntry; 
	if(!guid)
		return false;
	var srcFrame = Helper.getQsValueByParam("rq_Frame");
	if(srcFrame && srcFrame!="" && oHtmlRoot.oUp && oHtmlRoot.oUp.oRegistry && oHtmlRoot.oUp.oRegistry.oFrameReg[srcFrame])
	{
		return this._refreshSelect(guid, oHtmlRoot.oUp.oRegistry.oFrameReg[srcFrame], l_bEmptyEntry);
	}
	return false;
}
function Select_RefreshSelect(guid, oTargWin, p_bEmptyEntry)
{
	if(Browser.handleException)
	{
		try
		{
			this.__refreshSelect(guid, oTargWin, p_bEmptyEntry);
		}
		catch(e)
		{
			return false;
		}	
	}
	else
	{
		this.__refreshSelect(guid, oTargWin, p_bEmptyEntry);
	}
}
function Select__RefreshSelect(guid, oTargWin, p_bEmptyEntry)
{
	var l_bEmptyEntry = p_bEmptyEntry;
	bFound = false;
	if(!guid || !oTargWin )
		return false;
	var oHtmlDestCtrl = oTargWin.getElement(guid);
	if(!oHtmlDestCtrl)
		return false;
	var oUpDestCtrl = oHtmlDestCtrl.oUp;
	var selectedOptionValue = "";
	if(oUpDestCtrl.oHtml.options.selectedIndex > -1)
	{
		selectedOptionValue = oUpDestCtrl.oHtml.options[oUpDestCtrl.oHtml.options.selectedIndex].value;
	}
	oUpDestCtrl.clearOptions();
	var oldOpt = null;
	if(l_bEmptyEntry && this.oHtml.length>=1 && this.oHtml.options[0].value!="")
	{
		oUpDestCtrl.insertOption("","");
	}
	for(var i=0;i<this.oHtml.length;i++)
	{
		oldOpt = this.oHtml.options[i];
		oUpDestCtrl.insertOption(oldOpt.text, oldOpt.value);
	}
	l_strCompareText = oUpDestCtrl.compareText;
	oUpDestCtrl.compareText="0";
	if(selectedOptionValue != "")
	{
		Browser.setValue(oUpDestCtrl, 0);
		Browser.setValue(oUpDestCtrl, selectedOptionValue);
	}
	else
	{
		Browser.setValue(oUpDestCtrl, 0);
	}
	oUpDestCtrl.compareText = l_strCompareText;
	if(selectedOptionValue!='' && (bFound || this.oHtml.options[j].value!=''))
		oUpDestCtrl.oHtml.onchange();
 return true;
}
function SelectClearOptions()
{
	var htmlEle = this.oHtml;
	while(htmlEle.length > 0)
	{
		htmlEle.options[0] = null;
	}
}
function SelectInsertOption(p_strText,p_strValue)
{
	var htmlEle = this.oHtml;
	var newOpt = new Option(p_strText,p_strValue);
	htmlEle.options[htmlEle.length] = newOpt;
	//htmlEle.options[htmlEle.selectedIndex].selected = false;  
	//htmlEle.options[htmlEle.length-1].selected = true;
}
function SelectValidateRequired(p_strMessage)
{
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.SELECT_CONSTR_REQUIRED;
	}
	else
	{
		l_strMessage = p_strMessage;
	}
	if (!this.validateRequiredDo())
	{
		alert(l_strMessage);
		return false;
	}
	return true;
}
function SelectValidateRequiredDo()
{
 var noOfSelected = 0;
 for (var i=0;i< this.oHtml.options.length;i++)
 {
	if (this.oHtml.options[i].selected && this.oHtml.options[i].value!="")
	{
		noOfSelected ++;
	}
 }
 if (noOfSelected < this.min || noOfSelected > this.max)
 {
	return false;
 }
 return true;
}
function upListboxControl()
{
	this.upType = "upListboxControl";
	this.styleType = "Listbox_Standard";	 
	this.max = "1";
	this.min = "1";
	this.multiple = false;
	this.visibleEntries = 1;
}
upListboxControl.prototype = new upSelectMainControl();
function upDropdownControl()
{
	this.upType = "upDropdownControl";
	this.styleType = "Dropdown_Standard";	
	this.max = "1";
	this.min = "1";
}
upDropdownControl.prototype = new upSelectMainControl();
function upCheckControlGroup()
{
	this.upType = "upCheckControlGroup";
	this.styleType = "CheckboxGroup_Standard";
	this.max = "";
	this.min = 1;
	this.validateRequired = CheckControlGroupValidateRequired;
	this.validateRequiredDo = CheckControlGroupValidateRequiredDo;	
	this.validateValue = CheckControlGroupValidateValue;
	this.validateValueDo = CheckControlGroupValidateValueDo;
}
upCheckControlGroup.prototype = new upDataControl();
function CheckControlGroupValidateRequired(p_strMessage)
{
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.CHECK_CONSTR_REQUIRED;
	}
	else
	{
		l_strMessage = p_strMessage;
	}
	if (!this.validateRequiredDo())
	{
	alert(l_strMessage);
	return false;
	}
	return true;
}
function CheckControlGroupValidateRequiredDo()
{
	var min = 1;
	var noOfChecked = 0;
	for (var i=0;i< this.elements.length;i++)
	{
		if (this.elements[i].oHtml.checked)
		{
			noOfChecked ++;
		}
	}
	if (noOfChecked < min)
	{
		return false;
	}
	return true;
}
function CheckControlGroupValidateValue(p_strMessage)
{
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.CHECK_CONSTR_REQUIRED;
	}
	else
	{
		l_strMessage = p_strMessage;
	}
	if (!this.validateRequiredDo())
	{
	alert(l_strMessage);
	return false;
	}
	return true;
}
function CheckControlGroupValidateValueDo()
{
	var noOfChecked = 0;
	for (var i=0;i< this.elements.length;i++)
	{
		if (this.elements[i].oHtml.checked)
		{
			noOfChecked ++;
		}
	}
	if (this.min !="" && !isNaN(this.min) && noOfChecked < this.min)
	{
		return false;
	}
	if (this.max !="" && !isNaN(this.max) && noOfChecked > this.max)
	{
		return false;
	}
	return true;
}
function upCheckControl()
{
	this.upType = "upCheckControl";
	this.styleType = "Checkbox_Standard";
	this.validateRequired = CheckControlValidateRequired;
	this.validateRequiredDo = CheckControlValidateRequiredDo;
}
upCheckControl.prototype = new upDataControl();
function CheckControlValidateRequired(p_strMessage)
{
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.CHECK_CONSTR_REQUIRED;
	}
	else
	{
		l_strMessage = p_strMessage;
	}
	if (!this.validateRequiredDo())
	{
		alert(l_strMessage);
		return false;
	}
	return true;
}
function CheckControlValidateRequiredDo()
{
	if (this.oHtml.checked)
	{
		return true;
	}
	return false;
}
function upRadioControlGroup()
{
	this.upType = "upRadioControlGroup";
	this.styleType = "RadioGroup_Standard";
	this.elements = null;
	this.validateRequired = RadioControlGroupValidateRequired;
	this.validateRequiredDo = RadioControlGroupValidateRequiredDo;
}
upRadioControlGroup.prototype = new upDataControl();
function RadioControlGroupValidateRequired(p_strMessage)
{
	var l_strMessage = "";
	if (!p_strMessage || p_strMessage=="")
	{
		l_strMessage = self.oUp.oMessage.RADIO_CONSTR_REQUIRED;
	}
	else
	{
		l_strMessage = p_strMessage;
	}
	if (!this.validateRequiredDo())
	{
		alert(l_strMessage);
		return false;
	}
	return true;
}
function RadioControlGroupValidateRequiredDo()
{
 for (var i=0;i< this.elements.length;i++)
 {
	 if (this.elements[i].oHtml.checked)
	 {
		return true;
	 }
 }
 return false;
}
function upRadioControl()
{
	this.upType = "upRadioControl";
	this.styleType = "Radio_Standard"; 
	this.group = null;
}
upRadioControl.prototype = new upDataControl();
function upFileMainControl()
{
	this.description = "";
	this.hasRecord = false;
	this.validateRequiredDo = ControlValidateRequiredFileMainControlDo;
}
upFileMainControl.prototype = new upDataControl();
function ControlValidateRequiredFileMainControlDo()
{
	if(!this.hasRecord)
	{
		var value = this.oHtml.value;
		if (value == "")
		{
			return false;
		}
	}
	return true;
}
function upFileControl()
{
	this.upType = "upFileControl";
	this.styleType = "Editfield_Standard"; 	
}
upFileControl.prototype = new upFileMainControl();
function upImageFileControl()
{
	this.upType = "upImageFileControl";
	this.styleType = "Editfield_Standard"; 	 
}
upImageFileControl.prototype = new upFileMainControl();
