function HpConstants(){}
HpConstants.JSF=':';
HpConstants.MESSAGES='messages';
HpConstants.SERVICE_SUCCESS='enterprise.SUCCESS';
HpConstants.control='control';
HpConstants.config='config';
HpConstants.init='init';
HpConstants.localize='localize';
HpConstants.localizer='localizer';
HpConstants.text='text';
HpConstants.integer='integer';
HpConstants.decimal= 'decimal';
HpConstants.currency='currency';
HpConstants.rate= 'rate';
HpConstants.minlength= 'minlength';
HpConstants.maxlength= 'maxlength';
HpConstants.minimum= 'minimum';
HpConstants.maximum= 'maximum';
HpConstants.step='step';
HpConstants.format='format';
HpConstants.notrim='notrim';
HpConstants.plain= 'plain';
HpConstants.required='required';
HpConstants.readonly='readonly';
HpConstants.info= 'info';
HpConstants.warn= 'warn';
HpConstants.error='error';
HpConstants.success='success';
HpConstants.active='active';
HpConstants.passive='passive';
HpConstants.hide= 'hide';
HpConstants.light='light';
HpConstants.selected='selected';
function HpResource(){}
HpResource.decimalSeparator='.';
HpResource.groupingSeparator=',';
HpResource.minlength='Minimum charaters';
HpResource.maxlength='Maximum characters';
HpResource.minimum='Minimum';
HpResource.maximum='Maximum';
HpResource.step='Allowed step size:';
HpResource.errorAJAX='Action failed!';
HpResource.errorCurrency='Not a valid number or more than two decimal places!';
HpResource.errorDecimal='Not a valid number!';
HpResource.errorInteger='Bitte nur Ganzzahlen eingeben!';
HpResource.errorRate='Not a valid number or more than four decimal places!';
HpResource.errorRequired='Input data are missing!';
HpResource.errorTrim='No leading or trailing spaces!';
function HpEvent(event)
{
this.type=null;
this.target=null;
this.relatedTarget=null;
this.keyCode=null;
this.clientX=null;
this.clientY=null;
if(event==null)
event=window.event;
this.type=event.type;
if(event.srcElement==null)
this.target=event.target;
else
this.target=event.srcElement;
if(event.type=='mouseover')
{
if((event.relatedTarget==null) && (event.fromElement!=null))
this.relatedTarget=event.fromElement;
else
this.relatedTarget=event.relatedTarget;
}
else if(event.type=='mouseout')
{
if((event.relatedTarget==null) && (event.toElement!=null))
this.relatedTarget=event.toElement;
else
this.relatedTarget=event.relatedTarget;
}
this.keyCode=event.keyCode;
this.clientX=event.clientX;
this.clientY=event.clientY;
}
HpEvent.addEvent=function(a,b,c,d){if(a.addEventListener){a.addEventListener(b,c,d);return true;}else if(a.attachEvent){var e=a.attachEvent('on'+b,c);return e;}else {a['on'+b]=c;}}
function HpCore(){}
HpCore.messages=null;
HpCore.actions=new Array();
HpCore.locale='en';
HpCore.locales=new Array('en','de');
HpCore.initAutomatic=true;
HpCore.initBefore=new Array();
HpCore.initStartElement=new Array();
HpCore.initEndElement=new Array();
HpCore.initAfter=new Array();
HpEvent.addEvent(window,'load',initHpCore,false);
function initHpCore()
{
var i=0;
HpCore.messages=document.getElementById(HpConstants.MESSAGES);
for(i=0;i<HpCore.initBefore.length;i++)
HpCore.initBefore[i]();
if(HpCore.initAutomatic==true)
HpAction.registerAutomatic(new Array(),document);
for(i=0;i<HpCore.initAfter.length;i++)
HpCore.initAfter[i]();
HpAction.connect();
HpCore.initBefore=null;
HpCore.initStartElement=null;
HpCore.initEndElement=null;
HpCore.initAfter=null;
}
HpCore.addInitBefore=function(a){HpCore.initBefore[HpCore.initBefore.length]=a;}
HpCore.addInitStartElement=function(a){HpCore.initStartElement[HpCore.initStartElement.length]=a;}
HpCore.addInitEndElement=function(a){HpCore.initEndElement[HpCore.initEndElement.length]=a;}
HpCore.addInitAfter=function(a){HpCore.initAfter[HpCore.initAfter.length]=a;}
function HpDom(){}
HpDom.searchClass=function(a,b){var c=0;var d='';if((a.className==null)||(a.className.length<=0)) return null;c=a.className.indexOf(b);if((c<0)||((c>0)&&(a.className.charAt(c-1)!=' '))) return null;for(;(c<a.className.length)&&(a.className.charAt(c)!=' ');c++) d=d+a.className.charAt(c);return d;}
HpDom.containsClass=function(a,b){if(HpDom.getClassIndex(a,b)>=0) return true;else return false;}
HpDom.getClassIndex=function(a,b){var c=0;if(a.className==null) return -1;if(a.className==b) return 0;c=a.className.indexOf(b+' ');if(c==0) return 0;c=a.className.indexOf(' '+b+' ');if(c>=0) return c+1;c=a.className.indexOf(' '+b);if((c>=0)&&(c==a.className.length-1-b.length)) return c+1;return -1;}
HpDom.getClasses=function(a){return a.className;}
HpDom.setClasses=function(a,b){a.className=b;}
HpDom.addClass=function(a,b){if(b==null) return;if(HpDom.containsClass(a,b)==false){if(a.className.length==0) a.className=b;else a.className=a.className+' '+b;}}
HpDom.addClasses=function(a,b){var c=0;var d=null;if(b==null) return;d=HpUtil.compressSpace(b).split(' ');for(c=0;c<d.length;c++) HpDom.addClass(a,d[c]);}
HpDom.removeClass=function(a,b){var c=0;if(b==null) return;c=HpDom.getClassIndex(a,b);if(c>=0) a.className=a.className.substring(0,c)+a.className.substring(c+b.length,a.className.length);}
HpDom.removeClasses=function(a,b){var c=0;var d=null;if(b==null) return;d=HpUtil.compressSpace(b).split(' ');for(c=0;c<d.length;c++) HpDom.removeClass(a,d[c]);}
HpDom.getElementsByClass=function(a,b){var c=0;var d=null;var e=new Array();if(HpDom.containsClass(a,b)==true) e[e.length]=a;for(c=0;c<a.childNodes.length;c++){d=HpDom.getElementsByClass(a.childNodes[c],b);HpUtil.append(e,d);}return e;}
HpDom.removeChilds=function(a){var b=a.childNodes.length;while(a.hasChildNodes()) a.removeChild(a.firstChild);return b;}
HpDom.getChild=function(a,b){var c=0;for(c=0;c<a.childNodes.length;c++){if(a.childNodes[c].nodeName.toLowerCase()==b.toLowerCase()) return a.childNodes[c];}return null;}
HpDom.listChild=function(a,b,c){var d=0;var e=0;var f=null;var g=new Array();var h=null;if(b!=null) h=b.split(',');for(d=0;d<a.childNodes.length;d++){f=a.childNodes[d];if((f==null)||(f.nodeType!=1)) continue;if(b==null){g[g.length]=f;}else {if(f.nodeName!=null){for(e=0;e<h.length;e++){if(f.nodeName.toLowerCase()==h[e].toLowerCase()) g[g.length]=f;}}}if((c==true)&&(f.hasChildNodes()==true)) HpUtil.appendArray(g,HpDom.listChild(f,b,c));}return g;}
HpDom.isParent=function(a,b){var c=0;while(b.parentNode!=null){if(b.parentNode==a) return true;b=b.parentNode;}return false;}
HpDom.findParent=function(a,b){if(a.parentNode==null) return null;if(a.parentNode.nodeName.toLowerCase()==b.toLowerCase()) return a.parentNode;return HpDom.findParent(a.parentNode,b);}
HpDom.findPrevious=function(a,b){while(a!=null){a=a.previousSibling;if(a==null) return null;if(a.nodeName.toLowerCase()==b) return a;}return null;}
HpDom.findNext=function(a,b){while(a!=null){a=a.nextSibling;if(a==null) return null;if(a.nodeName.toLowerCase()==b) return a;}return null;}
HpDom.getText=function(a){if(HpDom.isField(a)==true) return a.value;else if((a.firstChild==null)||(a.nodeValue!=null)) return a.nodeValue;else return a.firstChild.nodeValue;}
HpDom.setText=function(a,b){if(HpDom.isField(a)==true) a.value=b;else if((a.firstChild==null)||(a.nodeValue!=null)) a.nodeValue=b;else a.firstChild.nodeValue=b;}
HpDom.unselect=function(a){var b=HpDom.getText(a);HpDom.setText(a,'');HpDom.setText(a,b);}
HpDom.isField=function(a){var b=null;if(a.nodeName==null) return false;b=a.nodeName.toLowerCase();if((b=='input')||(b=='select')||(b=='textarea')) return true;else return false;}
HpDom.isInput=function(a){if((a.nodeName!=null)&&(a.nodeName.toLowerCase()=='input')) return true;else return false;}
HpDom.isSelect=function(a){if((a.nodeName!=null)&&(a.nodeName.toLowerCase()=='select')) return true;else return false;}
HpDom.isTextArea=function(a){if((a.nodeName!=null)&&(a.nodeName.toLowerCase()=='textarea')) return true;else return false;}
HpDom.clearElement=function(a){if(HpDom.isSelect(a)==true) HpDom.removeChilds(a);else if(HpDom.isField(a)==true) HpDom.setText(a,'');else HpDom.removeChilds(a);}
HpDom.addOption=function(a,b,c,d,e){HpDom.setOption(a,a.length,b,c,d,e);}
HpDom.setOption=function(a,b,c,d,e,f){a[b]=new Option(c,d,e,f);}
HpDom.removeOption=function(a,b){a[b]=null;}
HpDom.removeOptionByValue=function(a,b){var c=0;for(c=a.options.length-1;c>=0;c--){if(a.options[c].value==b) a[c]=null;}}
HpDom.getAttribute=function(a,b){return a.getAttributeNode(b);}
HpDom.setAttribute=function(a,b,c){var d=null;try{d=document.createAttribute(b);d.nodeValue=c;a.setAttributeNode(d);}catch(e){a.setAttribute(b,c);}return a.getAttributeNode(b);}
HpDom.removeAttribute=function(a,b){a.removeAttribute(b,0);}
HpDom.cloneXML=function(a){var b=0;var c=null;var d=null;if(a.nodeType==1){c=document.createElement(a.nodeName);for(b=0;b<a.attributes.length;b++){if(a.attributes[b].nodeName=='onabort') c.onabort=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onblur') c.onblur=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onchange') c.onchange=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onclick') c.onclick=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='ondblclick') c.ondblclick=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onerror') c.onerror=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onfocus') c.onfocus=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onkeydown') c.onkeydown=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onkeypress') c.onkeypress=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onkeyup') c.onkeyup=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onload') c.onload=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onmousedown') c.onmousedown=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onmousemove') c.onmousemove=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onmouseout') c.onmouseout=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onmouseover') c.onmouseover=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onmouseup') c.onmouseup=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onreset') c.onreset=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onresize') c.onresize=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onselect') c.onselect=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onsubmit') c.onsubmit=new Function('event',a.attributes[b].nodeValue);else if(a.attributes[b].nodeName=='onunload') c.onunload=new Function('event',a.attributes[b].nodeValue);else HpDom.setAttribute(c,a.attributes[b].nodeName,a.attributes[b].nodeValue);}for(b=0;b<a.childNodes.length;b++) c.appendChild(HpDom.cloneXML(a.childNodes[b]));}else if(a.nodeType==3){c=document.createTextNode(HpUtil.filter(a.nodeValue));}else {throw 'Unhandeled a type in HpDom.cloneXML!';}return c;}
function HpNumber(){}
HpNumber.round=function(a,b){var c=Math.pow(10,b);var d=Math.round(Math.abs(a)*c);if(a>=0.0) return d/c;else return d/c*-1;}
HpNumber.checkInteger=function(a){return HpNumber.checkNumber(a,0);}
HpNumber.checkDecimal=function(a){return HpNumber.checkNumber(a,-1);}
HpNumber.checkCurrency=function(a){return HpNumber.checkNumber(a,2);}
HpNumber.checkRate=function(a){return HpNumber.checkNumber(a,4);}
HpNumber.checkNumber=function(a,b){return HpNumber.check(a,b,HpResource.decimalSeparator,HpResource.groupingSeparator);}
HpNumber.parseInteger=function(a){return HpNumber.parseNumber(a,0);}
HpNumber.parseDecimal=function(a){return HpNumber.parseNumber(a,-1);}
HpNumber.parseCurrency=function(a){return HpNumber.parseNumber(a,2);}
HpNumber.parseRate=function(a){return HpNumber.parseNumber(a,4);}
HpNumber.parseNumber=function(a,b){return HpNumber.parse(a,b,HpResource.decimalSeparator,HpResource.groupingSeparator);}
HpNumber.formatInteger=function(a){return HpNumber.formatNumber(a,0) }
HpNumber.formatDecimal=function(a){return HpNumber.formatNumber(a,-1) }
HpNumber.formatCurrency=function(a){return HpNumber.formatNumber(a,2) }
HpNumber.formatRate=function(a){return HpNumber.formatNumber(a,4) }
HpNumber.formatNumber=function(a,b){return HpNumber.format(a,b,HpResource.decimalSeparator,HpResource.groupingSeparator) }
HpNumber.check=function(a,b,c,d){var e=null;var f=-1;if(a.length<=0) return false;for(i=0;i<a.length;i++){e=a.charAt(i);if((e>='0')&&(e<='9')) continue;if(e==d){if((f!=-1)&&(i>f)) return false;continue;}if(e==c){if(b==0) return false;if((b!=-1)&&(i<a.length-b-1)) return false;if(f!=-1) return false;f=i;continue;}if(((e=='+')||(e=='-'))&&(i==0)) continue;return false;}return true;}
HpNumber.parse=function(a,b,c,d){var e=0;var f=null;var g='';var h='';if(e<a.length){f=a.charAt(e);if((f=='+')||(f=='-')){e++;h=f;}}if(e<a.length){f=a.charAt(e);if(f==c) g=h+'0';else g=h;}for(;e<a.length;e++){f=a.charAt(e);if(f==d) continue;else if(f==c) g=g+'.';else if((f>='0')&&(f<='9')) g=g+f;}if(g.length==0) return null;if(b>=0) return HpNumber.round(parseFloat(g),b);return parseFloat(g);}
HpNumber.extract=function(a){var b=0;var c=null;var d='';var e=false;var f=false;if(a==null) return null;for(b=0;b<a.length;b++){c=a.charAt(b);if((d.length==0)&&((c=='-')||(c=='+'))){d=d+c;}else if((c>='0')&&(c<='9')){f=true;d=d+c;}else if((f==true)&&(e==false)&&(c=='.')){e=true;d=d+c;}}if(f==false) return null;else return parseFloat(d);}
HpNumber.format=function(a,b,c,d){var e=0;var f=null;var g=0;var h='';var i='';var j=-1;if(b>=0) i=HpNumber.round(a,b).toFixed(b);else i=a.toString();j=i.indexOf('.');for(e=i.length-1;e>=0;e--){f=i.charAt(e);if((f=='-')||(f=='+')){h=f+h;break;}if(f=='.'){h=c+h;continue;}if((j==-1)||(j>e)) g++;if(g==4){g=1;h=d+h;}h=f+h;}return h;}
function HpStyle(){}
HpStyle.getPropertyOfRule=function(a,b){var c=0;var d=null;var e=null;b=HpUtil.trim(b).toLowerCase();d=a.style.cssText.split(';');for(c=d.length-1;c>=0;c--){e=HpPair.parse(d[c],':',true,true);if((e!=null)&&(e.key==b)) return e;}return null;}
HpStyle.setPropertyOfRule=function(a,b,c){var d='';var e=null;var f=null;b=HpUtil.trim(b).toLowerCase();c=HpUtil.trim(c).toLowerCase();f=HpStyle.listPropertiesOfRule(a);for(i=f.length-1;i>=0;i--){if(f[i].key==b){e=f[i];d=d+b+':'+c+';';}else d=d+f[i].format(':') +';';}if(e==null) d=d+b+':'+c+';';a.style.cssText=d;return e;}
HpStyle.removePropertyOfRule=function(a,b){var c=0;var d='';var e=null;var f=null;b=HpUtil.trim(b).toLowerCase();f=HpStyle.listPropertiesOfRule(a);for(c=f.length-1;c>=0;c--){if(f[c].key==b) e=f[c];else d=d+f[c].format(':')+';';}a.style.cssText=d;return e;}
HpStyle.listPropertiesOfRule=function(a){var b=0;var c=null;var d=null;var e=new Array();c=a.style.cssText.split(';');for(b=c.length-1;b>=0;b--){d=HpPair.parse(c[b],':',true,true);if(d!=null) e[e.length]=d;}return e;}
HpStyle.getRuleOfDocument=function(a,b){var c=0;var d=null;for(c=document.styleSheets.length-1;c>=0;c--){if((a==null)||(HpStyle.isSheetForMedia(document.styleSheets[c],a)==true)){d=HpStyle.getRuleOfSheet(document.styleSheets[c],b);if(d!=null) return d;}}return null;}
HpStyle.getRuleOfSheet=function(a,b){return HpStyle.getRuleOfList(HpStyle.listRulesOfSheet(a),b);}
HpStyle.getRuleOfList=function(a,b){var c=0;var d=0;var e=null;b=HpUtil.trim(b).toLowerCase();for(c=a.length-1;c>=0;c--){e=a[c].selectorText.toLowerCase().split(',');for(d=e.length-1;d>=0;d--){if(HpUtil.trim(e[d])==b) return a[c];}}return null;}
HpStyle.listRulesOfDocument=function(a){var b=0;var c=new Array();for(b=document.styleSheets.length-1;b>=0;b--){if((a==null)||(HpStyle.isSheetForMedia(document.styleSheets[b],a)==true)) HpUtil.append(c,HpStyle.listRulesOfSheet(document.styleSheets[b]));}return c;}
HpStyle.listRulesOfSheet=function(a){var b=0;var c=null;var d=new Array();if(a.cssRules) c=a.cssRules;else if(a.rules) c=a.rules;for(b=c.length-1;b>=0;b--) d[d.length]=c[b];return d;}
HpStyle.isSheetForMedia=function(a,b){var c=0;var d=null;b=HpUtil.trim(b).toLowerCase();if(a.media.mediaText) d=a.media.mediaText.toLowerCase().split(',');else d=a.media.toLowerCase().split(',');for(c=0;c<d.length;c++){if(HpUtil.trim(d[c])==b) return true;}return false;}
function HpUtil(){}
HpUtil.appendArray=function(a,b){var c=0;for(c=0;c<b.length;c++) a[a.length]=b[c];}
HpUtil.getInnerWidth=function(){if(self.innerWidth) return self.innerWidth;if(document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth;if(document.body) return document.body.clientWidth;return 0;}
HpUtil.getInnerHeight=function(){if(self.innerHeight) return self.innerHeight;if(document.documentElement && document.documentElement.clientHeight) return document.documentElement.clientHeight;if(document.body) return document.body.clientHeight;return 0;}
HpUtil.filter=function(a){var b=null;var c='';var d=false;for(b=0;b<a.length;b++){char=a.charAt(b);if((char==' ')||(char=='\n')||(char=='\t')){if(d==true) c=c+' ';d=false;}else {c=c+char;d=true;}}return c;}
HpUtil.compressSpace=function(a){var b=0;var c=0;var d=null;var e='';a=HpUtil.trim(a);for(b=0;b<a.length;b++){d=a.charAt(b);if(d==' ') c++;else c=0;if(c<=1) e=e+d;}return e;}
HpUtil.trim=function(a){return HpUtil.trimRight(HpUtil.trimLeft(a));}
HpUtil.trimLeft=function(a){var b=0;for(b=0;b<a.length;b++){if(a.charAt(b)!=' ') break;}return a.substring(b);}
HpUtil.trimRight=function(a){var b=0;for(b=a.length-1;b>=0;b--){if(a.charAt(b)!=' ') break;}return a.substring(0,b+1);}
HpUtil.append=function(a,b){for(var c=0;c<b.length;c++) a[a.length]=b[c];}
HpUtil.getIndex=function(a,b){for(var c=0;c<a.length;c++){if(a[c]==b) return c;}return -1;}
HpUtil.isNaviKey=function(a){if(a.keyCode==null) return false;if(a.keyCode==9) return true;if((a.keyCode>=37)&&(a.keyCode<=40)) return true;return false;}
function HpElement(){}
HpElement.separator=',';
HpElement.renderText=function(a,b,c,d){var e=null;if(b==null) return null;if((b.length<=0)&&(c==true)) return null;e=HpDom.getText(a);if((e==null)||(e.length<=0)){HpDom.setText(a,b);return a;}if(c==true){if(d==null) HpDom.setText(a,e+b);else HpDom.setText(a,e+d+b);return a;}if(b!=e) HpDom.setText(a,b);return a;}
function HpInput(){}
HpInput.separator=',';
HpInput.renderText=function(a,b,c,d){return HpElement.renderText(a,b,c,d);}
function HpSelect(){}
HpSelect.renderText=function(a,b,c,d){if(b==null) return null;if(d<0){HpDom.addOption(a,b,c,false,true);return a;}HpDom.setOption(a,d,b,c,false,true);return a;}
function HpTextArea(){}
HpTextArea.separator='\n';
HpTextArea.renderText=function(a,b,c,d){return HpElement.renderText(a,b,c,d);}
function HpTable(source,arrow)
{
var i=0;
this.source=source;
this.arrow=arrow;
this.edit=false;
this.currentCell=null;
this.onLeft=null;
this.onUp=null;
this.onRight=null;
this.onDown=null;
this.renderCurrentCell=function(a){if((a==null)||(a==this.currentCell)||(HpDom.containsClass(a,HpConstants.hide)==true)||(HpDom.containsClass(a,HpConstants.active)==true)||(HpDom.containsClass(a,HpConstants.readonly)==true)||(HpDom.listChild(a,'input,textarea,select').length<=0)) return false;if(this.currentCell!=null){HpDom.unselect (this.currentCell);HpDom.removeClass(this.currentCell,HpConstants.active);}this.currentCell=a;HpDom.unselect(this.currentCell);HpDom.addClass(this.currentCell,HpConstants.active);this.edit=false;this.source.focus();return true;}
this.renderKeyDown=function(a,b){var c=null;var d=null;var e=null;var f=new HpEvent(b).keyCode;if(this.currentCell==null) return;d=this.currentCell;if((f<37)||(f>40)){if(this.edit==false){e=HpDom.listChild(this.currentCell,'input,textarea,select');if(e.length>0){this.edit=true;e[0].focus();e[0].select();}}else {if((f==9)||(f==13)){this.edit=false;this.renderRightCell();}}return;}if((this.arrow==false)&&(this.edit==true)) return true;if(f==37){c=this.renderLeftCell();if(this.onLeft!=null) this.onLeft(b,d,c);return;}if(f==38){c=this.renderUpCell();if(this.onUp!=null) this.onUp(b,d,c);return;}if(f==39){c=this.renderRightCell();if(this.onRight!=null) this.onRight(b,d,c);return;}if(f==40){c=this.renderDownCell();if(this.onDown!=null) this.onDown(b,d,c);return;}}
this.renderLeftCell=function(){var a=this.currentCell;while(a!=null){a=HpDom.findPrevious(a,'td');if(this.renderCurrentCell(a)==true) return a;}return null;}
this.renderUpCell=function(){var a=0;var b=null;var c=this.currentCell;while(c!=null){a++;c=HpDom.findPrevious(c,'td');}b=HpDom.findParent(this.currentCell,'tr');while(b!=null){b=HpDom.findPrevious(b,'tr');if(b==null) return null;if(HpDom.containsClass(b,HpConstants.hide)==true) continue;c=b.cells[a-1];if(this.renderCurrentCell(c)==true) return c;}return null;}
this.renderRightCell=function(){var a=this.currentCell;while(a!=null){a=HpDom.findNext(a,'td');if(this.renderCurrentCell(a)==true) return a;}return null;}
this.renderDownCell=function(){var a=0;var b=null;var c=this.currentCell;while(c!=null){a++;c=HpDom.findPrevious(c,'td');}b=HpDom.findParent(this.currentCell,'tr');while(b!=null){b=HpDom.findNext(b,'tr');if(b==null) return null;if(HpDom.containsClass(b,HpConstants.hide)==true) continue;c=b.cells[a-1];if(this.renderCurrentCell(c)==true) return c;}return null;}
}
HpAttribute.TAG_ATTRIBUTE='Attribute';
HpAttribute.TAG_ID='Id';
HpAttribute.TAG_NAME='Name';
HpAttribute.TAG_VALUE='Value';
function HpAttribute(element,name,value)
{
this.element=element;
this.name=name;
this.value=value;
}
HpAttribute.create=function(a){var b=new HpAttribute(null,null,null);b.element=document.getElementById(HpDom.getText(HpDom.getChild(a,HpAttribute.TAG_ID)));b.name=HpDom.getText(HpDom.getChild(a,HpAttribute.TAG_NAME));b.value=HpDom.getText(HpDom.getChild(a,HpAttribute.TAG_VALUE));return b;}
function HpAttributeList()
{
var list=new Array();
this.size=function(){return list.length;}
this.item=function(a){return list[a];}
this.get=function(a,b){var c=0;for(c=0;c<list.length;c++){if((list[c].element==a)&&(list[c].name==b)) return list[c].value;}return null;}
this.getItem=function(a,b){var c=0;for(c=0;c<list.length;c++){if((list[c].element==a)&&(list[c].name==b)) return list[c];}return null;}
this.indexOf=function(a,b){var c=0;for(c=0;c<list.length;c++){if((list[c].element==a)&&(list[c].name==b)) return c;}return -1;}
this.contains=function(a,b){if(this.indexOf(a,b)>=0) return true;else return false;}
this.add=function(a){if(a instanceof HpAttribute) list[list.length]=a;else throw 'No instance of HpAttribute!';}
this.addNew=function(a,b,c){var d=new HpAttribute(a,b,c);list[list.length]=d;return d;}
this.addList=function(a){for(i=0;i<a.size();i++) this.add(a.item(i));}
this.put=function(a,b,c){var d=this.getItem(a,b);if(d==null) return this.addNew(a,b,c);d.element=a;d.name=b;d.value=c;return d;}
this.remove=function(a){var b=0;var c=null;for(b=0;b<list.length;b++){if(c!=null) list[b-1]=list[b];if((c==null)&&(b==a)) c=list[b];}if(c!=null) list.length=list.length-1;return c;}
this.clear=function(){list.length=0;}
this.filter=function(a,b){var c=0;var d=new HpAttributeList();for(c=0;c<list.length;c++){if((a!=null)&&(a!=list[c].element)) continue;if((b!=null)&&(b!=list[c].name)) continue;d.add(list[c]);}return d;}
this.formatFallBack=function(a,b,c){var d=0;var e='';var f='';for(d=0;d<list.length;d++){if((a==null)&&(list[d].element!=null)) continue;if((a!=null)&&(list[d].element!=null)&&(a!=list[d].element)) continue;if((b!=null)&&(list[d].name!=null)&&(b!=list[d].name)) continue;if(list[d].element==null){if(e.length<=0) e=list[d].value;else e=e +c+ list[d].value;}else {if(f.length<=0) f=list[d].value;else f=f +c+ list[d].value;}}if(f.length>0) return f;else return e;}
}
HpAttributeList.create=function(a){var b=0;var c=null;var d=new HpAttributeList();c=HpDom.listChild(a,HpAttribute.TAG_ATTRIBUTE,false);for(b=0;b<c.length;b++) d.add(HpAttribute.create(c[b]));return d;}
function HpPair(key,value)
{
this.key=key;
this.value=value;
this.format=function(a){if((this.key==null)&&(this.value==null)) return '';if(this.key==null) return a+this.value;if(this.value==null) return this.key+a;return this.key+a+this.value;}
}
HpPair.parse=function(a,b,c,d){var e=0;var f=null;if((a==null)||(a.length<=0)) return null;e=a.indexOf(b);if(e==0) return null;else if(e<0) f=new HpPair(a,null);else if(e==a.length-1) f=new HpPair(a.substring(0,e),null);else f=new HpPair(a.substring(0,e),a.substring(e+1,a.length));if(c==true){f.key=HpUtil.trim(f.key);if(f.value!=null) f.value=HpUtil.trim(f.value);if((f.key==null)||(f.key.length<=0)) return null;if((f.value!=null)&&(f.value.length<=0)) f.value=null;}if(d==true){f.key=f.key.toLowerCase();if(f.value!=null) f.value=f.value.toLowerCase();}return f;}
function HpPairList()
{
var list=new Array();
this.size=function(){return list.length;}
this.item=function(a){return list[a];}
this.get=function(a){var b=0;for(b=0;b<list.length;b++){if(list[b].key==a) return list[b].value;}return null;}
this.getItem=function(a){var b=0;for(b=0;b<list.length;b++){if(list[b].key==a) return list[b];}return null;}
this.indexOf=function(a){var b=0;for(b=0;b<list.length;b++){if(list[b].key==a) return b;}return -1;}
this.containsKey=function(a){if(this.indexOf(a)>=0) return true;else return false;}
this.add=function(a){if(a instanceof HpPair) list[list.length]=a;else throw 'No instance of HpPair!';}
this.addNew=function(a,b){var c=new HpPair(a,b);list[list.length]=c;return c;}
this.put=function(a,b){var c=this.getItem(a);if(c==null) return this.addNew(a,b);c.key=a;c.value=b;return c;}
this.remove=function(a){var b=0;var c=null;for(b=0;b<list.length;b++){if(c!=null) list[b-1]=list[b];if((c==null)&&(list[b].key==a)) c=list[b];}if(c!=null) list.length=list.length-1;return c;}
this.clear=function(){list.length=0;}
this.format=function(a,b){var c='';for(i=0;i<list.length;i++){c=c+list[i].format(b);if(i<list.length-1) c=c+a;}return c;}
}
function HpUrl()
{
this.address=null;
this.params=new HpPairList();
this.format=function(){if((this.address==null)&&(this.params.size()<=0)) return '';if(this.address==null) return HpUrl.formatParams(this.params);if(this.params.size()<=0) return HpUrl.formatAddress(this.address);return HpUrl.formatAddress(this.address)+'?'+HpUrl.formatParams(this.params);}
}
HpUrl.formatAddress=function(a){if((a==null)||(a.length<=0)) return '';else return encodeURI(a);}
HpUrl.formatParams=function(a){var b=0;var c='';var d=null;for(b=0;b<a.size();b++){d=a.item(b);c=c+encodeURIComponent(d.key) +'='+ encodeURIComponent(d.value);if(b<a.size()-1) c=c+'&';}return c;}
HpUrl.parse=function(a){var b=0;var c=new HpUrl();if((a==null)||(a.length<=0)||(a=='?')) return c;b=a.indexOf('?');if(b<0) c.address=decodeURI(a);else if(b==a.length-1) c.address=decodeURI(a.substring(0,b));else if(b>0){c.address=decodeURI(a.substring(0,b));c.params=HpUrl.parseParams(a.substring(b+1,a.length));}else c.params=HpUrl.parseParams(a.substring(1,a.length));return c;}
HpUrl.parseParams=function(a){var b=0;var c=null;var d=new HpPairList();if((a==null)||(a.length<=0)) return d;c=a.split('&');for(b=0;b<c.length;b++){pair=HpPair.parse(decodeURIComponent(c[b]),'=',false,false);if(pair!=null) d.add(pair);}return d;}
function HpCurrency(required,format,minLength,maxLength,minimum,maximum,step)
{
this.required=required;
this.format=format;
this.minLength=minLength;
this.maxLength=maxLength;
this.minimum=minimum;
this.maximum=maximum;
this.step=step;
this.execute=function(a,b,c){var d=new HpAction(a,b);d.addInit (HpCurrency.init);d.addRender(HpCurrency.render);d.controls.put(HpConstants.config,this);if(c==null) d.addTarget(a);else d.addTarget(c);HpCurrency.config(d);d.execute();return d;}
}
HpCurrency.executeKeyUp=function(a,b,c){var d=null;var e=new HpAction(a,b);e.addInit (HpCurrency.init);e.addRender(HpCurrency.render);if(c==null) e.addTarget(a);else e.addTarget(c);d=HpCurrency.config(e);d.format=false;d.minLength=null;d.minimum=null;d.step=null;e.execute();return e;}
HpCurrency.executeBlur=function(a,b,c){var d=null;var e=new HpAction(a,b);e.addInit (HpCurrency.init);e.addRender(HpCurrency.render);if(c==null) e.addTarget(a);else e.addTarget(c);d=HpCurrency.config(e);e.execute();return e;}
HpCurrency.register=function(a,b,c,d,e){var f=null;var g=new HpPairList();if(b==null) b=HpCurrency.init;if(d==null) d=HpCurrency.render;if(e==null) e=a;f=HpAction.registerAll(a,'keyup',b,c,d,e);config=HpCurrency.config(f);config.format=false;config.minLength=null;config.minimum=null;config.step=null;g.addNew(f.type,f);f=HpAction.registerAll(a,'blur',b,c,d,e);config=HpCurrency.config(f);g.addNew(f.type,f);return g;}
HpCurrency.config=function(a){var b=null;var c=null;if(a.controls.containsKey(HpConstants.config)==false){c=new HpCurrency();c.required=HpDom.containsClass(a.source,HpConstants.required);c.format=(HpDom.containsClass(a.source,HpConstants.plain)==false);b=HpDom.searchClass(a.source,HpConstants.minlength);if(b!=null) c.minLength=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.maxlength);if(b!=null) c.maxLength=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.minimum);if(b!=null) c.minimum=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.maximum);if(b!=null) c.maximum=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.step);if(b!=null) c.step=HpNumber.extract(b);a.controls.put(HpConstants.config,c);}a.styles.addNew(null,HpConstants.error,HpConstants.error);a.styles.addNew(null,HpConstants.success,HpConstants.success);return c;}
HpCurrency.init=function(a){var b=null;var c=null;if(a.state==false) return;b=HpDom.getText(a.source);config=a.controls.get(HpConstants.config);if(b.length<=0){if(config.required==true){a.state=false;a.messages.addNew(null,HpConstants.error,HpResource.errorRequired);}return;}a.state=HpNumber.checkCurrency(b);if(a.state==false){a.messages.addNew(null,HpConstants.error,HpResource.errorCurrency);return;}HpInit.initLength(a,b,config.minLength,config.maxLength);if(a.state==false) return;HpInit.initRange(a,HpNumber.parseCurrency(b),config.minimum,config.maximum,config.step);if(a.state==false) return;}
HpCurrency.render=function(a){var b=0;var c=null;var d=null;var e=null;if(HpUtil.isNaviKey(a.event)==true) return true;c=HpDom.getText(a.source);d=a.controls.get(HpConstants.config);if((a.state==true)&&(d.format==true)&&(c.length>0)) e=HpNumber.formatCurrency(HpNumber.parseCurrency(c));else e=c;for(b=0;b<a.targets.length;b++){HpRender.renderInit(a.targets[b],a.styles);HpRender.renderText(a.targets[b],e,false);HpRender.renderState(a.targets[b],a.state,a.styles);HpRender.messageRender(a);}return true;}
function HpDecimal(required,format,minLength,maxLength,minimum,maximum,step)
{
this.required=required;
this.format=format;
this.minLength=minLength;
this.maxLength=maxLength;
this.minimum=minimum;
this.maximum=maximum;
this.step=step;
this.execute=function(a,b,c){var d=new HpAction(a,b);d.addInit (HpDecimal.init);d.addRender(HpDecimal.render);d.controls.put(HpConstants.config,this);if(c==null) d.addTarget(a);else d.addTarget(c);HpDecimal.config(d);d.execute();return d;}
}
HpDecimal.executeKeyUp=function(a,b,c){var d=null;var e=new HpAction(a,b);e.addInit (HpDecimal.init);e.addRender(HpDecimal.render);if(c==null) e.addTarget(a);else e.addTarget(c);d=HpDecimal.config(e);d.format=false;d.minLength=null;d.minimum=null;d.step=null;e.execute();return e;}
HpDecimal.executeBlur=function(a,b,c){var d=null;var e=new HpAction(a,b);e.addInit (HpDecimal.init);e.addRender(HpDecimal.render);if(c==null) e.addTarget(a);else e.addTarget(c);d=HpDecimal.config(e);e.execute();return e;}
HpDecimal.register=function(a,b,c,d,e){var f=null;var g=new HpPairList();if(b==null) b=HpDecimal.init;if(d==null) d=HpDecimal.render;if(e==null) e=a;f=HpAction.registerAll(a,'keyup',b,c,d,e);config=HpDecimal.config(f);config.format=false;config.minLength=null;config.minimum=null;config.step=null;g.addNew(f.type,f);f=HpAction.registerAll(a,'blur',b,c,d,e);config=HpDecimal.config(f);g.addNew(f.type,f);return g;}
HpDecimal.config=function(a){var b=null;var c=null;if(a.controls.containsKey(HpConstants.config)==false){c=new HpDecimal();c.required=HpDom.containsClass(a.source,HpConstants.required);c.format=(HpDom.containsClass(a.source,HpConstants.plain)==false);b=HpDom.searchClass(a.source,HpConstants.minlength);if(b!=null) c.minLength=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.maxlength);if(b!=null) c.maxLength=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.minimum);if(b!=null) c.minimum=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.maximum);if(b!=null) c.maximum=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.step);if(b!=null) c.step=HpNumber.extract(b);a.controls.put(HpConstants.config,c);}a.styles.addNew(null,HpConstants.error,HpConstants.error);a.styles.addNew(null,HpConstants.success,HpConstants.success);return c;}
HpDecimal.init=function(a){var b=null;var c=null;if(a.state==false) return;b=HpDom.getText(a.source);config=a.controls.get(HpConstants.config);if(b.length<=0){if(config.required==true){a.state=false;a.messages.addNew(null,HpConstants.error,HpResource.errorRequired);}return;}a.state=HpNumber.checkDecimal(b);if(a.state==false){a.messages.addNew(null,HpConstants.error,HpResource.errorDecimal);return;}HpInit.initLength(a,b,config.minLength,config.maxLength);if(a.state==false) return;HpInit.initRange(a,HpNumber.parseDecimal(b),config.minimum,config.maximum,config.step);if(a.state==false) return;}
HpDecimal.render=function(a){var b=0;var c=null;var d=null;var e=null;if(HpUtil.isNaviKey(a.event)==true) return true;c=HpDom.getText(a.source);d=a.controls.get(HpConstants.config);if((a.state==true)&&(d.format==true)&&(c.length>0)) e=HpNumber.formatDecimal(HpNumber.parseDecimal(c));else e=c;for(b=0;b<a.targets.length;b++){HpRender.renderInit(a.targets[b],a.styles);HpRender.renderText(a.targets[b],e,false);HpRender.renderState(a.targets[b],a.state,a.styles);HpRender.messageRender(a);}return true;}
function HpEntry(){}
HpEntry.wrapper='div';
HpEntry.renderText=function(a,b,c,d,e){var f=null;var g=null;if(b==null) return null;if(c<0){if(d==null) g=document.createElement(HpEntry.wrapper);else g=document.createElement(d);g.appendChild(document.createTextNode(b));HpDom.setAttribute(g,'class','');if((e!=null)&&(e!=true)&&(e!=false)) HpDom.setAttribute(g,'id',e);a.appendChild(g);return g;}f=HpDom.listChild(a,null,false);if(d==null) d=f[c].nodeName;g=document.createElement(d);g.appendChild(document.createTextNode(b));HpDom.setAttribute(g,'class','');if((e!=null)&&(e!=false)){if(e==true) HpDom.setAttribute(g,'id',f[c].id);else HpDom.setAttribute(g,'id',e);}a.replaceChild(g,f[c]);return g;}
function HpInteger(required,format,minLength,maxLength,minimum,maximum,step)
{
this.required=required;
this.format=format;
this.minLength=minLength;
this.maxLength=maxLength;
this.minimum=minimum;
this.maximum=maximum;
this.step=step;
this.execute=function(a,b,c){var d=new HpAction(a,b);d.addInit (HpInteger.init);d.addRender(HpInteger.render);d.controls.put(HpConstants.config,this);if(c==null) d.addTarget(a);else d.addTarget(c);HpInteger.config(d);d.execute();return d;}
}
HpInteger.executeKeyUp=function(a,b,c){var d=null;var e=new HpAction(a,b);e.addInit (HpInteger.init);e.addRender(HpInteger.render);if(c==null) e.addTarget(a);else e.addTarget(c);d=HpInteger.config(e);d.format=false;d.minLength=null;d.minimum=null;d.step=null;e.execute();return e;}
HpInteger.executeBlur=function(a,b,c){var d=null;var e=new HpAction(a,b);e.addInit (HpInteger.init);e.addRender(HpInteger.render);if(c==null) e.addTarget(a);else e.addTarget(c);d=HpInteger.config(e);e.execute();return e;}
HpInteger.register=function(a,b,c,d,e){var f=null;var g=new HpPairList();if(b==null) b=HpInteger.init;if(d==null) d=HpInteger.render;if(e==null) e=a;f=HpAction.registerAll(a,'keyup',b,c,d,e);config=HpInteger.config(f);config.format=false;config.minLength=null;config.minimum=null;config.step=null;g.addNew(f.type,f);f=HpAction.registerAll(a,'blur',b,c,d,e);config=HpInteger.config(f);g.addNew(f.type,f);return g;}
HpInteger.config=function(a){var b=null;var c=null;if(a.controls.containsKey(HpConstants.config)==false){c=new HpInteger();c.required=HpDom.containsClass(a.source,HpConstants.required);c.format=(HpDom.containsClass(a.source,HpConstants.plain)==false);b=HpDom.searchClass(a.source,HpConstants.minlength);if(b!=null) c.minLength=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.maxlength);if(b!=null) c.maxLength=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.minimum);if(b!=null) c.minimum=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.maximum);if(b!=null) c.maximum=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.step);if(b!=null) c.step=HpNumber.extract(b);a.controls.put(HpConstants.config,c);}a.styles.addNew(null,HpConstants.error,HpConstants.error);a.styles.addNew(null,HpConstants.success,HpConstants.success);return c;}
HpInteger.init=function(a){var b=null;var c=null;if(a.state==false) return;b=HpDom.getText(a.source);config=a.controls.get(HpConstants.config);if(b.length<=0){if(config.required==true){a.state=false;a.messages.addNew(null,HpConstants.error,HpResource.errorRequired);}return;}a.state=HpNumber.checkInteger(b);if(a.state==false){a.messages.addNew(null,HpConstants.error,HpResource.errorInteger);return;}HpInit.initLength(a,b,config.minLength,config.maxLength);if(a.state==false) return;HpInit.initRange(a,HpNumber.parseInteger(b),config.minimum,config.maximum,config.step);if(a.state==false) return;}
HpInteger.render=function(a){var b=0;var c=null;var d=null;var e=null;if(HpUtil.isNaviKey(a.event)==true) return true;c=HpDom.getText(a.source);d=a.controls.get(HpConstants.config);if((a.state==true)&&(d.format==true)&&(c.length>0)) e=HpNumber.formatInteger(HpNumber.parseInteger(c));else e=c;for(b=0;b<a.targets.length;b++){HpRender.renderInit(a.targets[b],a.styles);HpRender.renderText(a.targets[b],e,false);HpRender.renderState(a.targets[b],a.state,a.styles);HpRender.messageRender(a);}return true;}
function HpLocale(){}
HpLocale.register=function(a,b,c,d,e){var f=null;var g=new HpPairList();if(d==null) d=HpLocale.render;f=HpAction.registerAll(a,'click',b,c,d,e);g.addNew('click',f);HpLocale.config(f);return g;}
HpLocale.config=function(a){a.targets=null;}
HpLocale.render=function(a){var b=0;var c=0;var d=null;var e=null;for(b=0;b<HpCore.locales.length;b++){if(HpDom.containsClass(a.source,HpCore.locales[b])==true) e=HpCore.locales[b];}for(b=0;b<HpCore.locales.length;b++){if(a.targets==null) d=HpDom.getElementsByClass(document,HpCore.locales[b]);else d=a.targets;for(c=0;c<d.length;c++){if(HpDom.containsClass(d[c],HpConstants.localizer)==true) continue;if(HpCore.locales[b]==e) HpDom.removeClasses(d[c],HpConstants.localize);else HpDom.addClasses(d[c],HpConstants.localize);}}return true;}
function HpRate(required,format,minLength,maxLength,minimum,maximum,step)
{
this.required=required;
this.format=format;
this.minLength=minLength;
this.maxLength=maxLength;
this.minimum=minimum;
this.maximum=maximum;
this.step=step;
this.execute=function(a,b,c){var d=new HpAction(a,b);d.addInit (HpRate.init);d.addRender(HpRate.render);d.controls.put(HpConstants.config,this);if(c==null) d.addTarget(a);else d.addTarget(c);HpRate.config(d);d.execute();return d;}
}
HpRate.executeKeyUp=function(a,b,c){var d=null;var e=new HpAction(a,b);e.addInit (HpRate.init);e.addRender(HpRate.render);if(c==null) e.addTarget(a);else e.addTarget(c);d=HpRate.config(e);d.format=false;d.minLength=null;d.minimum=null;d.step=null;e.execute();return e;}
HpRate.executeBlur=function(a,b,c){var d=null;var e=new HpAction(a,b);e.addInit (HpRate.init);e.addRender(HpRate.render);if(c==null) e.addTarget(a);else e.addTarget(c);d=HpRate.config(e);e.execute();return e;}
HpRate.register=function(a,b,c,d,e){var f=null;var g=new HpPairList();if(b==null) b=HpRate.init;if(d==null) d=HpRate.render;if(e==null) e=a;f=HpAction.registerAll(a,'keyup',b,c,d,e);config=HpRate.config(f);config.format=false;config.minLength=null;config.minimum=null;config.step=null;g.addNew(f.type,f);f=HpAction.registerAll(a,'blur',b,c,d,e);config=HpRate.config(f);g.addNew(f.type,f);return g;}
HpRate.config=function(a){var b=null;var c=null;if(a.controls.containsKey(HpConstants.config)==false){c=new HpRate();c.required=HpDom.containsClass(a.source,HpConstants.required);c.format=(HpDom.containsClass(a.source,HpConstants.plain)==false);b=HpDom.searchClass(a.source,HpConstants.minlength);if(b!=null) c.minLength=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.maxlength);if(b!=null) c.maxLength=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.minimum);if(b!=null) c.minimum=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.maximum);if(b!=null) c.maximum=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.step);if(b!=null) c.step=HpNumber.extract(b);a.controls.put(HpConstants.config,c);}a.styles.addNew(null,HpConstants.error,HpConstants.error);a.styles.addNew(null,HpConstants.success,HpConstants.success);return c;}
HpRate.init=function(a){var b=null;var c=null;if(a.state==false) return;b=HpDom.getText(a.source);config=a.controls.get(HpConstants.config);if(b.length<=0){if(config.required==true){a.state=false;a.messages.addNew(null,HpConstants.error,HpResource.errorRequired);}return;}a.state=HpNumber.checkRate(b);if(a.state==false){a.messages.addNew(null,HpConstants.error,HpResource.errorRate);return;}HpInit.initLength(a,b,config.minLength,config.maxLength);if(a.state==false) return;HpInit.initRange(a,HpNumber.parseRate(b),config.minimum,config.maximum,config.step);if(a.state==false) return;}
HpRate.render=function(a){var b=0;var c=null;var d=null;var e=null;if(HpUtil.isNaviKey(a.event)==true) return true;c=HpDom.getText(a.source);d=a.controls.get(HpConstants.config);if((a.state==true)&&(d.format==true)&&(c.length>0)) e=HpNumber.formatRate(HpNumber.parseRate(c));else e=c;for(b=0;b<a.targets.length;b++){HpRender.renderInit(a.targets[b],a.styles);HpRender.renderText(a.targets[b],e,false);HpRender.renderState(a.targets[b],a.state,a.styles);HpRender.messageRender(a);}return true;}
function HpText(required,trim,minLength,maxLength)
{
this.required=required;
this.trim=trim;
this.minLength=minLength;
this.maxLength=maxLength;
this.execute=function(a,b,c){var d=new HpAction(a,b);d.addInit (HpText.init);d.addRender(HpText.render);d.controls.put(HpConstants.config,this);if(c==null) d.addTarget(a);else d.addTarget(c);HpText.config(d);d.execute();return d;}
}
HpText.executeKeyUp=function(a,b,c){var d=null;var e=new HpAction(a,b);e.addInit (HpText.init);e.addRender(HpText.render);if(c==null) e.addTarget(a);else e.addTarget(c);d=HpText.config(e);d.trim=false;d.minLength=null;e.execute();return e;}
HpText.executeBlur=function(a,b,c){var d=null;var e=new HpAction(a,b);e.addInit (HpText.init);e.addRender(HpText.render);if(c==null) e.addTarget(a);else e.addTarget(c);d=HpText.config(e);e.execute();return e;}
HpText.register=function(a,b,c,d,e){var f=null;var g=new HpPairList();if(b==null) b=HpText.init;if(d==null) d=HpText.render;if(e==null) e=a;f=HpAction.registerAll(a,'keyup',b,c,d,e);config=HpText.config(f);config.trim=false;config.minLength=null;g.addNew(f.type,f);f=HpAction.registerAll(a,'blur',b,c,d,e);config=HpText.config(f);g.addNew(f.type,f);return g;}
HpText.config=function(a){var b=null;var c=null;if(a.controls.containsKey(HpConstants.config)==false){c=new HpText();c.required=HpDom.containsClass(a.source,HpConstants.required);c.trim=(HpDom.containsClass(a.source,HpConstants.notrim)==false);b=HpDom.searchClass(a.source,HpConstants.minlength);if(b!=null) c.minLength=HpNumber.extract(b);b=HpDom.searchClass(a.source,HpConstants.maxlength);if(b!=null) c.maxLength=HpNumber.extract(b);a.controls.put(HpConstants.config,c);}a.styles.addNew(null,HpConstants.error,HpConstants.error);a.styles.addNew(null,HpConstants.success,HpConstants.success);return c;}
HpText.init=function(a){var b=null;if(a.state==false) return;b=HpDom.getText(a.source);config=a.controls.get(HpConstants.config);if(b.length<=0){if(config.required==true){a.state=false;a.messages.addNew(null,HpConstants.error,HpResource.errorRequired);}return;}if((config.trim==true)&&((b.charAt(0)==' ')||(b.charAt(b.length-1)==' '))){a.state=false;a.messages.addNew(null,HpConstants.error,HpResource.errorTrim);return;}HpInit.initLength(a,b,config.minLength,config.maxLength);if(a.state==false) return;}
HpText.render=function(a){var b=0;var c=null;if(HpUtil.isNaviKey(a.event)==true) return true;for(b=0;b<a.targets.length;b++){HpRender.renderInit(a.targets[b],a.styles);HpRender.renderState(a.targets[b],a.state,a.styles);HpRender.messageRender(a);}return true;}
function HpAction(source,event)
{
this.source=null;
this.type=null;
this.init=new Array();
this.action=new Array();
this.render=new Array();
this.targets=new Array();
this.controls=new HpPairList();
this.styles=new HpAttributeList();
this.messages=new HpAttributeList();
this.state=true;
this.event=null;
this.ajax=null;
this.source=source;
if(event!=null)
{
this.type=event.type;
this.event=new HpEvent(event);
}
this.addInit=function(a){this.init[this.init.length]=a;}
this.addAction=function(a){this.action[this.action.length]=a;}
this.addRender=function(a){this.render[this.render.length]=a;}
this.addTarget=function(a){this.targets[this.targets.length]=a;}
this.setAJAX=function(a){this.ajax=new HpAJAX(this,a);}
this.execute=function(){var a=0;this.messages.clear();this.state=true;for(a=0;a<this.init.length;a++) this.init[a](this);for(a=0;a<this.action.length;a++) this.action[a](this);if(this.ajax==null){for(a=0;a<this.render.length;a++) this.render[a](this);}return this.state;}
}
HpAction.get=function(a,b){var c=HpAction.indexOf(a,b);if(c>=0) return HpCore.actions[c];else return null;}
HpAction.indexOf=function(a,b){var c=0;for(c=0;c<HpCore.actions.length;c++){if((HpCore.actions[c].source==a)&&(HpCore.actions[c].type==b)) return c;}return -1;}
HpAction.connect=function(){for(var a=0;a<HpCore.actions.length;a++) HpEvent.addEvent(HpCore.actions[a].source,HpCore.actions[a].type,HpAction.execute,false);}
HpAction.execute=function(a){var b=-1;var c=new HpEvent(a);var d=c.target;while((d!=null)&&(b<0)){b=HpAction.indexOf(d,c.type);d=d.parentNode;}if(b<0) return false;HpCore.actions[b].event=c;return HpCore.actions[b].execute();}
HpAction.register=function(a){HpCore.actions[HpCore.actions.length]=a;}
HpAction.registerAll=function(a,b,c,d,e,f){var g=new HpAction();g.source=a;g.type=b;if(c!=null){if(c instanceof Array) g.init=c;else g.init[0]=c;}if(d!=null){if(d instanceof Array) g.action=d;else g.action[0]=d;}if(e!=null){if(e instanceof Array) g.render=e;else g.render[0]=e;}if(f!=null){if(f instanceof Array) g.targets=f;else g.targets[0]=f;}HpAction.register(g);return g;}
HpAction.registerRender=function(a,b,c,d){return HpAction.registerAll(a,b,null,null,c,d) }
HpAction.registerAutomatic=function(a,b){var c=0;var d=null;var e=null;a[a.length]=b;if(b.nodeType==1){if(HpDom.isInput(b)==true){if(HpDom.containsClass(b,HpConstants.integer)==true) e=HpInteger.register(b);else if(HpDom.containsClass(b,HpConstants.decimal)==true) e=HpDecimal.register(b);else if(HpDom.containsClass(b,HpConstants.currency)==true) e=HpCurrency.register(b);else if(HpDom.containsClass(b,HpConstants.rate)==true) e=HpRate.register(b);else e=HpText.register(b);}else if(HpDom.isTextArea(b)==true) e=HpText.register(b);else if(HpDom.containsClass(b,HpConstants.localizer)==true) e=HpLocale.register(b);if(e==null) e=new HpPairList();for(c=0;c<HpCore.initStartElement.length;c++) HpCore.initStartElement[c](a,b,e);}for(c=0;c<b.childNodes.length;c++) HpAction.registerAutomatic(a,b.childNodes[c]);if(b.nodeType==1){for(c=0;c<HpCore.initEndElement.length;c++) HpCore.initEndElement[c](a,b,e);}a[a.length-1]=null;a.length=a.length-1;}
HpAJAX.TAG_MESSAGES='Messages';
HpAJAX.TAG_SERVICE_STATE='ServiceState';
HpAJAX.ACTIVEX=['MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'];
function HpAJAX(action,url)
{
this.action=action;
this.url=HpUrl.parse(url);
this.data=new HpPairList();
this.request=null;
this.response=null;
this.sendGet=function(){HpAJAX.send(this.action,this.url,null);}
this.sendPost=function(){HpAJAX.send(this.action,this.url,this.data);}
}
HpAJAX.send=function(a,b,c){var d=0;try{a.state=false;a.ajax.response=null;a.ajax.request=HpAJAX.createXMLHttpRequest();b.params.put('de.hp.ajax',(new Date()).getTime());if(c==null){a.ajax.request.open('GET',b.format(),true);a.ajax.request.onreadystatechange=process;a.ajax.request.send(null);}else {a.ajax.request.open('POST',b.format(),true);a.ajax.request.onreadystatechange=process;a.ajax.request.setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=utf-8');a.ajax.request.send(HpUrl.formatParams(c));}}catch(e){a.messages.addNew(null,HpConstants.error,'[Send] ' +HpResource.errorAJAX);for(d=0;d<a.render.length;d++){a.render[d](a);}}function process(){if(a.ajax.request.readyState==4){try{if(a.ajax.request.status==200) HpAJAX.response(a);else throw '[Status] '+HpResource.errorAJAX;}catch(e){a.messages.addNew(null,HpConstants.error,'[Process] '+HpResource.errorAJAX);}finally {for(d=0;d<a.render.length;d++){a.render[d](a);}}}}}
HpAJAX.createXMLHttpRequest=function(){var a=0;var b=null;try{b=new XMLHttpRequest();}catch(e){}if(b!=null) return b;for(a=0;a<HpAJAX.ACTIVEX.length;a++){try{b=new ActiveXObject(HpAJAX.ACTIVEX[a]);}catch(e){}if(b!=null){HpAJAX.ACTIVEX=[HpAJAX.ACTIVEX[a]];return b;}}throw HpResource.errorAJAX+' [Request]';}
HpAJAX.response=function(a){var b=null;var c=null;if((a.ajax.request==null)||(a.ajax.request.responseXML==null)){a.messages.addNew(null,HpConstants.error,'[Response] '+HpResource.errorAJAX);throw HpResource.errorAJAX;}a.ajax.response=HpDom.getChild(a.ajax.request.responseXML,'JSAction');if(a.ajax.response==null){a.messages.addNew(null,HpConstants.error,'[Root] '+HpResource.errorAJAX);throw HpResource.errorAJAX;}b=HpDom.getChild(a.ajax.response,HpAJAX.TAG_SERVICE_STATE);if(b==null){a.messages.addNew(null,HpConstants.error,'[State] '+HpResource.errorAJAX);throw HpResource.errorAJAX;}c=HpAJAX.listMessage(a.ajax.response);if(c!=null) a.messages.addList(c);if(HpAJAX.getServiceState(a.ajax.response)==HpConstants.SERVICE_SUCCESS){a.state=true;}else {a.state=false;a.messages.addNew(null,HpConstants.error,'[Service] '+HpResource.errorAJAX);}}
HpAJAX.getServiceState=function(a){return HpDom.getText(HpDom.getChild(a,HpAJAX.TAG_SERVICE_STATE));}
HpAJAX.listMessage=function(a){var b=HpDom.getChild(a,HpAJAX.TAG_MESSAGES);if(b==null) return null;else return HpAttributeList.create(b);}
function HpInit(){}
HpInit.initLength=function(a,b,c,d){if((c!=null)&&(b.length<c)){a.state=false;a.messages.addNew(null,HpConstants.error,HpResource.minlength +' '+ c);return;}if((d!=null)&&(b.length>d)){a.state=false;a.messages.addNew(null,HpConstants.error,HpResource.maxlength +' '+ d);return;}}
HpInit.initRange=function(a,b,c,d,e){var f=null;if((c!=null)&&(b<c)){a.state=false;a.messages.addNew(null,HpConstants.error,HpResource.minimum +' '+ HpNumber.formatDecimal(c));return;}if((d!=null)&&(b>d)){a.state=false;a.messages.addNew(null,HpConstants.error,HpResource.maximum +' '+ HpNumber.formatDecimal(d));return;}if(e!=null){if(c==null) f=b%e;else f=(b-c)%e;if(f!=0){a.state=false;a.messages.addNew(null,HpConstants.error,HpResource.step +' '+ HpNumber.formatDecimal(e));}return;}}
function HpRender(){}
HpRender.messageRender=function(a){var b=null;var c=null;var d=new HpPairList();if(HpCore.messages==null) return true;HpDom.clearElement(HpCore.messages);d.addNew(HpCore.messages,null);for(i=0;i<a.messages.size();i++){if(a.messages.item(i).element==null) c=HpCore.messages;else {c=a.messages.item(i).element;if(d.containsKey(c)==false){HpDom.clearElement(c);d.addNew(c,null);}}b=HpRender.renderEntry(c,a.messages.item(i).value);HpRender.renderStyle(b,a.messages.item(i).name,null);}return true;}
HpRender.stateRender=function(a){var b=0;var c=null;c=a.controls.get(HpConstants.text);for(b=0;b<a.targets.length;b++){HpRender.renderInit (a.targets[b],a.styles);HpRender.renderText (a.targets[b],c,false);HpRender.renderState(a.targets[b],a.state,a.styles);}return true;}
HpRender.renderEntry=function(a,b){if(HpDom.isInput(a)==true) return HpInput.renderText(a,b,true,HpInput.separator);if(HpDom.isTextArea(a)==true) return HpTextArea.renderText(a,b,true,HpTextArea.separator);if(HpDom.isSelect(a)==true) return HpSelect.renderText(a,b,b,-1);return HpEntry.renderText(a,b,-1,HpEntry.wrapper,null);}
HpRender.renderText=function(a,b,c){if(HpDom.isInput(a)==true) return HpInput.renderText(a,b,c,HpInput.separator);if(HpDom.isTextArea(a)==true) return HpTextArea.renderText(a,b,c,HpTextArea.separator);if(HpDom.isSelect(a)==true){if(c==true) return HpSelect.renderText(a,b,b,-1);else return HpSelect.renderText(a,b,b,0);}return HpElement.renderText(a,b,c,HpElement.separator);}
HpRender.renderInit=function(a,b){if((b.contains(a,HpConstants.init)==true)||(b.contains(null,HpConstants.init)==true)) HpDom.setClasses(a,b.formatFallBack(a,HpConstants.init,' '));}
HpRender.renderState=function(a,b,c){var d=c.formatFallBack(a,HpConstants.error,' ');var e=c.formatFallBack(a,HpConstants.success,' ');if(b==true){HpDom.removeClasses(a,d);HpDom.addClasses (a,e);}else {HpDom.removeClasses(a,e);HpDom.addClasses (a,d);}return a;}
HpRender.renderStyle=function(a,b,c){if(b instanceof HpAttributeList) HpDom.addClasses(a,b.formatFallBack(a,c,' '));else HpDom.addClasses(a,b);return a;}
HpRender.display=function(a){var b=document.getElementById(a);if(HpDom.containsClass(b,HpConstants.hide)==false) HpDom.addClass(b,HpConstants.hide);else HpDom.removeClass(b,HpConstants.hide);}

