function clsTextValidation(p_strForbiddenSymbols,p_strAllowedSymbols,p_intMaxLength,p_intMinLength)
{this.strForbiddenSymbols=p_strForbiddenSymbols;this.strAllowedSymbols=p_strAllowedSymbols;this.intMaxLength=p_intMaxLength;if(p_intMinLength!=null)
this.intMinLength=p_intMinLength;else
this.intMinLength=0;if(typeof(this.strAllowedSymbols)!='undefined'&&this.strAllowedSymbols!=null)
{this.objReg=new RegExp('[^'+this.strAllowedSymbols+']','g');this.strSymbolErrorCode='allowed_only';this.strSymbolErrorValue=this.strAllowedSymbols;}
else
{if(!this.strForbiddenSymbols)
{this.objReg=new RegExp('x\A','g');}
else
this.objReg=new RegExp('['+this.strForbiddenSymbols+']','g');this.strSymbolErrorCode='forbidden';this.strSymbolErrorValue=this.strForbiddenSymbols;}}
clsTextValidation.prototype.g_str_fDefaultValue=function()
{return'';}
clsTextValidation.prototype.g_hsh_fSpin=function(p_hshArgs)
{return{};}
clsTextValidation.prototype.g_str_fRealToDisplay=function(p_strRealValue)
{return p_strRealValue;}
clsTextValidation.prototype.g_str_fDisplayToReal=function(p_strDisplayValue)
{return p_strDisplayValue;}
clsTextValidation.prototype.g_hsh_fValidateValueChange=function(p_hshArgs)
{var strOldDisplayValue=p_hshArgs['strOldDisplayValue'];var strNewDisplayValue=p_hshArgs['strNewDisplayValue'];var hshCursor=p_hshArgs['hshCursor'];var objValue=p_hshArgs['objValue'];var hshDiffs=p_hsh_fGetStringDiffWithCursor(strNewDisplayValue,hshCursor['selectionEnd'],strOldDisplayValue);var strValueChange=hshDiffs['strDiffA'];var objMatch=strValueChange.match(this.objReg);if(objMatch)
{var objError=new clsError();objError.g_fAddError(this.strSymbolErrorCode,this.strSymbolErrorValue);return{objValue:objValue,blnStop:true,objError:objError};}
if(strNewDisplayValue.length>this.intMaxLength)
{var objError=new clsError();objError.g_fAddError('too_long',this.intMaxLength);return{blnStop:true,objError:objError};}
var strNewEnd=hshDiffs['strEnd'];var intCursorStart=strNewDisplayValue.length-strNewEnd.length;var objReturn={objValue:strNewDisplayValue,blnStop:false};if(strNewDisplayValue!=strOldDisplayValue)
{objReturn['strDisplayValue']=strNewDisplayValue;objReturn['hshCursor']={selectionStart:intCursorStart,selectionEnd:intCursorStart};}
return objReturn;}
clsTextValidation.prototype.g_hsh_fPostValidation=function(p_hshArgs)
{var strDisplay=p_hshArgs['strDisplayValue'];var objError=new clsError();var objMatch=strDisplay.match(this.objReg);if(objMatch)
{objError.g_fAddError(this.strSymbolErrorCode,this.strSymbolErrorValue);return{blnValid:false,objError:objError};}
if(strDisplay.length>this.intMaxLength)
{objError.g_fAddError('too_long',this.intMaxLength);return{blnValid:false,objError:objError};}
if(strDisplay.length<this.intMinLength)
{objError.g_fAddError('too_short',this.intMinLength,true);return{objValue:strDisplay,strDisplayValue:strDisplay,blnValid:true,objError:objError};}
return{objValue:strDisplay,strDisplayValue:strDisplay,blnValid:true,objError:null};}
var g_objDefaultTextValidation=new clsTextValidation(null,null,8000,0);var g_objDigitsTextValidation=new clsTextValidation('abc','1234567890',20,5);var g_objUsernameValidation=new clsTextValidation(',.()><@','0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_',20,5);var g_objPasswordValidation=new clsTextValidation(null,null,20,5);var g_objNameValidation=new clsTextValidation(null,null,50,2);var g_objMaidenNameValidation=new clsTextValidation(';:-_=+\|//?^&!.@$£#*()%~<>{}[]0123456789',null,50,0);var g_objAboutValidation=new clsTextValidation(null,null,1950,0);var g_objTextAreaProfileValidation=new clsTextValidation(null,null,195,0);var g_objInputProfileValidation=new clsTextValidation(null,null,50,0);var g_objInputProfileValidationLonger=new clsTextValidation(null,null,50,0);var g_objEventTitleValidation=new clsTextValidation(null,null,200,3);var g_objTitleValidation=new clsTextValidation(null,null,50,5);var g_objLanguageValidation=new clsTextValidation(null,null,100,0);function clsEditableBox(p_hshArgs)
{if(!p_hshArgs)
p_hshArgs={};if(p_hshArgs['strId'])
this.g_strId=p_hshArgs['strId'];else
this.g_strId=g_str_fIdGenerator();this.strClassName=p_hshArgs['strClassName']!=null?p_hshArgs['strClassName']+' ':'';this.strClassName+='input';this.hshStyle=p_hshArgs['hshStyle'];this.hshNormalStyle=p_hshArgs['hshNormalStyle'];this.strEmptyInputClassName=p_hshArgs['strEmptyInputClassName']!=null?p_hshArgs['strEmptyInputClassName']+' ':'';this.strEmptyInputClassName+='input inputEmpty';this.hshEmptyInputStyle=p_hshArgs['hshEmptyInputStyle'];this.strFocusedClassName=p_hshArgs['strFocusedClassName']!=null?p_hshArgs['strFocusedClassName']+' ':'';this.strFocusedClassName+='input inputFocused';this.hshFocusedStyle=p_hshArgs['hshFocusedStyle'];this.strDisabledClassName=p_hshArgs['strDisabledClassName']!=null?p_hshArgs['strDisabledClassName']+' ':'';this.strDisabledClassName+='input inputDisabled';this.hshDisabledStyle=p_hshArgs['hshDisabledStyle'];this.objValidation=p_hshArgs['objValidation'];if(!this.objValidation)
{this.objValidation=g_objDefaultTextValidation;}
this.blnRequired=!!p_hshArgs['blnRequired'];this.iEventInterface=iEventInterface;this.iEventInterface([cEvents.cChange,cEvents.cValidationOK,cEvents.cError,cEvents.cFocus,cEvents.cBlur]);this.blnConstructed=false;this.blnEnabled=true;this.blnFocused=false;this.objRealValue='';this.strDisplayValue='';this.blnInsertMode=false;this.intCurrentSpinCode=0;this.intSpinCount=0;this.strEmptyText=p_hshArgs['strEmptyText'];this.objPostValidationErrors=null;g_objInputFactory.g_fRegisterInput(this);}
g_fExtend(clsEditableBox,iInputInterface);clsEditableBox.prototype.g_fInit=function(p_objParent)
{p_objParent=g_obj_fElement(p_objParent);if(!p_objParent)
return;if(this.blnConstructed)
{var objInput=document.getElementById(this.g_strId);p_objParent.appendChild(objInput);return;}
this.g_fCreateComponent();this.objInput.id=this.g_strId;this.fApplyStyleChange(this.objInput,this.strClassName,this.hshStyle);if(this.objTempReal)
{var strDisplayValue=this.objValidation.g_str_fRealToDisplay(this.objTempReal);this.fPostValidation(this.objTempReal,strDisplayValue,true);}
if(this.objInput.value=='')
{this.g_fSetValue(this.objValidation.g_str_fDefaultValue(),false);}
this.g_fInitComponent(p_objParent);this.fAddEvents(this.objInput);this.blnConstructed=true;}
clsEditableBox.prototype.g_fCreateComponent=function()
{this.objInput=document.createElement('INPUT');this.objInput.type='text';}
clsEditableBox.prototype.g_fInitComponent=function(p_objParent)
{p_objParent.appendChild(this.objInput);}
clsEditableBox.prototype.g_fUninit=function()
{if(this.objInput)
this.fRemoveEvents(this.objInput);}
clsEditableBox.prototype.g_str_fGetAlign=function()
{return'left';}
clsEditableBox.prototype.g_str_fGetDisplayValue=function()
{return this.strDisplayValue;}
clsEditableBox.prototype.g_obj_fGetElement=function()
{return this.objInput;}
clsEditableBox.prototype.g_fSetDisplayValue=function(p_strDisplayValue,p_blnEvaluate)
{this.objTempReal=this.objValidation.g_str_fDisplayToReal(p_objValue);if(this.blnConstructed)
{this.fPostValidation(this.objTempReal,p_strDisplayValue,p_blnEvaluate);}}
clsEditableBox.prototype.g_str_fGetValue=function()
{return this.objRealValue;}
clsEditableBox.prototype.g_fSetValue=function(p_objValue,p_blnEvaluate)
{this.objTempReal=p_objValue;if(this.blnConstructed)
{var strDisplayValue=this.objValidation.g_str_fRealToDisplay(p_objValue);this.fPostValidation(p_objValue,strDisplayValue,p_blnEvaluate);}}
clsEditableBox.prototype.g_obj_fGetLabel=function(p_strParentId)
{return'';}
clsEditableBox.prototype.g_bln_fIsEnabled=function()
{return this.blnEnabled;}
clsEditableBox.prototype.g_fSetEnabled=function(p_blnEnabled)
{if(p_blnEnabled==null)
p_blnEnabled=true;if(p_blnEnabled==this.blnEnabled)
return;this.blnEnabled=p_blnEnabled;g_fSetEnabledFilter(this.objInput,this.blnEnabled);if(this.blnEnabled)
{this.objInput.disabled=false;}
else
{this.g_fSetFocus(false);this.objInput.disabled=true;}}
clsEditableBox.prototype.g_bln_fIsFocused=function()
{return this.blnFocused;}
clsEditableBox.prototype.g_fSetFocus=function(p_blnFocus)
{if(p_blnFocus==null)
p_blnFocus=true;if(p_blnFocus==this.blnFocused)
return;try
{if(p_blnFocus)
{this.objInput.focus();}
else
{this.objInput.blur();}}
catch(exc)
{}}
clsEditableBox.prototype.g_fSetTabIndex=function(p_intTabIndex)
{this.objInput.tabIndex=p_intTabIndex;}
clsEditableBox.prototype.g_fSetValidation=function(p_objValidation)
{if(p_objValidation&&p_objValidation.g_hsh_fPartialValidation)
{this.objValidation=p_objValidation;this.fPostValidation(this.objRealValue,this.strDisplayValue,true);}}
clsEditableBox.prototype.g_fShowError=function(arg1,arg2)
{if(arguments.length==1&&arg1&&arg1.constructor==clsError)
{this.fShowErrors(arg1);}
else
{this.fShowErrors(new clsError(arg1,arg2,true));}}
clsEditableBox.prototype.g_bln_fErrorExist=function()
{if(!this.objErrorDiv)
{return false;}
return this.objErrorDiv.parentNode!=null;}
clsEditableBox.prototype.fAddEvents=function(p_objInput)
{addEvent(p_objInput,'keypress',this.fKeyPress.closure(this));addEvent(p_objInput,'keydown',this.fKeyDown.closure(this));addEvent(p_objInput,'keyup',this.fKeyUp.closure(this));addEvent(p_objInput,'focus',this.fFocus.closure(this));addEvent(p_objInput,'blur',this.fBlur.closure(this));if(cFF)
{addEvent(p_objInput,'input',this.fInput.closure(this));addEvent(p_objInput,'dragdrop',this.fInput.closure(this));}
if(cIE)
{addEvent(p_objInput,'drop',this.fIEInputEvent.closure(this));addEvent(p_objInput,'paste',this.fIEInputEvent.closure(this));addEvent(p_objInput,'cut',this.fIEInputEvent.closure(this));}}
clsEditableBox.prototype.fRemoveEvents=function(p_objInput)
{removeEvent(p_objInput,'keypress',this.fKeyPress.closure(this));removeEvent(p_objInput,'keydown',this.fKeyDown.closure(this));removeEvent(p_objInput,'keyup',this.fKeyUp.closure(this));removeEvent(p_objInput,'focus',this.fFocus.closure(this));removeEvent(p_objInput,'blur',this.fBlur.closure(this));if(cFF)
{removeEvent(p_objInput,'dragdrop',this.fInput.closure(this));removeEvent(p_objInput,'input',this.fInput.closure(this));}
if(cIE)
{removeEvent(p_objInput,'drop',this.fIEInputEvent.closure(this));removeEvent(p_objInput,'paste',this.fIEInputEvent.closure(this));removeEvent(p_objInput,'cut',this.fIEInputEvent.closure(this));}}
clsEditableBox.prototype.fApplyStyleChange=function(p_objInput,p_strClassName,p_hshStyle)
{p_objInput.className=p_strClassName;g_fApplyStyleProperties(p_objInput,p_hshStyle);p_objInput.style.border='none';}
clsEditableBox.prototype.fPostValidation=function(p_objValue,p_strDisplayValue,p_blnEvaluate)
{var hshCom=this.objValidation.g_hsh_fPostValidation({'objValue':p_objValue,'strDisplayValue':p_strDisplayValue});var hshEvent={object:this,value:hshCom['objValue']};if(hshCom['blnValid'])
{if(p_blnEvaluate)
this.fFireEvent(cEvents.cValidationOK,hshEvent);if(this.objRealValue!=hshCom['objValue'])
{this.objRealValue=hshCom['objValue'];this.strDisplayValue=hshCom['strDisplayValue'];this.objInput.value=this.strDisplayValue;if(p_blnEvaluate)
this.fFireEvent(cEvents.cChange,hshEvent);}}
else
{hshEvent['objError']=hshCom['objError'];if(p_blnEvaluate)
this.fFireEvent(cEvents.cError,hshEvent);}
this.objPostValidationErrors=hshCom['objError'];if(this.blnRequired)
{if(this.strDisplayValue=='')
{if(this.objPostValidationErrors==null)
{this.objPostValidationErrors=new clsError();}
this.objPostValidationErrors.g_fAddError('required_value','',true);}}
this.fShowErrors(this.objPostValidationErrors);}
clsEditableBox.prototype.fContinuousSpin=function(p_intSpinCode,p_intVal)
{var intDirection=p_intSpinCode=='38'?1:-1;var intSpinValue=intDirection*Math.ceil((Math.abs(this.intSpinCount)+1)/10)*p_intVal;if(p_intSpinCode!=this.intCurrentSpinCode)
{this.intCurrentSpinCode=p_intSpinCode;this.intSpinCount=0;}
else
{this.intSpinCount+=intSpinValue;}
var hshInfo=g_hsh_fGetCursorInformation(this.objInput);hshCom=this.objValidation.g_hsh_fSpin({'objValue':this.objRealValue,'strDisplayValue':this.strDisplayValue,'intSpinValue':intSpinValue,'hshCursor':hshInfo});this.fParseValidationInformation(hshCom,hshInfo);}
clsEditableBox.prototype.fEndContinuousSpin=function()
{this.intCurrentSpinCode=0;this.intSpinCount=0;}
clsEditableBox.prototype.fApplyInsertMode=function(p_hshCursorInfo)
{var intStart=p_hshCursorInfo['selectionStart'];var intEnd=p_hshCursorInfo['selectionStart'];if(this.blnInsertMode)
intEnd++;if(this.objValidation.g_hsh_fValidateCursorInfo)
{var hshNewInfo=this.objValidation.g_hsh_fValidateCursorInfo({selectionStart:p_hshCursorInfo['selectionStart'],selectionEnd:intEnd,blnInsertMode:this.blnInsertMode});intStart=hshNewInfo['selectionStart'];intEnd=hshNewInfo['selectionEnd'];}
if(p_hshCursorInfo['selectionStart']!=intStart||p_hshCursorInfo['selectionEnd']!=intEnd)
{g_fSetSelectionRange(this.objInput,intStart,intEnd);}}
clsEditableBox.prototype.fInvalidateCursor=function(p_hshCursor)
{p_hshCursor['selectionEnd']=p_hshCursor['selectionStart']-1;}
clsEditableBox.prototype.fShowErrors=function(p_objError)
{return;if(!this.blnConstructed)
return;if(p_objError==null||p_objError.g_intCount==0)
{return this.fHideErrors();}
var objOuterElement=this.obj_fGetOuterElement();var objOffsetParent=objOuterElement.offsetParent;var arrArg=objPosition(objOuterElement);var arr_intPositions=[6];var blnNewDiv=false;if(!this.objErrorDiv)
{blnNewDiv=true;this.objErrorDiv=document.createElement('DIV');this.objErrorDiv.style.position='absolute';}
this.objErrorDiv.innerHTML=p_objError.g_str_fGetHTMLMessage();this.objErrorDiv.style.width='250px';hshTemp=g_hsh_int_fGetCoordsByPosition(arrArg[2],arrArg[3],arrArg[0],arrArg[1],250,20,arr_intPositions);var arrLocalCoords=g_arr_int_fGetCoords(objOffsetParent,hshTemp['intX'],hshTemp['intY']);this.objErrorDiv.style.left=arrLocalCoords[0]+'px';this.objErrorDiv.style.top=arrLocalCoords[1]+'px';if(blnNewDiv)
{objOffsetParent.appendChild(this.objErrorDiv);}}
clsEditableBox.prototype.fHideErrors=function()
{if(this.objErrorDiv)
{this.objErrorDiv.parentNode.removeChild(this.objErrorDiv);this.objErrorDiv=null;}}
clsEditableBox.prototype.obj_fGetOuterElement=function()
{return this.objInput;}
clsEditableBox.prototype.fParseValidationInformation=function(p_hshValidation,p_hshCursorInfo,p_blnReconstructOnError)
{var hshNewCursor=null;var blnNeedOnChangeEvent=false;var objError=p_hshValidation['objError'];if(p_hshValidation['strDisplayValue']!=null)
{if(p_hshValidation['blnStop'])
{this.objInput.value=p_hshValidation['strDisplayValue'];}
this.strDisplayValue=p_hshValidation['strDisplayValue'];hshNewCursor=p_hshCursorInfo;if(this.objRealValue!=p_hshValidation['objValue'])
{this.objRealValue=p_hshValidation['objValue'];blnNeedOnChangeEvent=true;}}
else
{if(p_blnReconstructOnError)
{var hshDiffs=p_hsh_fGetStringDiffWithCursor(this.objInput.value,p_hshCursorInfo.selectionEnd,this.strDisplayValue);hshNewCursor={selectionStart:hshDiffs['strBegin'].length,selectionEnd:hshDiffs['strBegin'].length+hshDiffs['strDiffB'].length};this.objInput.value=this.strDisplayValue;}}
if(p_hshValidation['hshCursor']!=null)
{hshNewCursor=p_hshValidation['hshCursor'];}
if(hshNewCursor&&p_hshValidation['blnStop'])
{this.fInvalidateCursor(hshNewCursor);this.fApplyInsertMode(hshNewCursor);}
this.fShowErrors(objError);if(blnNeedOnChangeEvent)
{this.fFireEvent(cEvents.cChange,{object:this,value:this.objRealValue});}
if(objError)
{this.fFireEvent(cEvents.cError,{object:this,value:this.objRealValue,objError:objError});}
else
{this.fFireEvent(cEvents.cValidationOK,{object:this,value:this.objRealValue});}}
clsEditableBox.prototype.fKeyPress=function(p_hshEvent)
{var objEvent=p_hshEvent['event'];var intCode=g_int_fGetKeyCode(objEvent);var intCharCode=g_int_fGetCharCode(objEvent);var objValue=this.objInput.value;var blnNeedOnChangeEvent=false;var objError=null;var hshCom=null;if((!intCharCode&&intCode!=13)||cFF&&(objEvent.altKey||objEvent.ctrlKey))
{}
else
{var strSymbol=g_str_fGetInputChar(objEvent);var hshInfo=g_hsh_fGetCursorInformation(this.objInput);var strNewDisplayValue=this.objInput.value;strNewDisplayValue=strNewDisplayValue.substring(0,hshInfo.selectionStart)+strSymbol+strNewDisplayValue.substr(hshInfo.selectionEnd);hshInfo['selectionStart']=hshInfo['selectionStart']+strSymbol.length;hshInfo['selectionEnd']=hshInfo['selectionStart']
var hshCom=this.objValidation.g_hsh_fValidateValueChange({'objValue':this.objRealValue,'strOldDisplayValue':this.strDisplayValue,'strNewDisplayValue':strNewDisplayValue,'hshCursor':hshInfo});this.fParseValidationInformation(hshCom,hshInfo);if(hshCom['blnStop'])
{g_fStopEvent(objEvent,true,false);}}}
clsEditableBox.prototype.fKeyDown=function(p_hshEvent)
{var intKeyCode=p_hshEvent['event'].keyCode;var hshCom=null;var blnStop=false;if(this.objValidation.g_hsh_fValidateControlKeys)
{var hshInfo=g_hsh_fGetCursorInformation(this.objInput);hshCom=this.objValidation.g_hsh_fValidateControlKeys({'objInput':this.objInput,'objValue':this.objRealValue,'strDisplayValue':this.strDisplayValue,'intCode':intKeyCode,'hshCursor':hshInfo});this.objRealValue=hshCom['objValue'];this.strDisplayValue=this.objInput.value;blnStop=hshCom['blnStop'];hshInfo=hshCom['hshCursor'];this.fApplyInsertMode(hshInfo);}
if(intKeyCode=='38'||intKeyCode=='40')
{this.fContinuousSpin(intKeyCode,1);}
else
{this.fEndContinuousSpin();}
if(intKeyCode=='45')
{this.blnInsertMode=!this.blnInsertMode;var hshInfo=g_hsh_fGetCursorInformation(this.objInput);this.fApplyInsertMode(hshInfo);}
if(blnStop)
{g_fStopEvent(p_hshEvent['event'],true,false);}}
clsEditableBox.prototype.fKeyUp=function(p_hshEvent)
{var intKeyCode=p_hshEvent['event'].keyCode;if(intKeyCode==this.intCurrentSpinCode)
{this.fEndContinuousSpin();}
this.blnWasKeyUp=true;}
clsEditableBox.prototype.fInput=function(p_hshEvent)
{var strNewDisplayValue=this.objInput.value;if(strNewDisplayValue==this.strDisplayValue)
return;var hshInfo=g_hsh_fGetCursorInformation(this.objInput);var hshCom=this.objValidation.g_hsh_fValidateValueChange({'objValue':this.objRealValue,'strOldDisplayValue':this.strDisplayValue,'strNewDisplayValue':strNewDisplayValue,'hshCursor':hshInfo});this.fParseValidationInformation(hshCom,hshInfo,true);}
clsEditableBox.prototype.fIEInputEvent=function(p_hshEvent)
{if(!this.objCaller)
{this.objCaller=new clsFunctionCaller(this.fIEChangeEvent,this,1);this.objCaller.g_fStartCounter({object:p_hshEvent['object']});}}
clsEditableBox.prototype.fIEChangeEvent=function(p_hshEvent)
{this.fInput(p_hshEvent);this.objCaller=null;}
clsEditableBox.prototype.fFocus=function(p_hshEvent)
{if(!this.blnEnabled)
return;this.fApplyStyleChange(this.objInput,this.strFocusedClassName,this.hshFocusedStyle);this.blnFocused=true;this.objRealValueOnFocus=this.objRealValue;p_hshEvent['object']=this;if(typeof(this.objValidation.g_str_fGetDisplayValueFocused)=='function')
{var strNewDisplayValue=this.objValidation.g_str_fGetDisplayValueFocused(this.objRealValue);this.objInput.value=strNewDisplayValue;}
g_fSetSelectionRange(this.objInput,0,this.objInput.value.length);this.fFireEvent(cEvents.cFocus,p_hshEvent);}
clsEditableBox.prototype.fBlur=function(p_hshEvent)
{if(cIE)
{if(!this.objBlurCaller)
{this.objBlurCaller=new clsFunctionCaller(this.fBlurEvent,this,0);this.objBlurCaller.g_fStartCounter({object:p_hshEvent['object']});}}
else
{this.fBlurEvent(p_hshEvent);}}
clsEditableBox.prototype.fBlurEvent=function(p_hshEvent)
{this.objBlurCaller=null;if(!this.blnEnabled)
return;this.fApplyStyleChange(this.objInput,this.strClassName,this.hshNormalStyle);this.blnFocused=false;this.fHideErrors();p_hshEvent['object']=this;if(typeof(this.objValidation.g_str_fGetDisplayValueUnfocused)=='function')
{var strNewDisplayValue=this.objValidation.g_str_fGetDisplayValueUnfocused(this.objRealValue);this.objInput.value=strNewDisplayValue;}
if(this.objInput.value=='')
{this.objRealValue='';}
if(this.objRealValueOnFocus!=this.objRealValue||this.objPostValidationErrors!=null||this.blnWasKeyUp)
{this.fChange(p_hshEvent);this.blnWasKeyUp=false;}
this.fFireEvent(cEvents.cBlur,p_hshEvent);}
clsEditableBox.prototype.fChange=function(p_hshEvent)
{var strDisplayValue=this.objInput.value;var strRealValue=this.objValidation.g_str_fDisplayToReal(strDisplayValue);this.fPostValidation(strRealValue,strDisplayValue,true);}
function clsError()
{this.hshErrors={};this.g_intCount=0;if(arguments.length>0)
{this.g_fAddError(arguments[0],arguments[1],arguments[2]);}}
clsError.prototype.g_fAddError=function(p_strKey,p_strValue,p_blnCritical)
{this.hshErrors[p_strKey]={strKey:p_strKey,strValue:p_strValue,blnCritical:!!p_blnCritical};this.g_intCount++;}
clsError.prototype.g_str_fGetMessage=function()
{var strReturn='';for(var strKey in this.hshErrors)
{strReturn+=this.str_fFormatError(this.hshErrors[strKey])+'\n';}
return strReturn;}
clsError.prototype.g_str_fGetHTMLMessage=function()
{var strCritical='';var strNormal='';for(var strKey in this.hshErrors)
{var hshItem=this.hshErrors[strKey];if(hshItem['blnCritical'])
{strCritical+='<span><img style="width: 16px; height: 16px; vertical-align: middle;" src="'+cSYS.cIMAGE_PATH+'inputs/16_forbidden.gif" title="'+this.str_fFormatError(hshItem)+'" /></span><br/>';}
else
{strNormal+='<span><img style="width: 16px; height: 16px; vertical-align: middle;" src="'+cSYS.cIMAGE_PATH+'inputs/16_warning.gif" title="'+this.str_fFormatError(hshItem)+'" /></span><br/>';}}
return strCritical+' '+strNormal;}
clsError.prototype.str_fFormatError=function(p_hshItem)
{var strKey=p_hshItem['strKey'];switch(strKey)
{case'bad_symbols':return objLang.g_str_fGetString('symbol')+' \''+p_hshItem['strValue']+'\' '+objLang.g_str_fGetString('is_not_allowed');case'too_big':return objLang.g_str_fGetString('max_allowed_value_is')+' '+p_hshItem['strValue'];case'too_small':return objLang.g_str_fGetString('min_allowed_value_is')+' '+p_hshItem['strValue'];case'not_an_integer':return objLang.g_str_fGetString('not_an_integer');case'required_value':return objLang.g_str_fGetString('required_value');case'too_short':return objLang.g_str_fGetString('too_short')+' '+p_hshItem['strValue'];case'too_long':return objLang.g_str_fGetString('too_long')+' '+p_hshItem['strValue'];default:return strKey;}}
clsError.prototype.g_fAddErrors=function(p_objError)
{if(!p_objError)
return;for(var strKey in p_objError.hshErrors)
{this.hshErrors[strKey]=p_objError.hshErrors[strKey];this.g_intCount++;}}
function clsPasswordBox(p_hshArgs)
{clsTextBox.baseConstructor.call(this,p_hshArgs);this.hshStyle=p_hshArgs['hshStyle'];}
g_fExtend(clsPasswordBox,clsEditableBox);clsPasswordBox.prototype.g_fCreateComponent=function()
{this.objInput=document.createElement('INPUT');this.objInput.type='password';}
clsPasswordBox.prototype.g_fUninit=function()
{if(this.objInput)
this.fRemoveEvents(this.objInput);}
clsPasswordBox.prototype.fApplyStyleChange=function(p_objInput,p_strClassName,p_hshStyle)
{p_objInput.className=p_strClassName;g_fApplyStyleProperties(p_objInput,p_hshStyle);}
function clsTextArea(p_hshArgs)
{clsTextArea.baseConstructor.call(this,p_hshArgs);this.hshStyle=p_hshArgs['hshStyle'];}
g_fExtend(clsTextArea,clsEditableBox);clsTextArea.prototype.g_fCreateComponent=function()
{this.objInput=document.createElement('TEXTAREA');this.objInput.rows='4';this.objInput.cols='20';if(cFF)
{this.objInput.wrap='virtual';this.objInput.style.marginTop='0px';}
if(cIE)
{this.objInput.wrap='soft';this.objInput.style.marginTop='-1px';this.objInput.style.marginBottom='-1px';}
this.objInput.style.width='100%';this.objInput.style.height='100%';}
clsTextArea.prototype.g_fUninit=function()
{if(this.objInput)
this.fRemoveEvents(this.objInput);}
clsTextArea.prototype.fApplyStyleChange=function(p_objInput,p_strClassName,p_hshStyle)
{p_objInput.className=p_strClassName;g_fApplyStyleProperties(p_objInput,p_hshStyle);}
function clsTextBox(p_hshArgs)
{clsTextBox.baseConstructor.call(this,p_hshArgs);this.hshStyle=p_hshArgs['hshStyle'];}
g_fExtend(clsTextBox,clsEditableBox);clsTextBox.prototype.g_fCreateComponent=function()
{this.objInput=document.createElement('INPUT');this.objInput.type='text';}
clsTextBox.prototype.g_fUninit=function()
{if(this.objInput)
this.fRemoveEvents(this.objInput);}
clsTextBox.prototype.fApplyStyleChange=function(p_objInput,p_strClassName,p_hshStyle)
{p_objInput.className=p_strClassName;g_fApplyStyleProperties(p_objInput,p_hshStyle);}
var g_objInputFactory={hshInputs:{},g_obj_fCreate:function(g_fContructor,p_hshArgs)
{var objInput=new g_fContructor(p_hshArgs);this.hshInputs[objInput.g_strId]=objInput;return objInput;},g_obj_fGetInput:function(p_strInputId)
{return this.hshInputs[p_strInputId];},g_fRegisterInput:function(p_objInput)
{this.hshInputs[p_objInput.g_strId]=p_objInput;},g_fUninit:function()
{for(var strKey in this.hshInputs)
{if(this.hshInputs[strKey].g_fUninit)
this.hshInputs[strKey].g_fUninit();}
this.hshInputs={};}}
function g_fUninitInputs(p_objEvent)
{g_objInputFactory.g_fUninit();}
addEvent(window,'unload',g_fUninitInputs);function iInputInterface(p_hshArgs)
{this.g_strId;this.iEventInterface=iEventInterface;this.iEventInterface();}
iInputInterface.prototype.g_fInit=function(p_objParent)
{if(typeof(p_objParent)=='string')
{p_objParent=document.getElementById(p_objParent);}}
iInputInterface.prototype.g_fUninit=function()
{}
iInputInterface.prototype.g_str_fGetAlign=function()
{}
iInputInterface.prototype.g_str_fGetDisplayValue=function()
{}
iInputInterface.prototype.g_fSetDisplayValue=function(p_strValue,p_blnEvaluate)
{}
iInputInterface.prototype.g_str_fGetValue=function()
{}
iInputInterface.prototype.g_fSetValue=function(p_strValue,p_blnEvaluate)
{}
iInputInterface.prototype.g_obj_fGetLabel=function(p_strParentId)
{}
iInputInterface.prototype.g_bln_fIsEnabled=function()
{}
iInputInterface.prototype.g_fSetEnabled=function(p_blnEnabled)
{}
iInputInterface.prototype.g_bln_fIsFocused=function(p_strId)
{}
iInputInterface.prototype.g_fSetFocus=function(p_blnFocus)
{}
iInputInterface.prototype.g_fSetTabIndex=function(p_strId,p_intTabIndex)
{}
iInputInterface.prototype.g_fAddEvent=function(p_strEvent,p_objContext,p_fFunction,p_blnOneTimeRun)
{}
iInputInterface.prototype.g_fRemoveEvent=function(p_strEvent,p_objContext,p_fFunction)
{}
iInputInterface.prototype.fFireEvent=function(p_strEvent,p_objArg)
{}
iInputInterface.prototype.int_fGetRegisteredHandlerCount=function(p_strEvent)
{}
function g_fAddValidationMessages(p_objInputHTMLElement,p_objIconParent,p_objTextParent,p_strType,p_strMessage,p_objTextElement)
{var objRelativeElement=g_obj_fElement(p_objInputHTMLElement);if(!objRelativeElement)
return;if(p_strType&&p_strType.toLowerCase()=='clear')
return g_fSetValidationMessages(objRelativeElement,p_objIconParent,p_objTextParent,p_strType,p_strMessage)
p_objIconParent=g_obj_fElement(p_objIconParent);if(p_objIconParent)
{fAddValidationIcon(p_objInputHTMLElement,p_objIconParent,p_strType,p_strMessage);}
if(p_objTextElement)
{p_objTextElement=g_obj_fElement(p_objTextElement);objRelativeElement.setAttribute('msgTextId',p_objTextElement.id);}
p_objTextParent=g_obj_fElement(p_objTextParent);if(p_objTextParent)
{fAddValidationText(p_objInputHTMLElement,p_objTextParent,p_strType,p_strMessage);}}
function g_fSetValidationMessages(p_objInputHTMLElement,p_objIconParent,p_objTextParent,p_strType,p_strMessage,p_objTextElement)
{var objRelativeElement=g_obj_fElement(p_objInputHTMLElement);if(!objRelativeElement)
return;p_objIconParent=g_obj_fElement(p_objIconParent);if(p_objIconParent)
{fAddValidationIcon(p_objInputHTMLElement,p_objIconParent,p_strType,p_strMessage);}
if(p_objTextElement)
{p_objTextElement=g_obj_fElement(p_objTextElement);objRelativeElement.setAttribute('msgTextId',p_objTextElement.id);}
p_objTextParent=g_obj_fElement(p_objTextParent);if(p_objTextParent)
{fSetValidationText(p_objInputHTMLElement,p_objTextParent,p_strType,p_strMessage);}}
function g_fRemoveValidationMessages(p_objElement)
{var objOuterElement=g_obj_fElement(p_objElement);if(!objOuterElement)
return;fRemoveValidationByAttribute(objOuterElement,'msgIconId');fRemoveValidationByAttribute(objOuterElement,'msgTextId');}
function fAddValidationIcon(p_objInputHTMLElement,p_objTextParent,p_strType,p_strMessage)
{var strMsgIconId=p_objInputHTMLElement.getAttribute('msgIconId');var objMessageIcon=g_obj_fElement(strMsgIconId);if(!objMessageIcon)
{var objImg=document.createElement('IMG');objImg.style.width='16px';objImg.style.height='16px';objImg.style.verticalAlign='middle';objImg.src=cSYS.cIMAGE_PATH+'inputs/'+g_str_fGetValidationImage(p_strType);objImg.title=g_str_fGetValidationTitle(p_strType,p_strMessage);objImg.id=g_str_fIdGenerator();p_objInputHTMLElement.setAttribute('msgIconId',objImg.id);p_objTextParent.appendChild(objImg);}
else
{objMessageIcon.src=cSYS.cIMAGE_PATH+'inputs/'+g_str_fGetValidationImage(p_strType);objMessageIcon.title=g_str_fGetValidationTitle(p_strType,p_strMessage);}}
function fAddValidationText(p_objInputHTMLElement,p_objTextParent,p_strType,p_strMessage)
{var strMsgTextId=p_objInputHTMLElement.getAttribute('msgTextId');var objMessageText=g_obj_fElement(strMsgTextId);if(!objMessageText)
{var objSpan=document.createElement('DIV');objSpan.className='inputValidationText';objSpan.id=g_str_fIdGenerator();p_objInputHTMLElement.setAttribute('msgTextId',objSpan.id);objSpan.innerHTML=g_str_fFormatValidationTitle(g_str_fGetValidationTitle(p_strType,p_strMessage));p_objTextParent.appendChild(objSpan);}
else
{objMessageText.innerHTML+='<br/>'+g_str_fFormatValidationTitle(g_str_fGetValidationTitle(p_strType,p_strMessage));}}
function fSetValidationText(p_objInputHTMLElement,p_objTextParent,p_strType,p_strMessage)
{var strMsgTextId=p_objInputHTMLElement.getAttribute('msgTextId');var objMessageText=g_obj_fElement(strMsgTextId);if(!objMessageText)
{var objSpan=document.createElement('DIV');objSpan.className='inputValidationText'
objSpan.id=g_str_fIdGenerator();p_objInputHTMLElement.setAttribute('msgTextId',objSpan.id);objSpan.innerHTML=g_str_fFormatValidationTitle(g_str_fGetValidationTitle(p_strType,p_strMessage));p_objTextParent.appendChild(objSpan);}
else
{objMessageText.innerHTML=g_str_fFormatValidationTitle(g_str_fGetValidationTitle(p_strType,p_strMessage));}}
function fRemoveValidationByAttribute(p_objOuterElement,p_strAttribute)
{var strMsgDivId=p_objOuterElement.getAttribute(p_strAttribute);var objMessageDiv=g_obj_fElement(strMsgDivId);if(objMessageDiv&&objMessageDiv.parentNode&&objMessageDiv.parentNode.removeChild)
{objMessageDiv.parentNode.removeChild(objMessageDiv);objMessageDiv=null;p_objOuterElement.removeAttribute(p_strAttribute);}}
function g_str_fGetValidationImage(p_strType)
{var strType=p_strType.toLowerCase();if(strType=='ok')
{return'ok.gif';}
else
{return'disabled.gif';}}
function g_str_fFormatValidationTitle(p_strTitle)
{if(p_strTitle=='')
p_strTitle='&nbsp;';return p_strTitle;}
function g_str_fGetValidationTitle(p_strType,p_strMessage)
{var strType=p_strType.toLowerCase();if(strType=='ok'||strType=='clear')
{return'';}
else if(strType.substring(0,8)=='disabled')
{return'';}
else
{switch(strType)
{case'bad_symbols':return objLang.g_str_fGetString('symbol')+' \''+p_strMessage+'\' '+objLang.g_str_fGetString('is_not_allowed');case'too_big':return objLang.g_str_fGetString('max_allowed_value_is')+' '+p_strMessage;case'too_small':return objLang.g_str_fGetString('min_allowed_value_is')+' '+p_strMessage;case'not_an_integer':return objLang.g_str_fGetString('not_an_integer');case'required_value':return objLang.g_str_fGetString('required_value');case'too_short':return objLang.g_str_fGetString('too_short')+' '+p_strMessage;case'too_long':return objLang.g_str_fGetString('too_long')+' '+p_strMessage;default:return p_strMessage;}}
return'';}