function HxG_3 () { this.version="2.01"; this.brw=new this.HxBrowserMgr(); this.brw.initClientBrowserObject(this); this.geo=new this.HxGeometryMgr(this); this.res=new Array(); this.imp=new this.HxCompImpMgr(this); this.dragger=new this.HxDragMgr(this); this.uistate=new this.HxUIState(); this.Components=new Array(); this.SubComponents=new Array(); this.Behaviors=new Array(); this.Converters=new Array(); this.Validators=new Array(); this.Popups=new Array(); this.Timers=new Array(); this.userEvents=new Array(); this.regExp=new this.HxConstraints(); this.sel=new this.HxCaretSelection(); this.tabNav=null; this.c=new this.HxCache(); this.clip=new this.pseudoClipboard(); this.bodyLoadRewritten=false; this.globalResize=false; this.pendingFocusReturn=null; this.pendingSelect=false; this.pendingBlurRefocus=null; } HxG_3.prototype._Z="0"; HxG_3.prototype._C=","; HxG_3.prototype._U="_"; HxG_3.prototype._Y="-"; HxG_3.prototype._P="."; HxG_3.prototype._B=" "; HxG_3.prototype._E=""; HxG_3.prototype._LB="#"; HxG_3.prototype._EQ="="; HxG_3.prototype._QM="?"; HxG_3.prototype._SL="/"; HxG_3.prototype._SM=";"; HxG_3.prototype._VB="|"; HxG_3.prototype._SQT="'"; HxG_3.prototype._DQT='"'; HxG_3.prototype._ON="on"; HxG_3.prototype._HX="_hx_"; HxG_3.prototype._BODY="#body"; HxG_3.prototype._DOC="#document"; HxG_3.prototype.CLASS_LINES_SLIDER="inputText_Slider_Body"; HxG_3.prototype.CLASS_SLIDER="inputText_Slider"; HxG_3.prototype.CLASS_DP="inputText_DatePicker"; HxG_3.prototype.CLASS_BUTTON_LABEL="_Label"; HxG_3.prototype.CLASS_BUTTON_ICON="_Icon"; HxG_3.prototype.CLASS_DP_SIZE="Size"; HxG_3.prototype.CLASS_DP_HEADER="Header"; HxG_3.prototype.CLASS_DP_HEADER1="HeaderLine1"; HxG_3.prototype.CLASS_DP_HEADER2="HeaderLine2"; HxG_3.prototype.CLASS_DP_HEADERYEAR="HeaderYear"; HxG_3.prototype.CLASS_DP_HEADERMONTH= "HeaderMonth"; HxG_3.prototype.CLASS_DP_HEADER_WEEKDAY="HeaderWeekday"; HxG_3.prototype.CLASS_DP_BODY="Body"; HxG_3.prototype.CLASS_DP_BUTTON="Button"; HxG_3.prototype.CLASS_DP_CURRMONTH="CurrentMonth"; HxG_3.prototype.CLASS_DP_OTHERMONTH="OtherMonth"; HxG_3.prototype.CLASS_DP_CURRDAY="CurrentDay"; HxG_3.prototype.CLASS_DP_OTHERDAY="CurrentOtherDay"; HxG_3.prototype.CLASS_DP_TODAY="Today"; HxG_3.prototype.CLASS_DP_CURRENTTODAY="CurrentToday"; HxG_3.prototype.CLASS_DP_INVALIDDAY="InvalidDay"; HxG_3.prototype.DTFMT_DATE0="MM-dd-yyyy"; HxG_3.prototype.DTFMT_DEFAULTSTRICT=1; HxG_3.prototype.DTFMT_DEFAULTFIRSTDAYMONTH=0; HxG_3.prototype.DTFMT_YEAR="%yyyy"; HxG_3.prototype.DTFMT_GEYEAR="%GGGG %y"; HxG_3.prototype.DTFMT_GCYEAR="%yyyy %GG"; HxG_3.prototype.MFMT_DEFAULTSTRICT=1; HxG_3.prototype.DATE_EPOCH_IDS=["", "c", "j"]; HxG_3.prototype.D_DAYS_IN_MONTH=new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); HxG_3.prototype.STR_DATE_TODAY=new Array ("today","tomorrow","yesterday","now"); HxG_3.prototype.NFMT_DECIMAL0="###,###,##0"; HxG_3.prototype.NFMT_LOCALE0=",.%\u2030-$"; HxG_3.prototype.NFMT_DEFAULTSTRICT=1; HxG_3.prototype.TW_UP=0; HxG_3.prototype.TW_DN=1; HxG_3.prototype.TW_LT=2; HxG_3.prototype.TW_RT=3; HxG_3.prototype.TW_SNOUT=0; HxG_3.prototype.TW_PUG=1; HxG_3.prototype.TW_VEE=2; HxG_3.prototype.TW_TRI=3; HxG_3.prototype.TW_NOBAR=0; HxG_3.prototype.TW_BAR_INNER=1; HxG_3.prototype.TW_BAR_OUTER=2; HxG_3.prototype.TAG_OBJECT="object"; HxG_3.prototype.TAG_PARAM="param"; HxG_3.prototype.TAG_EMBED="embed"; HxG_3.prototype.ELEMENT_NODE=1; HxG_3.prototype.TEXT_NODE=3; HxG_3.prototype.DOCUMENT_NODE=9; HxG_3.prototype.KEY_BS=8; HxG_3.prototype.KEY_TAB=9; HxG_3.prototype.KEY_ENTER=13; HxG_3.prototype.KEY_ESC=27; HxG_3.prototype.KEY_SPACEBAR= 32; HxG_3.prototype.KEY_PGUP=33; HxG_3.prototype.KEY_PGDN=34; HxG_3.prototype.KEY_END=35; HxG_3.prototype.KEY_HOME=36; HxG_3.prototype.KEY_LTARROW=37; HxG_3.prototype.KEY_UPARROW=38; HxG_3.prototype.KEY_RTARROW=39; HxG_3.prototype.KEY_DNARROW=40; HxG_3.prototype.KEY_INS=45; HxG_3.prototype.KEY_DEL=46; HxG_3.prototype.INTERR_Dispatcher="Internal Error: Cannot dispatch user function."; HxG_3.prototype.INTERR_Constraint="Internal error: Cannot consruct constraint."; HxG_3.prototype.INTERR_Bad_Family="Internal error: Invalid stylesheet family."; HxG_3.prototype.INTERR_Parse_Literal= "Parse error: Failed parsing a strict literal: "; HxG_3.prototype.INTERR_Parse_TwoDig="Parse error: Failed parsing number digits: "; HxG_3.prototype.INTERR_Parse_end="Parse error: Failing at end of parse: "; HxG_3.prototype.STR_percent_char="%"; HxG_3.prototype.STR_mille_char="\u2030"; HxG_3.prototype.STR_icurrency_char="\u00A4"; Date.HxGetDaysInMonth=function (month, year) { if (1 == month) return ((0 == year % 4) && (0 != (year % 100))) || (0 == year % 400) ? 29 : 28; else return hX_3.D_DAYS_IN_MONTH[month]; } Date.prototype.HxClone=function(dt) { var r if (dt != null && dt >= 2) r=new Date (this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()); else if (dt != null && dt == 1) r=new Date (this.getFullYear(), 0, 0, this.getHours(), this.getMinutes(), this.getSeconds()); else r=new Date (this.getFullYear(), this.getMonth(), this.getDate(), 12, 0, 0); return (r); } Date.prototype.HxGetJulianDateOfYear=function() { var m=this.getMonth(); var d=this.getDate(); var y=this.getFullYear(); var j=d; for (var i=0; i < m; i++) { j+=Date.HxGetDaysInMonth(i, y); } return (j); } Date.prototype.HxGetJulianDateOfMonth=function() { var j=0; var d=this.getDate(); while (d > 0) { j++; d -= 7; } return (j); } Date.prototype.HxGetJulianWeekOfYear=function() { var first=new Date(this.getFullYear(), 0, 1, 0, 0, 0); var firstDay=first.getDay(); firstDay=(firstDay == 0) ? 0 : (7 - firstDay); var d=this.HxGetJulianDateOfYear() - 1 - firstDay; var j=Math.floor(d/7) + 2; return (j); } Date.prototype.HxGetJulianWeekOfMonth=function() { var first=new Date(this.getFullYear(), this.getMonth(), 1, 0, 0, 0); var firstDay=first.getDay(); firstDay=(7 - firstDay); var Day=this.getDate(); var d=(Day-firstDay-1); var j=Math.floor(d/7) + 2; return (j); } Date.prototype.HxAdjustDate=function (iYearDif, iMonthDif, iDayDif, iHourDif, iMinuteDif, iSecondDif) { var msDif=0; var iNewMonth=0; var bResetTime=false; var iOrigHour, iOrigMinute, iOrigSecond; if(!iHourDif && !iMinuteDif && !iSecondDif && (iDayDif || iMonthDif)) { iOrigHour=this.getHours(); iOrigMinute=this.getMinutes(); iOrigSecond=this.getSeconds(); bResetTime=true; this.setHours(this.getTimezoneOffset < 0 ? 4 : 20); } if(iSecondDif) msDif+=iSecondDif * 1000; if(iMinuteDif) msDif+=iMinuteDif * 60000; if(iHourDif) msDif+=iHourDif * 3600000; if(iDayDif) msDif+=iDayDif * 86400000; if(msDif) this.setTime(this.getTime() + msDif); if(iMonthDif) { var iYearAdj=Math.floor(Math.abs(iMonthDif) / 12) * ((iMonthDif < 0)?-1:1); iMonthDif=iMonthDif % 12; iNewMonth=this.getUTCMonth() + iMonthDif; if(iNewMonth < 0) { iYearAdj--; iNewMonth+=12; } else if(iNewMonth > 11) { iYearAdj++; iNewMonth -= 12; } iYearDif+=iYearAdj; } if(iYearDif) this.setUTCFullYear(this.getUTCFullYear() + iYearDif); if(iMonthDif) { var iDays=Date.HxGetDaysInMonth(iNewMonth, this.getUTCFullYear()); if(this.getUTCDate() > iDays) this.setUTCDate(iDays); this.setUTCMonth(iNewMonth); } if(bResetTime) { this.setHours(iOrigHour); this.setMinutes(iOrigMinute); this.setSeconds(iOrigSecond); } } Date.prototype.HxCompareDate=function(oDate, bCompareTime) { var iDiff; iDiff=this.getFullYear() - oDate.getFullYear(); if(iDiff == 0) iDiff=this.getMonth() - oDate.getMonth(); if(iDiff == 0) iDiff=this.getDate() - oDate.getDate(); if(bCompareTime && iDiff == 0) { iDiff=this.getHours() - oDate.getHours(); if(iDiff == 0) iDiff=this.getMinutes() - oDate.getMinutes(); if(iDiff == 0) iDiff=this.getSeconds() - oDate.getSeconds(); } if(iDiff < 0) iDiff=-1; else if (iDiff > 0) iDiff=1; return iDiff; } HxG_3.prototype.addComponent=function(id, obj) { if (id && obj && this.brw.isW3C()) { var DOMobj=this.getElementById(id); if (DOMobj && !this.Components[id]) { this.Components[id]=obj; obj.id=id; obj.DOMobj=DOMobj; obj.HTMLrendered=false; obj.p=this; obj.r=hX_3.currentResource(); return true; } } return false; } HxG_3.prototype.addSubComponent=function (childId, parentId, obj, position) { if (childId && parentId && obj && this.brw.isW3C()) { var theParent=this.getComponentById (parentId); var theObj=this.getElementById(childId); if (theParent && theObj) { this.SubComponents[childId]=obj; obj.id=childId; obj.DOMobj=theObj; obj.p=theParent; theParent.addSubComponent (childId, obj, position); return true; } } return false; } HxG_3.prototype.addBehavior=function(id, eventname, obj) { if (id && eventname && obj && obj.type && this.brw.isW3C()) { var DOMobj=(id == hX_3._BODY) ? document.body :this.getElementById(id); if (DOMobj) { var e=(this.brw.isNavOrMoz() && eventname=="onkeydown" && obj.type == "keybind") ? "onkeypress":eventname; var i=e.indexOf(hX_3._ON); var thisid=(i==0) ? e.substr(2) : e; thisid=id + hX_3._HX + obj.type + hX_3._U + thisid; if (this.Behaviors[thisid] && this.Behaviors[thisid].addSubComponent) { this.Behaviors[thisid].addSubComponent(obj); } else { this.Behaviors[thisid]=obj; obj.id=id; obj.eventname=e; obj.DOMobj=DOMobj; obj.HTMLrendered=false; obj.p=this; obj.r=hX_3.currentResource(); } return true; } } return false; } HxG_3.prototype.addConverter=function(id, obj) { if (id && obj && this.brw.isW3C()) { this.Converters[id]=obj; obj.id=id; obj.p=this; return true; } return false; } HxG_3.prototype.addValidator=function(id, obj) { if (id && obj && this.brw.isW3C()) { this.Validators[id]=obj; obj.id=id; obj.p=this; return true; } return false; } HxG_3.prototype.addPopup=function(id, parentid, srcvalue, clickstyle) { if (id && this.brw.isW3C()) { if (this.Popups[id]) { return this.Popups[id]; } else { var obj=new this.JSFPopup(parentid, srcvalue, clickstyle); this.Popups[id]=obj; obj.id=id; obj.HTMLrendered=false; obj.p=this; obj.r=hX_3.currentResource(); return obj; } } return null; } HxG_3.prototype.onPageLoad=function () { if (!this.bodyLoadRewritten) this.bodyLoadEventNum=this.attachEvent(document.body, "onload", "l", this.pageLoadAction); this.bodyLoadRewritten=true; return true; } HxG_3.prototype.pageLoadAction=function(evt) { hX_3.removeEvent(document.body, "onload", hX_3.bodyLoadEventNum); for (varobj in hX_3.Components) { if (hX_3.Components[varobj].onPageLoad) { if (!hX_3.Components[varobj].HTMLrendered) hX_3.Components[varobj].onPageLoad(); hX_3.Components[varobj].HTMLrendered=true; } } for (varobj in hX_3.Behaviors) { if (hX_3.Behaviors[varobj].onPageLoad) { if (!hX_3.Behaviors[varobj].HTMLrendered) hX_3.Behaviors[varobj].onPageLoad(); hX_3.Behaviors[varobj].HTMLrendered=true; } } for (varobj in hX_3.Popups) { if (hX_3.Popups[varobj].onPageLoad) { if (!hX_3.Popups[varobj].HTMLrendered) hX_3.Popups[varobj].onPageLoad(); hX_3.Popups[varobj].HTMLrendered=true; } } if (hX_3.globalResize && hX_3.brw.isNavOrMoz()) hX_3.redraw(); return; } HxG_3.prototype.redraw=function () { for (varobj in this.Components) { if (this.Components[varobj].uirelease) this.Components[varobj].uirelease(); if (this.Components[varobj].redraw) this.Components[varobj].redraw(); } for (varobj in this.Popups) { if (this.Popups[varobj].uirelease) this.Popups[varobj].uirelease(); } if (hX_3.tabNav != null) { delete (hX_3.tabNav); hX_3.tabNav=null; } if (!(this.isUnDef(typeof(hX_1))) && (hX_1 != null) && (hX_1.redraw)) hX_1.redraw(); if (!(this.isUnDef(typeof(hX_2))) && (hX_2 != null) && (hX_2.redraw)) hX_2.redraw(); return true; } HxG_3.prototype.uirelease=function () { this.dragger.killDrag(); var o=this.uistate.getActiveComponent(); if (o) o.uirelease(); this.uistate.setActiveComponent (""); this.imp.killAllTimers(); for (varobj in this.Components) { if (this.Components[varobj].uirelease) this.Components[varobj].uirelease(); } for (varobj in this.Popups) { if (this.Popups[varobj].uirelease) this.Popups[varobj].uirelease(); } if (!(this.isUnDef(typeof(hX_1))) && (hX_1 != null) && (hX_1.uirelease)) hX_1.uirelease(); return true; } HxG_3.prototype.getComponentById=function(obj) { if (obj != null && this.isString(obj)) return (this.Components[obj]); return (obj); } HxG_3.prototype.getSubComponentById=function(obj) { if (obj != null && this.isString(obj)) return (this.SubComponents[obj]); return (obj); } HxG_3.prototype.getParentComponentById=function(obj) { if (obj != null && this.isString(obj)) { var thisobj=this.SubComponents[obj]; return (thisobj.p); } return (obj); } HxG_3.prototype.getConverterById=function(obj) { if (obj != null && this.isString(obj)) return (this.Converters[obj]); return (obj); } HxG_3.prototype.getValidatorById=function(obj) { if (obj != null && this.isString(obj)) return (this.Validators[obj]); return (obj); } HxG_3.prototype.getBehaviorById=function(obj, behaviorname, eventname) { if (obj != null && this.isString(obj)) { var i=eventname.indexOf(hX_3._ON); var thisid=(i==0) ? eventname.substr(2) : eventname; thisid=obj + hX_3._HX + behaviorname + hX_3._U + thisid; var thisobj=this.Behaviors[thisid]; return (thisobj); } return (obj); } HxG_3.prototype.getPopupById=function(obj) { if (obj != null && this.isString(obj)) return(this.Popups[obj]); return (obj); } HxG_3.prototype.getElementById=function(obj) { var theObj; if (obj != null && this.isString(obj)) { if (window.document.getElementById != null) theObj=window.document.getElementById(obj); else if (window.document.all != null) theObj=window.document.all(obj); } else { theObj=obj; } return theObj; } HxG_3.prototype.attachComponentEvent=function (objid, eventname, position) { hX_3.attachEvent (objid, eventname, position, hX_3.imp.dispatchComponent); } HxG_3.prototype.attachBehaviorEvent=function (objid, behaviorname, eventname, position, alias) { if (alias) hX_3.attachEvent(objid, eventname, position, "hX_3.imp.dispatchBehavior(this, event, '" + behaviorname + "', '" + alias + "')"); else hX_3.attachEvent(objid, eventname, position, "hX_3.imp.dispatchBehavior(this, event, '" + behaviorname + "')"); } HxG_3.prototype.attachInputStateEvent=function (objid, eventname) { hX_3.attachEvent(objid, eventname, "f", hX_3.imp.dispatchInputState); } HxG_3.prototype.attachEvent=function (objid, eventname, position, handler, handler1, args) { if (objid && eventname && handler) { var rValue=null, obj=this.getElementById(objid); if (obj) { var srcid=this.imp.dispatchToID(obj); var userObj=hX_3.lookupEvent ("R", srcid, eventname); if (userObj == null) userObj=hX_3.addNewEvent (srcid, obj, eventname, "R", handler1, args); if (position == "f" || position == "first") rValue=userObj.addPre ("f", handler); else if (position == "p" || position == "previous") rValue=userObj.addPre ("l", handler); else if (position == "n" || position == "next") rValue=userObj.addPost ("f", handler); else rValue=userObj.addPost ("l", handler); var tgtobj=(srcid == hX_3._BODY) ? document.body : obj; if (this.brw.isIE()) { tgtobj.setAttribute(eventname, hX_3.runEvent); } else { if (eventname == "onpropertychange") tgtobj.addEventListener("DOMAttrModified", hX_3.runEvent1, false); else tgtobj.setAttribute(eventname, "return(hX_3.runEvent(this, event));"); } return rValue; } } return null; } HxG_3.prototype.removeEvent=function (objid, eventname, which) { if (objid && eventname) { var obj=this.getElementById(objid); if (obj) { var srcid=this.imp.dispatchToID(obj); var userObj=hX_3.lookupEvent ("R", srcid, eventname); if (userObj != null) { var user= (arguments.length > 2 && which && hX_3.isString(which) && which == "user"); var num=(arguments.length > 2 && which && hX_3.isNumber(which)); var all=(arguments.length <= 2); if (user) userObj.User=null; if (all) userObj.remove(0); if (num) userObj.remove(which); return true; } } } return false; } HxG_3.prototype.HxBrowserMgr=function () { this.m_browserLevel=3; this.m_browserName='Netscape'; this.m_browserVersion='Unknown'; this.m_clientPlatform='Unknown'; this.m_JSVersion=1.0; this.m_hasStyleSheet=false; this.m_hasActiveX=true; this.m_hasIECacheBug=false; this.m_hasDOM=false; this.m_hasDOM1=false; this.m_hasDOM2=false; this.m_hasLayers=false; this.m_hasPersistentStore= false; this.m_isIE=false; this.m_isNavigator=false; this.m_isFirefox=false; this.m_isOpera=false; this.m_isKonqueror=false; this.m_isMozilla=false; this.m_isW3C=false; this.m_isW3C_STD=false; this.m_isIE6_CSS=false; this.m_isIE_XP=false; this.isBrowserLevel=function(neededBrowserLevel) { return (neededBrowserLevel < (this.m_browserLevel+1)); } this.getRealAppVersion=function() { return this.m_realAppVersion; } this.hasIEZindexLimitation=function() { this.m_isIE && this.m_realAppVersion < 5.5; } this.getJSVersion=function() { return this.m_JSVersion; } this.hasActiveX=function() { return this.m_hasActiveX; } this.hasIECacheBug=function() { return this.m_hasIECacheBug; } this.hasStyleSheet=function() { return this.m_hasStyleSheet; } this.hasDOM=function() { this.m_isIE && this.isBrowserLevel(4); } this.hasDOM1=function() { return this.m_hasDOM1; } this.hasDOM2=function() { return this.m_hasDOM2; } this.isIE=function() { return this.m_isIE; } this.isNetscape=function() { return this.m_isNavigator; } this.isFirefox=function() { return this.m_isFirefox; } this.isOpera=function() { return this.m_isOpera; } this.isKonqueror=function() { return this.m_isKonqueror; } this.isMozilla=function() { return this.m_isMozilla; } this.isNavOrMoz=function() { return (this.m_isMozilla || this.m_isNavigator); } this.isNetscape4=function() { return (this.m_isNavigator && this.m_realAppVersion >= 4.0); } this.hasLayers=function() { return this.m_hasLayers; } this.isIE5=function() { return (this.m_isIE && this.m_realAppVersion >= 5.0); } this.isIE5_5=function() { return (this.m_isIE && this.m_realAppVersion >= 5.5); } this.isIE6_CSS=function() { return (this.m_isIE6_CSS); } this.isW3C=function() { return (this.m_isW3C); } this.isW3Cstd=function() { return (this.m_isW3C_STD); } this.isPlatformMac=function() { return ((this.m_clientPlatform.indexOf("Mac") != -1) ? true : false); } this.isPlatformWin=function() { return ((this.m_clientPlatform.indexOf("Win") != -1) ? true : false); } this.isPlatformIEWinXP=function() { return (this.m_isIE_XP); } this.inited=false; } HxG_3.prototype.HxBrowserMgr.prototype.initClientBrowserObject=function (parent) { if (this.inited) return; this.p=parent; this.m_browserLevel=parseInt (navigator.appVersion.charAt(0), 10); if (this.p.isDef(typeof(navigator.appName))) this.m_browserName=navigator.appName; if (this.p.isDef(typeof(navigator.userAgent))) this.m_browserVersion=navigator.userAgent; if (this.p.isDef(typeof(navigator.platform))) this.m_clientPlatform=navigator.platform; this.m_isIE=(this.m_browserName == "Microsoft Internet Explorer"); this.m_isNavigator=(this.m_browserName == "Netscape"); this.m_isOpera=(this.mbrowserName == "Opera"); this.m_isKonqueror=(this.mbrowserName == "Konqueror"); this.m_isMozilla=(window.navigator != null) ? (window.navigator.userAgent.indexOf("ecko") != -1) : false; if (this.m_isMozilla) { this.m_isNavigator=false; this.m_isFirefox=(window.navigator != null) ? (window.navigator.userAgent.indexOf("irefox") != -1) : false; } this.m_realAppVersion=parseFloat(this.m_isIE ? navigator.appVersion.substr(navigator.appVersion.indexOf("MSIE") + 4) : navigator.appVersion); this.m_hasLayers=this.m_isNavigator && this.m_browserLevel >= 4 && this.m_browserLevel < 5; if(window.gCookie && gCookie.bs && gCookie.bs == "") { this.m_isIE=true; this.m_isNavigator=false; this.m_browserLevel=5; this.m_realAppVersion=5.0; } if(window.gCookie && gCookie.bs && gCookie.bs == "_NN4") { this.m_isIE=false; this.m_isNavigator=true; this.m_browserLevel=4; this.m_realAppVersion=4.7; } this.m_hasIECacheBug=this.m_isIE; this.m_hasStyleSheet=this.isBrowserLevel(4); this.m_hasActiveX=this.m_isIE && (navigator.appVersion.indexOf("Win") != -1); this.m_hasPersistentStore=this.m_isIE && this.m_realAppVersion > 5 && this.isPlatformWin(); if (window.document.implementation != null) { this.m_hasDOM1=window.document.implementation.hasFeature("HTML","1.0"); this.m_hasDOM2=window.document.implementation.hasFeature("HTML","2.0") && window.document.implementation.hasFeature("Events","2.0") && window.document.implementation.hasFeature("Core","2.0") && window.document.implementation.hasFeature("CSS2","2.0"); } if (this.m_isIE && this.isPlatformWin() && (this.p.isDef(typeof(navigator.appVersion)))) { var str=navigator.appVersion; var ix=str.indexOf("Windows NT "); if (ix > 0 && ix+11 < str.length) { str=str.substr(ix+11,3); if (str.length > 0) { snum=new Number(str); this.m_isIE_XP=(snum >= 5.1); } } } if (document.images) { this.m_isW3C=(document.body && document.body.style && document.getElementById) ? true : false; if (this.m_isW3C) { this.m_isW3C_STD=(this.isNavOrMoz()) ? true : ((document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false); this.m_isIE6_CSS=(this.m_isIE && document.compatMode && document.compatMode.indexOf("CSS1") >= 0)? true : false; } } } HxG_3.prototype.HxGeometryMgr=function (thisparent) { this.p=thisparent; } HxG_3.prototype.HxGeometryMgr.prototype.getElementAbsPosTop=function(obj) { var rValue=0, elem=this.p.getElementById(obj); if(elem.offsetParent) { while(elem.offsetParent) { rValue+=elem.offsetTop; rValue -= elem.scrollTop; elem=elem.offsetParent; } } else if(elem.y) rValue+=elem.y; return rValue; } HxG_3.prototype.HxGeometryMgr.prototype.getElementAbsPosLeft=function(obj) { var rValue=0, elem=this.p.getElementById(obj); if(elem.offsetParent) { while(elem.offsetParent) { rValue+=elem.offsetLeft; rValue -= elem.scrollLeft; elem=elem.offsetParent; } } else if(elem.x) rValue+=elem.x; return rValue; } HxG_3.prototype.HxGeometryMgr.prototype.getElementRenderedHeight=function (obj) { var elem=this.p.getElementById(obj); return parseInt(elem.offsetHeight, 10); } HxG_3.prototype.HxGeometryMgr.prototype.getElementRenderedWidth=function (obj) { var elem=this.p.getElementById(obj); return parseInt(elem.offsetWidth, 10); } HxG_3.prototype.HxGeometryMgr.prototype.parseBorder=function (obj, which, defwidth) { var width=defwidth; var bname="border-" + which + "-style"; if ((this.getEffectiveStyle(obj, bname)) == "none") { width=0; } else { bname="border-" + which + "-width"; var value=this.getEffectiveStyle(obj, bname); width=(value == "") ? defwidth : ((value == "thin") ? 2 : ((value == "medium") ? 3 : ((value == "thick") ? 4 : parseInt(value, 10)))); } return width; } HxG_3.prototype.HxGeometryMgr.prototype.testXPBorder=function (obj) { var rvalue=false; if (this.p.brw.isPlatformIEWinXP()) { var style=this.getEffectiveStyle(obj, "border-style"); var width=this.getEffectiveStyle(obj, "border-width"); if (style == "none" && width == "2px") rvalue=true; } return rvalue; } HxG_3.prototype.HxGeometryMgr.prototype.getWindowClientWidth=function () { if (window.innerWidth) { return window.innerWidth; } else if (this.p.brw.isIE6_CSS()) { return document.body.parentElement.clientWidth; } else if (document.body && document.body.clientWidth) { return document.body.clientWidth; } return 0; } HxG_3.prototype.HxGeometryMgr.prototype.getWindowClientHeight=function () { if (window.innerHeight) { return window.innerHeight; } else if (this.p.brw.isIE6_CSS()) { return document.body.parentElement.clientHeight; } else if (document.body && document.body.clientHeight) { return document.body.clientHeight; } return 0; } HxG_3.prototype.HxGeometryMgr.prototype.getEffectiveStyle=function (obj, stylething1, stylething2) { var rvalue=null, elem=this.p.getElementById(obj); if (elem) { if (elem.currentStyle) { var cstyle=(stylething2) ? stylething2 : this.CSStagToDOMtag (stylething1); rvalue=elem.currentStyle.getAttribute(cstyle); } else if (window.getComputedStyle) { var compStyle=window.getComputedStyle(elem, ""); rvalue=compStyle.getPropertyValue(stylething1); } } return (rvalue); } HxG_3.prototype.HxGeometryMgr.prototype.CSStagToDOMtag=function(value) { var work=value; var q=work.indexOf(hX_3._Y); while (q >= 0) { work=work.substring(0, q) + (work.substring(q+1, q+2)).toUpperCase() + work.substring(q+2); q=work.indexOf(hX_3._Y); } return work; } HxG_3.prototype.HxGeometryMgr.prototype.toPoint=function (evt) { var cX, cY; if (hX_3.brw.isIE()) { var sBase=(hX_3.brw.isIE6_CSS()) ? document.body.parentNode : document.body; cX=evt.clientX; cY=evt.clientY; cX=cX + sBase.scrollLeft; cY=cY + sBase.scrollTop; } else { cX=evt.pageX; cY=evt.pageY; } return {X: cX, Y: cY}; } HxG_3.prototype.HxCache=function () { this.MAX_STR_DATE_MONTHS=null; this.MAX_STR_DATE_SHMONTHS=null; this.MAX_STR_DATE_DAYS=null; this.MAX_STR_DATE_SHDAYS=null; this.BIGNUM_converter=null; } HxG_3.prototype.currentResource=function () { if (hX_3.res != null) { if (hX_3.res.length <= 0) { hX_3.res[0]=new hX_3.HxResourceMgr(hX_3); hX_3.res[0].setAbsolutePaths(); } return (hX_3.res[hX_3.res.length-1]); } return null; } HxG_3.prototype.HxResourceMgr=function (thisparent) { this.p=thisparent; this.bPathSet=false; this.jsfRootToken="/faces"; this.protocol="http://"; this.baseLibPath=".ibmjsfres/"; this.baseImgPath=this.baseLibPath + "img/"; this.baseCssPath=this.baseLibPath + "css/"; this.baseDlgPath=this.baseLibPath + "dlg/"; this.getImgPath=function() { return this.baseImgPath; } this.getCssPath=function() { return this.baseCssPath; } this.getDlgPath=function() { return this.baseDlgPath; } this.p.R_IMG_CNT=5; this.p.R_IMG_SPACER=0; this.p.R_IMG_HINKIES=1; this.p.R_IMG_LG_HINKIES=2; this.p.R_IMG_VLG_HINKIES=3; this.p.R_IMG_CAL_HINKIES=4; this.RF_IMGS=[["1x1.gif", 1, 1, 0, 0, 0], ["hinkies.gif", 16, 96, 2, 3, 4], ["hinkies_lg.gif", 24, 24, 2, 2, 1], ["hinkies_vlg.gif", 24, 24, 2, 2, 1], ["HinkiesC.gif", 26, 156, 2, 12, 1]]; this.images=new Array(); } HxG_3.prototype.HxResourceMgr.prototype.recache=function () { for (var i=0; i < this.p.R_IMG_CNT; i++) { this.images[i]=new Image(this.RF_IMGS[i][1], this.RF_IMGS[i][2]); this.images[i].src=this.getImgPath() + this.RF_IMGS[i][0]; } } HxG_3.prototype.HxResourceMgr.prototype.getURI=function (img) { return "url('" + this.images[img].src + "')"; } HxG_3.prototype.HxResourceMgr.prototype.getURL=function (img) { return this.images[img].src; } HxG_3.prototype.HxResourceMgr.prototype.wellPosition=function (id, row, col, grp) { grp=(grp) ? grp : 0; var cellX=this.RF_IMGS[id][1] / this.RF_IMGS[id][3]; var cellY=this.RF_IMGS[id][2] / (this.RF_IMGS[id][4] * this.RF_IMGS[id][5]); var xOffset=-(col * cellX); var gOffset=grp * (cellY * this.RF_IMGS[id][4]); var yOffset=-(gOffset + (row*cellY)); return (xOffset + "px " + yOffset + "px"); } HxG_3.prototype.setResourceServer=function(path) { var cr=this.res.length; this.res[cr]=new this.HxResourceMgr(this); var lchar=path.charAt(path.length-1); path=(lchar == "/") ? path : path + "/"; this.res[cr].baseImgPath=path + "img/"; this.res[cr].baseCssPath=path + "css/" this.res[cr].baseDlgPath=path + "dlg/"; this.res[cr].bPathSet=true; this.res[cr].recache(); } HxG_3.prototype.HxResourceMgr.prototype.setAbsolutePaths=function() { if (this.bPathSet == false) { var sPathPrefix=this.getAbsolutePathPrefix(this.jsfRootToken); this.baseImgPath=sPathPrefix + this.baseLibPath + "img/"; this.baseCssPath=sPathPrefix + this.baseLibPath + "css/" this.baseDlgPath=sPathPrefix + this.baseLibPath + "dlg/"; this.bPathSet=true; this.recache(); } } HxG_3.prototype.HxResourceMgr.prototype.getAbsolutePathPrefix=function (sToken) { if (this.p.isUnDef(typeof(sToken)) || sToken == "") sToken=this.jsfRootToken; var sLocation=new String(document.location); var sPathPrefix=""; var iCursor=sLocation.indexOf(sToken, 0) - 1; var sl="/"; if (iCursor < 0) { iCursor=sLocation.indexOf(this.protocol, 0); if (iCursor != -1) { var sTailPath=sLocation.slice(iCursor + this.protocol.length); for (var i=0; i < sTailPath.length; i++) { if (sTailPath.charAt(i) == sl) { sTailPath=sTailPath.slice(i); for (i=1; i < sTailPath.length; i++) { if (sTailPath.charAt(i) == sl) { sPathPrefix=sTailPath.substring(0, i + 1); break; } } } } } } else { var bFoundProjectDir=false; for (var i=iCursor; i >= 0; i--) { if (sLocation.charAt(i) == sl) { bFoundProjectDir=true; break; } } if (bFoundProjectDir == true) { sPathPrefix=sLocation.substring(i, i + (iCursor - i) + 1 + 1); } } return sPathPrefix; } HxG_3.prototype.HxUIState=function () { this.activecomponent=null; this.activecomponentkind=""; } HxG_3.prototype.HxUIState.prototype.setActiveComponent=function(obj) { this.activecomponent=(obj) ? obj : ""; return true; } HxG_3.prototype.HxUIState.prototype.getActiveComponent=function(kind) { if (this.activecomponent && hX_3.isObject(this.activecomponent)) { return this.activecomponent; } return; } HxG_3.prototype.JSFargument=function (instring) { this.value=this.attribute=""; if (instring && (hX_3.isString(instring))) { var q=instring.indexOf(":"); q=(q < 0) ? instring.indexOf("=") : q; if (q > 0) { this.attribute=instring.substring(0,q); this.value=instring.substring(q+1); } else { this.attribute=instring; } this.attribute=hX_3.Trim(this.attribute); this.attribute=this.attribute.toLowerCase(); } } HxG_3.prototype.JSFargument.prototype.attribute; HxG_3.prototype.JSFargument.prototype.value; HxG_3.prototype.ARG_IS_TRUE=1; HxG_3.prototype.ARG_TO_NUM=2; HxG_3.prototype.ARG_TO_NAN=3; HxG_3.prototype.ARG_TO_FCN=4; HxG_3.prototype.ARG_TO_FCNS= 5; HxG_3.prototype.ARG_TO_NAS=6; HxG_3.prototype.ARG_IS_TRUEV=7; HxG_3.prototype.ARG_TO_BIGNUM=8; HxG_3.prototype.JSFargument.prototype.parseArg=function (thisp, type, arg1, arg2, arg3, arg4) { if (type != hX_3.ARG_TO_NAS) this.value=hX_3.Trim(this.value); if (type == hX_3.ARG_IS_TRUE) return (!(this.value == "false" || this.value == "off" || this.value == hX_3._Z)); else if (type == hX_3.ARG_IS_TRUEV) return ((this.value == "false" || this.value == "off" || this.value == hX_3._Z || this.value == "none") ? "none":"visible"); else if (type == hX_3.ARG_TO_NUM || type == hX_3.ARG_TO_BIGNUM) { var num; if (hX_3.isString(this.value)) { if (type == hX_3.ARG_TO_NUM) num=new Number(this.value); else { if (hX_3.c.BIGNUM_converter == null) hX_3.c.BIGNUM_converter=new hX_3.NumberConverter(); num=hX_3.c.BIGNUM_converter.constantToValue(this.value); } } else num=this.value; num=Math.min(Math.max(arg1, num), arg2); return num; } else if (type == hX_3.ARG_TO_NAN || type == hX_3.ARG_TO_NAS) { if (this.value.length <= 0) return null; else return this.value; } else if (type == hX_3.ARG_TO_FCN) { return eval(this.value); } else if (type == hX_3.ARG_TO_FCNS) { return (new Function ("event", this.value)); } else { return this.value; } } HxG_3.prototype.parseArg=function (attributeTable, thisp, a) { var i, j, v, v1, arg, desc, obj="object", und= "undefined", semi=";"; var b=(hX_3.isString(a)) ? [a] : a; for (i=0; i < b.length; i++) { arg=new this.JSFargument(b[i]); if (arg.attribute.length >= 0) { desc=attributeTable[arg.attribute]; if (desc) { if (!(desc[2]) || (desc[2] && !thisp.HTMLrendered)) { v=(desc[1] == null) ? (arg.value) : (arg.parseArg(thisp, desc[1], desc[3], desc[4], desc[5], desc[6])); if (thisp[desc[0]] != null && typeof(thisp[desc[0]]) == obj && typeof(thisp[desc[0]].length) != und && typeof(thisp[desc[0]].push) != und) { j=(v == null) ? -1 : v.indexOf(semi); while (j >= 0) { v1=v.substr(0,j); v=v.substr(j+1); (thisp[desc[0]]).push(v1); j=(v == null) ? -1 : v.indexOf(semi); } (thisp[desc[0]]).push(v); } else thisp[desc[0]]=v; } } } } } HxG_3.prototype.getArg=function (attributeTable, thisp, arg) { var rvalue=null; if (arg.length >= 0) { var argdesc=attributeTable[arg]; if (argdesc) rvalue=thisp[argdesc[0]]; } return rvalue; } HxG_3.prototype.HxCompImpMgr=function (thisparent) { this.p=thisparent; this.deferSetFocus=null; this.deferSetSelect=null; this.deferSetSelect1=null; this.deferNSRedraw=new Array(); } HxG_3.prototype.HxCompImpMgr.prototype.dispatchID=function(obj) { var src=null; if (obj && obj.id) { src=(obj.nodeType == hX_3.ELEMENT_NODE || obj.nodeType == hX_3.DOCUMENT_NODE) ? obj : obj.parentNode; src=src.id; } else if (obj == document || obj == document.body) src=hX_3._BODY; return src; } HxG_3.prototype.HxCompImpMgr.prototype.dispatchToID=function(obj) { return ((obj.nodeName == "DOCUMENT" || obj.nodeName == "BODY" || obj.nodeName == hX_3._BODY || obj.nodeName == hX_3._DOC) ? hX_3._BODY : obj.id); } HxG_3.prototype.HxCompImpMgr.prototype.dispatchComponent=function(evt) { evt=(evt) ? evt : ((event) ? event: null); var src=hX_3.imp.dispatchID(this); if (evt && src) { var obj=hX_3.getComponentById(src); if (obj) { var item=obj.DOMobj.tagName.toLowerCase(); return (obj.dispatchComponent (item, evt, evt.type, evt.keyCode)); } } return; } HxG_3.prototype.HxCompImpMgr.prototype.dispatchBehavior=function(thisp, evt, name, alias) { evt=(evt) ? evt : ((event) ? event: null); var src=hX_3.imp.dispatchID(thisp); if (evt && name && src) { var ename=(alias) ? alias : evt.type; var obj=hX_3.getBehaviorById(src, name, ename); if (obj != null) return (obj.dispatchBehavior (this, evt)); } return; } HxG_3.prototype.HxCompImpMgr.prototype.dispatchInputState=function(evt) { evt=(evt) ? evt : ((event) ? event: null); var src=hX_3.imp.dispatchID(this); if (evt && src) { var obj=hX_3.getBehaviorById(src, "assist", "oninput"); if (obj != null && obj.state) return obj.state.dispatch(evt); } return; } HxG_3.prototype.HxCompImpMgr.prototype.relayMouseEvents=function(obj, inout) { if (inout) { this.p.attachEvent (obj, "onmouseover", "f", this.p.imp.dispatchRelay); this.p.attachEvent (obj, "onmouseout", "f", this.p.imp.dispatchRelay); } this.p.attachEvent (obj, "onmousemove", "f", this.p.imp.dispatchRelay); this.p.attachEvent (obj, "onmouseup", "f", this.p.imp.dispatchRelay); this.p.attachEvent (obj, "onmousedown", "f", this.p.imp.dispatchRelay); this.p.attachEvent (obj, "onclick", "f", this.p.imp.dispatchRelay); this.p.attachEvent (obj, "ondblclick", "f", this.p.imp.dispatchRelay); } HxG_3.prototype.HxCompImpMgr.prototype.dispatchRelay=function(evt) { evt=(evt) ? evt : ((event) ? event: null); var obj=this.parentNode; if (evt && obj && obj.firstChild) { obj=obj.firstChild; if (obj.fireEvent) { if (evt.type == "click") obj.click(); else { var etyp=hX_3._ON + evt.type.toLowerCase(); obj.fireEvent(etyp, evt); } } else if (obj.dispatchEvent) obj.dispatchEvent(evt); hX_3.imp.cancelAction(evt, true); } return false; } HxG_3.prototype.HxCompImpMgr.prototype.dispatchBtnComponent=function(evt) { evt=(evt) ? evt : ((event) ? event: null); if (evt && this) { var src=((this.nodeType == hX_3.ELEMENT_NODE || this.nodeType == hX_3.DOCUMENT_NODE) ? this : this.parentNode); if (src) { var item=""; if (src.tagName == "IMG") src=src.parentNode; if (src.tagName == "BUTTON") { var sibling=src.previousSibling; src=src.parentNode; if (src && src.tagName == "SPAN") { item=(sibling && sibling.tagName == "BUTTON") ? "btn2" : "btn1"; src=src.previousSibling; } if (src && src.id && src.tagName == "INPUT") { var obj=hX_3.getComponentById(src.id); if (obj) { return (obj.dispatchComponent (item, evt, evt.type, evt.keyCode)); } } } } } return; } HxG_3.prototype.HxCompImpMgr.prototype.attachMonitor=function(obj, monitor, property1, property2) { var x, proparray=new Array(); for (x=2; x < arguments.length; x++) proparray.push(arguments[x]); this.p.attachEvent (obj, "onpropertychange", "l", this.dispatchMonitor, monitor, proparray); } HxG_3.prototype.HxCompImpMgr.prototype.dispatchMonitor=function(evt) { evt=(evt) ? evt : ((event) ? event: null); if (evt && this) { var src=((this.nodeType == hX_3.ELEMENT_NODE || this.nodeType == hX_3.DOCUMENT_NODE) ? this : this.parentNode); if (src) { var srcid=hX_3.imp.dispatchToID(src); var obj=hX_3.getComponentById(srcid); var prop=(hX_3.brw.isIE()) ? ((evt.propertyName) ? evt.propertyName:null) : ((evt.attrName) ? evt.attrName : null); var userObj=hX_3.lookupEvent ("R", srcid, "onpropertychange"); if (userObj != null && userObj.args && userObj.args.length) { for (var j=0; j < userObj.args.length; j++) { if (userObj.args[j] == prop) { if (hX_3.isString(userObj.handler1) && (userObj.handler1 == "standard")) { if (hX_3.brw.isIE()) { obj.redraw(); } else { hX_3.imp.deferNSRedraw.push(obj); setTimeout(hX_3.imp.NSRedraw, 10); } } else userObj.handler1.call (this, obj, evt, userObj.args); break; } } } } } return } HxG_3.prototype.HxCompImpMgr.prototype.NSRedraw=function () { while (hX_3.imp.deferNSRedraw.length > 0) { hX_3.imp.deferNSRedraw[hX_3.imp.deferNSRedraw.length-1].redraw(); hX_3.imp.deferNSRedraw.pop(); } } HxG_3.prototype.HxCompImpMgr.prototype.dispatchMonitorBtn=function(obj, evt, args) { if (hX_3.brw.isIE()) { hX_3.imp.sizeButtonsToInput(obj); } else { hX_3.imp.deferNSRedraw.push(obj); setTimeout(hX_3.imp.NSRedraw, 10); } return } HxG_3.prototype.HxCompImpMgr.prototype.attachResizeMonitor=function(obj, type) { if (this.p.brw.isIE()) { obj.onresize=(!type) ? this.dispatchMonitorResize : type; } else { if (!hX_3.globalResize) { this.p.attachEvent(document, "onresize", "l", ((!type) ? this.dispatchMonitorResize : type)); hX_3.globalResize=true; } } } HxG_3.prototype.HxCompImpMgr.prototype.dispatchMonitorResize=function(evt) { evt=(evt) ? evt : ((event) ? event: null); if (evt) { if (hX_3.brw.isIE()) { if (this) { var src=((this.nodeType == hX_3.ELEMENT_NODE || this.nodeType == hX_3.DOCUMENT_NODE) ? this : this.parentNode); if (src) { var srcid=hX_3.imp.dispatchToID(src); var obj=hX_3.getComponentById(srcid); obj.redraw(); } } } else { hX_3.redraw(); } } return } HxG_3.prototype.HxCompImpMgr.prototype.dispatchButtonMonitorResize=function(evt) { evt=(evt) ? evt : ((event) ? event: null); if (evt && this) { var src=((this.nodeType == hX_3.ELEMENT_NODE || this.nodeType == hX_3.DOCUMENT_NODE) ? this : this.parentNode); if (src) { if (!hX_3.brw.isIE()) { hX_3.redraw(); } else if (src.tagName == "SPAN") { var inputfld=src.firstChild; if (inputfld && inputfld.tagName == "INPUT") { var obj=hX_3.getComponentById(inputfld.id); if (obj) { var elemWidth=src.offsetWidth; if ((elemWidth - obj.bDsc.elemOffset) > 0) inputfld.style.width=(elemWidth - obj.bDsc.elemOffset) + "px"; else inputfld.style.width="0px"; if ((elemWidth - obj.bDsc.btnOffset) > 0) obj.bSet.innerspan.style.left=(elemWidth - obj.bDsc.btnOffset-1) + "px"; else obj.bSet.innerspan.style.left="0px"; return false; } } } } } return; } HxG_3.prototype.HxCompImpMgr.prototype.cancelAction=function(evt, preventDefault) { evt.cancelBubble=true; if (preventDefault) { if (evt.preventDefault) evt.preventDefault(); else if (evt.returnValue) evt.returnValue=false; } } HxG_3.prototype.HxCompImpMgr.prototype.fireEvent=function(obj, eventname) { var elem=this.p.getElementById(obj); var ename=eventname.toLowerCase(); if (elem) { if (elem.fireEvent) { return (elem.fireEvent(ename)); } else if (elem.dispatchEvent) { var shName=(ename.indexOf(hX_3._ON) == 0) ? ename.substr(2) : ename; var eType="HTMLEvents"; if (shName == "mousedown" || shName == "mouseup" || shName == "click" || shName == "dblclick" || shName == "mousemove" || shName == "mouseout" || shName == "mouseover") eType="MouseEvents"; var newEvt=document.createEvent(eType); newEvt.initEvent(shName, true, true); elem.dispatchEvent(newEvt); return true; } } return false; } HxG_3.prototype.HxCompImpMgr.prototype.setFocus=function(obj, select, defer) { hX_3.imp.deferSetFocus=hX_3.getElementById(obj); if (hX_3.imp.deferSetFocus && this.isFocusable(hX_3.imp.deferSetFocus)) { hX_3.imp.deferSetSelect=((arguments.length > 1) && select); if (arguments.length > 2 && defer) setTimeout(hX_3.imp.focusSetter, 10); else hX_3.imp.focusSetter(); return true; } return false; } HxG_3.prototype.HxCompImpMgr.prototype.focusSetter=function() { if (document.hasFocus && document.hasFocus() && document.activeElement && document.activeElement.id) { if (hX_3.sel.hasSelection(document.activeElement)) { var was=document.activeElement; var to=hX_3.imp.deferSetFocus; if (to.id == null || to.id != was.id) hX_3.sel.setSelection(was, 0, 0); } } hX_3.imp.deferSetFocus.focus(); if (hX_3.imp.deferSetSelect && hX_3.imp.deferSetFocus.select) hX_3.imp.deferSetFocus.select(); } HxG_3.prototype.HxCompImpMgr.prototype.isFocusable=function(obj) { if ((obj.type && obj.type == "hidden") || obj.disabled) return false; var h, d, root=obj; while (root != null && root.tagName.toUpperCase() != "BODY") { if (root.nodeType == hX_3.ELEMENT_NODE) { h=hX_3.geo.getEffectiveStyle (root, "visibility"); d=hX_3.geo.getEffectiveStyle (root, "display"); if (h == "hidden" || d == "none") return false; } root=root.parentNode; } return (obj.focus != null); } HxG_3.prototype.HxCompImpMgr.prototype.dispatchTimer=function(id, item, action) { elem=this.p.getComponentById(id); if (elem) { elem.dispatchTimer(item, action); return true; } return false; } HxG_3.prototype.HxCompImpMgr.prototype.dispatchTimerInputState=function(src, item, action) { if (src) { var obj=hX_3.getBehaviorById(src, "assist", "oninput"); if (obj != null && obj.state && obj.state.dispatchTimer) return obj.state.dispatchTimer(item, action); } return; } HxG_3.prototype.HxCompImpMgr.prototype.startTimerTimed=function(id, item, action, period, assist) { var dispatcher=(assist != null) ? "hX_3.imp.dispatchTimerInputState('" : "hX_3.imp.dispatchTimer('"; var executionstring=dispatcher + id + "', '" + item + "', '" + action + "')"; var thisid=window.setTimeout(executionstring, period); this.addTimer(thisid, "t"); return thisid; } HxG_3.prototype.HxCompImpMgr.prototype.startTimerInterval=function(id, item, action, period) { var executionstring="hX_3.imp.dispatchTimer('" + id + "', '" + item + "', '" + action + "')"; var thisid=window.setInterval(executionstring, period); this.addTimer(thisid, "i"); return thisid; } HxG_3.prototype.HxCompImpMgr.prototype.killAllTimers=function() { var i, timerid, iS="i", l=this.p.Timers.length; for (i=0; i < l; i++) { timerid=this.p.Timers[i][0]; if (timerid != 0) { if (this.p.Timers[i][1] == iS) window.clearInterval(timerid); else window.clearTimeout(timerid); this.p.Timers[i][0]=0; } } } HxG_3.prototype.HxCompImpMgr.prototype.killTimerTimed=function(timerid) { if (timerid && timerid != 0) { window.clearTimeout(timerid); var i, iT="t", l=this.p.Timers.length; for (i=0; i < l; i++) { if ((timerid == this.p.Timers[i][0]) && (iT == this.p.Timers[i][1])) this.p.Timers[i][0]=0; } } } HxG_3.prototype.HxCompImpMgr.prototype.killTimerInterval=function(timerid) { if (timerid && timerid != 0) { window.clearInterval(timerid); var i, iS="i", l=this.p.Timers.length; for (i=0; i < l; i++) { if ((timerid == this.p.Timers[i][0]) && (iS == this.p.Timers[i][1])) this.p.Timers[i][0]=0; } } } HxG_3.prototype.HxCompImpMgr.prototype.addTimer=function(timerid, type) { var i, added=false, l=this.p.Timers.length; var thisEntry=new Array(timerid, type); for (i=0; i < l; i++) { if (this.p.Timers[i][0] == 0) { this.p.Timers[i]=thisEntry; added=true; break; } } if (!added) this.p.Timers[l]=thisEntry; } HxG_3.prototype.JSFbuttondesc=function () { this.btnOrg=1; this.btnBorder=-1; this.btnColor="buttonface" this.btn1label=""; this.btn2label=""; this.btnBorderStyle=""; this.backcolor=""; this.saveprops=new Array(); this.HTMLcopied=false; this.HTMLattached=false; } HxG_3.prototype.JSFbuttonset=function (inobj) { this.valid=false; this.btn1=this.btn2=this.img1=this.img2=null; this.innerspan=this.outerspan=null; if (inobj == null || inobj.DOMobj == null || !inobj.bDsc || inobj.DOMobj.tagName != "INPUT") return; this.outerspan=inobj.DOMobj.parentNode; this.innerspan=inobj.DOMobj.nextSibling; this.btn1=(this.innerspan) ? this.innerspan.firstChild : null; this.img1=(this.btn1) ? this.btn1.firstChild : null; this.valid =(this.innerspan && this.outerspan && this.btn1 && this.img1 && this.innerspan.tagName == "SPAN" && this.outerspan.tagName == "SPAN" && this.btn1.tagName == "BUTTON" && this.img1.tagName == "IMG"); if (this.valid && inobj.bDsc.btnOrg == 2) { this.btn2=this.btn1.nextSibling; this.img2=(this.btn2) ? this.btn2.firstChild : null; this.valid=(this.btn2 && this.img2 && this.btn2.tagName == "BUTTON" && this.img2.tagName == "IMG"); } } HxG_3.prototype.HxCompImpMgr.prototype.addButtonsToInput=function (c, btnOrg, btnBorder, btnColor, btn1label, btn2label, blurIsOn, hinky) { if (!c || !c.DOMobj) return false; if (!c.bDsc) c.bDsc=new this.p.JSFbuttondesc(); c.bDsc.btnOrg=btnOrg; c.bDsc.btnBorder=btnBorder; c.bDsc.btnColor=btnColor; c.bDsc.btn1label=btn1label; c.bDsc.btn2label=""; c.bDsc.btngraphic=(hinky) ? hinky : hX_3.R_IMG_HINKIES; if (c.bDsc.btnOrg > 1) { c.bDsc.btn2label=btn2label; } if (this.p.brw.isIE()) c.bDsc.spandisplay="inline-block"; else c.bDsc.spandisplay="inline"; var parent=c.DOMobj.parentNode; this.p.attachComponentEvent (c.DOMobj, "onkeydown", "n"); var span1=document.createElement("span"); span1.setAttribute ("id", c.DOMobj.id + "_outerspan"); span1.style.position="relative"; span1.style.display=c.bDsc.spandisplay; var newspan=parent.insertBefore(span1, c.DOMobj); newspan.appendChild(c.DOMobj); var span2=document.createElement("span"); span2.style.position="absolute"; span2.style.padding=span2.style.margin="0px"; span2.style.textIndent="0px"; span2.style.display=c.bDsc.spandisplay; newspan2=newspan.appendChild(span2); var btn1=document.createElement("button"); btn1.setAttribute("type", "button"); btn1.setAttribute("title", c.bDsc.btn1label); btn1.style.position="absolute"; btn1.style.visibility="inherit"; btn1.style.padding=btn1.style.margin="0px"; btn1.onclick=btn1.ondblclick=btn1.onmousedown=btn1.onmouseup=btn1.onmouseout=this.dispatchBtnComponent; btn1.onkeydown=btn1.onkeypress=btn1.onkeyup=this.dispatchBtnComponent; if (blurIsOn) btn1.onblur=this.dispatchBtnComponent; var newbtn1=newspan2.appendChild(btn1); var img1=document.createElement("img"); img1.setAttribute("src", c.r.getURL(c.p.R_IMG_SPACER)); img1.setAttribute("width", 0); img1.setAttribute("height", 0); img1.setAttribute("border", 0); img1.style.verticalAlign="baseline"; img1.style.padding=img1.style.margin="0px"; img1.style.visibility="inherit"; img1.setAttribute("alt", c.bDsc.btn1label); newbtn1.appendChild(img1); if (c.bDsc.btnOrg == 2) { var btn2=document.createElement("button"); btn2.setAttribute("type", "button"); btn2.setAttribute("title", c.bDsc.btn2label); btn2.style.position="absolute"; btn2.style.visibility="inherit"; btn2.style.padding=btn2.style.margin="0px"; btn2.onclick=btn2.ondblclick=btn2.onmousedown=btn2.onmouseup=btn2.onmouseout=this.dispatchBtnComponent; btn2.onkeydown=btn2.onkeypress=btn2.onkeyup=this.dispatchBtnComponent; if (blurIsOn) btn2.onblur=this.dispatchBtnComponent; newbtn2=newspan2.appendChild(btn2); var img2=document.createElement("img"); img2.setAttribute("src", c.r.getURL(c.p.R_IMG_SPACER)); img2.setAttribute("width", 0); img2.setAttribute("height", 0); img2.setAttribute("border", 0); img2.style.padding=img2.style.margin="0px"; img2.style.visibility="inherit"; img2.style.verticalAlign="baseline"; img2.setAttribute("alt", c.bDsc.btn2label); newbtn2.appendChild(img2); } return true; } HxG_3.prototype.HxCompImpMgr.prototype.sizeButtonsToInput=function (obj) { var c=this.p.getComponentById(obj); if (c && !c.bSet) c.bSet=new this.p.JSFbuttonset(c); if (!c || !c.bSet || !c.bSet.valid) return false; var bDisabled=c.DOMobj.disabled; var bReadOnly=c.DOMobj.readOnly; var bHideFocus=(c.DOMobj.hideFocus) ? c.DOMobj.hideFocus : false; var bNoSelect=(c.DOMobj.unselectable) ? c.DOMobj.unselectable : false; var bDisplay=this.p.geo.getEffectiveStyle(c.DOMobj, "display") != "none"; var bVisible=this.p.geo.getEffectiveStyle(c.DOMobj, "visibility"); var elemHeight=c.DOMobj.offsetHeight; var elemWidth=c.DOMobj.offsetWidth; if (elemHeight==0 || elemWidth==0) return true; if (!bDisplay) { c.bSet.btn1.style.display="none"; if (c.bSet.btn2) c.bSet.btn2.style.display="none"; c.bSet.innerspan.style.display="none"; c.bSet.outerspan.style.display="none"; return true; } c.bSet.innerspan.style.display=c.bSet.outerspan.style.display=(bDisplay) ? c.bDsc.spandisplay : "none"; c.bSet.innerspan.style.visibility=bVisible; c.bSet.outerspan.disabled=bDisabled; if (c.bSet.outerspan.hideFocus) c.bSet.outerspan.HideFocus=bHideFocus; if (c.bSet.outerspan.unselectable) c.bSet.outerspan.unselectable=bNoSelect; var iPos=this.p.geo.getEffectiveStyle(c.DOMobj, "position"); var noPos=(this.p.brw.isIE() && iPos=="static"); iPos=(iPos != "absolute") ? "relative" : iPos; elemHeight=c.DOMobj.offsetHeight; elemWidth=c.DOMobj.offsetWidth; if (!c.bDsc.HTMLcopied) { this.copyStyle (c.DOMobj, c.bSet.outerspan, "z-index", "margin-left", "margin-right"); if (noPos) c.bSet.outerspan.style.position.left=c.bSet.outerspan.style.position.right=c.bSet.outerspan.style.position.top=c.bSet.outerspan.style.position.bottom=""; else this.copyStyle (c.DOMobj, c.bSet.outerspan, "left", "right", "top", "bottom"); c.bSet.outerspan.style.position=iPos; } else { this.copyStyleZ (c, c.DOMobj, c.bSet.outerspan, "z-index", "margin-left", "margin-right"); this.copyStyleZ (c, c.DOMobj, c.bSet.outerspan, "left", "right", "top", "bottom"); if (iPos != c.bDsc.saveprops["position"]) c.bSet.outerspan.style.position=iPos; } this.setStyleProperty(c.DOMobj, "position", "relative"); this.setStyleProperty(c.DOMobj, "margin-left", "0px"); this.setStyleProperty(c.DOMobj, "margin-right", "0px"); this.setStyleProperty(c.DOMobj, "left", ""); this.setStyleProperty(c.DOMobj, "right", ""); this.setStyleProperty(c.DOMobj, "top", ""); this.setStyleProperty(c.DOMobj, "bottom",""); c.bDsc.saveprops["position"]=c.DOMobj.style.position; c.bDsc.saveprops["marginLeft"]=c.bDsc.saveprops["marginRight"]="0px"; c.bDsc.saveprops["z-index"]=c.bDsc.saveprops["left"]=c.bDsc.saveprops["top"]=c.bDsc.saveprops["bottom"]=c.bDsc.saveprops["right"]=""; this.copyStyle (c.DOMobj, c.bSet.innerspan, "direction"); if (this.p.brw.isIE()) this.copyStyle (c.DOMobj, c.bSet.innerspan, "margin-top", "margin-bottom"); if (c.bDsc.btnBorder < 0) { c.bSet.innerspan.style.backgroundColor=c.bDsc.btnColor; if (this.p.brw.isIE()) { this.copyStyle (c.DOMobj, c.bSet.innerspan, "border-left-width", "border-left-style", "border-right-width", "border-right-style", "border-top-width", "border-top-style", "border-bottom-width", "border-bottom-style"); c.bSet.innerspan.style.borderLeftWidth="0px"; } } else { c.bSet.innerspan.style.backgroundColor="transparent"; c.bSet.innerspan.style.borderWidth="0px"; } var btnBorderColor=this.p.geo.getEffectiveStyle (c.DOMobj, "border-color"); if (btnBorderColor.indexOf(" ") < 0 && btnBorderColor==(this.p.geo.getEffectiveStyle (c.DOMobj, "color"))) { c.bSet.innerspan.style.borderColor=""; btnBorderColor=""; } else { this.copyStyle (c.DOMobj, c.bSet.innerspan, "border-color"); c.bSet.innerspan.style.borderRightColor=this.p.geo.getEffectiveStyle(c.DOMobj,"border-right-color"); c.bSet.innerspan.style.borderLeftColor=this.p.geo.getEffectiveStyle(c.DOMobj,"border-left-color"); c.bSet.innerspan.style.borderTopColor=this.p.geo.getEffectiveStyle(c.DOMobj,"border-top-color"); c.bSet.innerspan.style.borderBottomColor= this.p.geo.getEffectiveStyle(c.DOMobj,"border-bottom-color"); btnBorderColor=this.p.geo.getEffectiveStyle (c.DOMobj, "border-right-color"); } var borderL=this.p.geo.parseBorder(c.DOMobj, "left", 2); var borderR=this.p.geo.parseBorder(c.DOMobj, "right", 2); var borderT=this.p.geo.parseBorder(c.DOMobj, "top", 2); var borderB=this.p.geo.parseBorder(c.DOMobj, "bottom", 2); var btnBorderWidth; var xpflag=false; if (this.p.geo.testXPBorder(c.DOMobj) && c.bDsc.btnBorder < 0) { xpflag=true; btnBorderWidth=1; c.bDsc.btnBorderStyle="solid"; btnBorderColor="highlight"; } else { btnBorderWidth=(borderR > 3) ? 3 : borderR; btnBorderWidth=(c.bDsc.btnBorder >= 0) ? c.bDsc.btnBorder : btnBorderWidth; c.bDsc.btnBorderStyle=this.p.geo.getEffectiveStyle(c.DOMobj, "border-right-style"); } c.bDsc.btnBorderStyle=(c.bDsc.btnBorderStyle == "solid") ? c.bDsc.btnBorderStyle : ""; intBtnBorderWidth=(c.bDsc.btnBorder < 0 && c.bDsc.btnBorderStyle == "solid" && btnBorderWidth > 1) ? 1 : btnBorderWidth; var taborder=(c.DOMobj.tabIndex) ? c.DOMobj.tabIndex : 0; taborder=(this.p.brw.isIE()) ? taborder : ((taborder < 0) ? 0 : taborder); c.bDsc.backcolor=c.bSet.btn1.style.backgroundColor=(btnBorderWidth > 0) ? c.bDsc.btnColor : "transparent"; c.bSet.btn1.style.borderStyle=c.bDsc.btnBorderStyle; c.bSet.btn1.style.borderColor=btnBorderColor; c.bSet.btn1.style.borderWidth=intBtnBorderWidth + "px"; c.bSet.btn1.disabled=bDisabled || bReadOnly; c.bSet.btn1.hideFocus=(btnBorderWidth > 0) ? true : bHideFocus; c.bSet.btn1.style.display="inline"; c.bSet.btn1.tabIndex=taborder; var interiorLine=1; var bSpecialCase=(c.bDsc.btnBorderStyle == "solid"); if (bSpecialCase) { interiorLine=btnBorderWidth; if (xpflag) { c.bSet.innerspan.style.backgroundColor="transparent"; } else { c.bSet.btn1.style.borderColor=c.bDsc.backcolor; c.bSet.innerspan.style.backgroundColor=(c.bDsc.btnBorder < 0) ? btnBorderColor : "transparent"; } } if (c.bSet.btn2) { c.bSet.btn2.tabIndex=c.bSet.btn1.tabIndex; c.bSet.btn2.style.backgroundColor=c.bSet.btn1.style.backgroundColor; c.bSet.btn2.style.borderColor=c.bSet.btn1.style.borderColor; c.bSet.btn2.style.borderStyle=c.bSet.btn1.style.borderStyle; c.bSet.btn2.style.borderWidth=c.bSet.btn1.style.borderWidth; c.bSet.btn2.disabled=c.bSet.btn1.disabled; c.bSet.btn2.hideFocus=c.bSet.btn1.hideFocus; c.bSet.btn2.style.display=c.bSet.btn1.style.display; } var fullheight=elemHeight; if (c.bDsc.btnBorder < 0) fullheight -= (borderT + borderB); fullheight=(fullheight < 0) ? 0 : fullheight; var halfheight=Math.floor(fullheight/2); halfheight=(interiorLine > 1) ? (halfheight - (interiorLine-1)) : halfheight; var btnHeight=(c.bSet.btn2) ? halfheight : fullheight; btnWidth=(c.bSet.btn2) ? ((btnHeight*2)-2) : ((btnHeight*2)-2); btnWidth=(btnWidth < 10) ? 10 : ((btnWidth > 18) ? 18: btnWidth); c.bSet.btn1.style.top="0px"; c.bSet.btn1.style.left=interiorLine + "px"; c.bSet.btn1.style.width=(btnWidth - (interiorLine-1)) + "px"; c.bSet.btn1.style.height= btnHeight + "px"; if (c.bSet.btn2) { c.bSet.btn2.style.top=(fullheight - halfheight) + "px"; c.bSet.btn2.style.left=c.bSet.btn1.style.left; c.bSet.btn2.style.width=c.bSet.btn1.style.width; c.bSet.btn2.style.height= c.bSet.btn1.style.height; if (bSpecialCase && (fullheight != ((halfheight*2)+interiorLine))) { var yOffset=(interiorLine==1) ? -1 : 1; c.bSet.btn2.style.height= (parseInt(c.bSet.btn2.style.height,10) + yOffset) + "px"; c.bSet.btn2.style.top=(parseInt(c.bSet.btn2.style.top, 10) - yOffset) + "px"; } } var imgHeight=btnHeight-(intBtnBorderWidth*2); imgHeight=(imgHeight > 3) ? imgHeight-2 : 1; if (c.bDsc.btngraphic == hX_3.R_IMG_HINKIES) { imgHeight=Math.min(4, imgHeight); imgWidth=imgHeight*2; } else { imgHeight=Math.min(12, imgHeight); imgWidth=(imgHeight >= 6) ? imgHeight : imgHeight*2; } if (imgHeight > 1) { c.bSet.img1.style.backgroundImage=c.r.getURI (c.bDsc.btngraphic); c.bSet.img1.style.backgroundPosition = c.r.wellPosition(c.bDsc.btngraphic, imgHeight-2, (bDisabled || bReadOnly) ? 1:0, (c.bSet.btn2) ? 1 : 0); } else { c.bSet.img1.style.backgroundImage=c.r.getURI (this.p.R_IMG_SPACER); } c.bSet.img1.style.backgroundRepeat="no-repeat"; c.bSet.img1.style.height= imgHeight + "px"; c.bSet.img1.style.width=imgWidth + "px"; if (this.p.brw.isNavOrMoz()) { if (btnBorderWidth > 1) c.bSet.img1.style.marginBottom="1px"; if (btnBorderWidth >= 1 && c.bDsc.btngraphic != hX_3.R_IMG_HINKIES) c.bSet.img1.style.marginLeft=-btnBorderWidth + "px"; } if (c.bSet.btn2) { c.bSet.img2.style.height= c.bSet.img1.style.height; c.bSet.img2.style.width=c.bSet.img1.style.width; c.bSet.img2.style.backgroundImage=c.bSet.img1.style.backgroundImage; c.bSet.img2.style.backgroundPosition = c.r.wellPosition(c.bDsc.btngraphic, imgHeight-2, (bDisabled || bReadOnly) ? 1:0, 0); c.bSet.img2.style.backgroundRepeat=c.bSet.img1.style.backgroundRepeat; if (this.p.brw.isNavOrMoz()) c.bSet.img2.style.marginBottom=c.bSet.img1.style.marginBottom; } btnWidth=(this.p.brw.isW3Cstd()) ? btnWidth : (c.bSet.btn1.offsetWidth+(interiorLine-1)); btnWidth=(btnWidth < 0) ? 10 : btnWidth; borderR=(c.bDsc.btnBorder < 0) ? borderR : 0; var W3CadjustH=0, elemWidth2=elemWidth; if (this.p.brw.isW3Cstd()) { elemHeight -= (borderT + borderB); W3CadjustH=borderR; if (this.p.brw.isIE()) { var pL=parseInt(this.p.geo.getEffectiveStyle(c.DOMobj, "padding-left"), 10); elemWidth2 -= (borderR + borderL + pL + ((c.bDsc.btnBorder < 0) ? ((xpflag) ? 5 : 1) : 3)); } } var inputwidth, pctwidth; if (this.p.brw.isIE()) { inputwidth=this.p.geo.getEffectiveStyle(c.DOMobj, "width"); pctwidth=(inputwidth.indexOf("%")) >= 0; } else { pctwidth=(c.DOMobj.style.width.indexOf("%") >= 0); if (pctwidth) inputwidth=c.DOMobj.style.width; } var bWidthHasChanged=(c.bDsc.HTMLcopied) ? false: true; if (c.bDsc.HTMLCopied) { if (c.kind == "resizable") bWidthHasChanged=(this.p.brw.isIE()) ? false : true; else bWidthHasChanged=(inputwidth != c.bDsc.saveprops["width"]); } if (bWidthHasChanged) { if (this.p.brw.isIE()) { c.bSet.outerspan.style.width=inputwidth; c.bDsc.saveprops["width"]=(elemWidth2 - (btnWidth + 1)) + "px"; this.setStyleProperty(c.DOMobj, "width", c.bDsc.saveprops["width"]); this.setStyleProperty(c.DOMobj, "padding-right", "1px"); } else { var newWidth, pOffset=(btnBorderWidth > 1) ? 0 : 1; if (c.bDsc.btnBorder < 0) { this.setStyleProperty(c.DOMobj, "padding-right", (btnWidth + pOffset) + "px"); this.setStyleProperty(c.DOMobj, "padding-right", (btnWidth + pOffset) + "px"); newWidth=elemWidth2 + "px"; } else { newWidth=(elemWidth2 - (btnWidth + 1)) + "px"; } if (pctwidth) { c.bSet.outerspan.style.width=inputwidth; } else { c.bDsc.saveprops["width"]=newWidth; this.setStyleProperty(c.DOMobj, "width", newWidth); } } } c.bSet.innerspan.style.width=(btnWidth + borderR + 1 - W3CadjustH) + "px"; c.bSet.innerspan.style.height=elemHeight + "px"; c.bDsc.btnOffset=btnWidth + borderR; var nowElemWidth=c.DOMobj.offsetWidth; if (c.bDsc.btnBorder >= 0 || this.p.brw.isIE()) { if (this.p.brw.isW3Cstd()) c.bDsc.btnOffset=c.bDsc.btnOffset + borderR; if (this.p.brw.isNavOrMoz()) { c.bSet.innerspan.style.top=-(1+borderT) + "px"; c.bDsc.saveprops["marginRight"]=(btnWidth) + "px"; this.setStyleProperty(c.DOMobj, "margin-right", c.bDsc.saveprops["marginRight"]); } else c.bSet.innerspan.style.top="1px"; c.bSet.innerspan.style.left=(nowElemWidth - borderR) + "px"; } else { c.bDsc.btnOffset++; c.bSet.innerspan.style.top="-1px"; c.bSet.innerspan.style.left=(nowElemWidth - c.bDsc.btnOffset) + "px"; var elemtop=parseInt(this.p.geo.getElementAbsPosTop(c.DOMobj), 10); var spantop=parseInt(this.p.geo.getElementAbsPosTop(c.bSet.innerspan), 10); if ((elemtop+borderT) != spantop) { c.bSet.innerspan.style.top=parseInt(c.bSet.innerspan.style.top, 10) + ((elemtop+borderT)-spantop) + "px"; } } if (bWidthHasChanged) { if (pctwidth) { c.kind="resizable"; c.bDsc.elemOffset=elemWidth - parseInt(c.DOMobj.style.width, 10); this.p.imp.attachResizeMonitor(c.bSet.outerspan, this.p.imp.dispatchButtonMonitorResize); if (this.p.brw.isIE()) this.p.imp.fireEvent(c.bSet.outerspan.id, "onresize"); } else { c.kind=""; if (this.p.brw.isIE()) { c.bSet.outerspan.onresize=null; c.bSet.outerspan.style.width=elemWidth; } } } if (!c.bDsc.HTMLcopied) this.p.imp.attachMonitor(c.DOMobj, this.dispatchMonitorBtn, "className", "class", "disabled", "readonly"); c.bDsc.HTMLcopied=true; return true; } HxG_3.prototype.HxCompImpMgr.prototype.depressButton=function (obj, btn, downstate) { var c=this.p.getComponentById(obj); if (c && !c.bSet) c.bSet=new this.p.JSFbuttonset(c); if (!c || !c.bSet || !c.bSet.valid) return false; var style=this.depressButtonStyle(c.bDsc.btnBorderStyle); var thisbtn=(btn == "btn1") ? c.bSet.btn1.style : c.bSet.btn2.style; if (downstate == true) { thisbtn.borderStyle=style; thisbtn.backgroundColor="threedshadow"; } else { thisbtn.borderStyle=(c.bDsc.btnBorderStyle == "") ? "outset" : c.bDsc.btnBorderStyle; thisbtn.backgroundColor=c.bDsc.backcolor; } return true; } HxG_3.prototype.HxDragMgr=function (thisparent) { this.p=thisparent; this.dragObj=this.owningObj=null; this.topX=this.topY=this.Width=this.Height=0; this.clickstyle=this.dragging=this.dragswap=this.buttonup=this.buttondown=this.keydown=false; this.releaseNow=true; this.timerid=0; } HxG_3.prototype.HxDragMgr.prototype.dragInit=function (dragObject, owningObject, releaseNow, clickstyle, noskipinitial) { if (dragObject) { this.clickstyle=(clickstyle) ? true : false; this.dragObj=dragObject; this.owningObj=owningObject; this.releaseNow=releaseNow; this.dragging=this.dragswap=false; if (noskipinitial) { this.buttonup=this.buttondown=this.keydown=false; } else { this.buttonup=this.buttondown=this.keydown=true; } this.topY=this.p.geo.getElementAbsPosTop(this.dragObj); this.topX=this.p.geo.getElementAbsPosLeft(this.dragObj); this.Height=this.p.geo.getElementRenderedHeight(this.dragObj); this.Width=this.p.geo.getElementRenderedWidth(this.dragObj); this.p.swapDragEvent(true); this.dragswap=true; return true; } return false; } HxG_3.prototype.HxDragMgr.prototype.resetSize=function() { if (this.dragswap) { this.Height=this.p.geo.getElementRenderedHeight(this.dragObj); this.Width=this.p.geo.getElementRenderedWidth(this.dragObj); } } HxG_3.prototype.HxDragMgr.prototype.moveDrag=function (evtX, evtY) { if (this.dragging && this.owningObj != null && this.owningObj.dragMove) this.owningObj.dragMove(evtX, evtY); } HxG_3.prototype.HxDragMgr.prototype.killDrag=function () { if (this.timerid != 0) this.p.imp.killTimerTimed (this.timerid); if (this.dragswap) this.p.swapDragEvent(false); if (this.dragging && this.owningObj != null && this.owningObj.dragEnd) this.owningObj.dragEnd(); this.dragObj=this.owningObj=null; this.dragging=this.dragswap=false; this.timerid=0; } HxG_3.prototype.HxDragMgr.prototype.dispatchDragAction=function(evt) { evt=(evt) ? evt : ((event) ? event: null); if (evt) { var src=(evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : (hX_3.brw.isIE() ? document.body : null)); if (src) { src=(src.nodeType == hX_3.ELEMENT_NODE || src.nodeType == hX_3.DOCUMENT_NODE) ? src : src.parentNode; var isInPopup=false, thisX=-1, thisY=-1, cX, cY; if (hX_3.brw.isIE()) { var sBase=(hX_3.brw.isIE6_CSS()) ? document.body.parentNode : document.body; cX=evt.clientX + sBase.scrollLeft; cY=evt.clientY + sBase.scrollTop; } else { cX=evt.pageX; cY=evt.pageY; } if (cX >= hX_3.dragger.topX && cY >= hX_3.dragger.topY) { thisX=cX - hX_3.dragger.topX; thisY=cY - hX_3.dragger.topY; if (thisX <= hX_3.dragger.Width && thisY <= hX_3.dragger.Height) isInPopup=true; } if (hX_3.dragger.clickstyle) { if ((evt.type == "mousedown" || evt.type =="keydown") && hX_3.dragger.timerid != 0) { hX_3.imp.killTimerTimed (hX_3.dragger.timerid); hX_3.dragger.timerid=0; } if (evt.type == "keydown" || evt.type == "keyup") { if (hX_3.dragger.owningObj && hX_3.dragger.owningObj.dispatchDragAction) hX_3.dragger.owningObj.dispatchDragAction(evt); } else if (evt.type == "mousedown" || evt.type == "mouseup" || evt.type == "mousemove") { if (isInPopup) { if (hX_3.dragger.owningObj != null && hX_3.dragger.owningObj.dispatchDragAction) hX_3.dragger.owningObj.dispatchDragAction(evt); } else { if (evt.type == "mousedown" || evt.type == "mouseup") { if (evt.type == "mousedown" && hX_3.dragger.buttondown) { hX_3.dragger.buttondown=hX_3.dragger.keydown=false; } else if (evt.type == "mouseup" && hX_3.dragger.buttonup) { hX_3.dragger.buttonup=hX_3.dragger.keydown=false; } else { hX_3.uirelease(); } } } } } else { if (evt.type == "mousedown") { if ((evt.type == "mousedown" || evt.type =="keydown") && hX_3.dragger.timerid != 0) { hX_3.imp.killTimerTimed (hX_3.dragger.timerid); hX_3.dragger.timerid=0; } if (hX_3.dragger.dragging) { } else { if (isInPopup) { hX_3.dragger.dragging=true; if (hX_3.dragger.owningObj != null && hX_3.dragger.owningObj.dragStart) hX_3.dragger.owningObj.dragStart(); hX_3.dragger.moveDrag(thisX, thisY); } else { if (hX_3.dragger.buttondown) { hX_3.dragger.buttondown=hX_3.dragger.keydown=false; } else { hX_3.uirelease(); } } } } else if (evt.type == "mouseup") { if (isInPopup) { hX_3.dragger.moveDrag(thisX, thisY); if (hX_3.dragger.dragging && hX_3.dragger.owningObj != null && hX_3.dragger.owningObj.dragEnd) hX_3.dragger.owningObj.dragEnd(); if (hX_3.dragger.releaseNow) { if (hX_3.dragger.owningObj.dispatchTimer) { hX_3.dragger.dragging=false; hX_3.dragger.timerid=hX_3.imp.startTimerTimed (hX_3.dragger.owningObj.id, "popup", "dragEnd", 750); } else { hX_3.uirelease(); } } else { hX_3.dragger.dragging=false; } } else { if (hX_3.dragger.buttonup) { hX_3.dragger.buttonup=hX_3.dragger.keydown=false; } else { hX_3.uirelease(); } } } else if (evt.type == "mousemove") { if (isInPopup) hX_3.dragger.moveDrag(thisX, thisY); } else if (evt.type == "keydown") { if (hX_3.dragger.owningObj && hX_3.dragger.owningObj.dragKey) { hX_3.dragger.owningObj.dragKey(evt.type, evt.keyCode); } } } } } hX_3.imp.cancelAction(evt); if (evt.preventDefault) evt.preventDefault(); return false; } HxG_3.prototype.lookupEvent=function (kind, id, name) { var i, j, l1, l=this.userEvents.length; for (i=0; i < l; i++) { if (this.userEvents[i].id == id) { l1=this.userEvents[i].events.length; for (j=0; j < l1; j++) { if (this.userEvents[i].events[j].etype == kind && this.userEvents[i].events[j].eventname == name) return (this.userEvents[i].events[j]); } return null; } } return null; } HxG_3.prototype.addNewEvent=function (id, obj, eventname, kind, handler1, args) { var i, userObj, eObj=null, l=this.userEvents.length; for (var i=0; i < l && eObj == null; i++) { if (this.userEvents[i].id == id) eObj=this.userEvents[i]; } if (eObj == null) { eObj=new hX_3.JSFEventObject(id); this.userEvents.push(eObj); } userObj=new hX_3.JSFEvent(obj, eventname, kind, handler1, args); eObj.events.push(userObj); return userObj; } HxG_3.prototype.JSFEventObject=function (id, obj, eventname, etype, handler1, args) { this.id=id; this.events=new Array(); } HxG_3.prototype.JSFEvent=function (obj, eventname, etype, handler1, args) { if (obj && eventname) { this.eventCounter=0; this.eventname=eventname; this.preUser= new Array(); this.User=null; this.postUser= new Array(); this.etype=etype; this.obj=obj; this.args=args; this.handler1= handler1; this.id=null; if (etype == "R") { var f; if ((hX_3._BODY == hX_3.imp.dispatchToID(obj))) { f=document.body.getAttribute(eventname); this.id=hX_3._BODY; } else { f=obj.getAttribute(eventname); this.id=obj.id; } if (f != null) this.User=(hX_3.isFunction(f)) ? f : new Function("event", f); } else { this.id=obj; } } } HxG_3.prototype.JSFEventEntry=function (id, handler) { this.id=id; if (hX_3.isFunction(handler)) this.handler=handler; else if (hX_3.isString(handler)) this.handler=new Function("event", "return " + handler + ";"); else this.handler=hX_3.JSFNoOp; } HxG_3.prototype.JSFNoOp=function (event) { return; } HxG_3.prototype.JSFEvent.prototype.addPost=function (pos, handler) { this.eventCounter++; var entry=new hX_3.JSFEventEntry(this.eventCounter, handler); if (pos == "f" || pos == "first") this.postUser.unshift (entry); else this.postUser.push (entry); return (this.eventCounter); } HxG_3.prototype.JSFEvent.prototype.addPre=function(pos, handler) { this.eventCounter++; var entry=new hX_3.JSFEventEntry(this.eventCounter, handler); if (pos == "f" || pos == "first") this.preUser.unshift (entry); else this.preUser.push (entry); return (this.eventCounter); } HxG_3.prototype.JSFEvent.prototype.remove=function (id) { if (id <= 0) { var i, l=this.postUser.length; for (i=0; i < l; i++) this.postUser[i]=null; l=this.preUser.length; for (i=0; i < l; i++) this.preUser[i]=null; } else { var i, removed=false, l=this.postUser.length; for (i=0; ((i < l) && (!removed)); i++) { if ((this.postUser[i]).id == id) { this.postUser[i]=null; removed=true; } } l=this.preUser.length; for (i=0; ((i < l) && (!removed)); i++) { if ((this.preUser[i]).id == id) { this.preUser[i]=null; removed=true; } } } } HxG_3.prototype.mouseEvents=null; HxG_3.prototype.swapDragEvent=function (addevent) { if (hX_3.mouseEvents==null) hX_3.mouseEvents=(this.brw.isIE()) ? (new Array ("onmousedown", "onmouseup", "onmousemove", "onkeydown", "onkeyup")) : (new Array ("mousedown", "mouseup", "mousemove", "keydown", "keyup")); var userObj, j, l=hX_3.mouseEvents.length, dd="#docdrag", ss="S"; for (j=0; j < l; j++) { userObj=hX_3.lookupEvent (ss, dd, hX_3.mouseEvents[j]); if (!addevent) { if (userObj) { if (this.brw.isIE()) { document.body.setAttribute(hX_3.mouseEvents[j], userObj.User); } else { var ff=hX_3._ON + hX_3.mouseEvents[j]; document.body.removeEventListener(hX_3.mouseEvents[j], this.dragger.dispatchDragAction, true); document.body.setAttribute(ff, userObj.User); } } } else { if (userObj == null) userObj=hX_3.addNewEvent (dd, dd, hX_3.mouseEvents[j], ss); if (this.brw.isIE()) { userObj.User=document.body.getAttribute(hX_3.mouseEvents[j]); document.body.setAttribute(hX_3.mouseEvents[j], this.dragger.dispatchDragAction); } else { var ff=hX_3._ON + hX_3.mouseEvents[j]; userObj.User=document.body.getAttribute(ff); document.body.addEventListener(hX_3.mouseEvents[j], this.dragger.dispatchDragAction, true); } } } if (this.brw.isIE()) { if (addevent) document.body.setCapture(); else document.body.releaseCapture(); } return true; } HxG_3.prototype.runEvent1=function (evt) { hX_3.runEvent(this, evt); } HxG_3.prototype.runEvent=function (ethis, evt) { evt=(evt) ? evt : ((event) ? event: null); ethis=(!ethis) ? this : ethis; ethis=(ethis == window || ethis == document.window) ? window.document.body : ethis; if (ethis && evt) { var evtname=(evt.type=="DOMAttrModified") ? "onpropertychange" : (hX_3._ON + evt.type); var srcid=(ethis == document || ethis == document.body) ? hX_3._BODY : ethis.id; var userObj=hX_3.lookupEvent ("R", srcid, evtname); if (userObj != null) return ((hX_3.brw.isIE()) ? (userObj.run(ethis)) : (userObj.run(ethis, evt))); } return; } HxG_3.prototype.JSFEvent.prototype.run=function (ethis, evt) { var i, result=true; evt=(evt) ? evt : ((event) ? event: null); for (i=0; result && i < this.preUser.length; i++) { if (this.preUser[i] != null) { result=(hX_3.brw.isIE()) ? ((this.preUser[i]).handler.call(ethis)) : ((this.preUser[i]).handler.call(ethis, evt)); result=(result == false) ? false: true; if (evt.returnValue!=undefined && evt.returnValue == false) result=false; else if (evt.getPreventDefault && evt.type != "DOMAttrModified" && evt.getPreventDefault()) result=false; } } if (result && this.User != null) { result=(hX_3.brw.isIE()) ? (this.User.call(ethis)) : (this.User.call(ethis, evt)); result=(result == false) ? false: true; if (evt.returnValue!=undefined && evt.returnValue == false) result=false; else if (evt.getPreventDefault && evt.type != "DOMAttrModified" && evt.getPreventDefault()) result=false; } for (i=0; result && i < this.postUser.length; i++) { if (this.postUser[i] != null) { result=(hX_3.brw.isIE()) ? ((this.postUser[i]).handler.call(ethis)) : ((this.postUser[i]).handler.call(ethis, evt)); result=(result == false) ? false: true; if (evt.returnValue!=undefined && evt.returnValue == false) result=false; else if (evt.getPreventDefault && evt.type != "DOMAttrModified" && evt.getPreventDefault()) result=false; } } return result; } HxG_3.prototype.HxCompImpMgr.prototype.setStyleProperty=function (obj, property, newvalue) { var oldvalue=this.p.geo.getEffectiveStyle(obj, property); if (oldvalue != newvalue) { if (obj.currentStyle) { var propname=this.p.geo.CSStagToDOMtag(property); obj.style.setAttribute(propname, newvalue); } else { obj.style.setProperty(property, newvalue, ""); } } } HxG_3.prototype.HxCompImpMgr.prototype.depressButtonStyle=function(instyle) { var r=""; if (instyle == "outset" || instyle == "") r="inset"; else if (instyle == "inset") r="outset"; else if (instyle == "groove") r="ridge"; else if (instyle == "ridge") r="groove"; return r; } HxG_3.prototype.HxCompImpMgr.prototype.copyStyle=function (src, dst, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { var s, name; for (var x=2; x < arguments.length; x++) { s=this.p.geo.getEffectiveStyle(src, arguments[x]); if (src.currentStyle) { name=this.p.geo.CSStagToDOMtag(arguments[x]); dst.style.setAttribute(name, s); } else { dst.style.setProperty(arguments[x], s, ""); } } } HxG_3.prototype.HxCompImpMgr.prototype.copyStyleZ=function (component, src, dst, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { var s, name; for (var x=3; x < arguments.length; x++) { s=this.p.geo.getEffectiveStyle(src, arguments[x]); name=this.p.geo.CSStagToDOMtag(arguments[x]); if (component.bDsc.saveprops[name]) { s=(s) ? s : component.bDsc.saveprops[name]; if (src.currentStyle) dst.style.setAttribute(name, s); else dst.style.setProperty(arguments[x], s, ""); } else { if (src.currentStyle) dst.style.setAttribute(name, s); else dst.style.setProperty(arguments[x], s, ""); } } } HxG_3.prototype.HxConstraints=function () { this.regexp=new Array(); this.ELexp=new Array(); this.regexpstr=new Array(); this.ELexpstr=new Array(); this.staticConstraint("AlphabetExOnly","^[A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+$"); this.staticConstraint("AlphabetOnly", "^[A-Za-z]+$"); this.staticConstraint("DigitOnly", "^[0-9]+$"); this.staticConstraint("AlnumExOnly", "^[A-Za-z0-9\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+$"); this.staticConstraint("AlnumOnly", "^[A-Za-z0-9]+$"); this.staticConstraint("UpperCaseOnly", "^[A-Z]+$"); this.staticConstraint("LowerCaseOnly", "^[a-z]+$"); } HxG_3.prototype.HxConstraints.prototype.getRegExpByName=function (name) { return this.regexp[name]; } HxG_3.prototype.HxConstraints.prototype.testRegExp=function (test, exp) { return ((test.length==0) ? true : (!(test.match(exp) == null))); } HxG_3.prototype.HxConstraints.prototype.staticConstraint=function (name, x) { try { this.regexp[name]= new RegExp(x); this.regexp[name].compile(x); } catch (e) { window.status=hX_3.INTERR_Constraint; } } HxG_3.prototype.HxConstraints.prototype.registerConstraint=function (x) { var name, i, hxc="hxConstraint"; for (i=0; i < this.regexpstr.length; i++) { if (this.regexpstr[i] == x) { name=hxc + i; return this.regexp[name]; } } name=hxc + this.regexpstr.length; this.regexpstr.push(x); try { this.regexp[name]= new RegExp(x); this.regexp[name].compile(x); return this.regexp[name]; } catch (e) { window.status=hX_3.INTERR_Constraint; } return null; } HxG_3.prototype.HxConstraints.prototype.registerELConstraint=function (x, type) { var name, i, hxe="hxExpression"; for (i=0; i < this.ELexpstr.length; i++) { if (this.ELexpstr[i] == x) { name=hxe + i; return this.ELexp[name]; } } name=hxe + this.ELexpstr.length; this.ELexpstr.push(x); try { var exp=hX_3.replaceAll(x, "@testValue", "testValue"); if (type=="date") { exp=hX_3.replaceAll(exp, "testValue.date", "testValue.getDate()"); exp=hX_3.replaceAll(exp, "testValue.day", "testValue.getDay()"); exp=hX_3.replaceAll(exp, "testValue.hours", "testValue.getHours()"); exp=hX_3.replaceAll(exp, "testValue.minutes", "testValue.getMinutes()"); exp=hX_3.replaceAll(exp, "testValue.month", "testValue.getMonth()"); exp=hX_3.replaceAll(exp, "testValue.seconds", "testValue.getSeconds()"); exp=hX_3.replaceAll(exp, "testValue.timezoneOffset", "testValue.getTimezoneOffset()"); exp=hX_3.replaceAll(exp, "testValue.time", "testValue.getTime()"); exp=hX_3.replaceAll(exp, "testValue.year", "(testValue.getFullYear()-1900)"); } exp=" return (" + exp + "); "; this.ELexp[name]=new Function("testValue", exp); return this.ELexp[name]; } catch (e) { window.status=hX_3.INTERR_Constraint; } return null; } HxG_3.prototype.HxConstraints.prototype.testELExp=function (test, exp) { return (exp.call(this, test)); } HxG_3.prototype.HxCaretSelection=function () { } HxG_3.prototype.HxCaretSelection.prototype.getSelection=function (obj) { var sel=null; if (obj.selectionEnd) { sel=obj.value.substring(obj.selectionStart,obj.selectionEnd); } else if (document.selection) { var r=document.selection.createRange(); sel=r.text; } return sel; } HxG_3.prototype.HxCaretSelection.prototype.getSelectionR=function (obj) { var s=0, e=0; if (obj.selectionEnd) { s=obj.selectionStart; e=obj.selectionEnd; } else if (document.selection) { s=this.getCaretPos(obj); var l=this.getSelection(obj); e=s+l.length; } s=(s < 0) ? 0 : s; e=(e > obj.value.length) ? obj.value.length : e; return{start: s, end: e}; } HxG_3.prototype.HxCaretSelection.prototype.hasSelection=function (obj) { var sel=hX_3.sel.getSelection(obj); return (sel != null && sel.length > 0); } HxG_3.prototype.HxCaretSelection.prototype.setSelection=function (obj, start, end) { if (obj.createTextRange) { var t=(obj.tagName) ? obj.tagName.toUpperCase() : hX_3._E; var y=(obj.type) ? obj.type.toUpperCase() : hX_3._E; if (t=="BODY" || t=="TEXTAREA" || t=="BUTTON" || (t=="INPUT" && (y=="BUTTON" || y=="HIDDEN" || y=="PASSWORD" || y=="RESET" || y=="SUBMIT" || y=="TEXT"))) { var r=obj.createTextRange(); r.collapse(true); r.moveEnd('character', end); r.moveStart('character', start); r.select(); } } else if (obj.setSelectionRange) { obj.setSelectionRange(start, (end==null)?start:end); } } HxG_3.prototype.HxCaretSelection.prototype.getCaretPos=function (obj, hasFocus) { if (hasFocus != null && !hasFocus) if (obj.focus) obj.focus(); if (obj.selectionStart) { return obj.selectionStart; } else if (document.selection) { var n, r=document.selection.createRange(); r.moveEnd("textedit"); n=obj.value.length - r.text.length; return n; } return 0; } HxG_3.prototype.HxCaretSelection.prototype.setCaretPos=function (obj, pos, pos1, defer) { if (arguments.length > 3 && defer != null && defer) { hX_3.imp.deferSetFocus=obj; hX_3.imp.deferSetSelect=pos; hX_3.imp.deferSetSelect1=(arguments.length > 2 && pos1 != null) ? pos1 : null; setTimeout(hX_3.imp.selSetter, 1); } else { hX_3.sel.setSelection(obj, pos, pos1); } } HxG_3.prototype.HxCompImpMgr.prototype.selSetter=function() { if (hX_3.imp.deferSetSelect1 != null) hX_3.sel.setSelection(hX_3.imp.deferSetFocus, hX_3.imp.deferSetSelect, hX_3.imp.deferSetSelect1); else hX_3.sel.setSelection(hX_3.imp.deferSetFocus, hX_3.imp.deferSetSelect, hX_3.imp.deferSetSelect); } HxG_3.prototype.pseudoClipboard=function () { this.valueAsString=null; this.valueAsNumber=null; } HxG_3.prototype.padL=function (theNumber, toFill, pad) { var s=theNumber.toString(); var i, n=toFill - s.length; for (i=0; i < n; i++) s=((pad) ? pad:hX_3._Z) + s; return s; } HxG_3.prototype.padR=function (theNumber, toFill, pad) { var s=theNumber.toString(); var i, n=toFill - s.length; for (i=0; i < n; i++) s=s + ((pad) ? pad:hX_3._Z); return s; } HxG_3.prototype.truncateRoundHalfEven=function (str, chars) { var ostr=str, oflow=false; if (ostr.length > chars) { var tstr=ostr.substr(chars); ostr=ostr.substr(0, chars); var r=(tstr.length > 2) ? (new Number(tstr.substr(0,3))) : ((tstr.length > 1) ? (new Number(tstr.substr(0,2))*10) : (new Number(tstr.charAt(0))*100)); var r1=new Number (ostr.charAt(ostr.length-1)); if (r > 500 || (r == 500 && ((Math.floor(r1/2)*2) != r1))) { if (r1+1 == 10) { var n=new Number(ostr) +1, nn=new Number(ostr); n=n.toString(); nn=nn.toString(); if (n.length > nn.length && str.charAt(0) != hX_3._Z) { ostr=hX_3._Z; oflow=true; } else { ostr=hX_3.padL(n, chars); } } else { ostr=ostr.substr(0,ostr.length-1) + (r1+1); } } } return {value: ostr, overflow: oflow}; } HxG_3.prototype.replaceAll=function (s, ch1, ch2) { if(ch1==ch2)return s; var o=s; var t=ch1.length; var i=o.indexOf(ch1); while (i >= 0 && o.length > 0) { o=(i==0) ? (ch2 + o.substr(ch1.length)) : (o.substr(0,i) + ch2 + o.substr(i+t)); i=o.indexOf(ch1); } return o; } HxG_3.prototype.allTrim=function (s) { if (null==s || 0==s.length) return s; var o=hX_3.replaceAll(s, " ", " "); if (o.charAt(0) == " ") o=o.substr(1); if (o.charAt(o.length-1) == " ") o=o.substr(0,o.length-1); return o; } HxG_3.prototype.Trim=function (s) { if (null==s || 0==s.length) return s; var o, q=0; while (q < s.length && s.substr(q,1) == " ") q++; o=s.substr(q); q=o.length-1; while (q >= 0 && o.substr(q,1) == " ") q--; return (o.slice(0,q+1)); } HxG_3.prototype.trimL=function (s, iChar) { if (null==s || 0==s.length) return s; var q=0, ch=(iChar == null) ? " ":iChar; while (q < s.length && s.substr(q,1) == ch) q++; return (s.substr(q)); } HxG_3.prototype.isChar=function (c, set) { return (set.indexOf(c) >= 0) ? true : false; } HxG_3.prototype.NLSFormatMsg=function (template, args) { r=""; if (template != null) { r=template; if (args != null) { for (var i=0; i < args.length; i++) r=hX_3.replaceAll (r, "{" + i + "}", args[i]); } } return r; } HxG_3.prototype.findNestedObject=function(obj, childtag) { if(obj == null || obj.childNodes == null || obj.childNodes.length == 0) return null; var i, nested_child, children=obj.childNodes; for(i=0; i < children.length; i++) { if(children[i].nodeName == childtag) return children[i]; } for(i=0; i < children.length; i++) { nested_child=hX_3.findNestedObject(children[i], childtag); if (nested_child != null) { return nested_child; } } return null; } HxG_3.prototype.applyNestedAttribute=function(root, attributeName, attributeValue, force) { var obj=root; if (root.nodeType == hX_3.ELEMENT_NODE) { if ((root.getAttribute(attributeName) != null) || force) if (attributeName == "disabled") root.disabled=attributeValue; else root.setAttribute(attributeName, attributeValue); } for (var child=root.firstChild; child != null; child=child.nextSibling) { this.applyNestedAttribute (child, attributeName, attributeValue, force); } } HxG_3.prototype.gotoNextPrev=function (t, forward) { if (hX_3.tabNav == null) hX_3.tabNav=new hX_3.tabNavigator (); var obj=hX_3.tabNav.getFocus(t, forward); if (obj) hX_3.imp.setFocus(obj, (obj.tagName.toUpperCase()=="INPUT" && obj.type.toUpperCase()=="TEXT"), true); } HxG_3.prototype.tabbableElements=function (a) { a.push(new hX_3.tagListItem("INPUT",null)); a.push(new hX_3.tagListItem("SELECT",null)); a.push(new hX_3.tagListItem("TEXTAREA",null)); a.push(new hX_3.tagListItem("BUTTON",null)); a.push(new hX_3.tagListItem("A",null)); a.push(new hX_3.tagListItem("EMBED",null)); a.push(new hX_3.tagListItem("OBJECT",null)); a.push(new hX_3.tagListItem("APPLET",null)); } HxG_3.prototype.isObject=function(obj) { return (typeof(obj) == "object"); } HxG_3.prototype.isFunction=function(obj) { return (typeof(obj) == "function"); } HxG_3.prototype.isString=function(obj) { return (typeof(obj) == "string"); } HxG_3.prototype.isNumber=function(obj) { return (typeof(obj) == "number"); } HxG_3.prototype.isUnDef=function(objt) { return (objt == "undefined"); } HxG_3.prototype.isDef=function(objt) { return (objt != "undefined"); } HxG_3.prototype.tagListItem=function (tag, type) { this.tag=tag.toUpperCase(); this.type=(type != null) ? type.toUpperCase() : null; } HxG_3.prototype.isTag=function (inobj, tagset) { var i, hit=false, obj=hX_3.getElementById(inobj), typ="type"; if (obj && hX_3.isDef(typeof(obj.nodeType)) && obj.nodeType == hX_3.ELEMENT_NODE) { for (i=0; i < tagset.length && !hit; i++) { if (tagset[i].tag == obj.tagName) { if ((tagset[i].type == null) || (obj.getAttribute(typ).toUpperCase() == tagset[i].type)) hit=true; } } } return hit; } HxG_3.prototype.findFirstTag=function (inroot, tagset) { var obj, root=hX_3.getElementById(inroot); if (hX_3.isTag(root, tagset)) return root; if (root && hX_3.isDef(typeof(root.firstChild))) { for (var child=root.firstChild; child != null; child=child.nextSibling) { obj=this.findFirstTag (child, tagset); if (obj != null) return obj; } } return null; } HxG_3.prototype.getKeyCode=function(ev) { return ((ev.keyCode) ? ev.keyCode : ev.which); } HxG_3.prototype.getChrCode=function(ev) { return (String.fromCharCode ((ev.charCode) ? ev.charCode : ev.keyCode)); } HxG_3.prototype.isFunctionKey=function(keyCode) { return (112 <= keyCode && keyCode << 123); } HxG_3.prototype.evtGetTarget=function (evt) { return ((evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null)); } HxG_3.prototype.getFirstClassName=function (inobj) { var r=null, obj=hX_3.getElementById(inobj); if (obj && obj.className) { r=hX_3.allTrim(obj.className); if (r.indexOf(" ") > 0) r=r.substr(0,r.indexOf(" ")); } return r; } HxG_3.prototype.isClassDefined=function (testname) { var sheets, rulelist, rule, selector, j, k; var name="." + testname; for (i=0; i < document.styleSheets.length; i++) { sheets=document.styleSheets[i]; rulelist=(hX_3.isDef(typeof(sheets.cssRules))) ? sheets.cssRules : ((hX_3.isDef(typeof(sheets.rules))) ? sheets.rules : null); if (rulelist) { for (j=0; j < rulelist.length; j++) { rule=rulelist[j].selectorText; while (rule.length > 0) { k=rule.indexOf(hX_3._C); if (k < 0) { selector=rule; rule=""; } else { selector=rule.substr(0,k); rule=rule.substr(k+1); } selector=hX_3.allTrim(selector); if (selector.indexOf(" ") < 0 && selector == name) { return rulelist[j].style; } } } } } return null; } if (typeof(hX_3) == 'undefined' || !hX_3) { var hX_3=new HxG_3(); } if (typeof(hX) == 'undefined' || !hX) { var hX=hX_3; } HxG_3.prototype.DateTimeConverter=function () { this.type="datetime"; this.nStrict=hX_3.DTFMT_DEFAULTSTRICT; this.sFormat=hX_3.DTFMT_DATE0; this.sFormatTokenized=null; this.nLiteralCnt=0; this.sLiterals=new Array(); this.nTokenCnt=0; this.sTokens=new Array(); this.bHasDate=false; this.bHasTime=false; this.FMTChars="aDdEFGHhKkMmSsWwyz"; this.FMTDateChars="DdEFGMWwy"; this.FMTTimeChars="aHhKkmSsz"; this.SEPChars="-_ .,;:|()<>/\\"; this.bHasEpoch=false; this.bChristianEra=null; this.sEpoch=""; this.nEpoch=null; this.timeZoneSeparator=":"; this.sAM=hX_3.STR_AM_SUFFIX; this.sPM=hX_3.STR_PM_SUFFIX; this.base2DigitSpan=80; this.minMonthName=3; this.DF_MaxLength=null; this.msgFail=""; this.intMsgFail=""; this.maskFormat=null; this.maskFormatDigits=null; this.maskFormatLast=null; this.maskFormatFirst=null; this.simpleFormat=null; this.simpleConverter=null; this.attributeTable=new Array(); this.attributeTable ['strict']=['nStrict', hX_3.ARG_TO_NUM, false, 0, 2]; this.attributeTable ['format']=['sFormat', hX_3.ARG_TO_NAS, false, null, null]; this.attributeTable ['base-2digit-span']=['base2DigitSpan', hX_3.ARG_TO_NUM, false, 0, 99]; this.attributeTable ['epoch']=['sEpoch', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['am']=['sAM', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['pm']=['sPM', hX_3.ARG_TO_NAN, false, null, null]; this.setAttribute(arguments); } HxG_3.prototype.DateTimeConverter.prototype.setAttribute=function(a) { hX_3.parseArg (this.attributeTable, this, a); this.parseFormatString(); this.bHasEpoch=(-1 != this.sFormatTokenized.indexOf("%G")); this.nEpoch=0; for (var i=0; i < hX_3.DATE_EPOCH_IDS.length; i++) { if (hX_3.DATE_EPOCH_IDS[i] == this.sEpoch) { this.nEpoch=i; break; } } this.bChristianEra=(this.nEpoch <= 1); this.minMonthName=3; for (var i=0; i < 12; i++) { if (hX_3.STR_DATE_MONTHS[i].length > this.minMonthName) { for (var j=0; j < 12; j++) { if (i != j && hX_3.STR_DATE_MONTHS[i].length > this.minMonthName) { if (hX_3.STR_DATE_MONTHS[i].substr(0,this.minMonthName) == hX_3.STR_DATE_MONTHS[j].substr(0,this.minMonthName)) { this.minMonthName++; j=0; } } } } } if (this.simpleFormat) this.genAssistMasks(); return true; } HxG_3.prototype.DateTimeConverter.prototype.FormatToken=function (token, typ) { this.type=typ; this.token=token; } HxG_3.prototype.DateTimeConverter.prototype.parseFormatString=function () { var fmt=this.sFormat; this.sFormatTokenized=""; this.nLiteralCnt=0; this.nTokenCnt=0; this.DF_MaxLength=0; var index, i, xchar, nchar; var last=""; var lastlen=0; var q=false, noT=false; var len=fmt.length; for (index=0; index < len; index++) { xchar=fmt.charAt(index); if (!q && hX_3.isChar(xchar, this.FMTChars)) { if (xchar==last) { noT=false; if (lastlen >= 5) noT=true; if (lastlen >= 4 && xchar != "y") noT=true; if (lastlen >= 3 && xchar == "S") noT=true; if (lastlen >= 2 && hX_3.isChar(xchar, "dhHmskK")) noT=true; if (lastlen >= 1 && hX_3.isChar(xchar, "DFwWaz")) noT=true; if (!noT) { this.sFormatTokenized=this.sFormatTokenized + xchar; lastlen++; } } else { this.sFormatTokenized=this.sFormatTokenized + "%" + xchar; lastlen=1; } last=xchar; this.bHasDate=(this.bHasDate) ? this.bHasDate : hX_3.isChar(xchar, this.FMTDateChars); this.bHasTime=(this.bHasTime) ? this.bHasTime : hX_3.isChar(xchar, this.FMTTimeChars); } else { if (xchar == "'") { nchar=fmt.charAt(index+1); if (nchar == "'") { index++; } else if (q) { xchar=""; q=false; } else { xchar=nchar; q=true; index++; } } if (last != "^") { this.sFormatTokenized=this.sFormatTokenized + "^" + this.nLiteralCnt; this.sLiterals[this.nLiteralCnt]=""; this.nLiteralCnt++; } this.sLiterals[this.nLiteralCnt-1]=this.sLiterals[this.nLiteralCnt-1] + xchar; last="^"; } } fmt=this.sFormatTokenized; var token, next, nextp, nextl; while (fmt.length > 0) { xchar=fmt.charAt(0); fmt=fmt.substr(1); nextp=fmt.indexOf("%"); nextl=fmt.indexOf("^"); next=(nextp < 0) ? nextl : ((nextl < 0) ? nextp : Math.min(nextp,nextl)); if (next >= 0) { token=fmt.substr(0,next); fmt=fmt.substr(next); } else { token=fmt; fmt=""; } if (xchar == "%") { this.sTokens[this.nTokenCnt]=new this.FormatToken(token, 0); this.nTokenCnt++; } else { index=parseInt(token, 10); token=this.sLiterals[index]; for (i=1; i < this.SEPChars.length; i++) token=hX_3.replaceAll(token, this.SEPChars.charAt(i), this.SEPChars.charAt(0)); token=hX_3.replaceAll(token, this.SEPChars.charAt(0)+ this.SEPChars.charAt(0), this.SEPChars.charAt(0)); this.sTokens[this.nTokenCnt]=new this.FormatToken(this.sLiterals[index], (token == this.SEPChars.charAt(0)) ? 2 : 1); this.nTokenCnt++; } } var c, l; var ar, al; for (i=0; i < this.nTokenCnt; i++) { if (this.sTokens[i].type == 0) { l=this.sTokens[i].token.length; switch (this.sTokens[i].token.charAt(0)) { case "D": case "S": this.DF_MaxLength+=3; break; case "F": case "W": this.DF_MaxLength+=1; break; case "y": this.DF_MaxLength+=(l==2) ? 2 : 4; break; case "a": this.DF_MaxLength+=Math.max(this.sAM.length, this.sPM.length); break; case "z": this.DF_MaxLength+=10; break; case "E": al=(l > 3) ? hX_3.c.MAX_STR_DATE_DAYS : hX_3.c.MAX_STR_DATE_SHDAYS; if (al == null) { ar=(l > 3) ? hX_3.STR_DATE_DAYS : hX_3.STR_DATE_SHDAYS; for (index=0; index < ar.length; index++) al=Math.max(al, ar[index].length); if (l > 3) hX_3.c.MAX_STR_DATE_DAYS=al; else hX_3.c.MAX_STR_DATE_SHDAYS=al; } this.DF_MaxLength+=al; break; case "M": if (l < 3) this.DF_MaxLength+=2; else { al=(l > 3) ? hX_3.c.MAX_STR_DATE_MONTHS : hX_3.c.MAX_STR_DATE_SHMONTHS; if (al == null) { ar=(l > 3) ? hX_3.STR_DATE_MONTHS : hX_3.STR_DATE_SHMONTHS; for (index=0; index < ar.length; index++) al=Math.max(al, ar[index].length); if (l > 3) hX_3.c.MAX_STR_DATE_MONTHS=al; else hX_3.c.MAX_STR_DATE_SHMONTHS=al; } this.DF_MaxLength+=al; } break; default: this.DF_MaxLength+=2; break; } } else { this.DF_MaxLength+=this.sTokens[i].token.length; } } } HxG_3.prototype.DateTimeConverter.prototype.getAttribute=function (attribute) { return (hX_3.getArg(this.attributeTable, this, attribute)); } HxG_3.prototype.DateTimeConverter.prototype.lastError=function () { return ((this.msgFail && this.msgFail.length > 0) ? this.msgFail : null); } HxG_3.prototype.DateTimeConverter.prototype.stringToValue=function (iDate) { var r=this.stringToValueBase(iDate); return ((r) ? r.value : null); } HxG_3.prototype.DateTimeConverter.prototype.stringToValueBase=function (iDate, tokenStop) { this.intMsgFail=""; this.msgFail=""; var args=new Array; args[0]=iDate; if (iDate == null || !hX_3.isString(iDate)) { this.msgFail=hX_3.ERR_empty; return null; } var sDate=iDate; while (sDate.length > 0 && sDate.charAt(sDate.length-1) == " ") sDate=sDate.substr(0, sDate.length-1); if (sDate.length == 0) return null; var tokArr=this.sTokens; var tokInd=0; var curdate=new Date(); var intMonth=curdate.getMonth() + 1; var intDay=curdate.getDate(); var intJDay=0; var intYear=curdate.getFullYear(); var intCentury=(Math.floor(intYear/100) * 100) - 100; var intHour=12; var intMin=0; var intSec=0; var intMS=0; var ampm=""; var zOffset=null; var bShortYear=false; var bShortHour=false; var bKampm=false; var bJulianDate=false; var bNormalDate=false; var EpochBase=null; var EpochMax=null; if (this.bHasEpoch) { var epoch=hX_3.DATE_EPOCHS[this.nEpoch]; EpochBase=this.constantToValue(epoch[epoch.length-1][0]); EpochBase=(EpochBase) ? (EpochBase.getFullYear() - 1) : null; } var tokenC=(tokenStop != null) ? tokenStop : this.nTokenCnt; var token, pose, i, j, r, n, ch; while (this.msgFail.length == 0 && sDate.length > 0 && tokInd < tokenC) { token=tokArr[tokInd].token; if (tokArr[tokInd].type == "x") { } else if (tokArr[tokInd].type >= 1) { if (this.nStrict > 1 || tokArr[tokInd].type == 1) { if (token == sDate.substr(0,token.length)) { sDate=sDate.substr(token.length); } else { this.msgFail=hX_3.ERR_datetime_parse_fail; this.intMsgFail=hX_3.INTERR_Parse_Literal + token; break; } } else { sDate=this.skipSeparators(sDate); } } else { switch (token) { case "d": case "dd": case "h": case "hh": case "H": case "HH": case "k": case "kk": case "K": case "KK": case "m": case "mm": case "s": case "ss": case "F": case "w": case "W": if (this.nStrict <= 1) if (this.skipIfMissing(sDate, true)) break; n=this.matchDigits (sDate, 2, false); if (n.fail) { this.msgFail=hX_3.ERR_datetime_parse_fail; this.intMsgFail=hX_3.INTERR_Parse_TwoDig + token; break; } sDate=n.s; switch (tokArr[tokInd].token) { case "d": case "dd": intDay=n.n; bNormalDate=true; break; case "h": case "hh": intHour=n.n; bShortHour=true; break; case "H": case "HH": intHour=n.n; break; case "k": case "kk": intHour=n.n - 1; break; case "K": case "KK": intHour=n.n + 1; bShortHour=true; bKampm=true; break; case "m": case "mm": intMin=n.n; break; case "s": case "ss": intSec=n.n; break; case "F": case "w": case "W": default: break; } break; case "SSS": case "SS": case "S": case "D": if (this.nStrict <= 1) if (this.skipIfMissing(sDate, true)) break; n=this.matchDigits (sDate, 3, false); if (n.fail) { this.msgFail=hX_3.ERR_datetime_parse_fail; this.intMsgFail=hX_3.INTERR_Parse_TwoDig + token; break; } sDate=n.s; if (token == "D") { bJulianDate=true; intJDay=n.n; } else { intMS=n.n; } break; case "y": case "yy": case "yyy": case "yyyy": case "yyyyy": if (token == "yyyyy") n=this.matchDigits (sDate, 4, true); else n=this.matchDigits (sDate, 4, false); if (n.fail) { this.msgFail=hX_3.ERR_datetime_parse_fail; this.intMsgFail=hX_3.INTERR_Parse_TwoDig + token; break; } sDate=n.s; intYear=n.n; if (n.cnt <= 2) bShortYear=true; break; case "G": case "GG": case "GGG": case "GGGG": if (this.nStrict <= 1) if (this.skipIfMissing(sDate)) break; r=false; var epoch=hX_3.DATE_EPOCHS[this.nEpoch]; for (i=0; i < epoch.length; i++) { if (token.length <= 3) pose=epoch[i][2].toUpperCase(); else pose=epoch[i][1].toUpperCase(); if (sDate.substr(0, pose.length).toUpperCase() == pose) { sDate=sDate.substr(pose.length); if (epoch[i][0] == "-" || epoch[i][0] == "+") { } else { EpochBase=this.constantToValue(epoch[i][0]); EpochBase=(EpochBase) ? (EpochBase.getFullYear() - 1) : null; if (i < (epoch.length - 1)) { EpochMax=this.constantToValue (epoch[i+1][0]); EpochMax=(EpochMax) ? (EpochMax.getFullYear()) : null; } } r=true; break; } } if (!r) this.msgFail=hX_3.ERR_epoch_name; break; case "M": case "MM": case "MMM": case "MMMM": if (token.length <= 2 || this.nStrict <= 1) { n=this.matchDigits (sDate, 2, false); if (n.fail && this.nStrict > 1) { this.msgFail=hX_3.ERR_datetime_parse_fail; this.intMsgFail=hX_3.INTERR_Parse_TwoDig + token; break; } else if (!n.fail) { sDate=n.s; intMonth=n.n; break; } } r=false; for (i=0; i < 12; i++) { if (token.length > 3 || this.nStrict <= 1) pose=hX_3.STR_DATE_MONTHS[i].toUpperCase(); else pose=hX_3.STR_DATE_SHMONTHS[i].toUpperCase(); if (sDate.substr(0, pose.length).toUpperCase() == pose) { sDate=sDate.substr(pose.length); intMonth=i+1; r=true; break; } pose=hX_3.STR_DATE_MONTHS[i].toUpperCase(); if (this.nStrict <= 1 && pose.length > this.minMonthName) { pose=pose.substr(0, this.minMonthName); j=0; ch=sDate.charAt(0); while (j < sDate.length && (!hX_3.isChar (ch, "0123456789")) && !(hX_3.isChar (ch, this.SEPChars))) { j++; ch=sDate.charAt(j); } if (j >= this.minMonthName && sDate.substr(0, pose.length).toUpperCase() == pose) { sDate=sDate.substr(j); intMonth=i+1; r=true; } } } if (!r) this.msgFail=hX_3.ERR_month_name; break; case "E": case "EE": case "EEE": case "EEEE": if (this.nStrict <= 1) { if (this.skipIfMissing(sDate)) break; if (token.length <= 3) sDate=this.skipToSeparator(sDate,(this.nStrict==0)?-1:3); else sDate=this.skipToSeparator(sDate,-1); } else { r=false; for (i=0; i < 7; i++) { if (token.length <= 3) pose=hX_3.STR_DATE_SHDAYS[i].toUpperCase(); else pose=hX_3.STR_DATE_DAYS[i].toUpperCase(); if (sDate.substr(0, pose.length).toUpperCase() == pose) { sDate=sDate.substr(pose.length); r=true; break; } } if (!r) this.msgFail=hX_3.ERR_day_name; } break; case "a": if (this.nStrict <= 1) if (this.skipIfMissing(sDate)) break; if (sDate.length >= 2 && sDate.substr(0,2).toUpperCase() == this.sAM.toUpperCase()) { ampm=this.sAM; sDate=sDate.substr(2); } else if (sDate.length >= 2 && sDate.substr(0,2).toUpperCase() == this.sPM.toUpperCase()) { ampm=this.sPM; sDate=sDate.substr(2); } else { this.msgFail=hX_3.ERR_ampm_name; } break; case "z": if (this.nStrict <= 1) if (this.skipIfMissing(sDate)) break; r=false; for (i=0; i < hX_3.STR_TIMEZONES.length; i++) { pose=hX_3.STR_TIMEZONES[i][1].toUpperCase(); if (sDate.substr(0, pose.length).toUpperCase() == pose) { zOffset=this.readTimeZoneOffset(hX_3.STR_TIMEZONES[i][0]); sDate=sDate.substr(pose.length); r=true; break; } pose=hX_3.STR_TIMEZONES[i][3].toUpperCase(); if (sDate.substr(0, pose.length).toUpperCase() == pose) { zOffset=this.readTimeZoneOffset(hX_3.STR_TIMEZONES[i][2]); sDate=sDate.substr(pose.length); r=true; break; } } if (r && i == 0) { var sign=+1; var bDigit=false; if (sDate.charAt(0) == "+") { sDate=sDate.substr(1); bDigit=true; } else if (sDate.charAt(0) == "-") { sign=-1; sdate=sDate.substr(1); bDigit=true; } n=this.matchDigits (sDate, 2, false); if (n.fail) { if (bDigit) r=false; else zOffset=0; } if (r) { sDate=n.s; if (n.n < 0 || n.n > 13) r=false; else zOffset=sign * (n.n * 60); if (r && sDate.charAt(0) == this.timeZoneSeparator) { sDate=sDate.substr(1); n=this.matchDigits (sDate, 2, false); r=!n.fail; if (r) { sDate=n.s; if (n.n < 0 || n.n > 59) r=false; else zOffset=sign * (Math.abs(zOffset) + n.n); } } } } if (!r) this.msgFail=hX_3.ERR_tzone_name; break; default: break; } } tokInd++; } if (this.msgFail.length == 0 && this.nStrict > 1 && (tokInd != tokenC || sDate.length > 0)) { this.msgFail=hX_3.ERR_datetime_parse_fail; this.intMsgFail=hX_3.INTERR_Parse_end + sDate; } if (this.msgFail.length == 0) { if (bShortYear && !this.bHasEpoch) { intYear+=intCentury; if (intYear <= this.getBaseYear()) intYear+=100; } if (EpochBase && this.bHasEpoch && bShortYear) { intYear+=EpochBase; } if (bJulianDate && !bNormalDate) { intMonth=1; j=0; while (intJDay > Date.HxGetDaysInMonth(j,intYear)) { intJDay=intJDay - Date.HxGetDaysInMonth(j,intYear); intMonth++; j++; } intDay=intJDay; } if (!bJulianDate && !bNormalDate) { intDay=Date.HxGetDaysInMonth(intMonth-1,intYear); if (zOffset) intDay=Math.min(curdate.getDate(),intDay); } if (this.nStrict == 0) { if(intMonth > 12 && intDay > 0 && intDay <= 12) { i=intMonth; intMonth=intDay; intDay=i; } } } if (this.msgFail.length == 0 && this.nStrict > 0 && EpochBase && EpochMax && intYear >= EpochMax) { this.msgFail=hX_3.ERR_epoch_range; } if (this.msgFail.length == 0 && (intMonth < 1 || intMonth > 12)) { this.msgFail=hX_3.ERR_month_range; } if (this.msgFail.length == 0 && (intDay < 1 || intDay > 28)) { var dayCnt=Date.HxGetDaysInMonth(intMonth - 1, intYear); if (intDay < 1 || intDay > dayCnt) { this.msgFail=hX_3.ERR_month_rangelimit; args[1]=hX_3.STR_DATE_MONTHS[intMonth - 1]; args[2]=dayCnt; } } if (this.msgFail.length == 0) { if (!bShortHour) { if (this.nStrict <= 1 && ampm.length > 0) { if (ampm == this.sPM && intHour <= 12) intHour+=12; } if (intHour < 0 || intHour > 23) { this.msgFail=hX_3.ERR_hour_range_long; } } else { if (this.nStrict <= 1) { if (intHour > 12) { ampm=this.sPM; intHour -= 12; } if (ampm.length == 0) ampm=(intHour >= 6 && intHour <= 11) ? this.sAM : this.sPM; } if (intHour < 1 || intHour > 12) this.msgFail=hX_3.ERR_hour_range_short; if (bKampm) { if (ampm == this.sPM && intHour != 0) { intHour+=12; } else if (ampm == this.sAM && intHour == 0) intHour=0; } else { if (ampm == this.sPM && intHour != 12) intHour+=12; else if (ampm == this.sAM && intHour == 12) intHour=0; } } } if (this.msgFail.length == 0 && (intMin < 0 || intMin > 59)) { this.msgFail=hX_3.ERR_minute_range; } if (this.msgFail.length == 0 && (intSec < 0 || intSec > 59)) { this.msgFail=hX_3.ERR_second_range; } if (this.msgFail.length > 0) { this.msgFail=hX_3.NLSFormatMsg (this.msgFail, args); return null; } r=new Date(intYear, intMonth-1, intDay, intHour, intMin, intSec); if (intMS && intMS > 0) r.setMilliseconds(intMS); if (zOffset && (zOffset != -(r.getTimezoneOffset()))) { intMin=r.getMinutes(); intMin -= (zOffset + r.getTimezoneOffset()); r=new Date(intYear, intMonth-1, intDay, intHour, intMin, intSec); } return {value:r, token:(tokInd > 0)?tokInd-1:0, pos:(iDate.length-sDate.length)}; } HxG_3.prototype.DateTimeConverter.prototype.stringToLastToken=function (iDate, pos) { var token=0; var all="hHkKms"; if (iDate.length <= 0 || pos == 0) { while (token < this.sTokens.length && !(this.sTokens[token].type == 0 && hX_3.isChar(this.sTokens[token].token.charAt(0),all))) token++; } else { var r=this.stringToValueBase(iDate.substr(0,pos)); if (r) { token=(r.token < this.sTokens.length) ? r.token : this.sTokens.length-1; if (this.sTokens[token].type != 0) { while (token < this.sTokens.length && this.sTokens[token].type != 0) token++; } token=(token >= this.sTokens.length) ? this.sTokens.length-1:token; while (token >= 0 && !(this.sTokens[token].type == 0 && hX_3.isChar(this.sTokens[token].token.charAt(0),all))) token--; } } if (token < 0 || token >= this.sTokens.length) return "h"; else if (this.sTokens[token].token.charAt(0) == "m") return "m"; else if (this.sTokens[token].token.charAt(0) == "s") return "s"; else return "h"; } HxG_3.prototype.DateTimeConverter.prototype.posFromLastToken=function (iDate, token) { if (iDate.length == 0 || !token || token.length != 1) return 0; var hit=false; var hitstring=(token=="s") ? "s" : ((token=="m") ? "m" : "hHkK"); for (var i=0; i < this.sTokens.length && !hit; i++) { if (this.sTokens[i].type == 0 && hX_3.isChar(this.sTokens[i].token.charAt(0),hitstring)) hit=true; } if (!hit) return 0; i=(i > 0) ? i-1:0; var r=this.stringToValueBase(iDate, i); return ((r) ? r.pos : 0); } HxG_3.prototype.DateTimeConverter.prototype.getMaxLength=function () { return this.DF_MaxLength; } HxG_3.prototype.DateTimeConverter.prototype.genAssistMasks=function() { var m=""; var p=""; var d=""; var sep=true; var c, i, t; for (i=0; i < this.nTokenCnt; i++) { if (this.sTokens[i].type == 0) { c=this.sTokens[i].token.charAt(0); if (c == "y") { m=m + "yyyy"; p=p + "####"; d=d + "yyyy"; sep=true; } else if (c == "h") { m=m + "HH"; p=p + "##"; d=d + "hh"; sep=true; } else if (c == "M" || c == "d" || c == "m" || c == "s" || c == "H") { m=m + c + c; p=p + "##"; d=d + ((c == "M" || c == "d") ? "mm" : "hh"); sep=true; } else { sep=false; } } else { t=this.sTokens[i].token; if (t.length > 0) { m=m + ((sep) ? "'"+t+"'" : ""); p=p + ((sep) ? t : ""); d=d + ((sep) ? t : ""); } } } this.maskFormat=hX_3.Trim(p); this.maskFormatDigits=hX_3.Trim(d); m=hX_3.Trim(m); if (m.length > 0) { if (m.charAt(0) == "'") m="'" + hX_3.Trim(m.substr(1)); if (m.substr(0,2) == "''") m=hX_3.Trim(m.substr(2)); if (m.charAt(m.length-1) == "'") m=hX_3.Trim(m.substr(0, m.length-1)) + "'"; if (m.substr(m.length-2,2) == "''") m=hX_3.Trim(m.substr(0,m.length-2)); } this.simpleFormat=m; var args=new Array(); args.push("strict:2"); if (this.simpleFormat) args.push("format:"+this.simpleFormat); if (this.base2DigitSpan)args.push("base-2digit-span:"+this.base2DigitSpan); if (this.sEpoch) args.push("epoch:"+this.sEpoch); if (this.sAM) args.push("am:"+this.sAM); if (this.sPM) args.push("pm:"+this.sPM); this.simpleConverter=new hX_3.DateTimeConverter(args[0],args[1],args[2],args[3],args[4],args[5], args[6]); this.maskFormatFirst=-1; this.maskFormatLast=-1; for (i=0; i < this.maskFormat.length; i++) { if (this.maskFormat.charAt(i) == "#" || this.maskFormat.charAt(i) == "?") { this.maskFormatLast=i; this.maskFormatFirst=(this.maskFormatFirst >= 0) ? this.maskFormatFirst : i; } } } HxG_3.prototype.DateTimeConverter.prototype.getBaseYear=function() { var today=new Date(); var thisYear=today.getFullYear(); return (thisYear - this.base2DigitSpan); } HxG_3.prototype.DateTimeConverter.prototype.skipSeparators=function (str) { var r=str; while (r.length > 0 && hX_3.isChar (r.charAt(0), this.SEPChars)) r=r.substr(1); return r; } HxG_3.prototype.DateTimeConverter.prototype.skipToSeparator=function (str, max) { var i=this.countToSeparator(str, max); return (str.substr(i)); } HxG_3.prototype.DateTimeConverter.prototype.countToSeparator=function (str, max) { var r=str; var i=0; while (r.length > 0 && (i < max || max < 0) && !hX_3.isChar (r.charAt(0), this.SEPChars)) { r=r.substr(1); i++; } return i; } HxG_3.prototype.DateTimeConverter.prototype.skipIfMissing=function (str, notdigit) { var r=(hX_3.isChar (str.charAt(0), this.SEPChars)); if (!r) { var n=this.matchDigits (str, 1, true); r=(notdigit) ? n.fail : (!n.fail); } return r; } HxG_3.prototype.DateTimeConverter.prototype.matchDigits=function (str, n, exact) { var matchArr; switch (n) { case 4: if (exact) matchArr=str.match(/^\d{4}/); else matchArr=str.match(/^\d{1,4}/); break; case 3: if (exact) matchArr=str.match(/^\d{3}/); else matchArr=str.match(/^\d{1,3}/); break; case 2: if (exact) matchArr=str.match(/^\d{2}/); else matchArr=str.match(/^\d{1,2}/); break; case 1: default: matchArr=str.match(/^\d{1}/); break; } if (matchArr == null) return {fail: true, s: "", n: 0, cnt: 0}; return {fail: false, s: (str.substr(matchArr[0].length)), n: parseInt(matchArr[0],10), cnt: matchArr[0].length}; } HxG_3.prototype.DateTimeConverter.prototype.readTimeZoneOffset=function(str) { var sign=+1; if (str.charAt(0) == "-") sign=-1; var zoffset=(parseInt(str.substr(1,2), 10)) * 60; zoffset+=parseInt(str.substr(3,2), 10); zoffset=zoffset * sign; return zoffset; } HxG_3.prototype.DateTimeConverter.prototype.constantToValue=function (sDate) { var oDate=null; var len=sDate.length; var i, yr, mo, dy, hr, mn, sc, z; yr=mo=dy=mn=sc=0; hr=z=null; var bRelative=false; var t; var tstr=sDate.toUpperCase(); for (i=0; i < 4; i++) { t=hX_3.STR_DATE_TODAY[i].toUpperCase(); if (tstr.length >= t.length && tstr.substr(0, t.length) == t) { bRelative=true; break; } } if (bRelative) { oDate=new Date(); oDate.setSeconds(0); var daysAdj=0; var dayAdj=(i==1) ? 1 : ((i==2) ? -1 : 0); tstr=tstr.substr(t.length); tstr=hX_3.allTrim(tstr); if (tstr.charAt(0) == "+") { daysAdj=parseInt(tstr.substr(1),10); } else if (tstr.charAt(0) == "-") { daysAdj=-(parseInt(tstr.substr(1),10)); } if (i == 3) { oDate.HxAdjustDate(0, 0, 0, daysAdj, 0, 0); } else { oDate.setHours(12); oDate.setMinutes(0); oDate.HxAdjustDate(0, 0, (dayAdj+daysAdj), 0, 0, 0); } } else { if (len >= 4) yr=parseInt(sDate.substr(0,4), 10); if (len >= 6) mo=parseInt(sDate.substr(4,2), 10); if (len >= 8) dy=parseInt(sDate.substr(6,2), 10); if(len >= 10) hr=parseInt(sDate.substr(8,2), 10); if (len >= 12) mn=parseInt(sDate.substr(10,2), 10); if (len >= 14) sc=parseInt(sDate.substr(12,2), 10); if (len >= 16) z=parseInt(sDate.substr(14,3), 10); if (yr == 0 && mo == 0 && dy == 0) { oDate=new Date(); yr=oDate.getFullYear(); mo=oDate.getMonth()+1; dy=oDate.getDate(); } if (z) { oDate=new Date(Date.UTC(yr, mo-1, dy, hr, mn, sc, 0)); oDate.setTime(oDate.getTime() - (z * 1000)); } else { if (!hr) oDate=new Date (yr, mo-1, dy, 12, 0, 0); else oDate=new Date (yr, mo-1, dy, hr, mn, sc); } } return oDate; } HxG_3.prototype.DateTimeConverter.prototype.valueToConstant=function (oDate) { var m=hX_3.padL(oDate.getMonth()+1, 2); var d=hX_3.padL(oDate.getDate(), 2); return (oDate.getFullYear() + m + d); } HxG_3.prototype.DateTimeConverter.prototype.valueToString=function (oDate, ifmt, promptChar) { this.msgFail=""; if (oDate == null) return ""; var fmt=(ifmt != null) ? ifmt : this.sFormatTokenized; var oddampm=(fmt.indexOf("%K") >= 0); fmt=hX_3.replaceAll(fmt, "%MMMM", "@0"); fmt=hX_3.replaceAll(fmt, "%MMM", "@1"); fmt=hX_3.replaceAll(fmt, "%EEEE", "@2"); fmt=hX_3.replaceAll(fmt, "%EEE", "@3"); fmt=hX_3.replaceAll(fmt, "%GGGG", "@4"); fmt=hX_3.replaceAll(fmt, "%GGG", "@5"); fmt=hX_3.replaceAll(fmt, "%GG", "@6"); fmt=hX_3.replaceAll(fmt, "%G", "@7"); fmt=hX_3.replaceAll(fmt, "%a", "@8"); fmt=hX_3.replaceAll(fmt, "%z", "@9"); var y=oDate.getFullYear(); if (this.bHasEpoch) { if (this.bChristianEra) { fmt=hX_3.replaceAll(fmt, "%yyyyy", y); fmt=hX_3.replaceAll(fmt, "%yyyy", y); fmt=hX_3.replaceAll(fmt, "%yyyy", y); fmt=hX_3.replaceAll(fmt, "%yy", hX_3.padL(y % 100, 2, promptChar)); fmt=hX_3.replaceAll(fmt, "%y", hX_3.padL(y % 100, 2, promptChar)); } else { fmt=hX_3.replaceAll(fmt, "%yyyy",hX_3.padL(this.valueToYearEpoch(oDate).year, 4, promptChar)); fmt=hX_3.replaceAll(fmt, "%yyy", hX_3.padL(this.valueToYearEpoch(oDate).year, 3, promptChar)); fmt=hX_3.replaceAll(fmt, "%yy", hX_3.padL(this.valueToYearEpoch(oDate).year, 2, promptChar)); fmt=hX_3.replaceAll(fmt, "%y", this.valueToYearEpoch(oDate).year); } } else { fmt=hX_3.replaceAll(fmt, "%yyyyy", y); fmt=hX_3.replaceAll(fmt, "%yyyy", y); fmt=hX_3.replaceAll(fmt, "%yyyy", y); fmt=hX_3.replaceAll(fmt, "%yy", hX_3.padL(y % 100, 2, promptChar)); fmt=hX_3.replaceAll(fmt, "%y", hX_3.padL(y % 100, 2, promptChar)); } var m=oDate.getMonth() + 1; fmt=hX_3.replaceAll(fmt, "%MM", hX_3.padL(m, 2, promptChar)); fmt=hX_3.replaceAll(fmt, "%M", m); if (fmt.indexOf("%w") >= 0) fmt=hX_3.replaceAll(fmt, "%w", oDate.HxGetJulianWeekOfYear()); if (fmt.indexOf("%W") >= 0) fmt=hX_3.replaceAll(fmt, "%W", oDate.HxGetJulianWeekOfMonth()); var d=oDate.getDate(); fmt=hX_3.replaceAll(fmt, "%dd", hX_3.padL(d, 2, promptChar)); fmt=hX_3.replaceAll(fmt, "%d", d); if (fmt.indexOf("%D") >= 0) fmt=hX_3.replaceAll(fmt, "%D", oDate.HxGetJulianDateOfYear()); if (fmt.indexOf("%F") >= 0) fmt=hX_3.replaceAll(fmt, "%F", oDate.HxGetJulianDateOfMonth()); var h=oDate.getHours(); var m=oDate.getMinutes(); var s=oDate.getSeconds(); var k=oDate.getMilliseconds(); fmt=hX_3.replaceAll(fmt, "%hh", (h % 12) == 0 ? 12 : hX_3.padL(h % 12, 2, promptChar)); fmt=hX_3.replaceAll(fmt, "%h", (h % 12) == 0 ? 12 : (h % 12)); fmt=hX_3.replaceAll(fmt, "%kk", hX_3.padL(h+1,2, promptChar)); fmt=hX_3.replaceAll(fmt, "%k", h+1); fmt=hX_3.replaceAll(fmt, "%HH", hX_3.padL(h, 2, promptChar)); fmt=hX_3.replaceAll(fmt, "%H", h); fmt=hX_3.replaceAll(fmt, "%KK", hX_3.padL((((h % 12) == 0) ? 12 : (h % 12)) - 1 , 2, promptChar)); fmt=hX_3.replaceAll(fmt, "%K", ((h % 12) == 0 ? 12 : (h % 12)) - 1); fmt=hX_3.replaceAll(fmt, "%mm", hX_3.padL(m, 2, promptChar)); fmt=hX_3.replaceAll(fmt, "%m", m); fmt=hX_3.replaceAll(fmt, "%ss", hX_3.padL(s, 2, promptChar)); fmt=hX_3.replaceAll(fmt, "%s", s); fmt=hX_3.replaceAll(fmt, "%SSS", hX_3.padL(k, 3, promptChar)); fmt=hX_3.replaceAll(fmt, "%SS", hX_3.padL(k, 3, promptChar).substr(0,2)); fmt=hX_3.replaceAll(fmt, "%S", hX_3.padL(k, 3, promptChar).substr(0,1)); fmt=hX_3.replaceAll(fmt, "@0", this.valueToMonthLabel(oDate)); fmt=hX_3.replaceAll(fmt, "@1", this.valueToShortMonthLabel(oDate)); fmt=hX_3.replaceAll(fmt, "@2", this.valueToDayLabel(oDate)); fmt=hX_3.replaceAll(fmt, "@3", this.valueToShortDayLabel(oDate)); fmt=hX_3.replaceAll(fmt, "@4", this.valueToYearEpoch(oDate).name); fmt=hX_3.replaceAll(fmt, "@5", this.valueToYearEpoch(oDate).nameabb); fmt=hX_3.replaceAll(fmt, "@6", this.valueToYearEpoch(oDate).nameabb); fmt=hX_3.replaceAll(fmt, "@7", this.valueToYearEpoch(oDate).nameabb); fmt=hX_3.replaceAll(fmt, "@8", this.valueToAmPmLabel(oDate, oddampm)); fmt=hX_3.replaceAll(fmt, "@9", this.valueToTimeZone(oDate)); var str; for (var i=0; i < this.nLiteralCnt; i++) { str="^"+i; fmt=hX_3.replaceAll(fmt, str, this.sLiterals[i]); } return fmt; } HxG_3.prototype.DateTimeConverter.prototype.valueToAmPmLabel=function(oDate, oddampm) { var o=oDate.getHours(); if (oddampm) return (o==0) ? this.sPM : ((o <= 12) ? this.sAM : this.sPM); else return (o < 12) ? this.sAM : this.sPM; } HxG_3.prototype.DateTimeConverter.prototype.valueToTimeZone=function(oDate) { var r=""; var j, zoffset, z1, z2, z3, z4; var z=-(oDate.getTimezoneOffset()); var feb=new Date(oDate.getFullYear(), 1, 7); var jun=new Date(oDate.getFullYear(), 5, 15); var zfeb=-(feb.getTimezoneOffset()); var zjun=-(jun.getTimezoneOffset()); var dst=false; if (z == zfeb && z != zjun) dst=false; if (z == zjun && z != zfeb) dst=true; var z1=(dst) ? 2 : 0; var z2=(dst) ? 3 : 1; var znames=hX_3.STR_TIMEZONES.length; for (j=znames-1; j > 0; j--) { if (hX_3.STR_TIMEZONES[j][0] == null || hX_3.STR_TIMEZONES[j][0].length == 0) { } else { zoffset=this.readTimeZoneOffset(hX_3.STR_TIMEZONES[j][z1]); if (zoffset == z) { r=hX_3.STR_TIMEZONES[j][z2]; break; } } } if (r.length == 0) { r=hX_3.STR_TIMEZONES[0][1] + ((z < 0) ? "-" : "+"); z=Math.abs(z); var hr=Math.floor(z/60); var mn=z-(hr*60); hr=hX_3.padL(hr,2); mn=hX_3.padL(mn,2); r=r + hr + this.timeZoneSeparator + mn; } return (r); } HxG_3.prototype.DateTimeConverter.prototype.isDateFormat=function() { return this.bHasDate; } HxG_3.prototype.DateTimeConverter.prototype.isTimeFormat=function() { return this.bHasTime; } HxG_3.prototype.DateTimeConverter.prototype.valueToDayLabel=function(oDate) { return hX_3.STR_DATE_DAYS[oDate.getDay()]; } HxG_3.prototype.DateTimeConverter.prototype.valueToShortDayLabel=function(oDate) { return hX_3.STR_DATE_SHDAYS[oDate.getDay()]; } HxG_3.prototype.DateTimeConverter.prototype.valueToMonthLabel=function(oDate) { return hX_3.STR_DATE_MONTHS[oDate.getMonth()]; } HxG_3.prototype.DateTimeConverter.prototype.valueToShortMonthLabel=function(oDate) { return hX_3.STR_DATE_SHMONTHS[oDate.getMonth()]; } HxG_3.prototype.DateTimeConverter.prototype.valueToYearLabel=function (oDate) { if (this.bHasEpoch) { if (this.bChristianEra) return this.valueToString(oDate, hX_3.DTFMT_GCYEAR); else return this.valueToString(oDate, hX_3.DTFMT_GEYEAR); } else return this.valueToString(oDate, hX_3.DTFMT_YEAR); } HxG_3.prototype.DateTimeConverter.prototype.valueToYearEpoch=function (oDate) { var i, cDate; var epoch=hX_3.DATE_EPOCHS[this.nEpoch]; for (i=epoch.length - 1; i >= 0; i--) { if (epoch[i][0] == "-") { } else if (epoch[i][0] == "+") { return { name: epoch[i][1], nameabb: epoch[i][2], year: oDate.getFullYear() }; } else { cDate=this.constantToValue (epoch[i][0]); if (cDate && (oDate.HxCompareDate(cDate) >= 0)) return { name: epoch[i][1], nameabb: epoch[i][2], year: oDate.getFullYear() - cDate.getFullYear() + 1 }; } } return { name: '', nameabb: '', year: oDate.getFullYear() }; } HxG_3.prototype.DateTimeValidator=function () { this.type="datetime"; this.required=false; this.minimumBound=null; this.maximumBound=null; this.minimumDate=null; this.maximumDate=null; this.oMinimum=new Date (1000, 0, 1); this.ELexpression=null; this.ELexpressionImp=null; this.msgFail=""; this.attributeTable=new Array(); this.attributeTable ['required']=['required', hX_3.ARG_IS_TRUE, false, null, null]; this.attributeTable ['minimum-bound']=['minimumBound', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['min-bound']=['minimumBound', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['maximum-bound']=['maximumBound', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['max-bound']=['maximumBound', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['constraint-expression']=['ELexpression', hX_3.ARG_TO_NAN, false, null, null]; this.setAttribute(arguments); } HxG_3.prototype.DateTimeValidator.prototype.setAttribute=function(a) { var wasmax=this.maximumBound; var wasmin=this.minimumBound; var DTP=new hX_3.DateTimeConverter(); hX_3.parseArg (this.attributeTable, this, a); if (this.minimumBound && wasmin != this.minimumBound) this.minimumDate=DTP.constantToValue (this.minimumBound); if (this.maximumBound && wasmax != this.maximumBound) this.maximumDate=DTP.constantToValue (this.maximumBound); if (this.maximumDate && this.minimumDate) { if (1 != this.maximumDate.HxCompareDate (this.minimumDate, true)) this.minimumBound=this.maximumBound=this.minimumDate=this.maximumDate=null; } if (this.minimumDate && (-1 == this.minimumDate.HxCompareDate(this.oMinimum))) this.minimumDate=oMinimum.HxClone(0); if (this.ELexpression != null) this.ELexpressionImp=hX_3.regExp.registerELConstraint(this.ELexpression, "date"); return true; } HxG_3.prototype.DateTimeValidator.prototype.getAttribute=function (attribute) { return (hX_3.getArg(this.attributeTable, this, attribute)); } HxG_3.prototype.DateTimeValidator.prototype.lastError=function () { return ((this.msgFail && this.msgFail.length > 0) ? this.msgFail : null); } HxG_3.prototype.DateTimeValidator.prototype.validate=function (testdate, iDTP, treatAsDate) { this.msgFail=""; var test=null; var DTP=(iDTP != null) ? hX_3.getConverterById(iDTP) : null; if (DTP == null || !hX_3.isObject(DTP)) { return false; } var bTimeCompare=(treatAsDate) ? false : DTP.isTimeFormat(); var bTimeOnly=DTP.isTimeFormat() && !DTP.isDateFormat(); if (testdate == null || hX_3.isString(testdate)) { var r=!(this.required); if (testdate == null) { this.msgFail=(r) ? "" : hX_3.ERR_required; return r; } var e=hX_3.allTrim (testdate); if (e.length == 0) { this.msgFail=(r) ? "" : hX_3.ERR_required; return r; } test=DTP.stringToValue(e); } else { if (testdate.HxClone) test=testdate.HxClone(2); } if (test == null) { this.msgFail=hX_3.ERR_required; return false; } if (bTimeOnly && (this.minimumDate || this.maximumDate)) { if (test.getFullYear() > 1970) { test.setYear(1970); test.setMonth(0); test.setDate(1); } test.setMilliseconds(0); } if (this.oMinimum && !bTimeOnly) { if (-1 == test.HxCompareDate(this.oMinimum)) { this.msgFail=hX_3.ERR_minimum; return false; } } if (this.minimumDate) { if (-1 == test.HxCompareDate(this.minimumDate, bTimeCompare)) { this.msgFail=hX_3.ERR_minimum; return false; } } if (this.maximumDate) { if (1 == test.HxCompareDate(this.maximumDate, bTimeCompare)) { this.msgFail=hX_3.ERR_maximum; return false; } } if (this.ELexpressionImp != null) { if (!hX_3.regExp.testELExp(test, this.ELexpressionImp)) { this.msgFail=hX_3.ERR_constraint; return false; } } return true; } HxG_3.prototype.DateTimeValidator.prototype.coerce=function (testdate, iDTP, treatAsDate) { var o=null; this.msgFail=""; var DTP=(iDTP != null) ? hX_3.getConverterById(iDTP) : null; if (DTP == null || !hX_3.isObject(DTP)) { this.msgFail=hX_3.ERR_required; return false; } var bTimeCompare=(treatAsDate) ? false : DTP.isTimeFormat(); var bTimeOnly=DTP.isTimeFormat() && !DTP.isDateFormat(); if (testdate != null && hX_3.isString(testdate)) { var e=hX_3.allTrim (testdate); if (e.length > 0) o=DTP.stringToValue(e); } else { if (testdate.HxClone) o=testdate.HxClone(2); } if (o == null) o=new Date (); if (bTimeOnly && (this.minimumDate || this.maximumDate)) { if (o.getFullYear() > 1970) { o.setYear(1970); o.setMonth(0); o.setDate(1); } o.setMilliseconds(0); } if (this.oMinimum && !bTimeOnly) { if (-1 == o.HxCompareDate(this.oMinimum)) o=this.oMinimum.HxClone(2); } if (this.minimumDate) { if (-1 == o.HxCompareDate(this.minimumDate, bTimeCompare)) o=this.minimumDate.HxClone(2); } if (this.maximumDate) { if (1 == o.HxCompareDate(this.maximumDate, bTimeCompare)) o=this.maximumDate.HxClone(2); } return o; } HxG_3.prototype.DateTimeAssist=function (_elem, _state, _converter, _validator, _promptChar) { if (!_elem || !_converter || !_state) return; this.isFilled=isFilled; this.onFocus=onFocus; this.onBlur=onBlur; this.onCut=onCut; this.onPaste=onPaste; this.toAssist=toAssist; this.fromAssist=fromAssist; this.onClick=onClick; this.onChangeKeyCode= onChangeKeyCode; this.onChangeChrCode= onChangeChrCode; this.onValidate=onValidate var elem=_elem; var state=_state; var cvt=_converter; var validator=_validator; var promptChar=_promptChar; var handler=null; if (cvt.simpleFormat == null) cvt.genAssistMasks(); handler=new hX_3.MaskAssist.prototype.maskHandler(elem, state, cvt, promptChar); function valueToSimpleString (iDate) { var r=null; if (iDate == null || iDate.length == 0) r=handler.getEmptyMask(); else r=(cvt.simpleConverter) ? cvt.simpleConverter.valueToString(iDate,null,promptChar) : cvt.valueToString(iDate,null,promptChar); return r; } function simpleStringToValue (sDate, ending) { var i; var testDate=sDate; var l=testDate.length; if (testDate.length <= 0) return null; var empty=true; for (i=0; empty && ending && i < l; i++) { if (cvt.maskFormat.charAt(i) == "#" && testDate.charAt(i) != promptChar && testDate.charAt(i) != " ") empty=false; } if (ending && empty) return (""); if (l < cvt.maskFormat.length) testDate=testDate + handler.getEmptyMask().substr(l); else if (!ending && l > cvt.maskFormat.length) return null; var c1, c2, c3, c4, m; for (i=0; i < l; i++) { if (cvt.maskFormat.charAt(i) == "#") { m=cvt.maskFormatDigits.charAt(i); if (m != "y") { c1=testDate.charAt(i); c2=((i+1) cvt.maskFormatLast && c != promptChar && c != " "); } function onFocus (evt) { var newValue=toAssist(elem.value); elem.value=(newValue.v==null) ? "" : newValue.v; hX_3.sel.setCaretPos(elem, cvt.maskFormatFirst); return true; } function toAssist (v) { var newValue=(v != null) ? hX_3.Trim(v) : null; newValue=(newValue != null && newValue.length > 0) ? cvt.stringToValue(newValue) : null; newValue=valueToSimpleString(newValue); return {v:newValue, i:null}; } function onBlur (evt) { var v=fromAssist(elem.value); if (v != null) { elem.value=v; return true; } return false; } function fromAssist (v) { if (v.length==0) return ""; var newValue=(v.length == 0) ? null : simpleStringToValue(v, true); if (newValue != null) newValue=(newValue.length==0) ? "" : cvt.valueToString(newValue); return newValue; } function onClick (evt) { return handler.onClick(evt); } function onCut (evt) { return handler.onCut(evt); } function onPaste (evt) { return handler.onPaste(evt); } function onChangeKeyCode (evt) { return handler.onChangeKeyCode (evt); } function onChangeChrCode (evt) { return handler.onChangeChrCode (evt); } function onValidate () { var newValue=simpleStringToValue(state.getValue(), false); if (newValue != null) { newValue=valueToSimpleString(newValue, null, promptChar); if (newValue != null) return true; } return false; } } HxG_3.prototype.NumberConverter=function () { this.type="number"; this.nStrict=hX_3.NFMT_DEFAULTSTRICT; this.pattern=hX_3.NFMT_DECIMAL0; this.locale=hX_3.NFMT_LOCALE0; this.invalidPattern=false; this.upattern=null; this.DF_GroupingSize=null; this.DF_NegativePrefix=null; this.DF_NegativeSuffix=null; this.DF_PositivePrefix=null; this.DF_PositiveSuffix=null; this.DF_PaddingLeft=null; this.DF_PaddingRight=null; this.DF_NegativePattern=null; this.DF_IsDecimalShown=null; this.DF_MinIntegerDigits=null; this.DF_MaxIntegerDigits=null; this.DF_MinFractionDigits=null; this.DF_MaxFractionDigits=null; this.DF_MinExponentDigits=null; this.DF_MaxLength=null; this.isExponent=false; this.isPercent=false; this.isMille=false; this.FMTChars=";0#.,E"; this.PREChars=hX_3.STR_percent_char+hX_3.STR_mille_char+hX_3.STR_icurrency_char; this.hardPlus="+"; this.hardMinus="-"; this.hardE="E"; this.LC_groupingSymbol=null; this.LC_decimalSymbol=null; this.LC_percentSymbol=null; this.LC_milleSymbol=null; this.LC_minusSymbol=null; this.LC_currencySymbol=null; this.LC_paddingChar=hX_3._Z; this.msgFail=hX_3._E; this.intMsgFail=hX_3._E; this.signedConverter=null; this.zeroConverter=null; this.attributeTable=new Array(); this.attributeTable ['strict']=['nStrict', hX_3.ARG_TO_NUM, false, 0, 2]; this.attributeTable ['pattern']=['pattern', hX_3.ARG_TO_NAS, false, null, null]; this.attributeTable ['locale']=['locale', hX_3.ARG_TO_NAS, false, null, null]; this.setAttribute(arguments); } HxG_3.prototype.NumberConverter.prototype.setAttribute=function(a) { hX_3.parseArg (this.attributeTable, this, a); this.parseLocaleString(); this.parsePatternString(); if (this.signedConverter) this.genAssistMasks(); return true; } HxG_3.prototype.NumberConverter.prototype.parseLocaleString=function () { this.LC_groupingSymbol=(this.locale.charAt(0) == hX_3._E) ? hX_3.NFMT_LOCALE0.charAt(0) : this.locale.charAt(0); this.LC_decimalSymbol=(this.locale.charAt(1) == hX_3._E) ? hX_3.NFMT_LOCALE0.charAt(1) : this.locale.charAt(1); this.LC_percentSymbol=(this.locale.charAt(2) == hX_3._E) ? hX_3.NFMT_LOCALE0.charAt(2) : this.locale.charAt(2); this.LC_milleSymbol=(this.locale.charAt(3) == hX_3._E) ? hX_3.NFMT_LOCALE0.charAt(3) : this.locale.charAt(3); this.LC_minusSymbol=(this.locale.charAt(4) == hX_3._E) ? hX_3.NFMT_LOCALE0.charAt(4) : this.locale.charAt(4); this.LC_currencySymbol=(this.locale.substr(5) == hX_3._E) ? hX_3.NFMT_LOCALE0.substr(5) : this.locale.substr(5); } HxG_3.prototype.NumberConverter.prototype.parsePatternString=function () { this.DF_GroupingSize=0; this.DF_NegativePrefix=hX_3._E; this.DF_NegativeSuffix=hX_3._E; this.DF_PositivePrefix=hX_3._E; this.DF_PositiveSuffix=hX_3._E; this.DF_NegativePattern=false; this.DF_IsDecimalShown=false; this.DF_MinIntegerDigits=0; this.DF_MaxIntegerDigits=0; this.DF_MinFractionDigits=0; this.DF_MaxFractionDigits=0; this.DF_MinExponentDigits=0; this.DF_PaddingLeft=hX_3._E; this.DF_PaddingRight=hX_3._E; this.isExponent=false; this.isPercent=false; this.isMille=false; this.invalidPattern=false; this.DF_MaxLength=0; var fmt=this.pattern; this.upattern=this.pattern; var index, i, j=0, xchar, nchar; var bInPositivePattern=true, bInPrefix=true; var bInNumber=false, bInExponent=false, bInQuote=false, bHaveGroup=false; var bInMinInteger=false, bInMaxInteger=false, bInMinFraction=false, bInMaxFraction=false; for (i=fmt.length-1; j < 4 && i > 0; i--) { xchar=fmt.charAt(i); if (xchar==hX_3._SQT || xchar==hX_3._P || xchar==hX_3._SM) break; if (hX_3._SL == fmt.charAt(i)) { xchar=fmt.substr(i+1); this.upattern=fmt=fmt.substr(0,i); if (xchar.length==1) this.DF_PaddingLeft=xchar; else if (xchar.length==2) { this.DF_PaddingLeft=xchar.substr(0,1); this.DF_PaddingRight=xchar.substr(1,1); } break; } j--; } var len=fmt.length; for (index=0; index < len; index++) { xchar=fmt.charAt(index); if (bInQuote) { if (xchar == hX_3._SQT) { nchar=fmt.charAt(index+1); if (nchar == hX_3._SQT) { this.addToPreSuf (bInPositivePattern, bInPrefix, bInQuote, xchar); index++; } else { bInQuote=false; } } else { this.addToPreSuf (bInPositivePattern, bInPrefix, bInQuote, xchar); } } else if (!hX_3.isChar(xchar, this.FMTChars)) { if (!bInPrefix) { bInNumber=bInMinInteger=bInMaxInteger=bInMinFraction=bInMaxFraction=bInExponent=false; } if (xchar == hX_3._SQT) { nchar=fmt.charAt(index+1); if (nchar == hX_3._SQT) { this.addToPreSuf (bInPositivePattern, bInPrefix, bInQuote, xchar); index++; } else { bInQuote=true; } } else { this.addToPreSuf (bInPositivePattern, bInPrefix, bInQuote, xchar); } } else { if (xchar == hX_3._SM) { bInPositivePattern=bInNumber=bInMinInteger=bInMaxInteger=bInMinFraction=bInMaxFraction=bInExponent=false; this.DF_NegativePattern=true; bInPrefix=true; } else { if (!bInPrefix && !bInNumber) { this.invalidPattern=true; this.intMsgFail="Bad format: Unexpected number symbol."; break; } bInPrefix=false; bInNumber=true; if (!bInPositivePattern) { } else { if (xchar == hX_3._Z) { if (bInExponent) { this.DF_MinExponentDigits++; } else if (bInMinInteger) { this.DF_MinIntegerDigits++; } else if (bInMinFraction) { this.DF_MinFractionDigits++; } else if (bInMaxFraction) { this.invalidPattern=true; this.intMsgFail="Bad format: Unexpected 0 symbol."; break; } else { if (this.DF_MinIntegerDigits > 0) { this.invalidPattern=true; this.intMsgFail="Bad format: Unexpected 0 symbol."; break; } this.DF_MinIntegerDigits++; bInMaxInteger=false; bInMinInteger=true; } if (bInMaxInteger || bInMinInteger) this.DF_GroupingSize++; } else if (xchar == hX_3._LB) { if (bInMinInteger || bInExponent) { this.invalidPattern=true; this.intMsgFail="Bad format: Unexpected # symbol."; break; } else if (bInMaxInteger) { this.DF_MaxIntegerDigits++; } else if (bInMaxFraction) { this.DF_MaxFractionDigits++; } else if (bInMinFraction) { this.DF_MaxFractionDigits++; bInMinFraction=false; bInMaxFraction=true; } else { this.DF_MaxIntegerDigits++; bInMaxInteger=true; } if (bInMaxInteger || bInMinInteger) this.DF_GroupingSize++; } else if (xchar == hX_3._C) { if (!bInMinInteger && !bInMaxInteger) { this.invalidPattern=true; this.intMsgFail="Bad format: Bad grouping character: " + bInMaxInteger + hX_3._P; break; } if (bInMaxInteger || bInMinInteger) this.DF_GroupingSize=0; bHaveGroup=true; } else if (xchar == hX_3._P) { if (bInExponent || this.DF_IsDecimalShown) { this.invalidPattern=true; this.intMsgFail="Bad format: multiple decimal points."; break; } bInMinInteger=false; bInMaxInteger=false; bInMinFraction=true; this.DF_IsDecimalShown=true; } else if (xchar == this.hardE) { if (this.isExponent || (!bInMinInteger && !bInMaxInteger && !bInMinFraction && !bInMaxFraction)) { this.invalidPattern=true; this.intMsgFail="Bad format: Bad exponent marker."; break; } bInMinInteger=bInMaxInteger=bInMinFraction=bInMaxFraction=false; bInExponent=true; this.isExponent=true; } } } } } this.DF_MaxIntegerDigits+=this.DF_MinIntegerDigits; this.DF_MaxFractionDigits+=this.DF_MinFractionDigits; if (!bHaveGroup || this.isExponent) this.DF_GroupingSize=0; if (this.isPercent && this.isMille) { this.invalidPattern=true; this.intMsgFail="Bad format: Cannot have percent and mille."; } if (!this.invalidPattern) { if (this.isExponent) { var pre=Math.max(this.DF_NegativePrefix.length, this.DF_PositivePrefix.length); var post=Math.max(this.DF_NegativeSuffix.length, this.DF_PositiveSuffix.length); var dec=(this.DF_IsDecimalShown) ? this.LC_decimalSymbol.length : 0; var exp=this.DF_MinExponentDigits; this.DF_MaxLength=pre + this.DF_MaxIntegerDigits + dec + this.DF_MaxFractionDigits + 1 + exp + post; } else { var pre=Math.max(this.DF_NegativePrefix.length, this.DF_PositivePrefix.length); var post=Math.max(this.DF_NegativeSuffix.length, this.DF_PositiveSuffix.length); var dec=(this.DF_IsDecimalShown) ? this.LC_decimalSymbol.length : 0; var com=(this.DF_GroupingSize == 0 && this.DF_MaxIntegerDigits > 0) ? 0 : Math.floor((this.DF_MaxIntegerDigits-1)/this.DF_GroupingSize); this.DF_MaxLength=pre + this.DF_MaxIntegerDigits + com + dec + this.DF_MaxFractionDigits + post; if (!this.DF_NegativePattern) this.DF_MaxLength++; } } } HxG_3.prototype.NumberConverter.prototype.addToPreSuf=function (bInPositivePattern, bInPrefix, bInQuote, c) { var xchar=c; if (!bInQuote && hX_3.isChar(xchar, this.PREChars)) { if (xchar == hX_3.STR_percent_char) { xchar=this.LC_percentSymbol; this.isPercent=true; } else if (xchar == hX_3.STR_mille_char){ xchar=this.LC_milleSymbol; this.isMille=true; } else if (xchar == hX_3.STR_icurrency_char) { xchar=this.LC_currencySymbol; } } if (bInPositivePattern) { if (bInPrefix) this.DF_PositivePrefix=this.DF_PositivePrefix + xchar; else this.DF_PositiveSuffix=this.DF_PositiveSuffix + xchar; } else { if (bInPrefix) this.DF_NegativePrefix=this.DF_NegativePrefix + xchar; else this.DF_NegativeSuffix=this.DF_NegativeSuffix + xchar; } } HxG_3.prototype.NumberConverter.prototype.getAttribute=function (attribute) { return (hX_3.getArg(this.attributeTable, this, attribute)); } HxG_3.prototype.NumberConverter.prototype.lastError=function () { return ((this.msgFail && this.msgFail.length > 0) ? this.msgFail : null); } HxG_3.prototype.NumberConverter.prototype.getMaxLength=function () { return this.DF_MaxLength; } HxG_3.prototype.NumberConverter.prototype.genAssistMasks=function() { var args=new Array(); if (this.DF_NegativePattern) { if (this.DF_PaddingLeft.length==0 && this.DF_PaddingRight.length==0) { this.signedConverter=this; } else { if (this.nStrict) args.push("strict:" +this.nStrict); if (this.upattern) args.push("pattern:"+this.upattern); if (this.locale) args.push("locale:" +this.locale); this.signedConverter=new hX_3.NumberConverter(args[0],args[1],args[2]); } } else { if (this.nStrict) args.push("strict:" +this.nStrict); if (this.upattern) args.push("pattern:"+this.upattern + hX_3._SM + this.LC_minusSymbol + this.upattern); if (this.locale) args.push("locale:" +this.locale); this.signedConverter=new hX_3.NumberConverter(args[0],args[1],args[2]); } var p1=hX_3._E, p=this.signedConverter.upattern; p=hX_3.replaceAll(p, hX_3._Z,hX_3._LB); var k=p.indexOf(hX_3._SM); if (k >= 0) { p1=p.substr(k); p=p.substr(0,k); } k=p.indexOf(hX_3._P); if (k > 0 && p.charAt(k-1)==hX_3._LB) p=p.substr(0,k-1) + hX_3._Z + p.substr(k); else if (k < 0) { k=p.length-1; while (k >= 0 && p.charAt(k) != hX_3._LB) k--; p=p.substr(0,k) + hX_3._Z + p.substr(k+1); } if (p1.length > 0) { k=p1.indexOf(hX_3._P); if (k > 0 && p1.charAt(k-1)==hX_3._LB) p1=p1.substr(0,k-1) + hX_3._Z + p1.substr(k); else if (k < 0) { k=p1.length-1; while (k >= 0 && p1.charAt(k) != hX_3._LB) k--; p1=p1.substr(0,k) + hX_3._Z + p1.substr(k+1); } } p=p+p1; var a=new Array(); if (this.nStrict) a.push("strict:" +this.nStrict); a.push("pattern:"+p); if (this.locale) a.push("locale:" +this.locale); this.zeroConverter=new hX_3.NumberConverter(a[0],a[1],a[2]); } HxG_3.prototype.NumberConverter.prototype.stringToValue=function (numString, promptChar) { this.msgFail=hX_3._E; this.intMsgFail=hX_3._E; var argsFail=new Array(); argsFail[0]=numString; if (numString == null || hX_3.isUnDef(typeof(numString)) || !hX_3.isString(numString)) { this.msgFail=hX_3.ERR_empty; return null; } if (this.invalidPattern) { this.msgFail=hX_3.ERR_number_fail; return null; } var sNum=hX_3.Trim(numString); if (this.DF_PaddingRight.length > 0 && this.DF_PaddingLeft.length > 0 && this.DF_PaddingRight == hX_3._B && this.DF_PaddingLeft == this.DF_PaddingRight) sNum=numString; if (sNum.length==0) { this.msgFail=hX_3.ERR_empty; return null; } var i, j, sign=+1; var preposmatch=false, prenegmatch=false, postposmatch=false, postnegmatch=false; var nopos=this.DF_PositivePrefix.length == 0 && this.DF_PositiveSuffix.length == 0; var noneg=this.DF_NegativePrefix.length == 0 && this.DF_NegativeSuffix.length == 0; if ((!this.DF_NegativePattern) && sNum.charAt(0) == this.LC_minusSymbol) { sNum=sNum.substr(1); sign=-1; prenegmatch=true; postnegmatch=true; } if (sign > 0 && nopos && sNum.charAt(0) == this.hardPlus) { sNum=sNum.substr(1); preposmatch=true; postposmatch=true; } var pre, post, match=false; if (!noneg) { pre=hX_3.Trim(this.DF_NegativePrefix.toUpperCase()); post=hX_3.Trim(this.DF_NegativeSuffix.toUpperCase()); prenegmatch=!(pre.length > 0); postnegmatch=!(post.length > 0); if (!prenegmatch && sNum.length >= pre.length && pre == (sNum.substr(0,pre.length)).toUpperCase()) prenegmatch=true; if (!postnegmatch && sNum.length >= post.length && post == (sNum.substr(sNum.length-post.length)).toUpperCase()) postnegmatch=true; if (prenegmatch && postnegmatch) { match=true; sNum=sNum.substr(pre.length); sNum=sNum.substr(0,sNum.length-post.length); } } if (!nopos && !match) { pre=hX_3.Trim(this.DF_PositivePrefix.toUpperCase()); post=hX_3.Trim(this.DF_PositiveSuffix.toUpperCase()); preposmatch=!(pre.length > 0); postposmatch=!(post.length > 0); if (!preposmatch && sNum.length >= pre.length && pre == (sNum.substr(0,pre.length)).toUpperCase()) preposmatch=true; if (!postposmatch && sNum.length >= post.length && post == (sNum.substr(sNum.length-post.length)).toUpperCase()) postposmatch=true; if (preposmatch && postposmatch) { match=true; sNum=sNum.substr(pre.length); sNum=sNum.substr(0,sNum.length-post.length); } } if (!match && noneg && this.DF_NegativePattern) prenegmatch=postnegmatch=match=true; if (prenegmatch && postnegmatch) sign=-1; else if (preposmatch && postposmatch) sign=+1; else if (!noneg || !nopos) { if (this.nStrict > 1) { if (!noneg && !nopos) this.msgFail=hX_3.ERR_number_fail; } } if (this.msgFail.length == 0) { var left, right; if (promptChar) sNum=hX_3.replaceAll(sNum, promptChar, hX_3._B); sNum=hX_3.Trim(sNum); j=sNum.indexOf(this.LC_decimalSymbol); if (j >= 0) { left=sNum.substr(0,j); right= sNum.substr(j+1); } else { if (this.isExponent) { sNum=sNum.toUpperCase(); j=sNum.indexOf(this.hardE); if (j >= 0) { left=sNum.substr(0,j); right= sNum.substr(j); } else { left=sNum; right=hX_3._E; } } else { left=sNum; right=hX_3._E; } } if (this.DF_PaddingLeft.length > 0 && this.DF_PaddingLeft != this.LC_paddingChar) { while (left.length > 0 && left.charAt(0) == this.DF_PaddingLeft) left=left.substr(1); left=(left.length==0) ? hX_3._Z:left; } if (this.DF_PaddingRight.length > 0 && this.DF_PaddingRight != this.LC_paddingChar) { while (right.length > 0 && right.charAt(right.length-1) == this.DF_PaddingRight) right=right.substr(0,right.length-1); } var leftc=hX_3._E, rightc=hX_3._E; while (left.length > 0) { if (this.matchDigit(left)) { leftc=leftc + left.charAt(0); left=left.substr(1); } else if (!this.isExponent && left.charAt(0) == this.LC_groupingSymbol) { left=left.substr(1); } else { argsFail[1]=left.charAt(0); this.msgFail=hX_3.ERR_number_char; break; } } var bE=false, bS=false; while ((this.msgFail.length == 0) && (right.length > 0)) { if (this.matchDigit(right)) { rightc=rightc + right.charAt(0); right=right.substr(1); } else if (this.isExponent) { if ((!bE && right.charAt(0) == this.hardE) || ((!bS && (right.charAt(0) == this.LC_minusSymbol || right.charAt(0) == this.hardMinus || right.charAt(0) == this.hardPlus)))) { if (right.charAt(0) == this.hardE) bE=true; else bS=true; rightc=rightc + right.charAt(0); right=right.substr(1); } else { argsFail[1]=right.charAt(0); this.msgFail=hX_3.ERR_number_char; break; } } else { argsFail[1]=right.charAt(0); this.msgFail=hX_3.ERR_number_char; break; } } if ((this.msgFail.length == 0) && (leftc.length == 0) && (rightc.length==0)) this.msgFail=hX_3.ERR_empty; if (this.msgFail.length == 0 && this.isExponent) { rightc=(rightc.length == 0) ? hX_3._Z : rightc; sNum=((sign < 0) ? this.hardMinus:hX_3._E) + leftc + this.LC_decimalSymbol + rightc; var r=new Number(sNum); if (isNaN(r)) r=null; if (r == null) this.msgFail=hX_3.ERR_number_fail; } else if (this.msgFail.length == 0) { if (leftc.length == 0) leftc=hX_3._Z; if (rightc.length == 0) rightc=hX_3._Z; if (isNaN(leftc)) leftc=hX_3._Z; if (isNaN(rightc)) rightc=hX_3._Z; while (leftc.length + rightc.length > 17) { if (rightc.length > 0) rightc=rightc.substr(0,rightc.length-1); else leftc=leftc.substr(1); } var o=leftc + hX_3._P + rightc; var r=new Number(o); if (isNaN(r)) r=null; if (r == null) { this.msgFail=hX_3.ERR_number_fail; } else { if (this.isPercent) r=r/100; if (this.isMille) r=r/1000; r=r * sign; } } } if (this.msgFail.length > 0) { this.msgFail=hX_3.NLSFormatMsg (this.msgFail, argsFail); return null; } return (r); } HxG_3.prototype.NumberConverter.prototype.matchDigit=function (str) { var matchArr=str.match(/^\d{1,1}/); return (matchArr == null) ? false : true; } HxG_3.prototype.NumberConverter.prototype.markDecimal=function (str) { for (i=0; i < str.length; i++) { if (!this.matchDigit(str.charAt(i))) return i; } return -1; } HxG_3.prototype.NumberConverter.prototype.valueToString=function (numValue, promptChar) { this.msgFail=hX_3._E; if (numValue == null || numValue == 'undefined' || isNaN(numValue) || this.invalidPattern) return hX_3._E; var strValue=null; var i, j; var sign=(numValue >= 0) ? +1 : -1; var abs=Math.abs(numValue); if (this.isExponent) { var nExp=0, fMant=hX_3._E, dMant=hX_3._E; var expnum=new String(abs); expnum=expnum.toUpperCase(); i=expnum.indexOf(this.hardE); if (i >= 0) { nExp=new Number(expnum.substr(i+1)); expnum=expnum.substr(0,i); } i=expnum.indexOf(this.LC_decimalSymbol); i=(i < 0) ? expnum.indexOf(hX_3._P) : i; dMant=expnum; if (i >= 0) { dMant=expnum.substr(0,i); fMant=expnum.substr(i+1); } while (dMant.length > 0 && dMant.charAt(0) == hX_3._Z) dMant=dMant.substr(1); while (fMant.length > 0 && fMant.charAt(fMant.length-1) == hX_3._Z) fMant=fMant.substr(0, fMant.length-1); var sci=(this.DF_MaxIntegerDigits > this.DF_MinIntegerDigits) && (this.DF_MaxIntegerDigits > 1); var zero=(dMant.length==0 && fMant.length==0); var tmp_DF_MinIntegerDigits=(!sci) ? this.DF_MinIntegerDigits : ((this.DF_MinIntegerDigits > 0) ? 1: 0); var e=(zero) ? 0 : tmp_DF_MinIntegerDigits - dMant.length; for (i=0; dMant.length==0 && i < fMant.length && fMant.charAt(i)==hX_3._Z; i++) e++; nExp -= e; if (sci) { var eToBe=(nExp<0) ? ((Math.ceil (Math.abs(nExp)/this.DF_MaxIntegerDigits)) * -this.DF_MaxIntegerDigits) : ((Math.floor(Math.abs(nExp)/this.DF_MaxIntegerDigits)) * this.DF_MaxIntegerDigits); e=e + (nExp - eToBe); nExp=eToBe; } if (e > 0) { fMant=hX_3.padR(fMant,e); dMant=dMant + fMant.substr(0,e); fMant=fMant.substr(e); } else if (e < 0) { fMant=dMant.substr(dMant.length+e) + fMant; dMant=dMant.substr(0,dMant.length+e); } var exp=(Math.abs(nExp)).toString(); exp=this.hardE + ((nExp >= 0) ? hX_3._E:this.LC_minusSymbol) + hX_3.padL(exp, this.DF_MinExponentDigits); while (dMant.length > tmp_DF_MinIntegerDigits && dMant.charAt(0) == hX_3._Z) dMant=dMant.substr(1); var sigDigits=this.DF_MaxIntegerDigits - dMant.length + ((this.DF_MinFractionDigits==0 || 1==1) ? this.DF_MaxFractionDigits : this.DF_MinFractionDigits); var fM=hX_3.truncateRoundHalfEven(fMant, sigDigits); fMant=fM.value; if (fM.overflow) { var n=new Number(dMant) + 1; dMant=((sign < 0)?this.hardMinus:hX_3._E) + n.toString() + hX_3._P + fMant + exp; n=new Number(dMant); return (this.valueToString (n)); } else { sigDigits=(zero) ? this.DF_MinFractionDigits : ((!sci) ? this.DF_MinFractionDigits : (this.DF_MinIntegerDigits + this.DF_MinFractionDigits - dMant.length)); dMant=hX_3.padL(dMant, tmp_DF_MinIntegerDigits); fMant=hX_3.padR(fMant, sigDigits); while (fMant.length > sigDigits && fMant.charAt(fMant.length-1) == hX_3._Z) fMant=fMant.substr(0,fMant.length-1); strValue=(fMant.length == 0 || !this.DF_IsDecimalShown) ? (dMant + exp) : (dMant + this.LC_decimalSymbol + fMant + exp); } } else { var left=Math.floor(abs); var right=abs - left; var fullstring=abs.toString(); var fullleft=fullstring, fullright=hX_3._E; var q=this.markDecimal(fullstring); if (q >= 0) { fullleft=fullstring.substr(0,q); fullright=fullstring.substr(q+1); } left=left.toString(); right=right.toString(); right=right.substr(this.markDecimal(right)+1); if (right != fullright && right != hX_3._Z) { if (fullright.length < right.length) right=fullright; } if (this.isPercent) { right=hX_3.padR(right,2); left=left + right.substr(0,2); right=right.substr(2); } else if (this.isMille) { right=hX_3.padR(right,3); left=left + right.substr(0,3); right=right.substr(3); } if (right.length > this.DF_MaxFractionDigits) { var fR=hX_3.truncateRoundHalfEven(right, this.DF_MaxFractionDigits); right=fR.value; if (fR.overflow) { var n=new Number(left); n=(n+1); left=n.toString(); } } right=hX_3.padR(right, this.DF_MinFractionDigits, this.LC_paddingChar); left=hX_3.padL(left, this.DF_MinIntegerDigits, this.LC_paddingChar); while (left.length > this.DF_MinIntegerDigits && left.charAt(0) == this.LC_paddingChar) left=left.substr(1); while (right.length > this.DF_MinFractionDigits && right.charAt(right.length-1) == this.LC_paddingChar) right=right.substr(0,right.length-1); var nR=new Number(right), nL=new Number(left); var zZ=false, zero=(nR == 0) && (nL == 0); var zR=zL=this.LC_paddingChar; if (this.DF_PaddingLeft.length > 0) { zL=(this.DF_PaddingLeft.length > 0) ? this.DF_PaddingLeft : this.LC_paddingChar; zR=(this.DF_PaddingRight.length > 0) ? this.DF_PaddingRight : this.LC_paddingChar; zZ=(this.DF_PaddingLeft.length > 0) && (this.DF_PaddingRight.length > 0) && (this.DF_PaddingLeft == this.DF_PaddingRight); if (zL != this.LC_paddingChar) { if (zero && zZ) { left=hX_3.padR(hX_3._E, this.DF_MinIntegerDigits, zL); right=hX_3.padR(hX_3._E, this.DF_MinFractionDigits, zL); } else { for (i=0; i < left.length; i++) { if (left.charAt(i) != this.LC_paddingChar) break; left=left.substr(0,i) + zL + left.substr(i+1); } } } if (zR != this.LC_paddingChar) { for (i=right.length-1; i >= 0; i--) { if (right.charAt(i) != this.LC_paddingChar) break; right=right.substr(0,i) + zR + right.substr(i+1); } } } if (promptChar) { if (left.length > 0 && left.length > this.DF_MaxIntegerDigits) left=left.substr(left.length-this.DF_MaxIntegerDigits); if (right.length > 0 && right.length > this.DF_MaxFractionDigits) right=right.substr(0, this.DF_MaxFractionDigits); while (left.length > this.DF_MinIntegerDigits && left.charAt(0) == zL) left=left.substr(1); while (right.length > this.DF_MinFractionDigits && right.charAt(right.length-1) == zR) right=right.substr(0,right.length-1); left=hX_3.padL(left, this.DF_MaxIntegerDigits, promptChar); right=hX_3.padR(right, this.DF_MaxFractionDigits, promptChar); } j=0; strValue=left; if (this.DF_GroupingSize > 0) { strValue=hX_3._E; for (i=left.length-1; i >= 0; i--) { if (j == this.DF_GroupingSize) { if (promptChar) strValue=((left.charAt(i)==promptChar) ? hX_3._E : this.LC_groupingSymbol) + strValue; else if (zL != this.LC_paddingChar) strValue=((left.charAt(i)==zL) ? zL : this.LC_groupingSymbol) + strValue; else strValue=this.LC_groupingSymbol + strValue; j=0; } strValue=left.charAt(i) + strValue; j++; } } if (this.DF_IsDecimalShown) { if (zero && zZ && zL != this.LC_paddingChar) strValue=strValue + zL + right; else strValue=strValue + this.LC_decimalSymbol + right; } } if (sign > 0 || zero) strValue=this.DF_PositivePrefix + strValue + this.DF_PositiveSuffix; else strValue=(!this.DF_NegativePattern) ? (this.LC_minusSymbol + this.DF_PositivePrefix + strValue + this.DF_PositiveSuffix) : (this.DF_NegativePrefix + strValue + this.DF_NegativeSuffix); return strValue; } HxG_3.prototype.NumberConverter.prototype.constantToValue=function (sNum) { var left, right; var sign=1; var str=sNum; if (sNum.charAt(0) == this.hardMinus) { sign=-1; str=sNum.substr(1); } var j=str.indexOf(hX_3._P); if (j >= 0) { left=str.substr(0,j); right= str.substr(j+1); } else { left=str; right=hX_3._Z; } if (left.length == 0) left=hX_3._Z; if (right.length == 0) right=hX_3._Z; var o=left + hX_3._P + right; return ((new Number(o))*sign); } HxG_3.prototype.NumberConverter.prototype.valueToConstant=function (nNum) { return (null); } HxG_3.prototype.NumberValidator=function () { this.type="number"; this.minimumBound=null; this.maximumBound=null; this.minimum=null; this.maximum=null; this.required=null; this.ELexpression=null; this.ELexpressionImp=null; this.msgFail=hX_3._E; this.attributeTable=new Array(); this.attributeTable ['required']=['required', hX_3.ARG_IS_TRUE, false, null, null]; this.attributeTable ['minimum-bound']=['minimumBound', hX_3.ARG_TO_BIGNUM, false, -999999999999999,999999999999999]; this.attributeTable ['min-bound']=['minimumBound', hX_3.ARG_TO_BIGNUM, false, -999999999999999,999999999999999]; this.attributeTable ['maximum-bound']=['maximumBound', hX_3.ARG_TO_BIGNUM, false, -999999999999999,999999999999999]; this.attributeTable ['max-bound']=['maximumBound', hX_3.ARG_TO_BIGNUM, false, -999999999999999,999999999999999]; this.attributeTable ['constraint-expression']=['ELexpression', hX_3.ARG_TO_NAN, false, null, null]; this.setAttribute(arguments); } HxG_3.prototype.NumberValidator.prototype.setAttribute=function(a) { var wasmax=this.maximumBound; var wasmin=this.minimumBound; hX_3.parseArg (this.attributeTable, this, a); if (this.minimumBound != null && (wasmin == null || wasmin != this.minimumBound)) this.minimum=new Number(this.minimumBound); if (this.maximumBound != null && (wasmax == null || wasmax != this.maximumBound)) this.maximum=new Number(this.maximumBound); if (this.maximum && this.minimum) { if (this.minimum >= this.maximum) this.minimumBound=this.maximumBound=this.minimum=this.maximum=null; } if (this.ELexpression != null) this.ELexpressionImp=hX_3.regExp.registerELConstraint(this.ELexpression); return true; } HxG_3.prototype.NumberValidator.prototype.getAttribute=function (attribute) { return (hX_3.getArg(this.attributeTable, this, attribute)); } HxG_3.prototype.NumberValidator.prototype.lastError=function () { return ((this.msgFail && this.msgFail.length > 0) ? this.msgFail : null); } HxG_3.prototype.NumberValidator.prototype.validate=function (testnum, iNP) { var test=null; this.msgFail=hX_3._E; var NP=(iNP != null) ? hX_3.getConverterById(iNP) : null; if (NP == null || !hX_3.isObject (NP)) { this.msgFail=hX_3.ERR_required; return false; } if (testnum == null || hX_3.isString(testnum)) { var r=!(this.required); if (testnum == null) { this.msgFail=(r) ? hX_3._E : hX_3.ERR_required; return r; } var e=hX_3.allTrim (testnum); if (e.length == 0) { this.msgFail=(r) ? hX_3._E : hX_3.ERR_required; return r; } test=NP.stringToValue(e); } else { test=testnum; } if (test == null || isNaN (test)) { this.msgFail=hX_3.ERR_required; return false; } if (this.minimum) { if (test < this.minimum) { this.msgFail=hX_3.ERR_minimum; return false; } } if (this.maximum) { if (test > this.maximum) { this.msgFail=hX_3.ERR_maximum; return false; } } if (this.ELexpressionImp != null) { if (!hX_3.regExp.testELExp(test, this.ELexpressionImp)) { this.msgFail=hX_3.ERR_constraint; return false; } } return true; } HxG_3.prototype.NumberValidator.prototype.coerce=function (testnum, iNP) { var o=null; this.msgFail=hX_3._E; var NP=(iNP != null) ? hX_3.getConverterById(iNP) : null; if (NP == null || !hX_3.isObject(NP)) { this.msgFail=hX_3.ERR_required; return false; } if (testnum != null && hX_3.isString(testnum)) { var e=hX_3.allTrim (testnum); if (e.length > 0) o=NP.stringToValue(e); } else { o=testnum; } if (o == null || isNaN (o)) o=new Number (0); if (this.minimum) { if (o < this.minimum) o=this.minimum; } if (this.maximum) { if (o > this.maximum) o=this.maximum; } return o; } HxG_3.prototype.NumberAssist=function (_elem, _state, _converter, _validator, _promptChar) { if (!_elem || !_converter || !_state) return; this.isFilled=isFilled; this.onFocus=onFocus; this.onBlur=onBlur; this.toAssist=toAssist; this.fromAssist=fromAssist; this.onClick=onClick; this.onCut=onCut; this.onCopy=onCopy; this.onPaste=onPaste; this.onChangeKeyCode= onChangeKeyCode; this.onChangeChrCode= onChangeChrCode; this.onValidate=onValidate var elem=_elem; var state=_state; var base_converter=_converter; var cvt=null; var outcvt=null; var validator=_validator; var promptChar=_promptChar; var command=hX_3._E; var lastCommand=-1; var firstCommand=-1; var decimalCommand=-1; var minusSign=null; var plusSign="+"; var zero=null; var zeroS=null; var negZeroS=null; var posZeroS=null; var negNullS=null; var posNullS=null; var nullOK=true; var getCChar=function (i) { return (i < 0 || i >= command.length) ? hX_3._E : command.charAt(i); } if (base_converter.signedConverter == null) base_converter.genAssistMasks(); outcvt=(base_converter.signedConverter) ? base_converter.signedConverter : base_converter; cvt=(base_converter.zeroConverter) ? base_converter.zeroConverter : base_converter; if (validator && (validator.required) != null && validator.required) nullOK=(cvt.nStrict != null && cvt.nStrict > 1) ? true : false; minusSign=cvt.LC_minusSymbol; zero=(validator) ? validator.coerce(0, cvt) : 0; zeroS=cvt.valueToString(zero, promptChar); posZeroS=cvt.valueToString(0, promptChar); negZeroS=cvt.valueToString(-1, promptChar); zeroS=(nullOK) ? hX_3.replaceAll(posZeroS, hX_3._Z, promptChar) : zeroS; if (nullOK) { negNullS=hX_3.replaceAll(negZeroS, "1", promptChar); posNullS=zeroS; } negZeroS=hX_3.replaceAll(negZeroS, "1", hX_3._Z); renewMaskHandler(elem.value); function handleDelete (evt) { var v=state.getValue(); var pos=state.getPos(); pos=(evt.type == "cut") ? (pos) : ((evt.keyCode == hX_3.KEY_BS) ? pos-1 : pos); if (pos < 0 && !state.hasSel()) return true; var cR=getCChar(pos); if (cR != hX_3._LB && !state.hasSel()) { if (cR == hX_3._EQ && (v.charAt(pos)== cvt.LC_decimalSymbol || v.charAt(pos)==cvt.LC_groupingSymbol) && evt.type != "cut") { pos=(evt.keyCode == hX_3.KEY_DEL) ? pos+1 : pos; state.setPos(pos); return -2; } return false; } var isLeft=((!cvt.DF_IsDecimalShown) || (pos <= decimalCommand)); if (state.hasSel()) { var rg=hX_3.sel.getSelectionR(elem); if ((rg.start <= 0) && (rg.end >= v.length)) { state.setValue(zeroS); state.setPos((cvt.DF_IsDecimalShown) ? decimalCommand : lastCommand+1); } else { adjRange(rg); if (cvt.DF_IsDecimalShown && ((v.substring(rg.start,rg.end)).indexOf(cvt.LC_decimalSymbol) >= 0)) { state.setValue(v.substr(0,rg.start) + cvt.LC_decimalSymbol + v.substr(rg.end)); state.setPos(decimalCommand); } else { state.setValue(v.substr(0,rg.start) + v.substr(rg.end)); state.setPos((!cvt.DF_IsDecimalShown) ? rg.end : ((rg.end <= decimalCommand)?rg.end:rg.start)); } } } else { state.setValue (v.substr(0,pos) + v.substr(pos+1)); state.setPos(pos+1+((isLeft)?(0):(-1))); } state.setPos (holdCursor(state.getPos(), state.getValue(), isLeft)); return -2; } function handleInsert (v, ch, pos, sel) { var l=v.length, wasV=v, isLeft=((!cvt.DF_IsDecimalShown) || (pos <= decimalCommand)); if (sel) { var rg=hX_3.sel.getSelectionR(elem); if ((rg.start <= 0) && (rg.end >= v.length)) { v=zeroS; if (cvt.DF_IsDecimalShown) { v=(ch.length > 1 && ch.indexOf(cvt.LC_decimalSymbol) >= 0) ? v : (v.substr(0,decimalCommand-1) + ch + v.substr(decimalCommand)); pos=decimalCommand; } else { v=v.substr(0,lastCommand) + ch + v.substr(lastCommand+1); pos=lastCommand+1; } } else { adjRange(rg); if (cvt.DF_IsDecimalShown && ((v.substring(rg.start,rg.end)).indexOf(cvt.LC_decimalSymbol) >= 0)) { v=(ch.length > 1 && ch.indexOf(cvt.LC_decimalSymbol) >=0) ? (v.substr(0,rg.start) + ch + v.substr(rg.end)) : (v.substr(0,rg.start) + ch + cvt.LC_decimalSymbol + v.substr(rg.end)); pos=decimalCommand; } else { v=v.substr(0,rg.start) + ch + v.substr(rg.end); pos=rg.end; } } state.setPos(holdCursor(pos, v, isLeft)); } else { var insertMode=false, fillLeft=false, fillRight=false, c=v.charAt(pos); if (c == promptChar) { if (isLeft && (pos < l-1) && (v.charAt(pos+1)==promptChar)) fillRight=true; else if (!isLeft && (v.charAt(pos-1)==promptChar)) fillLeft=true; } insertMode=(cvt.DF_IsDecimalShown) ? (c == cvt.LC_decimalSymbol) : (pos > lastCommand); if (isFilled(pos)) return -2; if (!insertMode) { v=v.substr(0,pos) + ch + v.substr(pos+1); if (pos+1 < lastCommand && getCChar(pos+1) == hX_3._EQ) pos++; state.setPos(pos+1); var ipos=pos; if (fillRight) { ipos++; while (v.charAt(ipos) == promptChar) { v=v.substr(0,ipos) + hX_3._Z + v.substr(ipos+1); ipos++; } } else if (fillLeft) { ipos--; while (v.charAt(ipos) == promptChar) { v=v.substr(0,ipos) + hX_3._Z + v.substr(ipos+1); ipos--; } } } else { c=v.charAt(firstCommand); if (isLeft && (c==promptChar || c==hX_3._Z || c==hX_3._B)) v=v.substr(0,pos) + ch + v.substr(pos); else return false; } if (v != wasV) state.setPos(holdCursor(state.getPos(), v, isLeft)); } state.setValue(v); return -2; } function handleCaretPrev (evt) { if (evt.shiftKey || state.hasSel()) return -1; else { state.setPos(getMovePrevSkipRange(state.getPos())); return -2; } } function handleCaretNext (evt) { if (evt.shiftKey || state.hasSel()) return -1; else { state.setPos(getMoveNextSkipRange(state.getPos())); return -2; } } function getMovePrevSkipRange (pos) { var i, c, v=state.getValue(), l=v.length; for (i=pos-1; i >= 0; i--) { c=getCChar(i); if (c == hX_3._QM || c == hX_3._LB || c == hX_3._EQ) { i=(i < 0) ? 0 : ((i > l) ? l : i); return (i); } } return (0); } function getMoveNextSkipRange (pos) { var i, c, v=state.getValue(), l=v.length; for (i=pos+1; i < l; i++) { if (i == lastCommand+1) return i; c=getCChar(i); if (c == hX_3._QM || c == hX_3._LB || c == hX_3._EQ) { i=(i < 0) ? 0 : ((i > l) ? l : i); return (i); } } return (l); } function getMoveNextSkipChar (ch, pos) { if (ch == cvt.LC_decimalSymbol) { if (!cvt.DF_IsDecimalShown) return {hit:true, skip:decimalCommand-pos}; if (pos == decimalCommand) return {hit:true, skip:decimalCommand-pos+1}; else return {hit:true, skip:decimalCommand-pos}; } else if (cvt.DF_GroupingSize > 0 && cvt.LC_groupingSymbol == ch) { if (pos >= decimalCommand) return {hit:true, skip:0}; var i, l=command.length, p=(pos >= decimalCommand-cvt.DF_GroupingSize) ? 0 : pos; for (i=p; i < l; ++i) { if (getCChar(i) == hX_3._EQ) return {hit:true, skip:(i - pos + 1)}; } } return {hit:false, skip:0}; } function centerCursor (v, plus) { var newpos=-1; if (cvt.DF_IsDecimalShown) newpos=v.indexOf(cvt.LC_decimalSymbol); if (newpos < 0) { newpos=v.length; if (plus && cvt.DF_PositiveSuffix) newpos -= cvt.DF_PositiveSuffix.length; else if ((!plus) && cvt.DF_NegativeSuffix) newpos -= cvt.DF_NegativeSuffix.length; newpos=(newpos < 0) ? 0 : newpos; } return newpos; } function adjRange (rg) { var pre=0, suff=command.length; while (pre < suff && (command.charAt(pre) == hX_3._VB || command.charAt(pre) == hX_3._QM)) pre++; if (command.charAt(suff-1) == hX_3._VB || command.charAt(suff-1) == hX_3._QM) { suff--; while (suff >= 0 && (command.charAt(suff) == hX_3._VB || command.charAt(suff) == hX_3._QM)) suff--; } rg.start=(rg.start < pre) ? pre : rg.start; rg.end=(rg.end > (suff+1)) ? (suff+1) : rg.end; } function holdCursor (pos, v, isLeft) { var r=pos; var plusPrefix=(cvt.DF_PositivePrefix) ? cvt.DF_PositivePrefix : hX_3._E; var minusPrefix=(cvt.DF_NegativePrefix) ? cvt.DF_NegativePrefix : hX_3._E; if (cvt.DF_GroupingSize > 0 || (plusPrefix.length != minusPrefix.length)) { var i, oldDigPos=-1, newValue=cvt.stringToValue(v, promptChar); if (isLeft) { oldDigPos=0; for (i=decimalCommand-1; (i >= pos) && (i >= 0); i--) { if (getCChar(i) != hX_3._EQ) oldDigPos++; } } newValue=cvt.valueToString(newValue, promptChar); newValue=(newValue == null || newValue.length == 0) ? zeroS : newValue; if (newValue != null && newValue.length > 0) { var wasCommand=command; renewMaskHandler(newValue); if (oldDigPos < 0) r=pos + (command.length - wasCommand.length); else { r=decimalCommand; while (oldDigPos > 0 && r > 0) { r--; if (getCChar(r) != hX_3._EQ) oldDigPos--; } } } } return r; } function putNumberToClipboard () { var v=state.getValue(); var rg=hX_3.sel.getSelectionR(elem); hX_3.clip.valueAsString=v.substring(rg.start,rg.end); adjRange(rg); v=v.substring(rg.start,rg.end); if (cvt.DF_GroupingSize > 0) v=hX_3.replaceAll(v, cvt.LC_groupingSymbol,hX_3._E); hX_3.clip.valueAsNumber=hX_3.replaceAll(v, promptChar,hX_3._E); } function renewMaskHandler (v) { var l=v.length, h=null, c=hX_3._E, prefix=hX_3._E, suffix=hX_3._E; var iV=cvt.stringToValue(v, promptChar); var plus=(iV==null) ? (!(negNullS != null && v == negNullS)) : ((iV == 0) ? (!(negZeroS != null && v == negZeroS)) : (iV > 0)); if (plus) { prefix=(cvt.DF_PositivePrefix) ? cvt.DF_PositivePrefix : hX_3._E; suffix=(cvt.DF_PositiveSuffix) ? cvt.DF_PositiveSuffix : hX_3._E; } else { prefix=(cvt.DF_NegativePrefix) ? cvt.DF_NegativePrefix : hX_3._E; suffix=(cvt.DF_NegativeSuffix) ? cvt.DF_NegativeSuffix : hX_3._E; } prefix=prefix.length; suffix=v.length - suffix.length; lastCommand=0; firstCommand=-1; decimalCommand=-1; for (var i=0; i < l; ++i) { h=v.charAt(i); if (i < prefix) c=c + (((!plus) && h == cvt.LC_minusSymbol) ? hX_3._QM : hX_3._VB); else if (i >= suffix) c+=hX_3._VB; else { if (cvt.DF_GroupingSize > 0 && h == cvt.LC_groupingSymbol) c+= hX_3._EQ; else if (cvt.DF_IsDecimalShown && h == cvt.LC_decimalSymbol) { c+=hX_3._EQ; decimalCommand=i; } else { c+=hX_3._LB; firstCommand=(firstCommand < 0) ? i : firstCommand; lastCommand=i; } } } decimalCommand=(cvt.DF_IsDecimalShown) ? decimalCommand : suffix; command=c; return (plus); } function isFilled (curpos) { renewMaskHandler(elem.value); var c=(cvt.DF_IsDecimalShown && cvt.DF_MaxFractionDigits>0) ? elem.value.charAt(lastCommand) : elem.value.charAt(firstCommand); if (c == hX_3._B || c == promptChar) return false; return (curpos > lastCommand); } function onFocus (evt) { var newValue=toAssist(elem.value); renewMaskHandler(newValue.v); var newpos=centerCursor(newValue.v, (newValue.i>=0)); elem.value=newValue.v; hX_3.sel.setCaretPos(elem, newpos, null, hX_3.brw.isNavOrMoz()); return true; } function toAssist (v) { var inum=(v.length == 0) ? null : base_converter.stringToValue(v); var newValue=null; if (inum == null && nullOK) { inum=0; newValue=zeroS; } else { inum=(inum==null) ? zero : inum; var newValueO=outcvt.valueToString(inum, promptChar); newValue=cvt.valueToString(inum, promptChar); if (cvt.DF_IsDecimalShown) { var i=decimalCommand, j=newValueO.indexOf(cvt.LC_decimalSymbol), k=newValue.indexOf(cvt.LC_decimalSymbol); if (i >= 0 && j >= 0 && k >= 0) { i++; j++; k++; while (i < command.length && command.charAt(i) == hX_3._LB && j < newValueO.length && k < newValue.length) { if (newValueO.charAt(j) == hX_3._Z && newValue.charAt(k) == promptChar) newValue=newValue.substr(0,k) + hX_3._Z + newValue.substr(k+1); i++; j++; k++; } } } } newValue=(newValue != null) ? newValue : hX_3._E; return {v:newValue, i:inum}; } function onBlur (evt) { var newValue=fromAssist(elem.value); if (newValue != null) { elem.value=newValue; return true; } return false; } function fromAssist (v) { if (v.length==0) return hX_3._E; var newValue=outcvt.stringToValue(v, promptChar); return (newValue != null) ? base_converter.valueToString(newValue) : hX_3._E; } function onClick (evt) { if (state.hasSel()) return true; var v=state.getValue(), pos=state.getPos(); renewMaskHandler(v); if (pos <= 0 || pos > (v.length-1)) return true; var newpos, MoveR=true, cL=getCChar(pos-1), cR=getCChar(pos); if (cL == hX_3._LB || cR == hX_3._LB || cL == hX_3._QM || cR == hX_3._QM || cL == hX_3._EQ || cR == hX_3._EQ) return true; if (cvt.DF_IsDecimalShown) MoveR=(pos <= v.indexOf(cvt.LC_decimalSymbol)); newpos=(MoveR) ? getMoveNextSkipRange(pos) : getMovePrevSkipRange(pos); state.setPos(newpos); return -2; } function onChangeKeyCode (evt) { renewMaskHandler(state.getValue()); switch (hX_3.getKeyCode(evt)) { case hX_3.KEY_BS: case hX_3.KEY_DEL: return handleDelete(evt); case hX_3.KEY_LTARROW: return handleCaretPrev(evt); case hX_3.KEY_RTARROW: return handleCaretNext(evt); } return true; } function onCut (evt) { if (hX_3.brw.isIE() && state.hasSel()) { var cutText=hX_3.sel.getSelection(elem); window.clipboardData.setData("Text", cutText); putNumberToClipboard(); renewMaskHandler(state.getValue()); return handleDelete(evt); } return true; } function onCopy (evt) { if (hX_3.brw.isIE() && state.hasSel()) putNumberToClipboard(); return true; } function onPaste (evt) { if (hX_3.brw.isIE()) { var cutText=window.clipboardData.getData("Text"); var v=state.getValue(), pos=state.getPos(), sel=state.hasSel(); if (cutText == hX_3.clip.valueAsString) cutText=hX_3.clip.valueAsNumber; else { if (cvt.DF_GroupingSize > 0) cutText=hX_3.replaceAll(cutText, cvt.LC_groupingSymbol,hX_3._E); cutText=hX_3.replaceAll(cutText, promptChar,hX_3._E); } var d=false; if (sel) { var rg=hX_3.sel.getSelectionR(elem); d=(v.substring(rg.start,rg.end).indexOf(cvt.LC_decimalSymbol) >= 0); } if (!d) { d=cutText.indexOf(cvt.LC_decimalSymbol); cutText=(d < 0) ? cutText : cutText.substr(0,d)+cutText.substr(d+1); } return (handleInsert(v, cutText, pos, sel)); } return true; } function onChangeChrCode (evt) { var ch=hX_3.getChrCode(evt); if (evt.keyCode == hX_3.KEY_TAB || evt.keyCode == hX_3.KEY_ENTER) return +2; var pos=state.getPos(), v=state.getValue(), sel=state.hasSel() renewMaskHandler(v); if (ch == minusSign || ch == plusSign) { var iV=cvt.stringToValue (v, promptChar); var posSignLen=0, negSignLen=0; var isLeft=((!cvt.DF_IsDecimalShown) || (pos <= decimalCommand)); var isNeg=((iV == null && negNullS && v==negNullS) || (iV == 0 && negZeroS && v==negZeroS) || (iV != null && iV != 0 && iV < 0)); if (sel) { var rg=hX_3.sel.getSelectionR(elem); isNeg=((rg.start <= 0) && (rg.end >= v.length)) ? false : isNeg; handleDelete(evt); pos=state.getPos(); v=state.getValue(); } iV=cvt.stringToValue (v, promptChar); iV=(iV != null) ? (iV * -1) : null; if (iV == null || iV == 0) { if (pos > 0) { posSignLen=(cvt.DF_PositivePrefix) ? cvt.DF_PositivePrefix.length : 0; negSignLen=(cvt.DF_NegativePrefix) ? cvt.DF_NegativePrefix.length : 0; } if ((iV == 0 && isNeg) || (iV == null && isNeg)) { v=(iV==0) ? posZeroS : (posNullS) ? posNullS: posZeroS; ch=(sel) ? 0 : (posSignLen-negSignLen); } else { v=(iV==0) ? negZeroS : (negNullS) ? negNullS : negZeroS; ch=negSignLen-posSignLen; } state.setValue(v); state.setPos (pos+ch, v, isLeft); renewMaskHandler(v); return -2; } else { if (pos > 0) { posSignLen=(cvt.DF_PositivePrefix) ? cvt.DF_PositivePrefix.length : 0; negSignLen=(cvt.DF_NegativePrefix) ? cvt.DF_NegativePrefix.length : 0; } ch=(iV < 0) ? (negSignLen-posSignLen) : (posSignLen-negSignLen); v=cvt.valueToString(iV); state.setValue(v); state.setPos (pos+ch, v, isLeft); renewMaskHandler(v); return -2; } } if (!sel) { var skip=getMoveNextSkipChar(ch, pos); if (skip.hit) { state.setPos(pos+skip.skip); return -2; } } return (handleInsert (v, ch, pos, sel)); } function onValidate (evt) { var v=state.getValue(); var newValue=cvt.stringToValue(v, promptChar); if (newValue != null) { if (newValue == 0 && negZeroS != null && v == negZeroS) newValue=negZeroS; else newValue=cvt.valueToString(newValue, promptChar); } else if (negNullS != null && v == negNullS) { newValue=negNullS; } if (newValue != null) { if (cvt.DF_IsDecimalShown) { var i=decimalCommand; var j=v.indexOf(cvt.LC_decimalSymbol); var k=newValue.indexOf(cvt.LC_decimalSymbol); if (i >= 0 && j >= 0 && k >= 0) { i++; j++; k++; while (i < command.length && command.charAt(i) == hX_3._LB && j < v.length && k < newValue.length) { if (v.charAt(j) == hX_3._Z && newValue.charAt(k) == promptChar) newValue=newValue.substr(0,k) + hX_3._Z + newValue.substr(k+1); i++; j++; k++; } } } state.setValue(newValue); return true; } else if (cvt.lastError() == hX_3.ERR_empty) { state.setValue(zeroS); return true; } return false; } } HxG_3.prototype.MaskConverter=function () { this.type="mask"; this.nStrict=hX_3.MFMT_DEFAULTSTRICT; this.maskFormat=""; this.maskFormatLast=-1; this.maskFormatFirst=-1; this.msgFail=""; this.intMsgFail=""; this.attributeTable=new Array(); this.attributeTable ['strict']=['nStrict', hX_3.ARG_TO_NUM, false, 0, 2]; this.attributeTable ['mask']=['maskFormat',hX_3.ARG_TO_NAS, false, null, null]; this.setAttribute(arguments); } HxG_3.prototype.MaskConverter.prototype.setAttribute=function(a) { hX_3.parseArg (this.attributeTable, this, a); this.maskFormatFirst=-1; this.maskFormatLast=-1; for (var i=0; i < this.maskFormat.length; i++) { if (this.maskFormat.charAt(i) == "#" || this.maskFormat.charAt(i) == "?") { this.maskFormatLast=i; this.maskFormatFirst=(this.maskFormatFirst >= 0) ? this.maskFormatFirst : i; } } return true; } HxG_3.prototype.MaskConverter.prototype.getAttribute=function (attribute) { return (hX_3.getArg(this.attributeTable, this, attribute)); } HxG_3.prototype.MaskConverter.prototype.lastError=function () { return ((this.msgFail && this.msgFail.length > 0) ? this.msgFail : null); } HxG_3.prototype.MaskConverter.prototype.getMaxLength=function () { return this.maskFormat.length; } HxG_3.prototype.MaskConverter.prototype.stringToValue=function (inString, promptChar) { this.msgFail=""; this.intMsgFail=""; var argsFail=new Array(); argsFail[0]=inString; if (inString == null || hX_3.isUnDef(typeof(inString)) || !hX_3.isString(inString)) { this.msgFail=hX_3.ERR_empty; return null; } var v=hX_3.Trim(inString); var l=v.length; var l1=this.maskFormat.length; if (l == 0) return ""; if (l > l1 && (!promptChar && l != l1)) { this.msgFail=hX_3.ERR_constraint; return null; } var out=""; var c, i, m, x, x1; for (i=0; i < l; i++) { c=null; x=v.charAt(i); m=this.maskFormat.charAt(i); if (m == "#" || m == "?") { if (promptChar && (x == promptChar || x == " ")) c=" "; else if (m == "#") { c=((hX_3.isChar(x, "0123456789")) ? x : null); } else { x1=x.toUpperCase(); c=((hX_3.isChar(x1,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")) ? x : null); } } else c=((x == m) ? "" : null); if (c == null) { this.msgFail=hX_3.ERR_constraint; return null; } out=out + c; } out=hX_3.Trim(out); return out; } HxG_3.prototype.MaskConverter.prototype.valueToString=function (inStr, promptChar) { this.msgFail=""; if (inStr == null) return ""; var c, i, j=0, out=""; var l=this.maskFormat.length; var l1=inStr.length; for (i=0; i < l; i++) { c=this.maskFormat.charAt(i); if (c == "#" || c == "?") { if (j < l1) out=out + inStr.charAt(j); else if (promptChar) out=out + promptChar; else { this.msgFail=hX_3.ERR_constraint; return null; } j++; } else { out=out + c; } } return out; } HxG_3.prototype.MaskConverter.prototype.constantToValue=function (s) { return (null); } HxG_3.prototype.MaskConverter.prototype.valueToConstant=function (s) { return (null); } HxG_3.prototype.StringValidator=function () { this.type="string"; this.minimumLength=null; this.maximumLength=null; this.required=null; this.constraint=null; this.constraintImp=null; this.constraintExp=null; this.constraintExpImp=null; this.ELexpression=null; this.ELexpressionImp=null; this.msgFail=""; this.attributeTable=new Array(); this.attributeTable ['required']=['required', hX_3.ARG_IS_TRUE, false, null, null]; this.attributeTable ['minimum-length']=['minimumLength', hX_3.ARG_TO_NUM, false, 0, 9999999]; this.attributeTable ['min-length']=['minimumLength', hX_3.ARG_TO_NUM, false, 0, 9999999]; this.attributeTable ['maximum-length']=['maximumLength', hX_3.ARG_TO_NUM, false, 1, 9999999]; this.attributeTable ['max-length']=['maximumLength', hX_3.ARG_TO_NUM, false, 1, 9999999]; this.attributeTable ['constraint']=['constraint', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['constraint-regexpression']= ['constraintExp', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['constraint-expression']=['ELexpression', hX_3.ARG_TO_NAN, false, null, null]; this.setAttribute(arguments); } HxG_3.prototype.StringValidator.prototype.setAttribute=function(a) { hX_3.parseArg (this.attributeTable, this, a); if (this.minimumLength != null && this.minimumLength < 0) this.minimumLength=0; if (this.maximumLength != null && this.maximumLength < 1) this.maximumLength=1; if (this.maximumLength && this.minimumLength && this.minimumLength >= this.maximumLength) { this.minimumLength=this.maximumLength=null; } if (this.constraint) this.constraintImp=hX_3.regExp.getRegExpByName(this.constraint); if (this.constraintExp) this.constraintExpImp=hX_3.regExp.registerConstraint(this.constraintExp); if (this.ELexpression != null) this.ELexpressionImp=hX_3.regExp.registerELConstraint(this.ELexpression); return true; } HxG_3.prototype.StringValidator.prototype.getAttribute=function (attribute) { return (hX_3.getArg(this.attributeTable, this, attribute)); } HxG_3.prototype.StringValidator.prototype.lastError=function () { return ((this.msgFail && this.msgFail.length > 0) ? this.msgFail : null); } HxG_3.prototype.StringValidator.prototype.validate=function (teststr, iC) { this.msgFail=""; var C=(iC != null) ? hX_3.getConverterById(iC) : null; if (teststr != null && !hX_3.isString(teststr)) { this.msgFail=hX_3.ERR_required; return false; } var test=(teststr == null) ? "" : teststr; test=test.replace(/[\r\n]/g, ""); if (test.length == 0) { if (this.required) { this.msgFail=hX_3.ERR_required; return false; } else return true; } if (this.minimumLength && test.length < this.minimumLength) { this.msgFail=hX_3.ERR_minimum; return false; } if (this.maximumLength && test.length > this.maximumLength) { this.msgFail=hX_3.ERR_maximum; return false; } if (this.constraintImp != null) { if (!hX_3.regExp.testRegExp(test, this.constraintImp)) { this.msgFail=hX_3.ERR_constraint; return false; } } if (this.constraintExpImp != null) { if (!hX_3.regExp.testRegExp(test, this.constraintExpImp)) { this.msgFail=hX_3.ERR_constraint; return false; } } if (this.ELexpressionImp != null) { if (!hX_3.regExp.testELExp(test, this.ELexpressionImp)) { this.msgFail=hX_3.ERR_constraint; return false; } } return true; } HxG_3.prototype.MaskAssist=function (_elem, _state, _converter, _validator, _promptChar) { if (!_elem || !_converter || !_state) return; this.isFilled=isFilled; this.onFocus=onFocus; this.onBlur=onBlur; this.onClick=onClick; this.onCut=onCut; this.onPaste=onPaste; this.onChangeKeyCode= onChangeKeyCode; this.onChangeChrCode= onChangeChrCode; this.onValidate=onValidate var elem=_elem; var state=_state; var cvt=_converter; var validator=_validator; var promptChar=_promptChar; var handler=null; handler=new hX_3.MaskAssist.prototype.maskHandler(elem, state, cvt, promptChar); function isFilled (curpos) { var v=elem.value; v=hX_3.Trim(v); var l=v.length; if (l < cvt.maskFormat.length) return false; var c=v.charAt(cvt.maskFormatLast); return ((curpos > cvt.maskFormatLast) && (c != promptChar) && (c != " ")); } function onFocus () { var newValue=(elem.value) ? hX_3.Trim(elem.value) : null; newValue=(newValue && newValue.length > 0) ? cvt.stringToValue(newValue, promptChar) : null; newValue=(newValue) ? cvt.valueToString(newValue, promptChar) : handler.getEmptyMask(); elem.value=newValue; hX_3.sel.setCaretPos(elem, cvt.maskFormatFirst, null, hX_3.brw.isNavOrMoz()); return true; } function onBlur () { var v=elem.value; if (v.length==0) return true; var newValue=cvt.stringToValue(v, promptChar); if (newValue != null) newValue=(newValue.length==0) ? "" : cvt.valueToString(newValue); if (newValue != null) { elem.value=newValue; return true; } return false; } function onClick (evt) { return handler.onClick(evt); } function onCut (evt) { return handler.onCut(evt); } function onPaste (evt) { return handler.onPaste(evt); } function onChangeKeyCode (evt) { return handler.onChangeKeyCode (evt); } function onChangeChrCode (evt) { return handler.onChangeChrCode (evt); } function onValidate () { var newValue=cvt.stringToValue(state.getValue(), promptChar); if (newValue != null) newValue=cvt.valueToString(newValue, promptChar); if (newValue != null) return true; return false; } } HxG_3.prototype.MaskAssist.prototype.maskHandler=function(_element, _state, _converter, _promptChar) { var elem=_element; var state=_state; var cvt=_converter; var promptChar=_promptChar; var emptyMask=null; this.onClick=onClick; this.onCut=onCut; this.onPaste=onPaste; this.onChangeKeyCode= onChangeKeyCode; this.onChangeChrCode= onChangeChrCode; this.getEmptyMask=function getEmptyMask() {return emptyMask;} var doDelete=doDelete; var doCaretPrev=doCaretPrev; var doCaretNext=doCaretNext; var getMoveForward=getMoveForward; var getMovePrevious=getMovePrevious; var fillWithMaskPiece= fillWithMaskPiece; var getKeyCode=hX_3.getKeyCode; var getCChar=function (i) { return (i < 0 || i >= cvt.maskFormat.length) ? "" : cvt.maskFormat.charAt(i); } emptyMask=hX_3.replaceAll(cvt.maskFormat, "#", promptChar); emptyMask=hX_3.replaceAll(emptyMask, "?", promptChar); function doDelete (evt) { var pos=state.getPos(); pos=(evt.type == "cut") ? (pos) : ((evt.keyCode == hX_3.KEY_BS) ? pos-1 : pos); if (pos < 0 && !state.hasSel()) return true; var cR=getCChar(pos); if (cR != "#" && cR != "?" && cR != "=" && !state.hasSel()) { if (evt.type != "cut") { pos=(evt.keyCode == hX_3.KEY_BS) ? (pos) : (pos+1); state.setPos(pos); return -2; } return false; } var v=state.getValue(); var s=state.hasSel(); if (s) { var rg=hX_3.sel.getSelectionR(elem); if (rg.start <= 0 && rg.end >= v.length-1) state.setValue(emptyMask); else state.setValue(fillWithMaskPiece(v, rg.start, rg.end)); } else state.setValue (v.substr(0,pos) + promptChar + v.substr(pos+1)); pos=(s || (evt.type != "cut" && evt.keyCode == hX_3.KEY_BS)) ? pos : pos+1; state.setPos(pos); return -2; } function doInsert (v, ch, pos, sel) { if (sel) { var rg=hX_3.sel.getSelectionR(elem); v=fillWithMaskPiece(v, rg.start, rg.end); var c, l=v.length; for (var i=rg.start; i < rg.end; i++) { c=getCChar(i); if (c == "#" || c == "?") break; } if (i < rg.end) v=v.substr(0,i) + ch + v.substr(i+1); state.setPos(rg.start+1); } else { v=v.substr(0,pos) + ch + v.substr(pos+1); pos=getMoveForward (v, pos+1); state.setPos(pos); } state.setValue(v); return -2; } function doCaretPrev (evt) { if (evt.shiftKey || state.hasSel()) return -1; else { var pos=getMovePrevious (state.getValue(), state.getPos()-1); state.setPos(pos); return -2; } } function doCaretNext (evt) { if (evt.shiftKey || state.hasSel()) return -1; else { var pos=getMoveForward (state.getValue(), state.getPos()+1); state.setPos(pos); return -2; } } function getMovePrevious (v, pos) { var c, c1, i; var l=v.length; pos=(pos < 0) ? 0 : ((pos > l) ? l : pos); for (i=pos; i > 0; i--) { c=getCChar(i); c1=getCChar(i+1); if (c == "?" || c == "#" || c1 == "?" || c1 == "#") return (i); } return (0); } function getMoveForward(v, pos) { var c, i; var l=v.length; pos=(pos < 0) ? 0 : ((pos > l) ? l : pos); for (i=pos; i <= l; i++) { c=getCChar(i); if (c == "?" || c == "#") return (i); } return (l); } function fillWithMaskPiece (v, start, end) { return (v.substr(0,start) + emptyMask.substr(start, end-start) + v.substr(end)); } function onClick(evt) { if (state.hasSel()) return true; var v=state.getValue(); var pos=state.getPos(); if (pos <= 0 || pos > (v.length-1)) return true; var cL=getCChar(pos-1); var cR=getCChar(pos); if (cL == "#" || cR == "#" || cL == "?" || cR == "?") return true; var MoveR=true; var posLeft=getMovePrevious (v, pos); var posRight=getMoveForward(v, pos); if ((pos-posLeft) < (posRight-pos)) state.setPos(posLeft); else state.setPos(posRight); return -2; } function onChangeKeyCode (evt) { switch (hX_3.getKeyCode(evt)) { case hX_3.KEY_BS: case hX_3.KEY_DEL: return doDelete(evt); case hX_3.KEY_LTARROW: return doCaretPrev(evt); case hX_3.KEY_RTARROW: return doCaretNext(evt); } return true; } function onCut(evt) { if (hX_3.brw.isIE() && state.hasSel()) { var cutText=hX_3.sel.getSelection(elem); window.clipboardData.setData("Text", cutText); return doDelete(evt); } return true; } function onPaste (evt) { if (hX_3.brw.isIE()) { var cutText=window.clipboardData.getData("Text"); var v=state.getValue(); var pos=state.getPos(); var sel=state.hasSel(); if (sel) { var rg=hX_3.sel.getSelectionR(elem); if (rg.start <= 0 && rg.end >= v.length-1) v=emptyMask; else v=fillWithMaskPiece(v, rg.start, rg.end); } var mChars=false; var c, m, i, r; var l=cutText.length; for (i=0; i < l; i++) { m=getCChar(i); if (m != "#" && m != "?") { mChars=(m == cutText.charAt(i)); break; } } for (i=0; i < l; i++) { m=getCChar(i); c=cutText.charAt(i); if (m != "#" && m != "?" && m == c) { } else { v=v.substr(0,pos) + c + v.substr(pos+1); } pos=(mChars) ? pos+1 : getMoveForward (v, pos+1); } state.setValue(v); pos=getMoveForward (v, pos); state.setPos(pos); return -2; } return true; } function onChangeChrCode (evt) { var v=state.getValue(); var pos=state.getPos(); var sel=state.hasSel(); var ch=hX_3.getChrCode(evt); if (evt.keyCode == hX_3.KEY_TAB || evt.keyCode == hX_3.KEY_ENTER) return +2; return (doInsert(v, ch, pos, sel)); } } HxG_3.prototype.JSFPopup=function (parentid, srcValue, clickstyle) { this.parentid=parentid; this.DOMobj=null; this.parentDOMobj=null; this.parentCOMPobj=null; this.srcValue=""; this.clickstyle=(clickstyle) ? true : false; this.hideArray=null; this.hideArrayV=null; } HxG_3.prototype.JSFPopup.prototype.onPageLoad=function() { this.parentDOMobj=this.p.getElementById(this.parentid); this.parentCOMPobj=this.p.getComponentById(this.parentid); if (this.parentDOMobj && this.parentCOMPobj) { var parentDOM=this.parentDOMobj; if (!this.HTMLrendered) { if (this.srcValue == "") { var elem=document.createElement("div"); elem.setAttribute("id", this.id); elem.style.position="absolute"; elem.style.left="0px"; elem.style.top="0px"; elem.style.height="10px"; elem.style.width="10px"; elem.style.zIndex="1000000"; elem.style.margin="0px"; elem.style.padding="0px"; elem.style.verticalAlign="top"; elem.style.overflow="hidden"; elem.style.display="none"; var newdiv=document.body.insertBefore (elem, (document.body.firstChild)); this.DOMobj=elem; this.HTMLrendered=true; return true; } } } return false; } HxG_3.prototype.JSFPopup.prototype.uivisible=function () { var popuptag=this.DOMobj; var ownertag=this.parentDOMobj; var ownercomp=this.parentCOMPobj; if (popuptag && ownertag && ownercomp) { var xtagtop=this.p.geo.getElementAbsPosTop(ownertag); var xtagleft=this.p.geo.getElementAbsPosLeft(ownertag); var popperheight= this.p.geo.getElementRenderedHeight(ownertag); var popperwidth=this.p.geo.getElementRenderedWidth(ownertag.parentNode); var xtop=xtagtop + popperheight - 1; var xleft=xtagleft; if (this.srcValue == "") { popuptag.style.top=xtop + "px"; popuptag.style.left= xleft + "px"; popuptag.style.display="block"; var h=this.p.geo.getElementRenderedHeight(popuptag); var w=this.p.geo.getElementRenderedWidth(popuptag); var winheight=this.p.geo.getWindowClientHeight(); var winwidth=this.p.geo.getWindowClientWidth(); var wintop=document.body.scrollTop; var winleft=document.body.scrollLeft; if (((xtop-wintop) + h > winheight) && (winheight > h)) popuptag.style.top=(xtagtop - h + 1) + "px"; if (xleft < winleft) popuptag.style.left= winleft + "px"; if (xleft+w >= (winwidth-1)) popuptag.style.left= (xtagleft + popperwidth - (w+2)) + "px"; if (hX_3.brw.isIE() && document.elementFromPoint) { var x1, y1, test; var y=this.p.geo.getElementAbsPosTop(popuptag); var x=this.p.geo.getElementAbsPosLeft(popuptag); var sBase=(hX_3.brw.isIE6_CSS()) ? document.body.parentNode : document.body; y=y - sBase.scrollTop; x=x - sBase.scrollLeft; popuptag.style.display="none"; for (x1=x; x1 < x+w; x1+=15) { for (y1=y; y1 < y+h; y1+=15) { test=document.elementFromPoint(x1, y1); if (test && test.tagName == "SELECT" && test.style.visibility != "hidden" && test.style.display != "none") { if (!this.hideArray) { this.hideArray=new Array(); this.hideArrayV=new Array(); } this.hideArray.push(test); this.hideArrayV.push(test.style.visibility); test.style.visibility= "hidden"; } } } popuptag.style.display="block"; } } this.p.dragger.dragInit (popuptag, ownercomp, true, this.clickstyle); return true; } return false; } HxG_3.prototype.JSFPopup.prototype.uirelease=function () { if (this.DOMobj) { this.DOMobj.style.display="none"; if (this.hideArray) { for (var i=0; i < this.hideArray.length; i++) { if (this.hideArray[i] && this.hideArray[i].style) this.hideArray[i].style.visibility=this.hideArrayV[i]; } this.hideArray=null; } return true; } return false; } HxG_3.prototype.JSFPopup.prototype.isPopped=function() { if (this.DOMobj) { if (this.DOMobj.style.display != "none") return true; } return false; } HxG_3.prototype.tabNavigator=function() { this.getFocus=function (obj, dir) { return focus(obj, ((dir > 0)?+1:-1)); } var tabItems=new Array(); function elem(obj, s) { this.obj=obj; this.name=(obj.name) ? obj.name : ""; this.tabOrder=obj.getAttribute("tabIndex"); this.srcOrder=s; } var tabElements=new Array(); hX_3.tabbableElements(tabElements); collectTabElement(document.body); tabItems.sort(compareTabIndex); function collectTabElement(node) { if (hX_3.isTag(node, tabElements)) { if (notDuplicateElement(node)) tabItems.push(new elem(node, tabItems.length)); } for (var child=node.firstChild; child != null; child=child.nextSibling) collectTabElement(child); } function notDuplicateElement(node) { if (node && hX_3.isDef(typeof(node.nodeType)) && node.nodeType == hX_3.ELEMENT_NODE) { if (node.tagName && node.tagName == "INPUT" && node.type && node.type.toUpperCase() == "RADIO") { if (node.name && node.name.length > 0) { var test=node.name; var l=tabItems.length; for (var ix=0; ix 0 && b > 0) r=a - b; else if (a >= 0 && b <= 0) r=-1; else if (b >= 0 && a <= 0) r=+1; return ((r != 0)? r : (ia.srcOrder - ib.srcOrder)); } function focus(obj, delta) { var r=null; var ix; var hit=false; for (ix=0; ix= tabItems.length) ix0=0; obj0=(tabItems[ix0]).obj; if ((tabItems[ix0]).tabOrder >= 0) hit=hX_3.imp.isFocusable(obj0); ix0+=delta; } r=(hit) ? obj0 : r; } return r; } } HxG_3.prototype.JSFImage=function () { this.type="image"; this.label=null; this.hasIcon=null; this.imageWidth=-1; this.imageHeight=-1; this.imageNormalSrc=""; this.imageMousedSrc=""; this.imageDepressedSrc=""; this.imageDisabledSrc=""; this.iconNormalSrc=null; this.iconMousedSrc=null; this.iconDepressedSrc=null; this.iconDisabledSrc=null; this.CSSNames=false; this.optimizeEvents=false; this.iconHAlign="left"; this.iconVAlign="middle"; this.outerSpan=null; this.labelSpan=null; this.iconSpan=null; this.iconDummySpan=null; this.gE=function (s) { return this.p.geo.getEffectiveStyle(this.DOMobj, s); } this.gPI=function (s) { var r=parseInt(this.p.geo.getEffectiveStyle(this.DOMobj, s), 10); return ((r == null || isNaN(r)) ? 0 : r); } this.gBI=function (s) { return (this.p.geo.parseBorder(this.DOMobj, s, 0)); } this.state=-1; this.image=new Array(null, null, null, null); this.icon=new Array(null, null, null, null); this.classNamesSrc=["_Src", "_Moused", "_Depressed", "_Disabled"]; this.classNamesIcon=["_Icon_Src", "_Icon_Moused", "_Icon_Depressed", "_Icon_Disabled"]; this.attributeTable=new Array(); this.attributeTable ['label']=['label', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['icon']=['hasIcon', hX_3.ARG_IS_TRUE, false, null, null]; this.attributeTable ['width']=['imageWidth', hX_3.ARG_TO_NUM, false, -1, 999999]; this.attributeTable ['height']=['imageHeight', hX_3.ARG_TO_NUM, false, -1, 999999]; this.attributeTable ['normal']=['imageNormalSrc', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['moused']=['imageMousedSrc', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['depressed']=['imageDepressedSrc', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['disabled']=['imageDisabledSrc', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['icon-normal']=['iconNormalSrc', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['icon-moused']=['iconMousedSrc', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['icon-depressed']=['iconDepressedSrc', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['icon-disabled']=['iconDisabledSrc', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['css-names']=['CSSNames', hX_3.ARG_IS_TRUE, false, null, null]; this.setAttribute(arguments); } HxG_3.prototype.JSFImage.prototype.onPageLoad=function () { if (this.DOMobj && this.DOMobj.src) this.imageNormalSrc=this.DOMobj.src; this.addSpansToInput(); this.redraw(); return true; } HxG_3.prototype.JSFImage.prototype.redraw=function () { this.sizeImageToAttributes(); this.setValue(0); return true; } HxG_3.prototype.JSFImage.prototype.uirelease=function () { this.setValue(0); return true; } HxG_3.prototype.JSFImage.prototype.setValue=function (ivalue) { var value=(this.DOMobj.disabled || this.DOMobj.readOnly) ? 3 : ivalue; if (this.state != value && value >= 0 && value <= 3) { var j=value; if (this.image[j] == null || this.image[j].src == null || this.image[j].src.length==0) j=0; if (this.image[j] && this.image[j].src && this.DOMobj.src != this.image[j].src) { this.DOMobj.src=this.image[j].src; if (this.DOMobj) this.DOMobj.src=this.image[j].src; } if (this.iconSpan) { j=value; if (this.icon[j] == null || this.icon[j].src == null) j=0; if (this.icon[j] && this.icon[j].src && this.iconSpan.src != this.icon[j].src) this.iconSpan.src=this.icon[j].src; } this.state=value; return true; } return false; } HxG_3.prototype.JSFImage.prototype.getValue=function() { return this.state; } HxG_3.prototype.JSFImage.prototype.setAttribute=function(a) { hX_3.parseArg (this.attributeTable, this, a); this.state=-1; if (this.HTMLrendered) this.redraw(); return true; } HxG_3.prototype.JSFImage.prototype.getAttribute=function (attribute) { return (hX_3.getArg(this.attributeTable, this, attribute)); } HxG_3.prototype.JSFImage.prototype.dispatchComponent=function (item, evt, action, keycode) { var newvalue=-1; if (this.DOMobj != null) { if (action == "mouseover" || action == "mousemove") newvalue=1; else if (action == "mousedown") newvalue=2; else if (action == "keydown") { if (hX_3.KEY_SPACEBAR || keycode == hX_3.KEY_ENTER) newvalue=2; } else newvalue=0; } this.setValue(newvalue); return; } HxG_3.prototype.JSFImage.prototype.NORMAL=0; HxG_3.prototype.JSFImage.prototype.MOUSED=1; HxG_3.prototype.JSFImage.prototype.DEPRESSED=2; HxG_3.prototype.JSFImage.prototype.DISABLED=3; HxG_3.prototype.JSFImage.prototype.prepImages=function () { var tmpClass=(this.CSSNames) ? this.p.getFirstClassName (this.DOMobj) : null; this.prepImage(this.imageNormalSrc, tmpClass, this.classNamesSrc, this.image, this.NORMAL, this.imageWidth, this.imageHeight); this.prepImage(this.imageMousedSrc, tmpClass, this.classNamesSrc, this.image, this.MOUSED, this.imageWidth, this.imageHeight); this.prepImage(this.imageDepressedSrc, tmpClass, this.classNamesSrc, this.image, this.DEPRESSED, this.imageWidth, this.imageHeight); this.prepImage(this.imageDisabledSrc, tmpClass, this.classNamesSrc, this.image, this.DISABLED, this.imageWidth, this.imageHeight); if (this.hasIcon) { this.prepImage(this.iconNormalSrc, tmpClass, this.classNamesIcon, this.icon, this.NORMAL); this.prepImage(this.iconMousedSrc, tmpClass, this.classNamesIcon, this.icon, this.MOUSED); this.prepImage(this.iconDepressedSrc, tmpClass, this.classNamesIcon, this.icon, this.DEPRESSED); this.prepImage(this.iconDisabledSrc, tmpClass, this.classNamesIcon, this.icon, this.DISABLED); } } HxG_3.prototype.JSFImage.prototype.prepImage=function (insrc, baseClass, classExtents, imp, state, width, height) { var src=insrc; if (baseClass && classExtents && baseClass.length > 0) { var testname=baseClass + classExtents[state]; var testobj=hX_3.isClassDefined(testname); if (testobj && testobj.backgroundImage) { var name=hX_3.allTrim(testobj.backgroundImage); if (name.substr(0,4) == "url(") name=name.substr(4); if (name.charAt(name.length-1) == ")") name=name.substr(0, name.length-1); src=name; } } if (src && (src.length > 0)) { if (imp[state] == null) imp[state]=new Image(0, 0); imp[state].src=src; if (width >= 0 && height >= 0) { imp[state].width=width; imp[state].height=height; } else { imp[state].width=""; imp[state].height=""; } } else { imp[state]=null; } } HxG_3.prototype.JSFImage.prototype.addSpansToInput=function () { if (!this.DOMobj) return false; this.prepImages(); this.DOMobj.setAttribute("src", this.image[this.NORMAL].src); if (this.label || this.hasIcon) { var span=document.createElement("span"); span.setAttribute ("id", this.DOMobj.id + "_OUTERSPAN"); span.style.position=(this.gE("position") == "absolute") ? "absolute" : "relative"; span.style.left=this.gE("left"); span.style.right=this.gE("right"); span.style.top=this.gE("top"); span.style.bottom=this.gE("bottom"); var sv=this.DOMobj.style.display; this.DOMobj.style.display="none"; this.DOMobj.style.position="relative"; this.DOMobj.style.left=this.DOMobj.style.right=this.DOMobj.style.top=this.DOMobj.style.bottom=""; this.outerSpan=this.DOMobj.parentNode.insertBefore(span, this.DOMobj); this.outerSpan.appendChild(this.DOMobj); this.DOMobj.style.display=sv; if (this.label) { span=document.createElement("span"); span.setAttribute ("id", this.DOMobj.id + "_LABELSPAN"); span.style.position="absolute"; span.style.display=""; span.style.cursor="pointer"; span.style.visibility="inherit"; span.style.overflow="hidden"; span.style.textIndent="0px"; span.unselectable=true; this.labelSpan=this.outerSpan.appendChild(span); } if (this.hasIcon && this.icon[this.NORMAL]) { span=document.createElement("img"); span.setAttribute("id", this.DOMobj.id + "_ICONIMG"); span.setAttribute("src", this.icon[this.NORMAL].src); span.style.position="absolute"; span.style.display=""; span.style.cursor="pointer"; span.style.visibility="inherit"; span.style.overflow="hidden"; span.style.textIndent="0px"; this.iconSpan=this.outerSpan.appendChild(span); span=document.createElement("span"); span.setAttribute ("id", this.DOMobj.id + "_ICONSPAN"); span.style.position="absolute"; span.style.display="none"; this.iconDummySpan=this.outerSpan.appendChild(span); } } else { if (this.image[this.MOUSED] == null && this.image[this.DEPRESSED] == null && this.image[this.DISABLED] == null) this.optimizeEvents=true; } if (!this.optimizeEvents) { this.p.attachComponentEvent (this.DOMobj, "onmouseup", "n"); this.p.attachComponentEvent (this.DOMobj, "onmousedown", "n"); this.p.attachComponentEvent (this.DOMobj, "onmouseover", "n"); this.p.attachComponentEvent (this.DOMobj, "onmouseout", "n"); this.p.attachComponentEvent (this.DOMobj, "onkeydown", "n"); this.p.attachComponentEvent (this.DOMobj, "onkeyup", "n"); this.p.attachComponentEvent (this.DOMobj, "onblur", "n"); if (this.outerSpan) { if (this.labelSpan) this.p.imp.relayMouseEvents (this.labelSpan, true); if (this.iconSpan) this.p.imp.relayMouseEvents (this.iconSpan, true); } } return true; } HxG_3.prototype.JSFImage.prototype.sizeImageToAttributes=function () { if (!this.DOMobj) return false; this.prepImages(); if (this.outerSpan) { var bDisplay=this.gE("display"); var btnHeight=this.p.geo.getElementRenderedHeight(this.DOMobj); var btnWidth=this.p.geo.getElementRenderedWidth(this.DOMobj); if (bDisplay == "none") { this.outerSpan.style.display="none"; } else { var bDisabled=(this.DOMobj.disabled || this.DOMobj.readOnly); var buttonClass=this.p.getFirstClassName (this.DOMobj); var bHideFocus=(this.DOMobj.hideFocus) ? this.DOMobj.hideFocus : false; var bNoSelect=(this.DOMobj.unselectable) ? this.DOMobj.unselectable : false; var bVisible=this.gE("visibility"); this.outerSpan.disabled=bDisabled; this.outerSpan.style.display=bDisplay; this.outerSpan.style.visibility=bVisible; if (this.DOMobj.hideFocus) this.outerSpan.HideFocus=bHideFocus; if (this.DOMobj.unselectable) this.outerSpan.unselectable=bNoSelect; var padLeft=0, padRight=0; padTop=0; padBottom=0; if (!this.p.brw.isIE() || this.p.brw.isIE6_CSS()) { padLeft=this.gPI ("padding-left"); padRight=this.gPI ("padding-right"); padTop=this.gPI ("padding-top"); padBottom=this.gPI ("padding-bottom"); } var brdLeft=this.gBI ("left"); var brdRight=this.gBI ("right"); var brdTop=this.gBI ("top"); var brdBottom=this.gBI ("bottom"); if (this.p.brw.isIE()) { if (this.p.brw.isIE6_CSS()) { baseOffsetLeft=this.DOMobj.clientLeft + padLeft + this.gPI("margin-left"); baseOffsetTop=this.DOMobj.clientTop + padTop + this.gPI("margin-top"); } else { baseOffsetLeft=this.DOMobj.clientLeft + this.gPI("margin-left"); baseOffsetTop=this.DOMobj.clientTop + this.gPI("margin-top"); } } else { baseOffsetLeft=this.DOMobj.offsetLeft + brdLeft + padLeft;; baseOffsetTop=this.DOMobj.offsetTop + brdTop + padTop; } btnHeight-= (brdTop + brdBottom + padTop + padBottom); btnWidth -= (brdLeft + brdRight + padLeft + padBottom); var prop, t, spanWidth, spanHeight; if (this.labelSpan) { var labelClass=(buttonClass) ? (buttonClass + hX_3.CLASS_BUTTON_LABEL) : null; labelClass=(labelClass) ? labelClass : ""; if (this.labelSpan.className != labelClass) this.labelSpan.className=labelClass; if (this.labelSpan.innerHTML != this.label) this.labelSpan.innerHTML=this.label; this.labelSpan.style.verticalAlign=this.labelSpan.style.textAlign=""; prop=this.p.geo.getEffectiveStyle(this.labelSpan, "text-align"); this.labelHAlign=(labelClass && prop && prop.length > 0) ? prop : "center"; prop=this.p.geo.getEffectiveStyle(this.labelSpan, "vertical-align"); this.labelVAlign=(labelClass && prop && prop.length > 0) ? prop : "middle"; spanWidth=this.p.geo.getElementRenderedWidth(this.labelSpan); t=((btnWidth - spanWidth) > 0) ? (btnWidth - spanWidth) : 0; if (this.labelHAlign == "left") this.labelSpan.style.left=baseOffsetLeft + "px"; else if (this.labelHAlign == "right") this.labelSpan.style.left=(baseOffsetLeft + t) + "px"; else this.labelSpan.style.left=(baseOffsetLeft + (t/2)) + "px"; spanHeight=this.p.geo.getElementRenderedHeight(this.labelSpan); t=((btnHeight - spanHeight)) > 0 ? (btnHeight - spanHeight) : 0; if (this.labelVAlign == "top") this.labelSpan.style.top=baseOffsetTop + "px"; else if (this.labelVAlign == "bottom") this.labelSpan.style.top=(baseOffsetTop + t) + "px"; else this.labelSpan.style.top=(baseOffsetTop + (t/2)) + "px"; } if (this.iconSpan) { var iconClass=(buttonClass) ? (buttonClass + hX_3.CLASS_BUTTON_ICON) : null; iconClass=(iconClass) ? iconClass : ""; if (this.iconSpan.className != iconClass) this.iconSpan.className=iconClass; if (this.iconDummySpan.className != iconClass) this.iconDummySpan.className=iconClass; this.iconSpan.src=this.icon[this.NORMAL].src; this.iconSpan.style.verticalAlign=this.iconSpan.style.textAlign=""; prop=this.p.geo.getEffectiveStyle(this.iconDummySpan, "text-align"); this.iconHAlign=(iconClass && prop && prop.length > 0) ? prop : "center"; prop=this.p.geo.getEffectiveStyle(this.iconSpan, "vertical-align"); this.iconVAlign=(iconClass && prop && prop.length > 0) ? prop : "middle"; spanWidth=this.p.geo.getElementRenderedWidth(this.iconSpan); t=((btnWidth - spanWidth) > 0) ? (btnWidth - spanWidth) : 0; if (this.iconHAlign == "left") this.iconSpan.style.left=baseOffsetLeft + "px"; else if (this.iconHAlign == "right") this.iconSpan.style.left=(baseOffsetLeft + t) + "px"; else this.iconSpan.style.left=(baseOffsetLeft + (t/2)) + "px"; spanHeight=this.p.geo.getElementRenderedHeight(this.iconSpan); t=((btnHeight - spanHeight)) > 0 ? (btnHeight - spanHeight) : 0; if (this.iconVAlign == "top") this.iconSpan.style.top=baseOffsetTop + "px"; else if (this.iconVAlign == "bottom") this.iconSpan.style.top=(baseOffsetTop + t) + "px"; else this.iconSpan.style.top=(baseOffsetTop + (t/2)) + "px"; } } } if (!this.HTMLrendered && !this.optimizeEvents) { this.p.imp.attachMonitor(this.DOMobj, "standard", "className", "class", "disabled", "readonly"); if (this.outerSpan) this.p.imp.attachResizeMonitor(this.DOMobj); } this.HTMLrendered=true; return true; } HxG_3.prototype.JSFTwistie=function () { this.type="twistie"; this.direction=hX_3.TW_RT; this.style=hX_3.TW_VEE; this.barstyle=hX_3.TW_NOBAR; this.size=null; this.sColorEdge=null; this.sColorFill=null; this.ptype="button"; this.canvas=null; this.colorEdge=null; this.colorFill=null; this.height=0; this.width=0; this.saveBorderStyle=""; this.saveCanvasLeft=0; this.saveCanvasTop=0; this.attributeTable=new Array(); this.attributeTable ['direction']=['direction', hX_3.ARG_TO_NUM, false, 0, 3]; this.attributeTable ['style']=['style', hX_3.ARG_TO_NUM, false, 0, 3]; this.attributeTable ['bar-style']=['barstyle', hX_3.ARG_TO_NUM, false, 0, 2]; this.attributeTable ['size']=['size', hX_3.ARG_TO_NUM, false, null, null]; this.attributeTable ['color-edge']=['sColorEdge',hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['color-fill']=['sColorFill',hX_3.ARG_TO_NAN, false, null, null]; this.setAttribute(arguments); } HxG_3.prototype.JSFTwistie.prototype.onPageLoad=function () { this.redraw(); return true; } HxG_3.prototype.JSFTwistie.prototype.redraw=function () { this.sizeImageToAttributes(); this.draw(); return true; } HxG_3.prototype.JSFTwistie.prototype.uirelease=function () { return true; } HxG_3.prototype.JSFTwistie.prototype.setValue=function (value) { return false; } HxG_3.prototype.JSFTwistie.prototype.getValue=function() { return null; } HxG_3.prototype.JSFTwistie.prototype.setAttribute=function(a) { hX_3.parseArg (this.attributeTable, this, a); if (this.HTMLrendered) this.redraw(); return true; } HxG_3.prototype.JSFTwistie.prototype.getAttribute=function (attribute) { return (hX_3.getArg(this.attributeTable, this, attribute)); } HxG_3.prototype.JSFTwistie.prototype.sizeImageToAttributes=function () { if (!this.DOMobj) return; if (this.DOMobj.tagName != "BUTTON" && this.DOMobj.tagName != "INPUT") return false; if (this.size==null || this.size=="") { var sSize=this.p.geo.getEffectiveStyle(this.DOMobj, "height"); var nSize=parseInt(sSize, 10); this.size=(nSize == null || nSize == 0 || isNaN(nSize)) ? 7 : (Math.floor((nSize-2+1)/2)); } var realclass=this.DOMobj.className; this.DOMobj.className=realclass + "_twistie"; var twistieColorFill=this.p.geo.getEffectiveStyle(this.DOMobj, "color"); var twistieColorEdge=this.p.geo.getEffectiveStyle(this.DOMobj, "border-left-color"); var twistieType=this.p.geo.getEffectiveStyle(this.DOMobj, "list-style-type"); var twistieType1=this.p.geo.getEffectiveStyle(this.DOMobj, "list-style-image"); this.DOMobj.className=realclass; this.colorFill=this.sColorFill; this.colorEdge=this.sColorEdge; if (this.sColorFill == "" || this.sColorEdge == "" || this.sColorFill == null || this.sColorEdge == null) { if (this.sColorFill == "" || this.sColorFill == null) this.colorFill=twistieColorFill; if (this.sColorEdge == "" || this.sColorEdge == null) this.colorEdge=twistieColorEdge; this.DOMobj.className=realclass; } if (this.DOMobj.disabled) { this.colorFill="GrayText"; this.colorEdge="GrayText"; } this.colorFill=(this.colorFill == "") ? "windowtext" : this.colorFill; this.colorEdge=(this.colorEdge == "") ? "windowtext" : this.colorEdge; if (twistieType == "square") this.style=hX_3.TW_TRI; else if (twistieType == "circle") this.style=hX_3.TW_PUG; else if (twistieType == "decimal") this.style=hX_3.TW_SNOUT; this.height=0; this.width=0; var even=((Math.floor(this.size/2)*2) == this.size); var b=(this.barstyle == hX_3.TW_BAR_INNER) ? 4: 0 var v=(this.style == hX_3.TW_SNOUT) ? (even ? this.size :this.size+1) : ((this.style == hX_3.TW_TRI) ? Math.floor(((this.size+1)/2)) : Math.floor(((this.size+1)/2) + 1)); if (this.direction == hX_3.TW_LT || this.direction == hX_3.TW_RT) { this.height=this.size; this.width=v + b; } else { this.width=this.size; this.height=v + b; } if (this.DOMobj.tagName == "BUTTON") { this.canvas=this.DOMobj.lastChild; if (this.canvas == null || this.canvas.tagName != "DIV" || this.canvas.id != (this.DOMobj.id+"_TWISTIE")) { this.canvas=document.createElement("DIV"); this.canvas.setAttribute ("id", this.DOMobj.id+"_TWISTIE"); this.canvas.style.position="relative"; this.canvas.tabIndex="-1"; this.canvas.unselectable="on"; this.DOMobj.appendChild(this.canvas); this.ptype="button"; } } else { var div=this.DOMobj.parentNode; if (div == null || div.tagName != "DIV" || div.id != (this.DOMobj.id+"_TWISTIE")) { var div=document.createElement("DIV"); div.setAttribute ("id", this.DOMobj.id+"_TWISTIE"); div.style.position="relative"; this.DOMobj.parentNode.insertBefore(div, this.DOMobj); div.appendChild(this.DOMobj); this.DOMobj.style.position="relative"; if (this.DOMobj.style.zIndex == "" || this.DOMobj.style.zIndex == "0" || this.DOMobj.style.zIndex == "auto") this.DOMobj.style.zIndex="2"; this.DOMobj.style.backgroundColor="transparent"; if (hX_3.brw.isNavOrMoz()) { var parent=div.parentNode; if (parent.tagName && parent.tagName == "TD") { parent.style.width=this.DOMobj.offsetWidth + "px"; div.style.height=this.DOMobj.offsetHeight + "px"; } } this.canvas=document.createElement("DIV"); this.canvas.style.position="absolute"; this.canvas.tabIndex="-1"; this.canvas.unselectable="on"; this.canvas.zIndex=parseInt(this.DOMobj.style.zIndex,10)-1; div.appendChild(this.canvas); this.DOMobj.onmousedown=this.onredirect; this.DOMobj.onmouseout=this.onredirect; this.DOMobj.onmouseup=this.onredirect; this.ptype="input"; } this.canvas=div.lastChild; } var child=this.canvas.firstChild; while (child != null) { this.canvas.removeChild(child); child=this.canvas.firstChild; } this.canvas.style.width=this.width + "px"; this.canvas.style.height=this.height + "px"; this.canvas.style.backgroundColor="transparent"; if (this.ptype == "button") { if (this.p.brw.isNavOrMoz()) { var align=this.p.geo.getEffectiveStyle(this.DOMobj, "text-align"); if (align == "center") { var xWidth=this.p.geo.getElementRenderedWidth(this.DOMobj); var xx=Math.floor((xWidth - this.width - 1)/2); this.canvas.style.left=(xx - 3) + "px"; } align=this.p.geo.getEffectiveStyle(this.DOMobj, "vertical-align"); if (align == "middle") this.canvas.style.top="-1px" } } else { var xHeight=hX_3.geo.getElementRenderedHeight(this.DOMobj); var xWidth=hX_3.geo.getElementRenderedWidth(this.DOMobj); var xOff, yOff, xx, yy; yy=Math.round((xHeight- this.height)/2); xx=Math.round((xWidth - this.width)/2); yOff=0; xOff=0; this.canvas.style.left=(xx + xOff) + "px"; this.canvas.style.top=(yy + yOff) + "px"; } this.saveBorderStyle=this.DOMobj.style.borderStyle; this.saveCanvasLeft=this.canvas.style.left; this.saveCanvasTop=this.canvas.style.top; return ((this.direction == hX_3.TW_LT || this.direction == hX_3.TW_RT) ? this.width : this.height); } HxG_3.prototype.JSFTwistie.prototype.onredirect=function (evt) { evt=(evt) ? evt : ((event) ? event: null); if (evt) { var src=hX_3.evtGetTarget(evt); if (src && src.tagName == "INPUT") { var thisp=hX_3.getComponentById(src.id); if (thisp && !thisp.DOMobj.disabled) { thisp.drawState(evt); } } } } HxG_3.prototype.JSFTwistie.prototype.drawState=function (evt) { if (this.DOMobj.disabled) return; if (evt.type == "mousedown") { hX_3.imp.setFocus(this.DOMobj); this.saveBorderStyle=this.DOMobj.style.borderStyle; this.saveCanvasLeft=this.canvas.style.left; this.saveCanvasTop=this.canvas.style.top; this.DOMobj.style.borderStyle="inset"; this.canvas.style.left=parseInt(this.canvas.style.left, 10) + 1; this.canvas.style.top=parseInt(this.canvas.style.top, 10) + 1; } else { if (this.DOMobj.style.borderStyle != this.saveBorderStyle) this.DOMobj.style.borderStyle=this.saveBorderStyle; if (this.canvas.style.top != this.saveCanvasTop) this.canvas.style.top=this.saveCanvasTop; if (this.canvas.style.left=this.saveCanvasLeft) this.canvas.style.left=this.saveCanvasLeft; } } HxG_3.prototype.JSFTwistie.prototype.draw=function() { if (!this.DOMobj || !this.canvas) return false; var stroke=(this.style == hX_3.TW_SNOUT) ? 2 : 1; var d, i, j, k=0, r, xs; if (this.direction == hX_3.TW_RT || this.direction == hX_3.TW_LT) { r=(this.direction == hX_3.TW_RT); j=this.height; i=(r) ? 0 : this.width-1; if (this.style != hX_3.TW_VEE) this.drawLine(i, k, 1, j, false, false, true, false, 1, this.colorEdge, this.colorFill); else this.drawLine(i, k, 1, j, true, true, false, false, 1, this.colorEdge, "transparent"); if (this.style == hX_3.TW_TRI) { j -= 2; k++; } for (i=((r) ? i+1:i-stroke); j > stroke; i=((r) ? i+stroke:i-stroke)) { this.drawLine(i, k, stroke, j, true, true, false, false, (this.style == hX_3.TW_VEE)?2:1, this.colorEdge, (this.style == hX_3.TW_VEE)?"transparent":this.colorFill); k++; j -= 2; } if (j > 0) this.drawLine((r) ? i : i+(stroke-1), k, 1, j, false, false, true, false, 1, this.colorEdge, this.colorFill); if (this.barstyle == hX_3.TW_BAR_INNER) { var xs=(this.style == hX_3.TW_VEE || this.style == hX_3.TW_TRI) ? 0 : 2; this.drawLine((r) ? this.width-2 : 0, (xs > 0) ? 1:0, 2, this.height-xs, false, false, true, false, 1, this.colorEdge, this.colorFill); } } else { d=(this.direction == hX_3.TW_DN); i=(d) ? 0:this.height-1; j=this.width; if (this.style!=hX_3.TW_VEE) this.drawLine(k, i, j, 1, true, false, false, false, 1, this.colorEdge, this.colorFill); else this.drawLine(k, i, j, 1, false, false, true, true, 1, this.colorEdge, "transparent"); if (this.style == hX_3.TW_TRI) { j -= 2; k++; } for (i=((d) ? i+1:i-stroke); j > stroke; i=((d) ? i+stroke : i-stroke)) { this.drawLine(k, i, j, stroke, false, false, true, true, (this.style == hX_3.TW_VEE)?2:1,this.colorEdge, (this.style == hX_3.TW_VEE)?"transparent":this.colorFill); k++; j -= 2; } if (j > 0) this.drawLine(k, (d) ? i:i+(stroke-1), j, 1, true, false, false, false, 1, this.colorEdge, this.colorFill); if (this.barstyle == hX_3.TW_BAR_INNER) { xs=(this.style == hX_3.TW_VEE || this.style == hX_3.TW_TRI) ? 0 : 2; this.drawLine((xs > 0) ? 1:0, (d) ? this.height-2:0, this.width-xs, 2, (d) ? false:true, (d)? true:false, false, false, 1, this.colorEdge, this.colorFill); } } } HxG_3.prototype.JSFTwistie.prototype.drawLine=function(xOffset, yOffset, width, height, T, B, L, R, n, edge, fill) { var poly=document.createElement("DIV"); poly.tabIndex="-1"; poly.style.position="absolute"; poly.style.borderColor=edge; poly.style.borderStyle="solid"; poly.style.borderWidth="0px"; poly.style.overflow="hidden"; this.canvas.appendChild(poly); var w=width, h=height, hide=false; if (this.p.brw.isW3Cstd()) { if (T && B) { h=h - (2*n); if (h <= 0) { hide=true; n=height; h=1; } } else if (L && R) { w=w - (2*n); if (w <= 0) { hide=true; n=width; w=1; } } else if (L || R) { hide=(h <= n); w -= n; } else if (T || B) { hide=(w <= n); h -= n; } } poly.style.width=w + "px"; poly.style.height=h + "px"; poly.style.backgroundColor=(hide) ? "transparent" : fill; poly.style.left=xOffset + "px"; poly.style.top=yOffset + "px"; if (T) poly.style.borderTopWidth=n + "px"; if (B) poly.style.borderBottomWidth=n + "px"; if (L) poly.style.borderLeftWidth=n + "px"; if (R) poly.style.borderRightWidth=n + "px"; if (hide) { if (B) poly.style.borderBottomWidth="0px"; if (R) poly.style.borderRightWidth="0px"; } } HxG_3.prototype.JSFBehavior=function () { this.beforeOthers=true; this.suppressAttach=false; } HxG_3.prototype.JSFBehavior.prototype.onPageLoad=function () { this.setEvent(); return true; } HxG_3.prototype.JSFBehavior.prototype.setAttribute=function(a) { hX_3.parseArg (this.attributeTable, this, a); if (this.setAttributeCode) this.setAttributeCode(); return true; } HxG_3.prototype.JSFBehavior.prototype.getAttribute=function (attribute) { return (hX_3.getArg(this.attributeTable, this, attribute)); } HxG_3.prototype.JSFBehavior.prototype.setEvent=function () { if (this.DOMobj != null) { if (!this.HTMLrendered && !(this.eventname=="onload" || this.suppressAttach)) { if (!this.beforeOthers) this.p.attachBehaviorEvent(this.DOMobj, this.type, this.eventname, "n"); else this.p.attachBehaviorEvent(this.DOMobj, this.type, this.eventname, "p"); } if (this.setEventCode) this.setEventCode(); this.HTMLrendered=true; return true; } return false; } HxG_3.prototype.JSFBehaviorKeybind=function () { this.type="keybind"; this.keyArray=new Array(); this.keyCode= null; this.modifier=null; this.fcn=null; this.actions= new Array(); this.targets= new Array(); this.cancelBubble=true; this.retainFocus=false; this.attributeTable=new Array(); this.attributeTable ['keycode']=['keyCode', hX_3.ARG_TO_NUM, false, 1, 999999]; this.attributeTable ['modifier']=['modifier', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['action']=['actions', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['function']=['fcn', hX_3.ARG_TO_FCNS, false, null, null]; this.attributeTable ['target']=['targets', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['cancel-bubble']=['cancelBubble', hX_3.ARG_IS_TRUE, false, null, null]; this.attributeTable ['retain-focus']=['retainFocus', hX_3.ARG_IS_TRUE, false, null, null]; this.setAttribute(arguments); this.addSubComponent(this); } HxG_3.prototype.JSFBehaviorKeybind.prototype=new hX_3.JSFBehavior(); HxG_3.prototype.JSFKey=function () { this.keyCode=null; this.modAlt=false; this.modShift=false; this.modCtrl=false; this.actions=null; this.fcn=null; this.targets=null; this.cancelBubble=true; this.retainFocus=false; } HxG_3.prototype.JSFBehaviorKeybind.prototype.addSubComponent=function(obj) { var sub=new hX_3.JSFKey(); sub.keyCode=obj.keyCode; if (obj.modifier) { obj.modifier=obj.modifier.toUpperCase(); sub.modAlt=(obj.modifier.indexOf("ALT") >= 0); sub.modShift= (obj.modifier.indexOf("SHIFT") >= 0); sub.modCtrl=(obj.modifier.indexOf("CTRL") >= 0); } if (obj.actions) sub.actions=obj.actions; if (obj.targets) sub.targets=obj.targets; if (obj.fcn) sub.fcn=obj.fcn; if (obj.cancelBubble) sub.cancelBubble= obj.cancelBubble; if (obj.retainFocus) sub.retainFocus=obj.retainFocus; this.keyArray.push(sub); if (obj.keyCode == 112) document.onhelp=function () { return false; } } HxG_3.prototype.isKeyBound=function(obj, keyname, evt) { if (obj != null && keyname != null && this.isString(keyname)) { var a, c, s, i, k, objid, behavior; for (i=0; i < 2; i++) { objid=(i==0) ? ((obj.tagName.toUpperCase() != "FORM") ? obj.id : null) : ((obj.form != null && obj.form.tagName.toUpperCase() == "FORM") ? obj.form.id : null) behavior=(objid != null) ? (this.getBehaviorById(objid, "keybind", "keydown")) : null; if (behavior != null) { for (k=0; k < behavior.keyArray.length; k++) { if (behavior.keyArray[k].keyCode == keyname) if (evt == null) return true; else { a=((evt.altKey) ? true : false), c=((evt.ctrlKey) ? true : false), s=((evt.shiftKey) ? true : false); if ((a == behavior.keyArray[k].modAlt) && (s == behavior.keyArray[k].modShift) && (c == behavior.keyArray[k].modCtrl)) return true; } } } } } return (false); } HxG_3.prototype.JSFBehaviorKeybind.prototype.dispatchBehavior=function (thisObj, evt) { var result=true; if ((this.DOMobj != null) && (evt != null) && (this.keyArray.length > 0)) { var a=(evt.altKey) ? true : false; var c=(evt.ctrlKey) ? true : false; var s=(evt.shiftKey) ? true : false; var t; for (var i=0; i < this.keyArray.length && result; i++) { if ((evt.keyCode == this.keyArray[i].keyCode) && (a == this.keyArray[i].modAlt) && (s == this.keyArray[i].modShift) && (c == this.keyArray[i].modCtrl)) result=this.processAction(thisObj, evt, this.keyArray[i].fcn, this.keyArray[i].actions, true, this.keyArray[i].targets, null, this.keyArray[i].cancelBubble, this.keyArray[i].retainFocus); } } return result; } HxG_3.prototype.JSFBehaviorValidate=function () { this.type="validate"; this.validatorId=null; this.converterId=null; this.successActions=new Array(); this.errorActions=new Array(); this.successTargets=new Array(); this.errorTargets=new Array(); this.successFunction= null; this.errorFunction=null; this.successClass=null; this.errorClass=null; this.defaultClass=null; this.converter=null; this.validator=null; this.coBehavior=-1; this.attributeTable=new Array(); this.attributeTable ['validator']=['validatorId', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['converter']=['converterId', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['success-function']= ['successFunction',hX_3.ARG_TO_FCNS, false, null, null]; this.attributeTable ['error-function']=['errorFunction', hX_3.ARG_TO_FCNS, false, null, null]; this.attributeTable ['success-action']=['successActions',hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['success-target']=['successTargets',hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['error-action']=['errorActions', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['error-target']=['errorTargets', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['success-class']=['successClass', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['error-class']=['errorClass', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['default-class']=['defaultClass', hX_3.ARG_TO_NAN, false, null, null]; this.setAttribute(arguments); } HxG_3.prototype.JSFBehaviorValidate.prototype=new hX_3.JSFBehavior(); HxG_3.prototype.JSFBehaviorValidate.prototype.setAttributeCode=function () { this.validator=null; this.converter=null; if (this.validatorId) this.validator=hX_3.getValidatorById(this.validatorId); if (this.converterId) this.converter=hX_3.getConverterById(this.converterId); if (this.validator) { if ((this.validator.type == "number" || this.validator.type == "datetime") && this.converter == null) this.validator=null; } } HxG_3.prototype.JSFBehaviorValidate.prototype.setEventCode=function () { if (!this.HTMLrendered) { if (this.eventname == "onblur" && this.errorActions != null && this.successActions != null) { var t, i, foundError=false; for (i=0; !foundError && i < this.errorActions.length; i++) { t=(this.errorActions[i]!=null) ? this.errorActions[i].toUpperCase() : ""; if (t == "FOCUS" || t == "SELECTED" || t=="UNSELECTED") foundError=this.errorTargets == null || this.errorTargets.length < i+1 || this.errorTargets[i]==null || this.errorTargets[i].length==0 || this.errorTargets[i]==this.DOMobj.id; } if (foundError) { for (i=0; i < this.successActions.length; i++) { t=(this.successActions[i]!=null) ? this.successActions[i].toUpperCase() : ""; if (t == "FOCUS" || t == "SELECTED") { if (this.successTargets == null || this.successTargets.length < i+1 || this.successTargets[i]==null || this.successTargets[i].length==0 || this.successTargets[i]==this.DOMobj.id) this.successActions[i]=""; } } } } foundError=false; for (i=0; this.errorActions != null && i < this.errorActions.length; i++) { t=(this.errorActions[i]!=null) ? this.errorActions[i].toUpperCase() : ""; if (t == "FOCUS" || t == "SELECTED" || t=="UNSELECTED") { if (foundError) this.errorActions[i]=""; else foundError=true; } } foundError=false; for (i=0; this.successActions != null && i < this.successActions.length; i++) { t=(this.successActions[i]!=null) ? this.successActions[i].toUpperCase() : ""; if (t == "FOCUS" || t == "SELECTED" || t=="UNSELECTED") { if (foundError) this.successActions[i]=""; else foundError=true; } } } } HxG_3.prototype.JSFBehaviorValidate.prototype.dispatchBehavior=function (thisObj, evt) { var result=true; if ((this.DOMobj != null) && (evt != null)) { if (hX_3.pendingFocusReturn && hX_3.pendingFocusReturn != this.DOMobj.id) return true; if (evt.type=="focus" && hX_3.pendingBlurRefocus != null && hX_3.pendingBlurRefocus == this.DOMobj.id) { hX_3.pendingBlurRefocus=null; return true; } hX_3.pendingFocusReturn=null; hX_3.pendingBlurRefocus=null; if ((this.DOMobj.readOnly != null && this.DOMobj.readOnly == true) || (this.DOMobj.disabled != null && this.DOMobj.disabled == true)) return true; if (this.coBehavior == -1) this.coBehavior=hX_3.getBehaviorById(this.DOMobj.id, "assist", "oninput"); if (evt.type == "blur" || evt.type=="focus") { var error=null, strValue=this.DOMobj.value, objValue=strValue; if (evt.type=="focus") { if (this.coBehavior && this.coBehavior.assist) error=null; else if (this.converter) { if (this.converter && strValue.length > 0) { objValue=this.converter.stringToValue(strValue); if (objValue == null) error=this.converter.lastError(); } } if (error != null && error == hX_3.ERR_empty) error=null; } else { if (this.converter) { if (strValue.length == 0) objValue=""; else { objValue=this.converter.stringToValue(strValue); if (objValue == null) error=this.converter.lastError(); else { strValue=this.converter.valueToString(objValue); if (strValue == null) error=this.converter.lastError(); else this.DOMobj.value=strValue; } } } if (error == null && this.validator) { if (!(this.validator.validate(objValue, this.converter))) error=this.validator.lastError(); } } var fcn, action, cssStyle, tgt; if (error != null) { evt.errorMsg=error; fcn=this.errorFunction; action=this.errorActions; tgt=(this.errorTargets == null) ? [this.DOMobj] : this.errorTargets; cssStyle=this.errorClass; } else { evt.errorMsg=void(0); fcn=this.successFunction; action=this.successActions; tgt=(this.successTargets == null) ? [this.DOMobj] : this.successTargets; cssStyle=(this.successClass) ? this.successClass : this.defaultClass; } result=this.processAction (this.DOMobj, evt, fcn, action, false, tgt, cssStyle, null, null, (error != null)); } } return result; } HxG_3.prototype.JSFBehaviorAssist=function () { this.type="assist"; this.suppressAttach=true; this.converterId=null; this.validatorId=null; this.autoTab=null; this.autoSubmit=null; this.autoChar=null; this.doAutoChar=false; this.promptChar=null; this.imeMode=null; this.converter=null; this.validator=null; this.assist=null; this.state=null; this.maxChars=null; this.attributeTable=new Array(); this.attributeTable ['converter']=['converterId', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['validator']=['validatorId', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['auto-char']=['autoChar', hX_3.ARG_IS_TRUE, false, null, null]; this.attributeTable ['auto-tab']=['autoTab', hX_3.ARG_TO_NUM, false, 0, 999999]; this.attributeTable ['auto-submit']=['autoSubmit', hX_3.ARG_IS_NAS, false, null, null]; this.attributeTable ['prompt-char']=['promptChar', hX_3.ARG_TO_NAS, false, null, null]; this.attributeTable ['ime-mode']=['imeMode', hX_3.ARG_TO_NAN, false, null, null]; this.setAttribute(arguments); } HxG_3.prototype.JSFBehaviorAssist.prototype=new hX_3.JSFBehavior(); HxG_3.prototype.JSFBehaviorAssist.prototype.setAttributeCode=function () { this.validator=null; this.converter=null; if (this.validatorId) this.validator=hX_3.getValidatorById(this.validatorId); if (this.converterId) this.converter=hX_3.getConverterById(this.converterId); if (this.validator) { if ((this.validator.type == "number" || this.validator.type == "datetime") && this.converter == null) this.validator=null; } if (this.promptChar) { if (this.promptChar == "default" || this.promptChar.length == 0) this.promptChar="_"; if (this.promptChar.length > 1) this.promptChar=this.promptChar.charAt(0); this.autoChar=true; } if (this.autoChar && !this.promptChar) this.promptChar="_"; if (this.autoChar && this.converter && this.converter.type=="number" && this.converter.isExponent) { this.promptChar=null; this.autoChar=null; } this.doAutoChar=(this.autoChar && this.converter); } HxG_3.prototype.JSFBehaviorAssist.prototype.setEventCode=function () { if (!this.HTMLrendered) { if (this.doAutoChar) { this.state=new hX_3.inputState(this.DOMobj, this); if (this.converter.type == "number") this.assist=new hX_3.NumberAssist(this.DOMobj, this.state, this.converter, this.validator, this.promptChar); else if (this.converter.type == "datetime") this.assist=new hX_3.DateTimeAssist(this.DOMobj, this.state, this.converter, this.validator, this.promptChar); else if (this.converter.type == "mask") this.assist=new hX_3.MaskAssist(this.DOMobj, this.state, this.converter, this.validator, this.promptChar); } } if (this.autoTab != null) { var maxlen=(this.autoTab > 0) ? this.autoTab : 0; var domMaxLen=(this.DOMobj.maxLength == -1 || this.DOMobj.maxLength == 0x7fffffff || this.DOMobj.maxLength == void(0)) ? 0 : this.DOMobj.maxLength; maxlen=(maxlen <= 0) ? domMaxLen : maxlen; this.maxChars=(maxlen > 0) ? maxlen : ((this.converter && this.converter.getMaxLength) ? this.converter.getMaxLength() : 0); if (this.maxChars <= 0) this.autoTab=null; else { if (domMaxLen > 0) this.DOMobj.maxLength=this.maxChars; if (!this.HTMLrendered && this.state == null) this.state=new hX_3.inputState(this.DOMobj, this, true); this.state.setAutoTab(this.maxChars); if (this.autoSubmit != null) this.state.setAutoSubmit(true); } } if (this.imeMode != null) { if (hX_3.brw.isIE()) { if (this.assist != null) { this.DOMobj.style.imeMode="disabled"; } else if (this.imeMode != null) { this.DOMobj.style.imeMode=this.imeMode; } } } } HxG_3.prototype.JSFBehaviorAlert=function () { this.type="alert"; this.message=""; this.mType=1; this.attributeTable=new Array(); this.attributeTable ['message']=['message', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['prompt-type']=['mType', hX_3.ARG_TO_NUM, false, 0, 1]; this.setAttribute(arguments); } HxG_3.prototype.JSFBehaviorAlert.prototype=new hX_3.JSFBehavior(); HxG_3.prototype.JSFBehaviorAlert.prototype.dispatchBehavior=function (thisObj, evt) { if (this.DOMobj != null && this.eventname != "" && this.message != "") { if (this.mType == 1) { var rvalue=confirm(this.message); if (rvalue) return; else return false; } else { alert (this.message); return; } } return; } HxG_3.prototype.JSFBehaviorFocus=function () { this.type="focus"; this.beforeOthers=false; this.suppressAttach=true; this.focusId=null; this.select=false; this.attributeTable=new Array(); this.attributeTable ['focus-id']=['focusId', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['select']=['select', hX_3.ARG_IS_TRUE, false, null, null]; this.setAttribute(arguments); } HxG_3.prototype.JSFBehaviorFocus.prototype=new hX_3.JSFBehavior(); HxG_3.prototype.JSFBehaviorFocus.prototype.setEventCode=function() { if (!this.HTMLrendered && this.eventname == "onload") this.dispatchBehavior(null, null); return true; } HxG_3.prototype.JSFBehaviorFocus.prototype.dispatchBehavior=function (thisObj, evt) { if (this.eventname != "") { var obj=(this.focusId == null) ? null : hX_3.getElementById(this.focusId); if (obj == null || (obj && obj.tagName && obj.tagName == "FORM")) { var tagset=new Array(); hX_3.tabbableElements(tagset); obj=(obj==null) ? document.body : obj; obj=hX_3.findFirstTag(obj, tagset); } if (obj) hX_3.imp.setFocus(obj, this.select, true); } return; } HxG_3.prototype.JSFBehaviorHS=function () { this.type="hideshow"; this.beforeOthers=false; this.inHideObject= ""; this.inHideTree=""; this.inHideField=""; this.state="false"; this.redraw="false"; this.hideObject=null; this.hideField=null; this.hideTree=null; this.attributeTable=new Array(); this.attributeTable ['hide-object']=['inHideObject', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['hide-tree']=['inHideTree', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['hide-field']=['inHideField', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['hide-field-value']=['state', hX_3.ARG_IS_TRUEV, false, null, null]; this.attributeTable ['redraw']=['redraw', hX_3.ARG_IS_TRUE, false, null, null]; this.setAttribute(arguments); } HxG_3.prototype.JSFBehaviorHS.prototype=new hX_3.JSFBehavior(); HxG_3.prototype.JSFBehaviorHS.prototype.setEventCode=function() { this.hideShow(); return true; } HxG_3.prototype.JSFBehaviorHS.prototype.setAttributeCode=function() { this.hideObject=hX_3.getElementById(this.inHideObject); this.hideTree=hX_3.getElementById(this.inHideTree); this.hideField=hX_3.getElementById(this.inHideField); if (this.HTMLrendered) this.hideShow(); return true; } HxG_3.prototype.JSFBehaviorHS.prototype.dispatchBehavior=function (thisObj, evt) { if (this.DOMobj != null && this.hideObject != null) { this.state=(this.hideObject.style.display == "none") ? "visible" : "none"; this.hideShow(); } return; } HxG_3.prototype.JSFBehaviorHS.prototype.hideShow=function () { if (this.DOMobj != null && this.hideObject != null) { var bHidden=(this.hideObject.style.display == "none"); var bStateHidden=(this.state == "none"); if (bHidden != bStateHidden) { var child, idString, node; if (this.hideTree != null && this.hideTree.rows) for (var r=0; r < this.hideTree.rows.length; r++) { if (r != 0) { child=hX_3.findNestedObject(this.hideTree.rows[r], "TABLE"); if (child != null && child.nodeName == "TABLE") { child.style.display="none"; idString=child.id; idString=idString.substring(0,idString.lastIndexOf('_')); node=this.p.getElementById (idString+'_display'); if (node != null) node.value="none"; } } } if (this.state != "none") { this.hideObject.style.display=""; if (this.hideField) this.hideField.value="visible"; if (this.redraw == "true") hX_3.redraw(); } else { this.hideObject.style.display="none"; if (this.hideField) this.hideField.value="none"; } } } return; } HxG_3.prototype.JSFBehavior.prototype.processAction=function (obj, evt, fcn, action, globalAction, target, cssStyle, cancelBubble, retainFocus, isError) { var result=true; if (fcn != null) { try { var realfcn=(hX_3.isFunction(fcn)) ? fcn : new Function ("event", fcn); result=realfcn.call(obj, evt); result=(hX_3.isUnDef(typeof(result))) ? true : ((result == false) ? false: true); if (evt.returnValue == false) result=false; else if (evt.getPreventDefault && evt.getPreventDefault()) result=false; } catch (e) { window.status=hX_3.INTERR_Dispatcher; if (evt.errorMsg) evt.errorMsg=null; } } var k, t, initialResult=result; if (result && action != null) { for (k=0; result && k < action.length; k++) { t=(hX_3.isDef(typeof(target[k])) && target[k] != null && target[k].length > 0) ? hX_3.getElementById(target[k]) : hX_3.evtGetTarget(evt); result=this.doAction (action[k], globalAction, t, evt); result=(hX_3.isUnDef(typeof(result))) ? true : ((result == false) ? false: true); if (evt && evt.returnValue == false) result=false; else if (evt && evt.getPreventDefault && evt.getPreventDefault()) result=false; } } if (initialResult && cssStyle != null) this.doCssStyleClass (obj, cssStyle); if (cancelBubble != null || (isError && !result)) { if (evt) { if (evt.preventDefault) { evt.stopPropagation(); evt.preventDefault(); } else { if (hX_3.brw.isIE() && evt.type == "keydown") { var code=(evt.keyCode && (evt.keyCode != 0)) ? evt.keyCode : -1; if ((code >= 91 && code <= 93) || (code >= 112 && code <= 123)) try { evt.keyCode=0; } catch (e) { } } evt.cancelBubble=true; evt.returnValue=false; } } result=false; } if (retainFocus) hX_3.imp.setFocus(t, false, true); return result; } HxG_3.prototype.JSFBehavior.prototype.doCssStyleClass=function (inobj, styleClass) { var obj=hX_3.getElementById(inobj); if ((obj != null) && (styleClass != null) && (obj.className != styleClass)) obj.className=styleClass; } HxG_3.prototype.JSFBehavior.prototype.doAction=function (action, globalAction, target, evt) { var result=true; var a=(action) ? action.toUpperCase() : null; var t=target; if (t != null && a != null && a != "NOTHING") { switch (a) { case "LOCKED": hX_3.applyNestedAttribute(t, "disabled", true, true); break; case "UNLOCKED": hX_3.applyNestedAttribute(t, "disabled", false, true); break; case "INVERTLOCKED": var b=(t.disabled) ? false : true; hX_3.applyNestedAttribute(t, "disabled", b, true); break; case "SHOW": t.style.display=""; hX_3.redraw(); break; case "HIDE": t.style.display="none"; hX_3.redraw(); break; case "INVERTHIDE": var b=hX_3.geo.getEffectiveStyle(t, "display"); if (b == "none") t.style.display=""; else t.style.display="none"; hX_3.redraw(); break; case "NEXTTAB": hX_3.gotoNextPrev (t, true); break; case "PREVTAB": hX_3.gotoNextPrev (t, false); result=false; break; case "CLICK": this.doClick(t); result=false; break; case "SUBMIT": var tagset=new Array(); tagset.push(new hX_3.tagListItem("INPUT","SUBMIT")); tagset.push(new hX_3.tagListItem("INPUT","IMAGE")); tagset.push(new hX_3.tagListItem("BUTTON","SUBMIT")); if (hX_3.isTag(t, tagset)) { this.doClick(t); } else { var form=(t.tagName=="FORM") ? t : t.form; if (form) { var submit=hX_3.findFirstTag(form, tagset); if (submit) this.doClick(submit); } } return false; break; case "PADLEFT": if (t && t.value && t.maxLength) { var domMaxLen=(t.maxLength == -1 || t.maxLength == 0x7fffffff || t.maxLength == void(0)) ? 0 : t.maxLength; if (domMaxLen > 0) t.value=hX_3.padL(t.value, domMaxLen, " "); } break; case "PADRIGHT": if (t && t.value && t.maxLength) { var domMaxLen=(t.maxLength == -1 || t.maxLength == 0x7fffffff || t.maxLength == void(0)) ? 0 : t.maxLength; if (domMaxLen > 0) t.value=hX_3.padR(t.value, domMaxLen, " "); } break; case "TRIM": if (t && t.value) t.value=hX_3.Trim(t.value); break; case "FOCUS": case "SELECTED": case "UNSELECTED": result=false; if (evt.type == "focus" && t.id == this.DOMobj.id) { if (a == "SELECTED") hX_3.sel.setCaretPos(this.DOMobj, 0, this.DOMobj.value.length, hX_3.brw.isNavOrMoz()); else { var bev=hX_3.getBehaviorById(this.DOMobj.id, "assist", "oninput"); if ((a == "UNSELECTED") || (bev == null) || (bev != null && bev.assist == null)) hX_3.sel.setCaretPos(this.DOMobj, 0, 0, hX_3.brw.isNavOrMoz()); } break; } hX_3.imp.setFocus(t, (a=="SELECTED"), true); if (evt.type == "blur") hX_3.pendingBlurRefocus=t.id; if (!globalAction) { hX_3.pendingFocusReturn=t.id; hX_3.pendingSelect=(a=="SELECTED"); } break; default: break; } } if (!result) hX_3.imp.cancelAction(true); return result; } HxG_3.prototype.JSFBehavior.prototype.doClick=function (obj) { var obj=hX_3.getElementById(obj); if (obj.click && hX_3.brw.isIE()) return (obj.click()); else return (hX_3.imp.fireEvent (obj, "onclick")); } HxG_3.prototype.JSFSpinner=function () { this.type="spinner"; this.buttonBorder=-1; this.buttonColor= "buttonface" this.interval=null; this.interval1=null; this.interval2=null; this.saveArgs=null; this.dataType="number"; this.NPid=""; this.NP=null; this.NVid=""; this.NV=null; this.spinstate=0; this.attributeTable=new Array(); this.attributeTable ['type']=['dataType', hX_3.ARG_TO_NAN, true, null, null]; this.attributeTable ['validator']=['NVid', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['converter']=['NPid', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['increment']=['interval', hX_3.ARG_TO_NUM, false, 0.001, 9999999]; this.attributeTable ['increment1']=['interval1', hX_3.ARG_TO_NUM, false, 0.01, 9999999]; this.attributeTable ['increment2']=['interval2', hX_3.ARG_TO_NUM, false, 0.01, 9999999]; this.attributeTable ['button-color']=['buttonColor', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['btn-color']=['buttonColor', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['button-border']=['buttonBorder', hX_3.ARG_TO_NUM, false, -1, 3]; this.attributeTable ['btn-border']=['buttonBorder', hX_3.ARG_TO_NUM, false, -1, 3]; this.setAttribute(arguments); this.saveArgs=arguments; } HxG_3.prototype.JSFSpinner.prototype.onPageLoad=function () { if (this.dataType != "number" && this.dataType != "datetime") this.dataType="number"; if (this.NPid && this.NP == null) this.NP=this.p.getConverterById(this.NPid); if (this.NP == null) { if (this.dataType == "datetime") this.NP=new this.p.DateTimeConverter(); else this.NP=new this.p.NumberConverter(); this.NP.setAttribute(this.saveArgs); } if (this.NVid && this.NV == null) this.NV=this.p.getValidatorById(this.NVid); if (this.NV == null) { if (this.dataType == "datetime") this.NV=new this.p.DateTimeValidator(); else this.NV=new this.p.NumberValidator(); this.NV.setAttribute(this.saveArgs); } this.interval=(this.interval != null) ? this.interval : ((this.dataType == "datetime") ? 3600:1); this.p.imp.addButtonsToInput(this, 2, this.buttonBorder, this.buttonColor, this.p.STR_SPINNER_INCREMENT, this.p.STR_SPINNER_DECREMENT, false); this.redraw(); return true; } HxG_3.prototype.JSFSpinner.prototype.redraw=function () { this.p.imp.sizeButtonsToInput(this.id); return true; } HxG_3.prototype.JSFSpinner.prototype.uirelease=function () { this.spinstate=0; this.p.imp.depressButton (this, "btn1", false); this.p.imp.depressButton (this, "btn2", false); return true; } HxG_3.prototype.JSFSpinner.prototype.setValue=function (value, notify, returns) { var r=false; if (this.DOMobj) { var ivalue=null; if (hX_3.isString(value)) ivalue=this.NP.stringToValue (value); else ivalue=value; if (ivalue != null) { ivalue=this.NV.coerce (ivalue, this.NP); if (returns) r=(ivalue != null) ? this.NP.valueToString(ivalue) : ""; else { this.DOMobj.value=(ivalue != null) ? this.NP.valueToString(ivalue) : ""; if (notify) this.p.imp.fireEvent (this.DOMobj, "onblur"); r=true; } } } return r; } HxG_3.prototype.JSFSpinner.prototype.getValue=function(cast) { if (this.DOMobj) { if (cast) return (this.NV.coerce(this.DOMobj.value, this.NP)); else return (this.DOMobj.value); } return null; } HxG_3.prototype.JSFSpinner.prototype.reValue=function (buttonitem, notify, inValue) { if (this.DOMobj) { var delta=0; var token=""; var value=(inValue!=null) ? this.NV.coerce(inValue, this.NP) : this.getValue(true); if (value == null || isNaN(value)){ if (this.dataType == "datetime") value=new Date(); else value=new Number(0); } else { delta=this.interval; if (this.dataType == "datetime" && this.interval1) { var pos=this.p.sel.getCaretPos(this.DOMobj, false); token=this.NP.stringToLastToken(this.getValue(), pos); if (token=="h") delta=this.interval; else if (token=="m") delta=this.interval1; else delta=(this.interval2) ? this.interval2 : 1; } delta=(buttonitem == "btn1") ? delta : -delta; if (this.dataType == "number") { var absdelta=(delta < 0) ? -(delta) : delta; if (absdelta >= 5) { if (delta >= 0) value=((Math.floor(value/absdelta))* absdelta); else value=((Math.ceil(value/absdelta))* absdelta); } } } if (this.dataType == "number") { var absD=(delta < 0) ? -(delta) : delta; if (absD < 1) { var delta1, power10, power=(absD < .01) ? 3 : ((absD < .1) ? 2 : 1); power10=Math.pow(10,power); delta1=delta*power10; value1=value*power10; value=(value1 + delta1)/power10; } else { value=value + delta; } } else value.HxAdjustDate(0,0,0,0,0,delta); if (inValue!=null) { return (this.setValue(value, false, true)); } else { this.setValue (value, notify); if (this.interval1) { var newpos=this.NP.posFromLastToken(this.getValue(), token); this.p.sel.setCaretPos(this.DOMobj, newpos); } } } } HxG_3.prototype.JSFSpinner.prototype.setAttribute=function(a) { var wasvalidator=this.NVid; var wasconverter=this.NPid; hX_3.parseArg (this.attributeTable, this, a); if (this.bDsc) { this.bDsc.btnColor=this.buttonColor this.bDsc.btnBorder=this.buttonBorder; } if (this.NPid && this.NPid != wasconverter) { var NP=hX_3.getConverterById(this.NPid); if (NP != null) this.NP=NP; } if (!this.NPid && this.NP) { this.NP.setAttribute(a); } if (this.NVid && this.NVid != wasvalidator) { var NV=hX_3.getValidatorById(this.NVid); if (this.NV != null) this.NV=NV; } if (!this.NVid && this.NV) { this.NV.setAttribute(a); } if (this.HTMLrendered) { this.redraw(); } return true; } HxG_3.prototype.JSFSpinner.prototype.getAttribute=function (attribute) { return (hX_3.getArg(this.attributeTable, this, attribute)); } HxG_3.prototype.JSFSpinner.prototype.isRedirectFcnKey=function (evt) { var code=(evt.keyCode && (evt.keyCode != 0)) ? evt.keyCode : -1; if (code == hX_3.KEY_UPARROW || code == hX_3.KEY_DNARROW) return true; return false; } HxG_3.prototype.JSFSpinner.prototype.doRedirectFcnKey=function (evt, newValue) { var code=(evt.keyCode && (evt.keyCode != 0)) ? evt.keyCode : -1; var r=null; if (code == hX_3.KEY_UPARROW) r=this.reValue("btn1", false, newValue); else if (code == hX_3.KEY_DNARROW) r=this.reValue("btn2", false, newValue); return r; } HxG_3.prototype.JSFSpinner.prototype.dispatchComponent=function (item, evt, action, keycode) { if (item == "btn1" || item == "btn2") { switch (action) { case "click": this.p.uirelease(); this.p.imp.depressButton (this, item, true); this.reValue(item, true); this.p.uirelease(); break; case "dblclick": this.p.uirelease(); if (this.p.brw.isIE()) { this.p.imp.depressButton (this, item, true); this.reValue(item, true); this.p.uirelease(); } break; case "mousedown": this.p.uirelease(); this.p.imp.depressButton (this, item, true); this.spinstate=1; this.p.imp.startTimerTimed (this.id, item, "start", 400); break; case "mouseout": case "mouseup": if (this.spinstate == 1) this.p.uirelease(); break; case "keydown": if (this.spinstate == 0) { this.p.uirelease(); } if (keycode == hX_3.KEY_SPACEBAR) { this.spinstate=1; this.p.imp.depressButton (this, item, true); this.reValue(item, true); this.p.imp.cancelAction(evt); return false; } else if (keycode == hX_3.KEY_UPARROW) { this.spinstate=1; this.p.imp.depressButton (this, "btn1", true); this.reValue("btn1", true); this.p.imp.cancelAction(evt); return false; } else if (keycode == hX_3.KEY_DNARROW) { this.spinstate=1; this.p.imp.depressButton (this, "btn2", true); this.reValue("btn2", true); this.p.imp.cancelAction(evt); return false; } else if (keycode >= hX_3.KEY_SPACEBAR && keycode <= hX_3.KEY_DNARROW) { this.p.imp.cancelAction(evt); return false; } break; case "keyup": if (keycode >= hX_3.KEY_SPACEBAR && keycode <= hX_3.KEY_DNARROW) { if (this.spinstate == 1) { this.p.uirelease(); } this.p.imp.cancelAction(evt); return false; } break; case "keypress": if (keycode >= hX_3.KEY_SPACEBAR && keycode <= hX_3.KEY_DNARROW) { this.p.imp.cancelAction(evt); return false; } break; default: if (action != "mousemove") this.p.uirelease(); } } else if (item == "input") { if (action == "keydown") { this.p.uirelease(); if (keycode == hX_3.KEY_UPARROW) this.reValue("btn1", false); else if (keycode == hX_3.KEY_DNARROW) this.reValue("btn2", false); } } else { this.p.uirelease(); } return; } HxG_3.prototype.JSFSpinner.prototype.dispatchTimer=function (item, action) { if (item == "btn1" || item == "btn2") { if (action == "spin") { this.reValue(item, true); } else if (action == "start") { this.p.imp.startTimerInterval (this.id, item, "spin", 75); } } } HxG_3.prototype.JSFSlider=function () { this.type="slider"; this.buttonBorder=-1; this.buttonColor="buttonface" this.interval=1; this.scale_width=300; this.show_labels=true; this.sliderClass=hX_3.CLASS_SLIDER; this.sliderLinesClass=hX_3.CLASS_LINES_SLIDER; this.continuous=false; this.saveArgs=null; this.NPid=""; this.NP=null; this.NVid=""; this.NV=null; this.objPopup=null; this.objStylus=null; this.objScale=null; this.scale_height=2; this.stylus_width=10; this.stylus_height=20; this.tick_height=5; this.tick_width=2; this.label_size=10; this.ticks=0; this.start_tick=0; this.tick_tabs=0; this.attributeTable=new Array(); this.attributeTable ['validator']=['NVid', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['converter']=['NPid', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['scale-width']=['scale_width', hX_3.ARG_TO_NUM, false, 0, 9999]; this.attributeTable ['show-labels']=['show_labels', hX_3.ARG_IS_TRUE, false, null, null]; this.attributeTable ['increment']=['interval', hX_3.ARG_TO_NUM, false, 0.01, 9999999]; this.attributeTable ['class-name']=['sliderClass', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['lines-class-name']=['sliderLinesClass', hX_3.ARG_TO_NAN,false, null, null]; this.attributeTable ['button-color']=['buttonColor', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['btn-color']=['buttonColor', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['button-border']=['buttonBorder', hX_3.ARG_TO_NUM, false, -1, 3]; this.attributeTable ['btn-border']=['buttonBorder', hX_3.ARG_TO_NUM, false, -1, 3]; this.setAttribute(arguments); this.saveArgs=arguments; } HxG_3.prototype.JSFSlider.prototype.onPageLoad=function () { if (this.NPid && this.NP == null) this.NP=this.p.getConverterById(this.NPid); if (this.NP == null) { this.NP=new this.p.NumberConverter(); this.NP.setAttribute(this.saveArgs); } if (this.NVid && this.NV == null) this.NV=this.p.getValidatorById(this.NVid); if (this.NV == null) { this.NV=new this.p.NumberValidator(); this.NV.setAttribute(this.saveArgs); } this.verifyValidator(); this.p.imp.addButtonsToInput(this, 1, this.buttonBorder, this.buttonColor, this.p.STR_SLIDER_LABEL, null, true); this.objPopup=this.p.addPopup (this.id + "_popup", this.id, ""); this.redraw(); return true; } HxG_3.prototype.JSFSlider.prototype.redraw=function () { this.p.imp.sizeButtonsToInput(this.id); return true; } HxG_3.prototype.JSFSlider.prototype.uirelease=function () { this.p.imp.depressButton(this.id, "btn1", false); if (this.p.uistate.getActiveComponent() == this && this.bSet && this.bSet.btn1) this.p.imp.setFocus(this.bSet.btn1); return true; } HxG_3.prototype.JSFSlider.prototype.setValue=function (value, notify, returns) { var r=false; if (this.DOMobj) { var ivalue=null; if (hX_3.isString(value)) ivalue=this.NP.stringToValue (value); else ivalue=value; if (ivalue != null) { ivalue=this.NV.coerce (ivalue, this.NP); if (returns) { r=(ivalue != null) ? this.NP.valueToString(ivalue) : ""; } else { this.DOMobj.value=(ivalue != null) ? this.NP.valueToString(ivalue) : ""; if (notify) this.p.imp.fireEvent (this.DOMobj, "onblur"); r=true; } } } return r; } HxG_3.prototype.JSFSlider.prototype.getValue=function(cast) { if (this.DOMobj) { if (cast) return (this.NV.coerce(this.DOMobj.value, this.NP)); else return (this.DOMobj.value); } return null; } HxG_3.prototype.JSFSlider.prototype.reValue=function (buttonitem, notify, inValue) { if (this.DOMobj) { var absdelta, delta=0; var value=(inValue!=null) ? this.NV.coerce(inValue, this.NP) : this.getValue(true); if (value == null || isNaN(value)) value=new Number(0); delta=(buttonitem == "btn1") ? this.interval : -(this.interval); absdelta=(delta < 0) ? -(delta) : delta; if (absdelta < 1) { var power10, delta1, power=(absdelta < .01) ? 3 : ((absdelta < .1) ? 2 : 1); power10=Math.pow(10,power); delta1=delta*power10; value1=value*power10; value=(value1 + delta1); delta1=(delta1 < 0) ? -(delta1) : delta1; value=(this.NV.minimum*power10) + ((Math.round((value-(this.NV.minimum*power10))/delta1))* delta1); value=value/power10; } else { value=value + delta; value=this.NV.minimum + ((Math.round((value-this.NV.minimum)/absdelta))* absdelta); } value=this.NV.coerce (value, this.NP); if (inValue!=null) return (this.setValue(value, false, true)); else this.setValue (value, notify); } } HxG_3.prototype.JSFSlider.prototype.setAttribute=function(a) { var wasvalidator=this.NVid; var wasconverter=this.NPid; hX_3.parseArg (this.attributeTable, this, a); if (this.bDsc) { this.bDsc.btnColor=this.buttonColor this.bDsc.btnBorder=this.buttonBorder; this.bDsc.sliderClass=this.sliderClass; this.bDsc.sliderLinesClass=this.sliderLinesClass; } if (this.NPid && this.NPid != wasconverter) { var NP=hX_3.getConverterById(this.NPid); if (NP != null) this.NP=NP; } if (!this.NPid && this.NP) { this.NP.setAttribute(a); } if (this.NVid && this.NVid != wasvalidator) { var NV=hX_3.getValidatorById(this.NVid); if (this.NV != null) this.NV=NV; } if (!this.NVid && this.NV) { this.NV.setAttribute(a); } if (this.NV != null) this.verifyValidator(); if (this.HTMLrendered) { this.redraw(); } return true; } HxG_3.prototype.JSFSlider.prototype.verifyValidator=function () { var min=this.NV.getAttribute("minimum-bound"); var max=this.NV.getAttribute("maximum-bound"); if (min == null && max == null) { this.NV.setAttribute ("maximum-bound:10"); this.NV.setAttribute ("minimum-bound:0"); } else if (min == null) { this.NV.setAttribute ("minimum-bound:"+(max-10)); } else if (max == null) { this.NV.setAttribute ("maximum-bound:"+(min+10)); } else if (min >= max) { min=max-10; this.NV.setAttribute ("minimum-bound:"+min); } } HxG_3.prototype.JSFSlider.prototype.getAttribute=function (attribute) { return (hX_3.getArg(this.attributeTable, this, attribute)); } HxG_3.prototype.JSFSlider.prototype.isRedirectFcnKey=function (evt) { var code=(evt.keyCode && (evt.keyCode != 0)) ? evt.keyCode : -1; if (code == hX_3.KEY_UPARROW || code == hX_3.KEY_DNARROW) return true; return false; } HxG_3.prototype.JSFSlider.prototype.doRedirectFcnKey=function (evt, newValue) { var code=(evt.keyCode && (evt.keyCode != 0)) ? evt.keyCode : -1; var r=null; if (code == hX_3.KEY_UPARROW) r=this.reValue("btn1", false, newValue); else if (code == hX_3.KEY_DNARROW) r=this.reValue("btn2", false, newValue); return r; } HxG_3.prototype.JSFSlider.prototype.dispatchComponent=function (item, evt, action, keycode) { var rvalue=true; var dropit=false; var undropit=false; if (this.objPopup != null) { if (item == "btn1") { switch (action) { case "click": case "dblclick": case "mousemove": case "mouseout": case "mouseover": case "mouseup": case "blur": case "focus": break; case "mousedown": if (this.objPopup.isPopped()) { undropit=true; } else { dropit=true; } break; case "keydown": if (keycode == hX_3.KEY_ESC) { if (this.objPopup.isPopped()) { this.setValue(this.escapeToValue, true); undropit=true; } } else if (keycode == hX_3.KEY_SPACEBAR || keycode == hX_3.KEY_UPARROW || keycode == hX_3.KEY_DNARROW) { if (this.objPopup.isPopped()) { undropit=true; } else { dropit=true; } this.p.imp.cancelAction(evt); rvalue=false; } else if (keycode >= hX_3.KEY_SPACEBAR && keycode <= hX_3.KEY_DNARROW) { this.p.imp.cancelAction(evt); rvalue=false; } break; case "keypress": case "keyup": if (keycode >= hX_3.KEY_SPACEBAR && keycode <= hX_3.KEY_DNARROW) { this.p.imp.cancelAction(evt); rvalue=false; } break; default: this.p.uirelease(); break; } } else if (item == "input") { if (action == "keydown") { this.p.uirelease(); if (keycode == hX_3.KEY_DNARROW) { this.reValue("btn2", false); } else if (keycode == hX_3.KEY_UPARROW) { this.reValue("btn1", false); } else if (keycode == hX_3.KEY_ESC) { if (this.objPopup.isPopped()) { this.setValue(this.escapeToValue, false); undropit=true; } } } } else { this.p.uirelease(); } if (dropit) { this.escapeToValue=this.getValue(); this.p.imp.setFocus(this.bSet.btn1); this.p.uirelease(); this.p.uistate.setActiveComponent (this); this.p.imp.depressButton(this.id, "btn1", true); this.sizeSliderToInput(); this.setStylusFromValue(); this.objPopup.uivisible(); this.p.imp.setFocus(this.objPopup.DOMobj); rvalue=false; } else if (undropit) { this.p.uirelease(); rvalue=false; } } if (!rvalue) { return false; } return; } HxG_3.prototype.JSFSlider.prototype.dispatchTimer=function (item, action) { if (item == "popup") { if (action == "dragEnd") { this.p.uirelease(); } } } HxG_3.prototype.JSFSlider.prototype.dragStart=function (xOff, yOff) { } HxG_3.prototype.JSFSlider.prototype.dragMove=function (xOff, yOff) { var xLeft=xOff - parseInt (this.objScale.style.left, 10); xLeft=(xLeft < 0) ? 0 : xLeft; xLeft=(xLeft > this.scale_width) ? this.scale_width : xLeft; xLeft=this.NV.minimum + ((Math.round(xLeft / this.tick_tabs)) * this.interval); this.setValue(xLeft); this.setStylusFromValue(xOff, yOff); } HxG_3.prototype.JSFSlider.prototype.dragKey=function (keyaction, keycode) { if (keycode == hX_3.KEY_ESC) { if (this.objPopup.isPopped()) { this.setValue(this.escapeToValue, true); this.p.uirelease(); } } else if (keycode == hX_3.KEY_SPACEBAR || keycode == hX_3.KEY_ENTER) { if (!this.p.dragger.keydown && this.objPopup.isPopped()) { this.dragEnd(); this.p.uirelease(); } } else if (keycode == hX_3.KEY_LTARROW) { this.reValue("btn2", true); this.setStylusFromValue(); } else if (keycode == hX_3.KEY_RTARROW) { this.reValue("btn1", true); this.setStylusFromValue(); } this.p.dragger.keydown=false; } HxG_3.prototype.JSFSlider.prototype.dragEnd=function () { this.setValue(this.getValue(), true); } HxG_3.prototype.JSFSlider.prototype.sizeSliderToInput=function () { var popup=this.objPopup; var popupElem=popup.DOMobj; if (popup && popupElem) { var i, j; var curValue=this.getValue(true); this.ticks=((this.NV.maximum - this.NV.minimum) / this.interval) + 1; this.start_tick=(curValue - this.NV.minimum) / this.interval; this.stylus_width=10; this.stylus_height=20; this.label_size=10; this.scale_height=1; this.tick_height=4; this.tick_width=1; this.tick_tabs=(this.scale_width-this.tick_width) / (this.ticks-1.0); popupElem.style.margin="0px"; popupElem.style.padding="0px"; popupElem.className=this.sliderClass; borderR=this.p.geo.parseBorder(popupElem, "right", 1); borderL=this.p.geo.parseBorder(popupElem, "left", 1); borderT=this.p.geo.parseBorder(popupElem, "top", 1); borderB=this.p.geo.parseBorder(popupElem, "bottom", 1); if (this.p.brw.isW3Cstd()) borderR=borderL=borderT=borderB=0; var popheight=(this.stylus_height + this.tick_height + this.label_size + 3 + borderT + borderB); var popwidth=(this.scale_width+this.stylus_width + 3 + borderL + borderR); borderR=borderL=borderT=borderB=0; popupElem.style.height=popheight + "px"; popupElem.style.width=popwidth + "px"; var scaleElem=popupElem.firstChild; if (scaleElem == null) { scaleElem=document.createElement("div"); scaleElem.setAttribute ("id", this.id + "_scale"); popupElem.appendChild(scaleElem); this.objScale=scaleElem; } var tickElem=scaleElem.nextSibling; if (tickElem == null) { tickElem=document.createElement("div"); tickElem.setAttribute ("id", this.id + "_ticks"); popupElem.appendChild(tickElem); } var labelElem=tickElem.nextSibling; if (labelElem == null) { labelElem=document.createElement("div"); labelElem.setAttribute ("id", this.id + "_label"); popupElem.appendChild(labelElem); } var stylusElem=labelElem.nextSibling; if (stylusElem == null) { stylusElem=document.createElement("div"); stylusElem.setAttribute ("id", this.id + "_stylus"); popupElem.appendChild(stylusElem); this.objStylus=stylusElem; } scaleElem.className=this.sliderLinesClass; scaleElem.style.position="absolute"; scaleElem.style.fontSize="0px"; scaleElem.style.overflow="hidden"; scaleElem.style.left=((this.stylus_width/2)+borderL+1) + "px"; scaleElem.style.top=((this.stylus_height/2)+borderT) + "px"; scaleElem.style.height=this.scale_height + "px"; scaleElem.style.width=this.scale_width + "px"; scaleElem.style.borderWidth="0px"; scaleElem.style.margin="0px"; scaleElem.style.padding="0px"; scaleElem.style.backgroundColor=this.p.geo.getEffectiveStyle(scaleElem, "color"); tickElem.className=this.sliderLinesClass; tickElem.style.position="absolute"; tickElem.style.fontSize="0px"; tickElem.style.overflow="hidden"; tickElem.style.left=((this.stylus_width/2)+borderL+1) + "px"; tickElem.style.top=((this.stylus_height/2)+this.scale_height+borderT) + "px"; tickElem.style.height=((this.stylus_height/2)+this.tick_height) + "px"; tickElem.style.width=this.scale_width + "px"; tickElem.style.borderWidth="0px"; tickElem.style.margin="0px"; tickElem.style.padding="0px"; tickElem.style.backgroundColor="transparent"; var curTick=tickElem.firstChild; for (i=0; i this.NV.maximum) label=this.NV.maximum; txtNode.nodeValue=this.NP.valueToString(label); curLabel=curLabel.nextSibling; } } while (curLabel != null) { curLabel.style.display="none"; curLabel=curLabel.nextSibling; } var borderWidth=(this.p.brw.isW3Cstd()) ? 2 : 0; var borderHeight=(this.p.brw.isW3Cstd()) ? 1 : 0; stylusElem.className=this.sliderLinesClass; stylusElem.style.position="absolute"; stylusElem.style.fontSize="0px"; stylusElem.style.overflow="hidden"; stylusElem.style.zIndex="1000001"; stylusElem.style.height=this.stylus_height + "px"; stylusElem.style.width=this.stylus_width + "px"; stylusElem.style.borderWidth="0px"; stylusElem.style.margin="0px"; stylusElem.style.padding="0px"; stylusElem.style.backgroundColor="transparent"; var triangleHeight=(this.stylus_width/2) - 1; var boxHeight=(this.stylus_height-triangleHeight-borderHeight); var subelem=stylusElem.firstChild; if (!subelem) { subelem=document.createElement("div"); stylusElem.appendChild(subelem); } subelem.className=this.sliderLinesClass; subelem.style.position="absolute"; subelem.style.overflow="hidden"; subelem.style.fontSize="0px"; subelem.style.overflow="hidden"; subelem.style.left="0px"; subelem.style.top="0px"; subelem.style.height=boxHeight + "px"; subelem.style.width=(this.stylus_width-borderWidth) + "px"; subelem.style.margin="0px"; subelem.style.padding="0px"; subelem.style.borderStyle="solid"; subelem.style.borderWidth="1px"; subelem.style.borderBottomWidth="0px"; for (i=1; i <= triangleHeight; i++) { subelem=subelem.nextSibling; if (!subelem) { subelem=document.createElement("div"); stylusElem.appendChild(subelem); } subelem.className=this.sliderLinesClass; subelem.style.position="absolute"; subelem.style.fontSize="0px"; subelem.style.overflow="hidden"; subelem.style.top=(boxHeight+i-1+borderHeight) + "px"; subelem.style.left=i + "px"; subelem.style.height="1px"; subelem.style.width=(this.stylus_width-borderWidth-(2*i)) + "px"; subelem.style.margin="0px"; subelem.style.padding="0px"; subelem.style.borderStyle="solid"; subelem.style.borderWidth="1px"; subelem.style.borderBottomWidth="0px"; subelem.style.borderTopWidth="0px"; } return true; } return false; } HxG_3.prototype.JSFSlider.prototype.setStylusFromValue=function () { var xLeft, xOff, wasLeft; var value=this.getValue(true); if (!value || value == null || isNaN(value)) value=new Number(0); wasLeft=xLeft=parseInt (this.objScale.style.left, 10); xOff=Math.round((value - this.NV.minimum)/this.interval) * this.tick_tabs; xLeft=xLeft + xOff - (this.stylus_width/2); if (wasLeft != xLeft) { this.objStylus.style.left=xLeft + "px"; } return true; } HxG_3.prototype.JSFDatePicker=function () { this.type="datepicker"; this.buttonBorder=-1; this.buttonColor="buttonface" this.CSSPrefix=""; this.nFirstDayOfWeek=hX_3.DTFMT_DEFAULTFIRSTDAYMONTH; this.saveArgs=null; this.DTPid=""; this.DTP=null; this.DTVid=""; this.DTV=null; this.oDate=null; this.oDrawDate=null; this.oToday=new Date(); this.classDiv=""; this.objPopup=null; this.HTML=null; this.sUnique="_hx_dp_"; this.timerTimed=0; this.timerInterval=0; this.wiggleX=0; this.wiggleY=0; this.verifyStyleSheets=false; this.attributeTable=new Array(); this.attributeTable ['validator']=['DTVid', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['converter']=['DTPid', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['CSS-prefix']=['CSSPrefix', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['first-day-of-week']=['nFirstDayOfWeek', hX_3.ARG_TO_NUM,false, 0, 6]; this.attributeTable ['button-color']=['buttonColor', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['btn-color']=['buttonColor', hX_3.ARG_TO_NAN, false, null, null]; this.attributeTable ['button-border']=['buttonBorder', hX_3.ARG_TO_NUM, false, -1, 3]; this.attributeTable ['btn-border']=['buttonBorder', hX_3.ARG_TO_NUM, false, -1, 3]; this.setAttribute(arguments); this.saveArgs=arguments; } HxG_3.prototype.JSFDatePicker.prototype.onPageLoad=function () { if (this.DTPid && this.DTP == null) this.DTP=this.p.getConverterById(this.DTPid); if (this.DTP == null) { this.DTP=new this.p.DateTimeConverter(); this.DTP.setAttribute(this.saveArgs); } if (this.DTVid && this.DTV == null) this.DTV=this.p.getValidatorById(this.DTVid); if (this.DTV == null) { this.DTV=new this.p.DateTimeValidator(); this.DTV.setAttribute(this.saveArgs); } this.p.imp.addButtonsToInput(this, 1, this.buttonBorder, this.buttonColor, this.p.STR_DATE_DN_TOGGLE, null, true, hX_3.R_IMG_CAL_HINKIES); this.objPopup=this.p.addPopup (this.id + "_popup", this.id, "", true); this.sUnique=this.id + "_hx_dp_popup_"; this.redraw(); return true; } HxG_3.prototype.JSFDatePicker.prototype.redraw=function () { this.p.imp.sizeButtonsToInput(this.id); return true; } HxG_3.prototype.JSFDatePicker.prototype.uirelease=function () { this.p.imp.depressButton(this.id, "btn1", false); if (this.p.uistate.getActiveComponent() == this && this.bSet && this.bSet.btn1) { this.p.imp.setFocus(this.bSet.btn1); } return true; } HxG_3.prototype.JSFDatePicker.prototype.setValue=function (value, notify, raw, returns) { r=false; if (this.DOMobj) { if (raw) { this.DOMobj.value=value; r=true; } else { var ivalue=null; if (hX_3.isString(value)) ivalue=this.DTP.stringToValue (value); else if (hX_3.isObject(value) && value.constructor && value.constructor == Date) ivalue=value.HxClone(0); else ivalue=null; if (ivalue && this.DTV.validate(ivalue, this.DTP)) { this.oDate=ivalue; if (returns) r=this.DTP.valueToString(ivalue); else { this.DOMobj.value=this.DTP.valueToString(ivalue); if (notify) this.p.imp.fireEvent (this.DOMobj, "onblur"); r=true; } } else { r=(returns) ? "" : false; } } } return r; } HxG_3.prototype.JSFDatePicker.prototype.reValue=function (y, m, d, notify, inValue) { if (this.DOMobj) { var skipInc=false, value=(inValue!=null) ? this.DTP.stringToValue(inValue) : this.getValue(true); if (value==null && inValue!=null && this.DTV && this.DTP) { value=this.oToday.HxClone(0); } else if (this.DOMobj.value.length==0) skipInc=true; if (value) { if (!skipInc) value.HxAdjustDate(y, m, d, 0, 0, 0); if (this.DTV.validate(value, this.DTP)) { if (inValue!=null) return (this.setValue(value, false, false, true)); else { this.setValue (value, notify); return true; } } } } return ((inValue) ? inValue : false); } HxG_3.prototype.JSFDatePicker.prototype.reValuePop=function (y, m, d, idate, noscroll) { if (this.DOMobj) { var testdate=null; if (idate) { testdate=idate; if (!this.DTV.validate(testdate, this.DTP)) return; } else { testdate=this.oDate.HxClone(0); testdate.HxAdjustDate (y, m, d, 0, 0, 0); testdate=this.DTV.coerce(testdate, this.DTP); if (!testdate) return; } this.oDate=testdate; if (noscroll) this.updateGrid(true); else this.updateGrid(); } } HxG_3.prototype.JSFDatePicker.prototype.setDateFromValue=function () { this.oDate=this.getValue(true); if (this.oDate == null || !this.DTV.validate(this.oDate, this.DTP)) this.oDate=this.oToday.HxClone(0); return true; } HxG_3.prototype.JSFDatePicker.prototype.getValue=function(cast) { if (this.DOMobj) { if (cast) { var d=this.DTP.stringToValue (this.DOMobj.value); return ((d != null) ? d.HxClone(0) : this.oToday.HxClone(0)); } return (this.DOMobj.value); } return null; } HxG_3.prototype.JSFDatePicker.prototype.setAttribute=function(a) { var wasvalidator=this.DTVid; var wasconverter=this.DTPid; hX_3.parseArg (this.attributeTable, this, a); if (this.bDsc) { this.bDsc.btnColor=this.buttonColor this.bDsc.btnBorder=this.buttonBorder; } if (this.DTPid && this.DTPid != wasconverter) { var DTP=hX_3.getConverterById(this.DTPid); if (DTP != null) this.DTP=DTP; } if (!this.DTPid && this.DTP) { this.DTP.setAttribute(a); } if (this.DTVid && this.DTVid != wasvalidator) { var DTV=hX_3.getValidatorById(this.DTVid); if (this.DTV != null) this.DTV=DTV; } if (!this.DTVid && this.DTV) { this.DTV.setAttribute(a); } if (this.HTMLrendered) { this.redraw(); } return true; } HxG_3.prototype.JSFDatePicker.prototype.getAttribute=function (attribute) { return (hX_3.getArg(this.attributeTable, this, attribute)); } HxG_3.prototype.JSFDatePicker.prototype.setClassNames=function () { if (!this.objPopup || !this.objPopup.DOMobj) return; var div=this.objPopup.DOMobj; if (this.CSSPrefix && this.CSSPrefix != "" && this.classDiv == this.CSSPrefix && this.CSSPrefix == div.className) return; if (this.CSSPrefix && this.CSSPrefix != "") { var i=this.CSSPrefix.indexOf(" "); if (i >= 0) this.CSSPrefix=this.CSSPrefix.substr(0,i); if (this.verifyStyleSheets) { var sheets, rulelist, j; var validFamily=false; var testname=this.CSSPrefix + "-" + hX_3.CLASS_DP_HEADER; for (i=0; i < document.styleSheets.length; i++) { sheets=document.styleSheets[i]; rulelist=(hX_3.isDef(typeof(sheets.cssRules))) ? sheets.cssRules : ((hX_3.isDef(typeof(sheets.rules))) ? sheets.rules : null); if (rulelist) { for (j=0; j < rulelist.length; j++) { if (rulelist[j].selectorText.indexOf(testname) >= 0) { validFamily=true; break; } } } } if (!validFamily) { window.status=hX_3.INTERR_Bad_Family; } } } else { this.CSSPrefix=hX_3.CLASS_DP; } this.classDiv=this.CSSPrefix; this.classSize=this.CSSPrefix + "-" + hX_3.CLASS_DP_SIZE; this.classHeader= this.CSSPrefix + "-" + hX_3.CLASS_DP_HEADER; this.classHeader1=this.CSSPrefix + "-" + hX_3.CLASS_DP_HEADER1; this.classHeader2=this.CSSPrefix + "-" + hX_3.CLASS_DP_HEADER2; this.classHeaderYear= this.CSSPrefix + "-" + hX_3.CLASS_DP_HEADERYEAR; this.classHeaderMonth= this.CSSPrefix + "-" + hX_3.CLASS_DP_HEADERMONTH; this.classWHeader= this.CSSPrefix + "-" + hX_3.CLASS_DP_HEADER_WEEKDAY; this.classBody=this.CSSPrefix + "-" + hX_3.CLASS_DP_BODY; this.classButton=this.CSSPrefix + "-" + hX_3.CLASS_DP_BUTTON; this.classCurrMonth=this.CSSPrefix + "-" + hX_3.CLASS_DP_CURRMONTH; this.classOtherMonth= this.CSSPrefix + "-" + hX_3.CLASS_DP_OTHERMONTH; this.classCurrDay=this.CSSPrefix + "-" + hX_3.CLASS_DP_CURRDAY; this.classOtherDay=this.CSSPrefix + "-" + hX_3.CLASS_DP_OTHERDAY; this.classToday=this.CSSPrefix + "-" + hX_3.CLASS_DP_TODAY; this.classCurrToday=this.CSSPrefix + "-" + hX_3.CLASS_DP_CURRENTTODAY; this.classInvalidDay= this.CSSPrefix + "-" + hX_3.CLASS_DP_INVALIDDAY; } HxG_3.prototype.JSFDatePicker.prototype.isRedirectFcnKey=function (evt) { var code=(evt.keyCode && (evt.keyCode != 0)) ? evt.keyCode : -1; if (code == hX_3.KEY_UPARROW || code == hX_3.KEY_DNARROW) return true; return false; } HxG_3.prototype.JSFDatePicker.prototype.doRedirectFcnKey=function (evt, newValue) { var code=(evt.keyCode && (evt.keyCode != 0)) ? evt.keyCode : -1; var r=null; if (code == hX_3.KEY_UPARROW) r=this.reValue(0,0,+1, false, newValue); else if (code == hX_3.KEY_DNARROW) r=this.reValue(0,0,-1, false, newValue); return r; } HxG_3.prototype.JSFDatePicker.prototype.dispatchDragAction=function (evt) { var r=false; evt=(evt) ? evt : ((event) ? event: null); if (evt) { var src=hX_3.evtGetTarget(evt); if (src) { src=(src.nodeType == hX_3.ELEMENT_NODE || src.nodeType == hX_3.DOCUMENT_NODE) ? src : src.parentNode; if (src) { if ((this.timerTimed != 0 || this.timerInterval != 0) && (evt.type == "keydown" || evt.type == "keyup" || evt.type == "mouseup" || evt.type == "mousemove")) { var stop=true; if (evt.type == "mousemove" && this.timerInterval != 0) { var x=Math.abs(this.wiggleX-evt.clientX); var y=Math.abs(this.wiggleY-evt.clientY); if (x < 4 && y < 4) stop=false; } if (stop) { if (this.timerInterval != 0) this.p.imp.killTimerInterval(this.timerInterval); if (this.timerTimed != 0) this.p.imp.killTimerTimed(this.timerTimed); this.timerTimed=0; this.timerInterval=0; this.pressButtonHTML (this.HTML.hdrbtn1, false); this.pressButtonHTML (this.HTML.hdrbtn2, false); this.pressButtonHTML (this.HTML.hdrbtn3, false); this.pressButtonHTML (this.HTML.hdrbtn4, false); } } if (evt.type == "keyup") { } else if (evt.type == "keydown") { var nYrAdj=0; var nDayAdj=0; var nMonAdj=0; switch (evt.keyCode) { case hX_3.KEY_ESC: if (this.objPopup.isPopped()) { this.setValue(this.escapeToValue, true, true); this.p.uirelease(); } break; case hX_3.KEY_SPACEBAR: case hX_3.KEY_ENTER: if (!this.p.dragger.keydown && this.objPopup.isPopped()) { this.setValue(this.oDate, true); this.p.uirelease(); } break; case hX_3.KEY_LTARROW: if (evt.shiftKey) nMonAdj=-1; else nDayAdj=-1; break; case hX_3.KEY_UPARROW: if (evt.shiftKey) nYrAdj=-1; else nDayAdj=-7; break; case hX_3.KEY_RTARROW: if (evt.shiftKey) nMonAdj=1; else nDayAdj=1; break; case hX_3.KEY_DNARROW: if (evt.shiftKey) nYrAdj=+1; else nDayAdj=7; break; case hX_3.KEY_TAB: nDayAdj=evt.shiftKey ? -1 : 1; break; default: break; } if (nYrAdj != 0 || nDayAdj != 0 || nMonAdj != 0) this.reValuePop (nYrAdj, nMonAdj, nDayAdj); this.p.dragger.keydown=false; } else if (evt.type == "mousedown") { if (src.tagName && src.tagName == "INPUT" && src.id) { if (src.id.indexOf("_HDRBTN") >= 0) { var btn=parseInt (src.id.substr(src.id.length-1),10); var btno=(btn==1) ? this.HTML.hdrbtn1 : ((btn==2) ? this.HTML.hdrbtn2 : ((btn==3) ? this.HTML.hdrbtn3 : this.HTML.hdrbtn4)); var item="btn" + btn; var nYrAdj=(btn==1) ? -1 : ((btn==2) ? +1 : 0); var nMonAdj=(btn==3) ? -1 : ((btn==4) ? +1 : 0); this.reValuePop (nYrAdj, nMonAdj, 0); this.wiggleX=evt.clientX; this.wiggleY=evt.clientY; this.pressButtonHTML (btno, true); this.timerTimed=this.p.imp.startTimerTimed (this.id, item, "start", 400); } } else if (src.tagName) { if (src.tagName == "SPAN" || src.tagName == "A") src=src.parentNode; if (src && src.tagName && src.tagName == "TD" && src.id) { var i=src.id.indexOf(this.sUnique); if (i >= 0) { var id=src.id.substr(this.sUnique.length); var oSelDate=this.DTP.constantToValue (id); this.reValuePop (0, 0, 0, oSelDate, true); } } } } else if (evt.type == "mouseup") { if (src.tagName) { if (src.tagName == "SPAN" || src.tagName == "A") src=src.parentNode; if (src && src.tagName && src.tagName == "TD" && src.id) { var i=src.id.indexOf(this.sUnique); if (i >= 0) { var id=src.id.substr(this.sUnique.length); var oSelDate=this.DTP.constantToValue (id); if (this.setValue (oSelDate, true)) this.p.dragger.timerid=this.p.imp.startTimerTimed (this.p.dragger.owningObj.id, "popup", "dragEnd", 400); } } } } } } } return r; } HxG_3.prototype.JSFDatePicker.prototype.dispatchComponent=function (item, evt, action, keycode) { var rvalue=true; var dropit=false; var undropit=false; if (this.objPopup != null) { if (item == "btn1") { if (action == "mousedown") { if (this.objPopup.isPopped()) { undropit=true; } else { dropit=true; } } else if (action == "click" || action == "dblclick" || action == "mousemove" || action == "mouseout" || action == "mouseover" || action == "mouseup" || action == "blur" || action == "focus") { } else if (action == "keydown") { if (keycode == hX_3.KEY_ESC) { if (this.objPopup.isPopped()) { this.setValue(this.escapeToValue, true, true); undropit=true; } } else if (keycode == hX_3.KEY_SPACEBAR || keycode == hX_3.KEY_UPARROW || keycode == hX_3.KEY_DNARROW) { if (this.objPopup.isPopped()) { undropit=true; } else { dropit=true; } this.p.imp.cancelAction(evt); rvalue=false; } else if (keycode >= hX_3.KEY_SPACEBAR && keycode <= hX_3.KEY_DNARROW) { this.p.imp.cancelAction(evt); rvalue=false; } } else if (action == "keypress" || action == "keyup") { if (keycode >= hX_3.KEY_SPACEBAR && keycode <= hX_3.KEY_DNARROW) { this.p.imp.cancelAction(evt); rvalue=false; } } else { this.p.uirelease(); } } else if (item == "input") { if (action == "keydown") { this.p.uirelease(); if (keycode == hX_3.KEY_DNARROW) this.reValue(0,0,-1, false); else if (keycode == hX_3.KEY_UPARROW) this.reValue(0,0,+1, false); else if (keycode == hX_3.KEY_ESC) { if (this.objPopup.isPopped()) { this.setValue(this.escapeToValue, false, true); undropit=true; } } } } else { this.p.uirelease(); } if (dropit) { this.escapeToValue=this.getValue(); this.p.imp.setFocus(this.bSet.btn1); this.p.uirelease(); this.p.uistate.setActiveComponent (this); this.p.imp.depressButton(this.id, "btn1", true); this.setDateFromValue(); this.sizePickerToInput(); this.objPopup.uivisible(); this.showFocus(this.oDate); rvalue=false; } else if (undropit) { this.p.uirelease(); rvalue=false; } } if (!rvalue) { return false; } return; } HxG_3.prototype.JSFDatePicker.prototype.dispatchTimer=function (item, action) { if (item == "popup") { if (action == "dragEnd") { this.p.uirelease(); } } if (item == "btn1" || item == "btn2" || item == "btn3" || item == "btn4") { if (action == "spin") { var btn=parseInt(item.substr(item.length-1),10); var nYrAdj=(btn==1) ? -1 : ((btn==2) ? +1 : 0); var nMonAdj=(btn==3) ? -1 : ((btn==4) ? +1 : 0); this.reValuePop (nYrAdj, nMonAdj, 0); } else if (action == "start") { this.timerTimed=0; this.timerInterval=this.p.imp.startTimerInterval (this.id, item, "spin", 50); } } } HxG_3.prototype.JSFDatePicker.prototype.sizePickerToInput=function () { var popupElem=(this.objPopup) ? this.objPopup.DOMobj : null; if (popupElem) { this.setClassNames(); if (!this.HTML) this.HTML=new this.p.JSFMonth(this, popupElem, this.sUnique); if (!this.HTML.valid) return; if (popupElem.className != this.classDiv) popupElem.className=this.classDiv; if (popupElem.style.overflow != "visible") popupElem.style.overflow="visible"; if (popupElem.style.width != "") popupElem.style.width=""; if (popupElem.style.height != "") popupElem.style.height=""; if (this.HTML.table.className != this.classSize) this.HTML.table.className=this.classSize; if (this.HTML.td1.width != "") this.HTML.td1.width=""; if (this.HTML.td2.width != "") this.HTML.td2.width=""; if (this.HTML.hdrTable.className != this.classHeader) this.HTML.hdrTable.className=this.classHeader; if (this.HTML.hdrTable.width != "100%") this.HTML.hdrTable.width="100%"; if (this.HTML.hdrtr1.cells[0].className != this.classHeader1) this.HTML.hdrtr1.cells[0].className=this.classHeader1; if (this.HTML.hdrtr1.cells[1].className != this.classHeaderYear) this.HTML.hdrtr1.cells[1].className=this.classHeaderYear; if (this.HTML.hdrtr1.cells[2].className != this.classHeader1) this.HTML.hdrtr1.cells[2].className=this.classHeader1; if (this.HTML.hdrtr2.cells[0].className != this.classHeader2) this.HTML.hdrtr2.cells[0].className=this.classHeader2; if (this.HTML.hdrtr2.cells[1].className != this.classHeaderMonth) this.HTML.hdrtr2.cells[1].className=this.classHeaderMonth; if (this.HTML.hdrtr2.cells[2].className != this.classHeader2) this.HTML.hdrtr2.cells[2].className=this.classHeader2; if (this.HTML.hdrbtn1.className != this.classButton) this.HTML.hdrbtn1.className=this.classButton; if (this.HTML.hdrbtn2.className != this.classButton) this.HTML.hdrbtn2.className=this.classButton; if (this.HTML.hdrbtn3.className != this.classButton) this.HTML.hdrbtn3.className=this.classButton; if (this.HTML.hdrbtn4.className != this.classButton) this.HTML.hdrbtn4.className=this.classButton; var i, c; if (this.HTML.bodyTable.className != this.classBody) this.HTML.bodyTable.className=this.classBody; if (this.HTML.bodyTable.width != "100%") this.HTML.bodyTable.width="100%"; for (i=this.nFirstDayOfWeek; i < this.nFirstDayOfWeek + 7; i++) { c=this.HTML.bodytr1.cells[i - this.nFirstDayOfWeek]; if (c.width != "") c.width=""; if (c.className != this.classWHeader) c.className=this.classWHeader; c.innerHTML='' + hX_3.STR_DATE_SHSHDAYS[i%7] + ''; } this.updateGrid(); return true; } return false; } HxG_3.prototype.JSFMonth=function (thisp, inobj, suffix) { this.valid=false; if (inobj == null) return; this.table=this.tr1=this.tr2=this.td1=this.td2=null; this.hdrTable=this.hdrtr1=this.hdrtr2=null; this.hdrbtn1=this.hdrbtn2=this.hdrbtn3=this.hdrbtn4=null; this.hdrMonth=this.hdrYear=null; this.bodyTable=this.bodytr1=this.bodytr2=null; this.table=thisp.getFirstChild(inobj); if (this.table == null) { this.table=document.createElement("table"); this.table.setAttribute ("id", suffix + "_table"); this.table.cellPadding=this.table.cellSpacing=this.table.border="0"; inobj.appendChild(this.table); this.tr1=this.table.insertRow(0); this.tr2=this.table.insertRow(1); this.td1=this.tr1.insertCell(0); this.td2=this.tr2.insertCell(0); this.td1.vAlign=this.td2.vAlign="top"; this.td1.align=this.td2.align="left"; } if (!this.table) return; this.tr1=this.table.rows[0]; this.tr2=this.table.rows[1]; this.td1=this.tr1.cells[0]; this.td2=this.tr2.cells[0]; if (!this.tr1 || !this.tr2 || !this.td1 || !this.td2) return; var htd1, htd2, htd3, htd4, htd5, htd6; this.hdrTable=thisp.getFirstChild(this.td1); if (this.hdrTable == null) { this.hdrTable=document.createElement("table"); this.hdrTable.setAttribute ("id", suffix + "_hdr_table"); this.hdrTable.cellPadding=this.hdrTable.cellSpacing=this.hdrTable.border="0"; this.td1.appendChild(this.hdrTable); this.hdrtr1=this.hdrTable.insertRow(0); this.hdrtr2=this.hdrTable.insertRow(1); htd1=this.hdrtr1.insertCell(0); htd2=this.hdrtr1.insertCell(0); htd3=this.hdrtr1.insertCell(0); htd4=this.hdrtr2.insertCell(0); htd5=this.hdrtr2.insertCell(0); htd6=this.hdrtr2.insertCell(0); htd1.vAlign=htd2.vAlign=htd3.vAlign=htd4.vAlign=htd5.vAlign=htd6.vAlign="middle"; htd1.align=htd4.align="left"; htd2.align=htd5.align="center"; htd3.align=htd6.align="right"; } if (!this.hdrTable) return; this.hdrtr1=this.hdrTable.rows[0]; this.hdrtr2=this.hdrTable.rows[1]; htd1=this.hdrtr1.cells[0]; htd2=this.hdrtr1.cells[1]; htd3=this.hdrtr1.cells[2]; htd4=this.hdrtr2.cells[0]; htd5=this.hdrtr2.cells[1]; htd6=this.hdrtr2.cells[2]; if (!this.hdrtr1 || !this.hdrtr2 || !htd1 || !htd2 || !htd3 || !htd4 || !htd5 || !htd6) return; this.hdrbtn1=thisp.getFirstChild(htd1); if (!this.hdrbtn1) this.hdrbtn1=thisp.emitButtonHTML (htd1, suffix + "_HDRBTN1", 1, 0, hX_3.STR_DATE_PREVIOUS_YEAR) this.hdrbtn2=thisp.getFirstChild(htd3); if (!this.hdrbtn2) this.hdrbtn2=thisp.emitButtonHTML (htd3, suffix + "_HDRBTN2", 0, 0, hX_3.STR_DATE_NEXT_YEAR) this.hdrbtn3=thisp.getFirstChild(htd4); if (!this.hdrbtn3) this.hdrbtn3=thisp.emitButtonHTML (htd4, suffix + "_HDRBTN3", 1, 0, hX_3.STR_DATE_PREVIOUS_MONTH) this.hdrbtn4=thisp.getFirstChild(htd6); if (!this.hdrbtn4) this.hdrbtn4=thisp.emitButtonHTML (htd6, suffix + "_HDRBTN4", 0, 0, hX_3.STR_DATE_NEXT_MONTH) this.hdrYear=htd2; this.hdrMonth=htd5; var i, j, r, c; this.bodyTable=thisp.getFirstChild(this.td2); if (this.bodyTable == null) { this.bodyTable=document.createElement("table"); this.bodyTable.setAttribute ("id", suffix + "_body_table"); this.bodyTable.cellPadding=this.bodyTable.cellSpacing=this.bodyTable.border="0"; this.td2.appendChild(this.bodyTable); for (i=0; i < 7; i++) { r=this.bodyTable.insertRow(i); for (j=0; j < 7; j++) { c=r.insertCell(j); c.vAlign="middle"; c.align="center"; } } } if (!this.bodyTable) return; this.bodytr1=this.bodyTable.rows[0]; this.bodytr2=this.bodyTable.rows[1]; if (this.bodytr1 && this.bodytr2) this.valid=true; } HxG_3.prototype.JSFDatePicker.prototype.emitButtonHTML=function (parent, id, wellx, welly, alt) { var btn=null; if (id) { btn=document.createElement("INPUT"); btn.setAttribute ("id", id); btn.setAttribute ("type", "image"); btn.className=this.classButton; btn.src=this.r.getURL (this.p.R_IMG_SPACER); btn.alt=alt; btn.title=alt; btn.style.backgroundImage=this.r.getURI (this.p.R_IMG_VLG_HINKIES); btn.style.backgroundPosition=this.r.wellPosition(hX_3.R_IMG_VLG_HINKIES, wellx, welly); btn.style.backgroundRepeat="no-repeat"; btn.style.margin="0px" parent.appendChild(btn); } return btn; } HxG_3.prototype.JSFDatePicker.prototype.pressButtonHTML=function (id, down) { var btn=this.p.getElementById(id); if (btn) { var x=(btn == this.HTML.hdrbtn1 || btn == this.HTML.hdrbtn3) ? 1 : 0; var y=(down) ? 1 : 0; btn.style.backgroundPosition=this.r.wellPosition(hX_3.R_IMG_VLG_HINKIES, x, y); } } HxG_3.prototype.JSFDatePicker.prototype.getFirstChild=function (cell) { r=(cell) ? cell.firstChild : null; while (r && r.nodeType != hX_3.ELEMENT_NODE) r=r.nextSibling; return r; } HxG_3.prototype.JSFDatePicker.prototype.updateGrid=function (noscroll) { var el; var x, y; var oDate=(noscroll && this.oDrawDate) ? this.oDrawDate : this.oDate; var yr=this.DTP.valueToYearLabel(oDate); var mo=this.DTP.valueToMonthLabel(oDate); if (!this.p.brw.isNavOrMoz()) { yr='' + yr + ''; mo='' + mo + ''; } if (this.HTML.hdrYear.innerHTML != yr) this.HTML.hdrYear.innerHTML=yr; if (this.HTML.hdrMonth.innerHTML != mo) this.HTML.hdrMonth.innerHTML=mo; var tempDate=new Date(oDate.getFullYear(), oDate.getMonth(), 1, 12, 0, 0); var iDaysBefore=tempDate.getDay() - this.nFirstDayOfWeek; if(iDaysBefore < 0) iDaysBefore+=7; var iDaysInAndBefore=Date.HxGetDaysInMonth(tempDate.getMonth(), tempDate.getFullYear()) + iDaysBefore; var iNoOfRows=Math.floor(iDaysInAndBefore / 7); if(iDaysInAndBefore > iNoOfRows * 7) iNoOfRows++; if(iDaysBefore) tempDate.HxAdjustDate(0, 0, -iDaysBefore, 0, 0, 0); var row, sizeChanged=false; for (y=0; y 7) || (r == nRows-1 && iDate < 7) ? this.classOtherMonth : this.classCurrMonth; if (!this.DTV.validate(oDate, this.DTP, true)) cl=this.classInvalidDay; if (cell.id != id || cell.className != cl) { if (this.p.brw.isNavOrMoz()) { s='' + iDate + ''; cell.style.cursor="pointer"; } else s='' + iDate + ''; cell.setAttribute("id", id); cell.className=cl; cell.tabIndex="1"; cell.innerHTML=s; } return true; } HxG_3.prototype.JSFDatePicker.prototype.dateToTag=function(oDate) { var s=(oDate) ? this.sUnique + this.DTP.valueToConstant(oDate) : ""; return s; } HxG_3.prototype.JSFDatePicker.prototype.showFocus=function() { if (this.oDate) { var obj=this.p.getElementById (this.dateToTag(this.oDate)); if (this.objPopup.isPopped() && obj) { if (obj.tagName && obj.tagName == "TD" && obj.focus) { obj.focus(); } else { obj=this.getFirstChild(obj); if (obj.tagName && obj.focus) obj.focus(); } } } } HxG_3.prototype.getParentIdByType=function(id,type) { var parent=hX_3.getElementById(id); parent=parent.parentNode; while (parent != null) { if(parent.nodeName==type){ break; } parent=parent.parentNode; } if (parent==null) { return; } if (parent.id==null || parent.id=="") { parent.id=type + "_parentof_"+ id; } return parent.id; } HxG_3.prototype.getParentOfType=function(obj,type) { var parent=obj.parentNode; while(parent!=null){ if(parent.nodeName==type) { return parent; } parent=parent.parentNode; } return; } HxG_3.prototype.JSFBehaviorRowAction=function () { this.type="tablerowaction"; this.hiddenInputId=""; this.inputValue=""; this.inputObj=null; this.formObj=null; this.attributeTable=new Array(); this.attributeTable ['input-id']=['hiddenInputId',hX_3.ARG_TO_NAN,false,null,null]; this.attributeTable ['input-value']=['inputValue',hX_3.ARG_TO_NAN,false,null,null]; this.setAttribute(arguments); } HxG_3.prototype.JSFBehaviorRowAction.prototype=new hX_3.JSFBehavior(); HxG_3.prototype.JSFBehaviorRowAction.prototype.setAttributeCode=function() { this.inputObj=hX_3.getElementById(this.hiddenInputId); this.formObj=hX_3.getParentOfType(this.inputObj,"FORM"); hX_3.getParentOfType(this.inputObj,"TR").style.cursor="pointer"; return true; } HxG_3.prototype.JSFBehaviorRowAction.prototype.dispatchBehavior=function(thisObj, evt) { if (this.DOMobj != null && this.inputObj != null && this.formObj != null) { this.inputObj.disabled=false; this.inputObj.value=this.inputValue; this.formObj.submit(); this.inputObj.disabled=true; } return; } HxG_3.prototype.JSFBehaviorRowCategory=function () { this.type="tablerowcategory"; this.catId=""; this.expImgSrc=""; this.colImgSrc=""; this.firstRowNum=""; this.lastRowNum=""; this.componentId=""; this.initImg=""; this.expImg=null; this.colImg=null; this.attributeTable=new Array(); this.attributeTable ['cat-id']=['catId',hX_3.ARG_TO_NAN,false,null,null]; this.attributeTable ['twistie-exp-img']=['expImgSrc',hX_3.ARG_TO_NAN,false,null,null]; this.attributeTable ['twistie-col-img']=['colImgSrc',hX_3.ARG_TO_NAN,false,null,null]; this.attributeTable ['first-row-num']=['firstRowNum',hX_3.ARG_TO_NAN,false,null,null]; this.attributeTable ['last-row-num']=['lastRowNum',hX_3.ARG_TO_NAN,false,null,null]; this.attributeTable ['component-id']=['componentId',hX_3.ARG_TO_NAN,false,null,null]; this.attributeTable ['init-img']=['initImg',hX_3.ARG_TO_NAN,false,null,null]; this.setAttribute(arguments); } HxG_3.prototype.JSFBehaviorRowCategory.prototype=new hX_3.JSFBehavior(); HxG_3.prototype.JSFBehaviorRowCategory.prototype.IMAGE_ARRAY=new Array(); HxG_3.prototype.JSFBehaviorRowCategory.prototype.setAttributeCode=function() { for(var i=0;i < this.IMAGE_ARRAY.length;i=i+2) { if(this.IMAGE_ARRAY[i] == this.expImgSrc){ this.expImg=this.IMAGE_ARRAY[i+1]; } if(this.IMAGE_ARRAY[i] == this.colImgSrc){ this.colImg=this.IMAGE_ARRAY[i+1]; } } if(this.expImg==null){ this.expImg=new Image(); this.expImg.src=this.expImgSrc; this.IMAGE_ARRAY[this.IMAGE_ARRAY.length]=this.expImgSrc; this.IMAGE_ARRAY[this.IMAGE_ARRAY.length]=this.expImg; } if(this.colImg==null){ this.colImg=new Image(); this.colImg.src=this.colImgSrc; this.IMAGE_ARRAY[this.IMAGE_ARRAY.length]=this.colImgSrc; this.IMAGE_ARRAY[this.IMAGE_ARRAY.length]=this.colImg; } if(this.initImg=="true"){ this.initTwistieImgs() } return true; } HxG_3.prototype.JSFBehaviorRowCategory.prototype.dispatchBehavior=function(thisObj, evt) { var rowNum=0,rowId="",row=null,twistieId=this.catId+'img'; var twistie=hX_3.getElementById(twistieId); var u=0; while(true) { rowId=this.catId+rowNum; if ((row=hX_3.getElementById(rowId))!=null){ if(row.style.display=='none'){ if(u==0){ twistie.src=this.expImg.src; u=1; } row.style.display=''; } else { if(u==0){ twistie.src=this.colImg.src; u=1; } row.style.display='none'; } rowNum++; } else { break; } } return; } HxG_3.prototype.JSFBehaviorRowCategory.prototype.initTwistieImgs=function() { var rowNum=0,rowId="",row=null,twistieId=this.catId+'img'; var twistie=hX_3.getElementById(twistieId); rowId=this.catId+rowNum; if ((row=hX_3.getElementById(rowId))!=null){ if(row.style.display=='none'){ twistie.src=this.colImg.src; } else { twistie.src=this.expImg.src; } } return; } HxG_3.prototype.JSFBehaviorRowEditShowHide=function () { this.type="tableroweditshowhide"; this.divId=""; this.show=""; this.divObj=null; this.trObj=null; this.cloneObj=null; this.attributeTable=new Array(); this.attributeTable ['div-id']=['divId',hX_3.ARG_TO_NAN,false,null,null]; this.attributeTable ['show']=['show',hX_3.ARG_TO_NAN,false,null,null]; this.setAttribute(arguments); } HxG_3.prototype.JSFBehaviorRowEditShowHide.prototype=new hX_3.JSFBehavior(); HxG_3.prototype.JSFBehaviorRowEditShowHide.prototype.setAttributeCode=function() { this.divObj=hX_3.getElementById(this.divId); this.trObj=hX_3.getParentOfType(this.divObj,"TR"); this.cloneObj=this.divObj.cloneNode(true); return true; } HxG_3.prototype.JSFBehaviorRowEditShowHide.prototype.dispatchBehavior=function(thisObj, evt) { if(this.divObj==null) { alert("RUNTIME ERROR: can't find element "+this.spanId); return; } if(!this.divObj.style) { return; } if(HxG_3.prototype.JSFBehaviorRowEditShowHide.prototype.LAST_SHOWN!=null) { HxG_3.prototype.JSFBehaviorRowEditShowHide.prototype.LAST_SHOWN.style.visibility="hidden"; } this.setVisible(this.show); HxG_3.prototype.JSFBehaviorRowEditShowHide.prototype.LAST_SHOWN=this.divObj; } HxG_3.prototype.JSFBehaviorRowEditShowHide.prototype.LAST_SHOWN=null; HxG_3.prototype.JSFBehaviorRowEditShowHide.prototype.setVisible=function(bVisible) { if(bVisible=="false") { this.divObj.style.visibility="hidden"; this.restoreState(this.cloneObj, this.divObj); } else { this.divObj.style.visibility="visible"; this.setPosition(); } } HxG_3.prototype.JSFBehaviorRowEditShowHide.prototype.restoreState=function(objFrom, objTo) { if(objFrom.nodeName != objTo.nodeName) { return; } if(objFrom.childNodes.length != objTo.childNodes.length) { return; } if(objFrom.value) { objTo.value=objFrom.value; } for(var i=0; i0) { var xOffset=pageW - (spanW+spanL); if(xOffset<0) { spanL+=xOffset; } if(spanL<0) { spanL=0; } } var rowH=this.trObj.offsetHeight; var rowT=this.getY(this.trObj); var scrollH=body.scrollTop; var clientH=body.clientHeight; var spanH=this.divObj.offsetHeight; var spanT=(rowT + (rowH/2)) - (spanH/2); if(clientH>0) { var yOffset=(scrollH + clientH) - (spanH + spanT); if(yOffset<0) { spanT+=yOffset; } if(spanT<0) { spanT=0; } if(spanT= this.styleList.length) { this.index=0; } return this.styleList[this.index++]; } HxG_3.prototype.HxCheckImageListener=function(strImgId, strUnselectedUrl, strSelectedUrl, strUnselected, strSelected) { if(!hX_3.getElementById) { return; } this.objImg=hX_3.getElementById(strImgId); if(this.objImg==null) { alert("RUNTIME ERROR: cannot find item to set background on: "+strImgId); } this.strUnselectedUrl=strUnselectedUrl; this.strSelectedUrl=strSelectedUrl; this.strUnselected=strUnselected; this.strSelected=strSelected; } HxG_3.prototype.HxCheckImageListener.prototype.selectionChanged=function (objHxSelection) { if(objHxSelection.isSelected()) { this.objImg.src=this.strSelectedUrl; this.objImg.alt=this.strSelected; } else { this.objImg.src=this.strUnselectedUrl; this.objImg.alt=this.strUnselected; } } HxG_3.prototype.HxCheckCellListener=function(strSpanId, strInputId, objGroup, objHxSelection){ if(!hX_3.getElementById) { return; } this.objTd=hX_3.getElementById(strSpanId); if(!this.objTd) { alert("RUNTIME ERROR: SPAN element "+strSpanId+" cannot be found"); return; } this.objTd=this.getParentOfType(this.objTd, "TD"); if(!this.objTd) { alert("RUNTIME ERROR: TD element cannot be found"); return; } this.objInput=hX_3.getElementById(strInputId); if(!this.objInput) { alert("RUNTIME ERROR: INPUT element "+strInputId+" cannot be found"); return; } this.objGroup=objGroup; this.objHxSelection=objHxSelection; this.bindToDom(); this.objGroup.addMember(this); } HxG_3.prototype.HxCheckCellListener.prototype.bindToDom=function() { var thisObj=this; this.objTd.onmousedown=function (evt) { if(!evt) { var evt=window.event; } thisObj.onMouseDown(evt); return false; } this.objTd.onclick=function (evt) { return false; } this.objTd.onkeypress=function (evt) { if(!evt) { var evt=window.event; } thisObj.onKey(evt); } } HxG_3.prototype.HxCheckCellListener.prototype.onMouseDown=function(evt) { this.objHxSelection.setSelected(!this.objHxSelection.isSelected()); this.setSelected(this.objHxSelection.isSelected()); this.objGroup.fireMouseDown(evt, this.objHxSelection.isSelected()); } HxG_3.prototype.HxCheckCellListener.prototype.onKey=function(evt) { var nKey=evt.which | evt.keyCode; if(nKey!=32) { return; } this.objHxSelection.setSelected(!this.objHxSelection.isSelected()); this.setSelected(this.objHxSelection.isSelected()); } HxG_3.prototype.HxCheckCellListener.prototype.setSelected=function(bSelected) { this.objHxSelection.setSelected(bSelected); this.objInput.value=bSelected; } HxG_3.prototype.HxCheckCellListener.prototype.isSelected=function() { return this.objHxSelection.isSelected(); } HxG_3.prototype.HxCheckCellListener.prototype.isInElementBoundary=function(pt) { var y=hX_3.geo.getElementAbsPosTop(this.objTd), x=hX_3.geo.getElementAbsPosLeft(this.objTd); if(pt.Xy || pt.X>x) return false; return true; } HxG_3.prototype.HxCheckCellListener.prototype.getParentOfType=function(node, strType) { if((node == null) || (strType==null)) { return null; } var parent=node.parentNode; while(parent!=null) { if(parent.nodeName==strType) { return parent; } parent=parent.parentNode; } return null; } HxG_3.prototype.HxCheckCellGroup=function() { this.arrayMembers=new Array(); this.bSelected=true; if(!hX_3.getElementById) { return; } } HxG_3.prototype.HxCheckCellGroup.prototype.GROUP=null; HxG_3.prototype.HxCheckCellGroup.prototype.addMember=function (objHxCheckCellListener) { this.arrayMembers[this.arrayMembers.length]=objHxCheckCellListener; } HxG_3.prototype.HxCheckCellGroup.prototype.isSelected=function() { return this.bSelected; } HxG_3.prototype.HxCheckCellGroup.prototype.setSelected=function(bSelected) { this.bSelected=bSelected; } HxG_3.prototype.HxCheckCellGroup.prototype.fireMouseDown=function(evt, bSelected) { this.setSelected(bSelected); hX_3.HxCheckCellGroup.prototype.GROUP=this; this.registerWindowListeners(evt); } HxG_3.prototype.HxCheckCellGroup.prototype.registerWindowListeners=function(evt) { if(document.attachEvent) { document.attachEvent("onmousemove", HxG_3.prototype.HxCheckCellGroup.prototype.onMouseEnterStatic); document.attachEvent("onmouseup", HxG_3.prototype.HxCheckCellGroup.prototype.onMouseUpStatic); document.attachEvent("onselectstart", HxG_3.prototype.HxCheckCellGroup.prototype.onSelectStartStatic); window.event.cancelBubble=true; window.event.returnValue=false; } else if(document.addEventListener) { document.addEventListener("mousemove", HxG_3.prototype.HxCheckCellGroup.prototype.onMouseEnterStatic, true); document.addEventListener("mouseup", HxG_3.prototype.HxCheckCellGroup.prototype.onMouseUpStatic, true); evt.preventDefault(); } } HxG_3.prototype.HxCheckCellGroup.prototype.onSelectStartStatic=function(evt) { return false; } HxG_3.prototype.HxCheckCellGroup.prototype.onMouseEnterStatic=function(evt) { if(!evt) { var evt=window.event; } hX_3.HxCheckCellGroup.prototype.GROUP.onMouseEnter(evt); } HxG_3.prototype.HxCheckCellGroup.prototype.onMouseEnter=function(evt) { var len=this.arrayMembers.length; for(var i=0; i= objElement.childNodes.length) { return null; } return objElement.childNodes[nIdx]; } HxG_3.prototype.HxFocusChanger.prototype.getIndexInParent=function(objElement) { var objParent=objElement.parentNode; for(var i=0; i0); } HxG_3.prototype.HxDomIterator.prototype.next=function() { var obj=this.popFromStack(); if(obj==null) { return null; } if(obj.nextSibling) { this.pushToStack(obj.nextSibling); } if(obj.firstChild) { this.pushToStack(obj.firstChild); } return obj; } HxG_3.prototype.HxFocusAdder=function(strTableId, nPrev, nNext) { if(!hX_3.getElementById) { return; } var objTable=hX_3.getElementById(strTableId); if(objTable==null) { return null; } var arrElements=objTable.getElementsByTagName("TD"); for(var i=0; i 0)) doAutoTab(); } function dispatch (evt) { var r=true; if (hX_3.pendingFocusReturn && hX_3.pendingFocusReturn != obj.id) return true; hX_3.pendingFocusReturn=null; if ((obj.readOnly != null && obj.readOnly == true) || (obj.disabled != null && obj.disabled == true)) return true; switch (evt.type) { case "focus": focus=true; keydown=false; keypress=false; updating=true; autotabtimer=null; if (!checkedComponent) { hasComponent=hX_3.getComponentById(obj.id); checkedComponent=true; } if (behavior.assist && behavior.assist.onFocus) behavior.assist.onFocus(evt); if (hX_3.pendingSelect && obj.select) obj.select(); hX_3.pendingSelect=false; saveState(); if (behavior.assist && pos >= 0) obj.style.imeMode="disabled"; break; case "blur": keydown=false; keypress=false; updating=true; if (autotabtimer) { hX_3.imp.killTimerTimed(autotabtimer); autotabtimer=null; } if (focus && behavior.assist && behavior.assist.onBlur) behavior.assist.onBlur(evt); focus=false; break; case "keydown": if (!focus) break; keydown=true; keypress=false; updating=false; saveState(); if (isSubmitFcnKey(evt) && behavior.assist) { if (focus && behavior.assist && behavior.assist.onBlur) behavior.assist.onBlur(evt); focus=false; break; } else if (isFcnKey(evt) && behavior.assist) { if (hasComponent && hasComponent.isRedirectFcnKey && hasComponent.isRedirectFcnKey(evt)) { var newValue=(behavior.assist.fromAssist) ? behavior.assist.fromAssist(value) : obj.value; newValue=(hasComponent.doRedirectFcnKey) ? hasComponent.doRedirectFcnKey(evt, newValue) : newValue; newValue=(behavior.assist.toAssist) ? behavior.assist.toAssist(newValue) : newValue; value=(newValue.v) ? newValue.v : value; commit(evt); if (pos >= 0) hX_3.sel.setCaretPos(obj, pos); r=false; } else if (behavior.assist.onChangeKeyCode && !isSkipFcnKey(evt)) { r=behavior.assist.onChangeKeyCode(evt); if (r == -1) r=true; else if (r) { var newR=doChange(evt); r=(r == -2) ? false : newR; } if (!r) hX_3.imp.cancelAction(evt, true); } keypress=true; keypress_r=r; } break; case "keypress": if (!focus) break; updating=false; if (hX_3.brw.isNavOrMoz() && evt.keyCode && evt.keyCode == 191 && evt.charCode!=null && evt.charCode==0) return false; if (keypress) r=keypress_r; else { keypress=true; if (behavior.assist && behavior.assist.onChangeChrCode) { var r=behavior.assist.onChangeChrCode(evt); var newR=false; if (r > 1) { r=true; newR=true; } else if (r) { newR=doChange(evt); r=(r == -2) ? false : newR; } if (newR && (autotab > 0)) doAutoTab(); } else if (autotab > 0) autotabtimer=hX_3.imp.startTimerTimed (obj.id, 0, "autotab", 1, true); } break; case "keyup": if (!focus) break; updating=false; if (behavior.assist && behavior.assist.onChangeKeyCode && (keydown && !keypress)) { if (hX_3.brw.isIE() && evt.keyCode == 67) r=false; else { r=behavior.assist.onChangeKeyCode(evt); if (r) { var newR=doChange(evt); r=(r == -2) ? false : newR; } } } keydown=keypress=false; break; case "click": if (!focus) break; keydown=false; keypress=false; updating=false; saveState(); if (!sel) { if (behavior.assist && behavior.assist.onClick) { r=behavior.assist.onClick(evt); if (r == -2 && pos >= 0) { hX_3.sel.setCaretPos(obj, pos); r=false; } } } break; case "cut": if (!focus) break; keydown=false; keypress=false; updating=false; saveState(); if (sel) { if (behavior.assist && behavior.assist.onCut) { r=behavior.assist.onCut(evt); if (r == -1) { r=true; } else if (r) { r=doChange(evt); r=(r == -2) ? false : r; } } } break; case "copy": if (focus && sel && behavior.assist && behavior.assist.onCopy) behavior.assist.onCopy(evt); break; case "paste": if (!focus) break; keydown=false; keypress=false; updating=false; saveState(); if (behavior.assist && behavior.assist.onPaste) { var newR=false; var r=behavior.assist.onPaste(evt); if (r) { newR=doChange(evt); r=(r == -2) ? false : newR; } var didTab=false; if (newR && (autotab > 0)) didTab=doAutoTab(); if (hX_3.brw.isIE() && newR && !didTab && pos >= 0) hX_3.sel.setCaretPos(obj, pos, null, true); } break; } return r; } function doChange(evt) { var r=true; if (behavior.assist && behavior.assist.onValidate) r=behavior.assist.onValidate(evt); if (r) commit(evt); else rollback(evt); return r; } function rollback (evt) { value=orgvalue; pos=orgpos; update(evt); } function commit (evt) { update (evt); } function update (evt) { if (!updating) { updating=true; if (obj.value != value) obj.value=value; if (pos >= 0) hX_3.sel.setCaretPos(obj, pos); updating=false; } } function doAutoTab() { if (isFilled(hX_3.sel.getCaretPos(obj))) { if (autosubmit) { var a=new Array(); var t=new Array(); a.push("SUBMIT"); t.push((behavior.autoSubmit.length > 0) ? behavior.autoSubmit : obj.form.id); return (behavior.processAction (obj, null, null, a, true, t, null, null, null, true)); } else hX_3.gotoNextPrev(obj, true); return true; } return false; } function isFilled(curpos) { if (behavior && behavior.assist && behavior.assist.isFilled) return (behavior.assist.isFilled(curpos)); else { return (obj.value.length >= autotab && (curpos >= autotab)); } } function isFcnKey (evt) { var code=(evt.keyCode && (evt.keyCode != 0)) ? evt.keyCode : -1; if (((code < 48) && (code != 32 && code != 9 && code != 13)) || (code >= 91 && code <= 93) || (code >= 112 && code <= 123) || (code >= 124 && code <= 185) || (code >= 223)) return true; return false; } function isSubmitFcnKey (evt) { var code=(evt.keyCode && (evt.keyCode != 0)) ? evt.keyCode : -1; if (code == 13) { if (!hX_3.isKeyBound(obj, "13", evt)) return true; } return false; } function isSkipFcnKey (evt) { var code=(evt.keyCode && (evt.keyCode != 0)) ? evt.keyCode : -1; if (code == 16 || code == 17 || code == 18 || code == 145 || code == 166 || code == 167) return true; return false; } }