/* * Licensed Material - Property of IBM * (C) Copyright IBM Corp. 2002, 2004 - All Rights Reserved. * US Government Users Restricted Rights - Use, duplication or disclosure * restricted by GSA ADP Schedule Contract with IBM Corp. */ function HxG_1 () { this.version= "1.00"; this.brw=new this.HxBrowserMgr(); this.brw.initClientBrowserObject(); 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.bodyLoadRewritten=false; this.res[0]=new this.HxResourceMgr(this); this.res[0].setAbsolutePaths(); } HxG_1.prototype.CLASS_LINES_SLIDER="inputText_Slider_Body"; HxG_1.prototype.CLASS_SLIDER="inputText_Slider"; HxG_1.prototype.CLASS_DP="inputText_DatePicker"; HxG_1.prototype.CLASS_DP_SIZE="Size"; HxG_1.prototype.CLASS_DP_HEADER="Header"; HxG_1.prototype.CLASS_DP_HEADER1="HeaderLine1"; HxG_1.prototype.CLASS_DP_HEADER2="HeaderLine2"; HxG_1.prototype.CLASS_DP_HEADERYEAR="HeaderYear"; HxG_1.prototype.CLASS_DP_HEADERMONTH= "HeaderMonth"; HxG_1.prototype.CLASS_DP_HEADER_WEEKDAY="HeaderWeekday"; HxG_1.prototype.CLASS_DP_BODY="Body"; HxG_1.prototype.CLASS_DP_BUTTON="Button"; HxG_1.prototype.CLASS_DP_CURRMONTH="CurrentMonth"; HxG_1.prototype.CLASS_DP_OTHERMONTH="OtherMonth"; HxG_1.prototype.CLASS_DP_CURRDAY="CurrentDay"; HxG_1.prototype.CLASS_DP_OTHERDAY="CurrentOtherDay"; HxG_1.prototype.CLASS_DP_TODAY="Today"; HxG_1.prototype.CLASS_DP_CURRENTTODAY="CurrentToday"; HxG_1.prototype.CLASS_DP_INVALIDDAY="InvalidDay"; HxG_1.prototype.DTFMT_DATE0="MM-dd-yyyy"; HxG_1.prototype.DTFMT_DEFAULTSTRICT=1; HxG_1.prototype.DTFMT_DEFAULTFIRSTDAYMONTH=0; HxG_1.prototype.DTFMT_YEAR="%yyyy"; HxG_1.prototype.DTFMT_GEYEAR="%GGGG %y"; HxG_1.prototype.DTFMT_GCYEAR="%yyyy %GG"; HxG_1.prototype.DATE_EPOCH_IDS=["", "c", "j"]; HxG_1.prototype.D_DAYS_IN_MONTH=new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); HxG_1.prototype.STR_DATE_TODAY=new Array ("today","tomorrow","yesterday","now"); HxG_1.prototype.NFMT_DECIMAL0="###,###,##0"; HxG_1.prototype.NFMT_LOCALE0=",.%\u2030-$"; HxG_1.prototype.NFMT_DEFAULTSTRICT=1; HxG_1.prototype.TW_UP=0; HxG_1.prototype.TW_DN=1; HxG_1.prototype.TW_LT=2; HxG_1.prototype.TW_RT=3; HxG_1.prototype.TW_SNOUT=0; HxG_1.prototype.TW_PUG=1; HxG_1.prototype.TW_VEE=2; HxG_1.prototype.TW_TRI=3; HxG_1.prototype.TW_NOBAR=0; HxG_1.prototype.TW_BAR_INNER=1; HxG_1.prototype.TW_BAR_OUTER=2; HxG_1.prototype.TAG_OBJECT="object"; HxG_1.prototype.TAG_PARAM="param"; HxG_1.prototype.TAG_EMBED="embed"; HxG_1.prototype.STR_mille_char="\u2030"; HxG_1.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_1.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_1.prototype.addComponent=function(id, obj) { if (id && obj && this.brw.isW3C()) { var DOMobj=this.getElementById(id); if (DOMobj) { this.Components[id]=obj; obj.id=id; obj.DOMobj=DOMobj; obj.HTMLrendered=false; obj.p=this; obj.r=this.res[this.res.length-1]; return true; } } return false; } HxG_1.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_1.prototype.addBehavior=function(id, eventname, obj) { if (id && obj && this.brw.isW3C()) { var DOMobj=this.getElementById(id); if (DOMobj) { var i=eventname.indexOf("on"); var thisid=(i==0) ? eventname.substr(2) : eventname; thisid=id + "_hx_" + thisid; this.Behaviors[thisid]=obj; obj.id=id; obj.eventname=eventname; obj.DOMobj=DOMobj; obj.HTMLrendered=false; obj.p=this; obj.r=this.res[this.res.length-1]; return true; } } return false; } HxG_1.prototype.addConverter=function(id, obj) { if (id && obj && this.brw.isW3C()) { this.Converters[id]=obj; obj.p=this; return true; } return false; } HxG_1.prototype.addValidator=function(id, obj) { if (id && obj && this.brw.isW3C()) { this.Validators[id]=obj; obj.p=this; return true; } return false; } HxG_1.prototype.addPopup=function(id, parentid, defwidth, defheight, srcvalue, clickstyle) { if (id && this.brw.isW3C()) { if (this.Popups[id]) { return this.Popups[id]; } else { var obj=new this.JSFPopup(parentid, defwidth, defheight, srcvalue, clickstyle); this.Popups[id]=obj; obj.id=id; obj.HTMLrendered=false; obj.p=this; obj.r=this.res[this.res.length-1]; return obj; } } return null; } HxG_1.prototype.onPageLoad=function () { if (!this.bodyLoadRewritten) this.attachEvent(document.body, "onload", null, this.pageLoadAction); this.bodyLoadRewritten=true; return true; } HxG_1.prototype.pageLoadAction=function(evt) { var thisp=hX_1; thisp.removeEvent(document.body, "onload", false, false, true); for (varobj in thisp.Components) { if (thisp.Components[varobj].onPageLoad) { if (!thisp.Components[varobj].HTMLrendered) thisp.Components[varobj].onPageLoad(); thisp.Components[varobj].HTMLrendered=true; } } for (varobj in thisp.Behaviors) { if (thisp.Behaviors[varobj].onPageLoad) { if (!thisp.Behaviors[varobj].HTMLrendered) thisp.Behaviors[varobj].onPageLoad(); thisp.Behaviors[varobj].HTMLrendered=true; } } for (varobj in thisp.Popups) { if (thisp.Popups[varobj].onPageLoad) { if (!thisp.Popups[varobj].HTMLrendered) thisp.Popups[varobj].onPageLoad(); thisp.Popups[varobj].HTMLrendered=true; } } return; } HxG_1.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(); } } return true; } HxG_1.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(); } } return true; } HxG_1.prototype.getComponentById=function(obj) { if (typeof obj == "string") { return (this.Components[obj]); } return (obj); } HxG_1.prototype.getSubComponentById=function(obj) { if (typeof obj == "string") { return (this.SubComponents[obj]); } return (obj); } HxG_1.prototype.getParentComponentById=function(obj) { if (typeof obj == "string") { var thisobj=this.SubComponents[obj]; return (thisobj.p); } return (obj); } HxG_1.prototype.getConverterById=function(obj) { if (typeof obj == "string") { return (this.Converters[obj]); } return (obj); } HxG_1.prototype.getValidatorById=function(obj) { if (typeof obj == "string") { return (this.Validators[obj]); } return (obj); } HxG_1.prototype.getBehaviorById=function(obj, eventname) { if (typeof obj == "string") { var i=eventname.indexOf("on"); var thisid=(i==0) ? eventname.substr(2) : eventname; thisid=obj + "_hx_" + thisid; var thisobj=this.Behaviors[thisid]; return (thisobj); } return (obj); } HxG_1.prototype.getPopupById=function(obj) { if (obj != null && typeof obj == "string") { return(this.Popups[obj]); } return (obj); } HxG_1.prototype.getElementById=function(obj) { var theObj; if (obj != null && typeof obj == "string") { if (window.document.getElementById != null) { theObj=window.document.getElementById(obj); } else if (window.document.all != null) { theObj=window.document.all(obj); } else if (window.document.layers != null) { theObj=this.seekLayerNN4(document, obj); } } else { theObj=obj; } return theObj; } HxG_1.prototype.seekLayerNN4=function(doc, name) { var theObj; for (var i=0; i < doc.layers.length; i++) { if (doc.layers[i].name == name) { theObj=doc.layers[i]; break; } if (doc.layers[i].document.layers.length > 0) { theObj=seekLayerNN4 (document.layers[i].document, name); } } return theObj; } HxG_1.prototype.attachEvent=function (objid, eventname, preobjevent, postobjevent) { if (objid && eventname) { var obj=this.getElementById(objid); if (obj) { var i; var found=false; var l=this.userEvents.length; var srcid=(obj.nodeName == "BODY" || obj.nodeName == "#document") ? "#body" : obj.id; for (i=0; i < l && !found; i++) { if (this.userEvents[i].etype == "R" && this.userEvents[i].id == srcid && this.userEvents[i].eventname == eventname) { found=true; break; } } if (!found) { this.userEvents[l]=new this.JSFEventObject(obj, eventname, "R"); i=l; } if (preobjevent != null) { this.userEvents[i].addPre (preobjevent); } if (postobjevent != null) { this.userEvents[i].addPost (postobjevent); } var tgtobj=(srcid == "#body") ? document.body : obj; if (this.brw.isIE()) { tgtobj.setAttribute(eventname, hX_1.runEvent); } else { tgtobj.setAttribute(eventname, "return(hX_1.runEvent(event));"); } return this.userEvents[i]; } } return null; } HxG_1.prototype.removeEvent=function (objid, eventname, userobj, preobj, postobj) { if (objid && eventname) { var obj=this.getElementById(objid); if (obj) { var i; var l=this.userEvents.length; var srcid=(obj.nodeName == "BODY") ? "#body" : obj.id; for (i=0; i < l; i++) { if (this.userEvents[i].etype == "R" && this.userEvents[i].id == srcid && this.userEvents[i].eventname == eventname) { if (userobj) { this.userEvents[i].User=null; } if (preobj) { this.userEvents[i].removePre(); } if (postobj) { this.userEvents[i].removePost(); } return true; } } } } return false; } HxG_1.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_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.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_1.prototype.HxBrowserMgr.prototype.initClientBrowserObject=function () { if (this.inited) return; this.m_browserLevel=parseInt (navigator.appVersion.charAt(0), 10); if (typeof (navigator.appName) != "undefined") this.m_browserName=navigator.appName; if (typeof (navigator.userAgent) != "undefined") this.m_browserVersion=navigator.userAgent; if (typeof (navigator.platform) != "undefined") 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_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() && (typeof (navigator.appVersion) != "undefined")) { 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) { if (this.isNavOrMoz()) { this.m_isW3C_STD=true; } else { this.m_isW3C_STD=(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_1.prototype.HxGeometryMgr=function (thisparent) { this.p=thisparent; } HxG_1.prototype.HxGeometryMgr.prototype.getElementAbsPosTop=function(obj) { var elem=this.p.getElementById(obj); var rValue=0; if(elem.offsetParent) { while(elem.offsetParent) { rValue+=elem.offsetTop; elem=elem.offsetParent; } } else if(elem.y) rValue+=elem.y; return rValue; } HxG_1.prototype.HxGeometryMgr.prototype.getElementAbsPosLeft=function(obj) { var elem=this.p.getElementById(obj); var rValue=0; if(elem.offsetParent) { while(elem.offsetParent) { rValue+=elem.offsetLeft; elem=elem.offsetParent; } } else if(elem.x) rValue+=elem.x; return rValue; } HxG_1.prototype.HxGeometryMgr.prototype.getElementRenderedHeight=function (obj) { var elem=this.p.getElementById(obj); return parseInt(elem.offsetHeight, 10); } HxG_1.prototype.HxGeometryMgr.prototype.getElementRenderedWidth=function (obj) { var elem=this.p.getElementById(obj); return parseInt(elem.offsetWidth, 10); } HxG_1.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_1.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_1.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_1.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_1.prototype.HxGeometryMgr.prototype.getEffectiveStyle=function (obj, stylething1, stylething2) { var rvalue; var 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_1.prototype.HxGeometryMgr.prototype.CSStagToDOMtag=function(value) { var work=value; var q=work.indexOf("-"); while (q >= 0) { work=work.substring(0, q) + (work.substring(q+1, q+2)).toUpperCase() + work.substring(q+2); q=work.indexOf("-"); } return work; } HxG_1.prototype.HxGeometryMgr.prototype.findContainer=function (obj, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) { var i=1; var p=obj; while (p && p.tagName != p0) p=(p.parentNode) ? p.parentNode : null; while (i <= arguments.length-2 && p && p.tagName && p.tagName == arguments[i]) { p=(p.parentNode) ? p.parentNode : null; i++; } p=(p && p.tagName && p.tagName == arguments[arguments.length-1]) ? p : null; return p; } HxG_1.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(); this.recache(); } HxG_1.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_1.prototype.HxResourceMgr.prototype.getURI=function (img) { return "url('" + this.images[img].src + "')"; } HxG_1.prototype.HxResourceMgr.prototype.getURL=function (img) { return this.images[img].src; } HxG_1.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_1.prototype.setResourceServer=function(path) { var cr=hX_1.res.length; hX_1.res[cr]=new hX_1.HxResourceMgr(hX_1); var lchar=path.charAt(path.length-1); path=(lchar == "/") ? path : path + "/"; hX_1.res[cr].baseImgPath=path + "img/"; hX_1.res[cr].baseCssPath=path + "css/" hX_1.res[cr].baseDlgPath=path + "dlg/"; hX_1.res[cr].bPathSet=true; hX_1.res[cr].recache(); } HxG_1.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_1.prototype.HxResourceMgr.prototype.setRelativePaths=function() { if (this.bPathSet == false) { var sPage2Root=this.getRelativePathPrefix(this.jsfRootToken); this.baseImgPath=sPage2Root + this.baseImgPath; this.baseCssPath=sPage2Root + this.baseCssPath; this.baseDlgPath=sPage2Root + this.baseDlgPath; this.bPathSet=true; this.recache(); } } HxG_1.prototype.HxResourceMgr.prototype.getRelativePathPrefix=function (sToken) { if (typeof(sToken) == "undefined" || sToken == "") sToken=this.jsfRootToken; var sLocation=new String(document.location); var sPage2Root=""; var iCursor=sLocation.indexOf(sToken, 0); if (iCursor != -1) { iCursor+=sToken.length; var sTailPath=sLocation.slice(iCursor+1); for (var i=0; i < sTailPath.length; i++) { if (sTailPath.charAt(i) == "/") { sPage2Root+="../"; } } } else { iCursor=sLocation.indexOf(this.protocol, 0); if (iCursor != -1) { iCursor+=this.protocol.length; var i,j; for (i=iCursor, j= 0; i < sLocation.length; i++) { if (sLocation.charAt(i) == "/") j++; } if (j > 2) { while (j-- > 2) sPage2Root+="../"; } } } return sPage2Root; } HxG_1.prototype.HxResourceMgr.prototype.getAbsolutePathPrefix=function (sToken) { if (typeof(sToken) == "undefined" || sToken == "") sToken=this.jsfRootToken; var sLocation=new String(document.location); var sPathPrefix=""; var iCursor=sLocation.indexOf(sToken, 0) - 1; 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) == "/") { sTailPath=sTailPath.slice(i); for (i=1; i < sTailPath.length; i++) { if (sTailPath.charAt(i) == "/") { sPathPrefix=sTailPath.substring(0, i + 1); break; } } } } } } else { var bFoundProjectDir=false; for (var i=iCursor; i >= 0; i--) { if (sLocation.charAt(i) == "/") { bFoundProjectDir=true; break; } } if (bFoundProjectDir == true) { sPathPrefix=sLocation.substring(i, i + (iCursor - i) + 1 + 1); } } return sPathPrefix; } HxG_1.prototype.HxUIState=function () { this.activecomponent=null; this.activecomponentkind=""; } HxG_1.prototype.HxUIState.prototype.setActiveComponent=function(obj) { if (obj) { this.activecomponent=obj; } else { this.activecomponent=""; } return true; } HxG_1.prototype.HxUIState.prototype.getActiveComponent=function(kind) { if (this.activecomponent && typeof(this.activecomponent) == "object") { return this.activecomponent; } return; } HxG_1.prototype.JSFargument=function (instring) { this.attribute=""; this.value=""; if (instring && (typeof instring == "string")) { 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_1.Trim(this.attribute); this.attribute=this.attribute.toLowerCase() } } HxG_1.prototype.ARG_IS_TRUE=1; HxG_1.prototype.ARG_TO_NUM=2; HxG_1.prototype.ARG_TO_NAN=3; HxG_1.prototype.ARG_TO_FCN=4; HxG_1.prototype.ARG_TO_FCNS= 5; HxG_1.prototype.ARG_TO_NAS=6; HxG_1.prototype.JSFargument.prototype.parseArg=function (thisp, type, arg1, arg2, arg3, arg4) { if (type != hX_1.ARG_TO_NAS) this.value=hX_1.Trim(this.value); if (type == hX_1.ARG_IS_TRUE) { return (!(this.value == "false" || this.value == "off" || this.value == "0")); } else if (type == hX_1.ARG_TO_NUM) { if (typeof this.value == "string") { var NP=new hX_1.NumberConverter(); var num=NP.constantToValue(this.value); } else var num=this.value; num=Math.min(Math.max(arg1, num), arg2); return num; } else if (type == hX_1.ARG_TO_NAN || type == hX_1.ARG_TO_NAS) { if (this.value.length <= 0) return null; else return this.value; } else if (type == hX_1.ARG_TO_FCN) { return eval(this.value); } else if (type == hX_1.ARG_TO_FCNS) { return (new Function ("thisEvent", this.value)); } else { return this.value; } } HxG_1.prototype.parseArg=function (attributeTable, thisp, a) { var i, arg, desc; var b=(typeof a == "string") ? [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)) { if (desc[1] == null) thisp[desc[0]]=arg.value; else { thisp[desc[0]]=arg.parseArg(thisp, desc[1], desc[3], desc[4], desc[5], desc[6]); } } } } } } HxG_1.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_1.prototype.JSFargument.prototype.attribute; HxG_1.prototype.JSFargument.prototype.value; HxG_1.prototype.HxCompImpMgr=function (thisparent) { this.p=thisparent; } HxG_1.prototype.HxCompImpMgr.prototype.dispatchAction=function(evt) { var thisp=hX_1; evt=(evt) ? evt : ((event) ? event: null); if (evt) { var src=(evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if (src) { src=(src.nodeType == 1 || src.nodeType == 9) ? src : src.parentNode; var item=src.tagName.toLowerCase(); if (src && src.id) { var obj=thisp.getComponentById(src.id); if (obj) { return (obj.dispatchAction (item, evt, evt.type, evt.keyCode)); } } } } return; } HxG_1.prototype.HxCompImpMgr.prototype.dispatchBehavior=function(evt) { var thisp=hX_1; evt=(evt) ? evt : ((event) ? event: null); if (evt) { var src=(evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if (src) { src=(src.nodeType == 1 || src.nodeType == 9) ? src : src.parentNode; if (src && src.id) { var obj=thisp.getBehaviorById(src.id, evt.type); if (obj) { return (obj.dispatchBehavior (evt, evt.type, evt.keyCode)); } } } } return; } HxG_1.prototype.HxCompImpMgr.prototype.dispatchBtnAction=function(evt) { var thisp=hX_1; evt=(evt) ? evt : ((event) ? event: null); if (evt) { var item=""; var src=(evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if (src) { src=(src.nodeType == 1 || src.nodeType == 9) ? src : src.parentNode; if (src) { 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=thisp.getComponentById(src.id); if (obj) { return (obj.dispatchAction (item, evt, evt.type, evt.keyCode)); } } } } } } return; } HxG_1.prototype.HxCompImpMgr.prototype.cancelAction=function(evt, preventDefault) { if (evt.cancelBubble) { evt.cancelBubble=true; } if (preventDefault) { if (evt.preventDefault) { evt.preventDefault(); } else if (evt.returnValue) { evt.returnValue=false; } } } HxG_1.prototype.HxCompImpMgr.prototype.fireEvent=function(obj, eventname) { var elem=this.p.getElementById(obj); var ename=eventname.toLowerCase(); if (elem) { if (elem.fireEvent) { elem.fireEvent(ename); return true; } else if (elem.dispatchEvent) { var newEvt=document.createEvent("HTMLEvents"); var shName=(ename.indexOf("on") == 0) ? ename.substr(2) : ename; newEvt.initEvent(shName, true, true); elem.dispatchEvent(newEvt); return true; } } return false; } HxG_1.prototype.HxCompImpMgr.prototype.setFocus=function(obj) { var elem=this.p.getElementById(obj); if (elem && elem.focus) { obj.focus(); return true; } return false; } HxG_1.prototype.HxCompImpMgr.prototype.dispatchTimer=function(id, item, action) { elem=this.p.getComponentById(id); if (elem) { elem.dispatchTimer(item, action); return true; } return false; } HxG_1.prototype.HxCompImpMgr.prototype.startTimerTimed=function(id, item, action, period) { var executionstring="hX_1.imp.dispatchTimer('" + id + "', '" + item + "', '" + action + "')"; var thisid=window.setTimeout(executionstring, period); this.addTimer(thisid, "t"); return thisid; } HxG_1.prototype.HxCompImpMgr.prototype.startTimerInterval=function(id, item, action, period) { var executionstring="hX_1.imp.dispatchTimer('" + id + "', '" + item + "', '" + action + "')"; var thisid=window.setInterval(executionstring, period); this.addTimer(thisid, "i"); return thisid; } HxG_1.prototype.HxCompImpMgr.prototype.killAllTimers=function() { var l=this.p.Timers.length; var timerid; for (var i=0; i < l; i++) { timerid=this.p.Timers[i][0]; if (timerid != 0) { if (this.p.Timers[i][1] == "i") { window.clearInterval(timerid); } else { window.clearTimeout(timerid); } this.p.Timers[i][0]=0; } } } HxG_1.prototype.HxCompImpMgr.prototype.killTimerTimed=function(timerid) { if (timerid && timerid != 0) { window.clearTimeout(timerid); var l=this.p.Timers.length; for (var i=0; i < l; i++) { if ((timerid == this.p.Timers[i][0]) && ("t" == this.p.Timers[i][1])) { this.p.Timers[i][0]=0; } } } } HxG_1.prototype.HxCompImpMgr.prototype.killTimerInterval=function(timerid) { if (timerid && timerid != 0) { window.clearInterval(timerid); var l=this.p.Timers.length; for (var i=0; i < l; i++) { if ((timerid == this.p.Timers[i][0]) && ("i" == this.p.Timers[i][1])) { this.p.Timers[i][0]=0; } } } } HxG_1.prototype.HxCompImpMgr.prototype.addTimer=function(timerid, type) { var added=false; var l=this.p.Timers.length; var thisEntry=new Array(timerid, type); for (var 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_1.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_1.prototype.JSFbuttonset=function (inobj) { this.valid=false; this.btn1=null; this.btn2=null; this.img1=null; this.img2=null; this.innerspan=null; 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_1.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_1.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.attachEvent (c.DOMobj, "onkeydown", null, this.dispatchAction); 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.margin="0px"; span2.style.padding="0px"; span2.style.zIndex="100000"; 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.margin="0px"; btn1.style.padding="0px"; btn1.onclick=this.dispatchBtnAction; btn1.ondblclick=this.dispatchBtnAction; btn1.onmousedown=this.dispatchBtnAction; btn1.onmouseup=this.dispatchBtnAction; btn1.onmouseout=this.dispatchBtnAction; btn1.onkeydown=this.dispatchBtnAction; btn1.onkeypress=this.dispatchBtnAction; btn1.onkeyup=this.dispatchBtnAction; if (blurIsOn) btn1.onblur=this.dispatchBtnAction; 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.margin="0px"; img1.style.padding="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.margin="0px"; btn2.style.padding="0px"; btn2.onclick=this.dispatchBtnAction; btn2.ondblclick=this.dispatchBtnAction; btn2.onmousedown=this.dispatchBtnAction; btn2.onmouseup=this.dispatchBtnAction; btn2.onmouseout=this.dispatchBtnAction; btn2.onkeydown=this.dispatchBtnAction; btn2.onkeypress=this.dispatchBtnAction; btn2.onkeyup=this.dispatchBtnAction; if (blurIsOn) btn2.onblur=this.dispatchBtnAction; 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.margin="0px"; img2.style.padding="0px"; img2.style.visibility="inherit"; img2.style.verticalAlign="baseline"; img2.setAttribute("alt", c.bDsc.btn2label); newbtn2.appendChild(img2); } return true; } HxG_1.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 || 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"); 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 elemHeight=c.DOMobj.offsetHeight; var elemWidth=c.DOMobj.offsetWidth; iPos=(iPos != "absolute") ? "relative" : iPos; if (!c.bDsc.HTMLcopied) { this.copyStyle (c.DOMobj, c.bSet.outerspan, "margin-left", "margin-right"); 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, "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, "position", "relative"); 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["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; 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_1.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) ? 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_1.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) ? 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; var 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); if (c.bDsc.btnBorder < 0) elemWidth2 -= (borderR + borderL + pL + 1); else elemWidth2 -= (borderR + borderL + pL + 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; var 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); if (this.p.brw.isIE()) { c.bSet.outerspan.onresize=this.p.imp.dispatchTrapAction; this.p.imp.fireEvent(c.bSet.outerspan.id, "onresize"); } else { this.p.attachEvent(document, "onresize", null, this.p.imp.dispatchTrapAction); } } else { c.kind=""; if (this.p.brw.isIE()) { c.bSet.outerspan.onresize=null; c.bSet.outerspan.style.width=elemWidth; } else { this.p.removeEvent(document, "onresize", false, false, true); } } } if (!c.bDsc.HTMLcopied) { if (this.p.brw.isIE()) { this.p.attachEvent (c.DOMobj, "onpropertychange", this.dispatchTrapAction, null); } else { c.DOMobj.addEventListener("DOMAttrModified", this.dispatchTrapAction, false); } } c.bDsc.HTMLcopied=true; return true; } HxG_1.prototype.HxCompImpMgr.prototype.dispatchTrapAction=function(evt) { var thisp=hX_1; evt=(evt) ? evt : ((event) ? event: null); if (evt) { var src=(evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if (src) { src=(src.nodeType == 1 || src.nodeType == 9) ? src : src.parentNode; if (evt.type == "propertychange" || evt.type == "DOMAttrModified") { if (src && src.tagName == "INPUT" && src.id) { var obj=thisp.getComponentById(src.id); if (thisp.brw.isIE()) { if (obj && evt.propertyName && (evt.propertyName == "className" || evt.propertyName == "class" || evt.propertyName == "disabled" || evt.propertyName == "readonly" )) { thisp.imp.sizeButtonsToInput(obj); } } else { if (obj && evt.attrName && (evt.attrName == "className" || evt.attrName == "class" || evt.attrName == "disabled" || evt.attrName == "readonly" )) { thisp.imp.sizeButtonsToInput(obj); thisp.imp.sizeButtonsToInput(obj); } } } } else if (evt.type == "resize") { if (src && (src.nodeName == "BODY" || src.nodeName == "#document")) { for (varobj in thisp.Components) { if (thisp.Components[varobj].kind && thisp.Components[varobj].kind=="resizable" && thisp.Components[varobj].redraw) { thisp.Components[varobj].redraw(); } } evt.preventDefault(); } else if (src && src.tagName == "SPAN") { var inputfld=src.firstChild; if (inputfld && inputfld.tagName == "INPUT") { var obj=thisp.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) + "px"; else obj.bSet.innerspan.style.left="0px"; return false; } } } } } } return; } HxG_1.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 { if (c.bDsc.btnBorderStyle == "") { thisbtn.borderStyle="outset"; } else { thisbtn.borderStyle=c.bDsc.btnBorderStyle; } thisbtn.backgroundColor=c.bDsc.backcolor; } return true; } HxG_1.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_1.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_1.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_1.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]) { if (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_1.prototype.HxDragMgr=function (thisparent) { this.p=thisparent; this.clickstyle=false; this.dragObj=null; this.owningObj=null; this.topX=0; this.topY=0; this.Width=0; this.Height=0; this.dragging=false; this.dragswap=false; this.releaseNow=true; this.buttonup=false; this.buttondown=false; this.keydown=false; this.timerid=0; } HxG_1.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=false; this.dragswap=false; if (noskipinitial) { this.buttonup=false; this.buttondown=false; this.keydown=false; } else { this.buttonup=true; this.buttondown=true; 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_1.prototype.HxDragMgr.prototype.moveDrag=function (evtX, evtY) { if (this.dragging && this.owningObj != null && this.owningObj.dragMove) { this.owningObj.dragMove(evtX, evtY); } } HxG_1.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=null; this.owningObj=null; this.dragging=false; this.dragswap=false; this.timerid=0; } HxG_1.prototype.HxDragMgr.prototype.dispatchDragAction=function(evt) { thisp=hX_1; evt=(evt) ? evt : ((event) ? event: null); if (evt) { var src=(evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : (thisp.brw.isIE() ? document.body : null)); if (src) { src=(src.nodeType == 1 || src.nodeType == 9) ? src : src.parentNode; var isInPopup=false; var thisX=-1; var thisY=-1; if (evt.clientX >= thisp.dragger.topX && evt.clientY >= thisp.dragger.topY) { thisX=evt.clientX - thisp.dragger.topX; thisY=evt.clientY - thisp.dragger.topY; if (thisX <= thisp.dragger.Width && thisY <= thisp.dragger.Height) { isInPopup=true; } } if (thisp.dragger.clickstyle) { if ((evt.type == "mousedown" || evt.type =="keydown") && thisp.dragger.timerid != 0) { thisp.imp.killTimerTimed (thisp.dragger.timerid); thisp.dragger.timerid=0; } if (evt.type == "keydown" || evt.type == "keyup") { if (thisp.dragger.owningObj && thisp.dragger.owningObj.dispatchDragAction) { thisp.dragger.owningObj.dispatchDragAction(evt); } } else if (evt.type == "mousedown" || evt.type == "mouseup" || evt.type == "mousemove") { if (isInPopup) { if (thisp.dragger.owningObj != null && thisp.dragger.owningObj.dispatchDragAction) { thisp.dragger.owningObj.dispatchDragAction(evt); } } else { if (evt.type == "mousedown" || evt.type == "mouseup") { if (evt.type == "mousedown" && thisp.dragger.buttondown) { thisp.dragger.buttondown=false; thisp.dragger.keydown=false; } else if (evt.type == "mouseup" && thisp.dragger.buttonup) { thisp.dragger.buttonup=false; thisp.dragger.keydown=false; } else { thisp.uirelease(); } } } } } else { if (evt.type == "mousedown") { if ((evt.type == "mousedown" || evt.type =="keydown") && thisp.dragger.timerid != 0) { thisp.imp.killTimerTimed (thisp.dragger.timerid); thisp.dragger.timerid=0; } if (thisp.dragger.dragging) { } else { if (isInPopup) { thisp.dragger.dragging=true; if (thisp.dragger.owningObj != null && thisp.dragger.owningObj.dragStart) { thisp.dragger.owningObj.dragStart(); } thisp.dragger.moveDrag(thisX, thisY); } else { if (thisp.dragger.buttondown) { thisp.dragger.buttondown=false; thisp.dragger.keydown=false; } else { thisp.uirelease(); } } } } else if (evt.type == "mouseup") { if (isInPopup) { thisp.dragger.moveDrag(thisX, thisY); if (thisp.dragger.dragging && thisp.dragger.owningObj != null && thisp.dragger.owningObj.dragEnd) { thisp.dragger.owningObj.dragEnd(); } if (thisp.dragger.releaseNow) { if (thisp.dragger.owningObj.dispatchTimer) { thisp.dragger.dragging=false; thisp.dragger.timerid=thisp.imp.startTimerTimed (thisp.dragger.owningObj.id, "popup", "dragEnd", 750); } else { thisp.uirelease(); } } else { thisp.dragger.dragging=false; } } else { if (thisp.dragger.buttonup) { thisp.dragger.buttonup=false; thisp.dragger.keydown=false; } else { thisp.uirelease(); } } } else if (evt.type == "mousemove") { if (isInPopup) { thisp.dragger.moveDrag(thisX, thisY); } } else if (evt.type == "keydown") { if (thisp.dragger.owningObj && thisp.dragger.owningObj.dragKey) { thisp.dragger.owningObj.dragKey(evt.type, evt.keyCode); } } } } } thisp.imp.cancelAction(evt); if (evt.preventDefault) { evt.preventDefault(); } return false; } HxG_1.prototype.JSFEventObject=function (obj, eventname, etype) { if (obj && eventname) { this.eventname=eventname; this.preUser=new Array(); this.User=null; this.postUser= new Array(); this.etype=etype; if (etype == "R") { tgtobj=(obj.nodeName == "BODY" || obj.nodeName == "#document") ? document.body : obj; this.id=(obj.nodeName == "BODY" || obj.nodeName == "#document") ? "#body" : obj.id; var f=tgtobj.getAttribute(eventname); if (f != null) { if (typeof f == "function") { this.User=f; } else { this.User=new Function("event", f); } } } else { this.id=obj; } } } HxG_1.prototype.JSFEventObject.prototype.addPost=function (objevent) { this.postUser[this.postUser.length]=objevent; } HxG_1.prototype.JSFEventObject.prototype.addPre=function(objevent) { this.preUser[this.preUser.length]=objevent; } HxG_1.prototype.JSFEventObject.prototype.removePost=function () { var l=this.postUser.length; for (var i=0; i < l; i++) { this.postUser[i]=null; } } HxG_1.prototype.JSFEventObject.prototype.removePre=function(objevent) { var l=this.preUser.length; for (var i=0; i < l; i++) { this.preUser[i]=null; } } HxG_1.prototype.swapDragEvent=function (addevent) { var i, j, found, l; if (this.brw.isIE()) { var eventname=new Array ("onmousedown", "onmouseup", "onmousemove", "onkeydown", "onkeyup"); } else { var eventname=new Array ("mousedown", "mouseup", "mousemove", "keydown", "keyup"); } for (j=0; j < eventname.length; j++) { found=false; l=this.userEvents.length; for (i=0; i < l; i++) { if (this.userEvents[i].etype == "S" && this.userEvents[i].id == "#docdrag" && this.userEvents[i].eventname == eventname[j]) { found=true; break; } } if (!addevent) { if (found) { if (this.brw.isIE()) { document.body.setAttribute(eventname[j], this.userEvents[i].User); } else { var ff="on" + eventname[j]; document.body.removeEventListener(eventname[j], this.dragger.dispatchDragAction, true); document.body.setAttribute(ff, this.userEvents[i].User); } } } else { if (!found) { i=l; this.userEvents[i]=new this.JSFEventObject("#docdrag", eventname[j], "S"); } if (this.brw.isIE()) { this.userEvents[i].User=document.body.getAttribute(eventname[j]); document.body.setAttribute(eventname[j], this.dragger.dispatchDragAction); } else { var ff="on" + eventname[j]; this.userEvents[i].User=document.body.getAttribute(ff); document.body.addEventListener(eventname[j], this.dragger.dispatchDragAction, true); } } } if (this.brw.isIE()) { if (addevent) { document.body.setCapture(); } else { document.body.releaseCapture(); } } return true; } HxG_1.prototype.runEvent=function (evt) { evt=(evt) ? evt : ((event) ? event: null); thisp=hX_1; if (evt) { var src=(evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : (thisp.brw.isIE() ? document.body : null)); if (src) { var i; var l=thisp.userEvents.length; var evtname="on" + evt.type; var srcid=(src.nodeName == "BODY" || src.nodeName == "#document") ? "#body" : src.id; for (i=0; i < l; i++) { if (thisp.userEvents[i].etype == "R" && thisp.userEvents[i].id == srcid && thisp.userEvents[i].eventname == evtname) { if (thisp.brw.isIE()) { return (thisp.userEvents[i].run()); } else { return (thisp.userEvents[i].run(evt)); } } } } } return; } HxG_1.prototype.JSFEventObject.prototype.run=function (evt) { thisp=hX_1; var i; var result=true; evt=(evt) ? evt : ((event) ? event: null); var src=(evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : (thisp.brw.isIE() ? document.body : null)); for (i=0; result && i < this.preUser.length; i++) { if (this.preUser[i] != null) { if (thisp.brw.isIE()) { result=this.preUser[i](); } else { result=this.preUser[i](evt); } result=(result == false) ? false: true; if (evt.returnValue == false) { result=false; } else if (evt.getPreventDefault && evt.getPreventDefault()) { result=false; } } } if (result && this.User != null) { if (thisp.brw.isIE()) { result=this.User.call(src); } else { result=this.User.call(src, evt); } result=(result == false) ? false: true; if (evt.returnValue == false) { result=false; } else if (evt.getPreventDefault && evt.getPreventDefault()) { result=false; } } for (i=0; result && i < this.postUser.length; i++) { if (this.postUser[i] != null) { if (thisp.brw.isIE()) { result=this.postUser[i](); } else { result=this.postUser[i](evt); } result=(result == false) ? false: true; if (evt.returnValue == false) { result=false; } else if (evt.getPreventDefault && evt.getPreventDefault()) { result=false; } } } return result; } HxG_1.prototype.fillZero=function (theNumber, toFill) { var s=theNumber.toString(); var n=toFill - s.length; for(var i=0; i < n; i++) s='0' + s; return s; } HxG_1.prototype.fillZeroR=function (theNumber, toFill) { var s=theNumber.toString(); var n=toFill - s.length; for(var i=0; i < n; i++) s=s + '0'; return s; } HxG_1.prototype.truncateRoundHalfEven=function (str, chars) { var ostr=str; var 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; var nn=new Number(ostr); n=n.toString(); nn=nn.toString(); if (n.length > nn.length && str.charAt(0) != "0") { ostr="0"; oflow=true; } else { ostr=hX_1.fillZero(n, chars); } } else { ostr=ostr.substr(0,ostr.length-1) + (r1+1); } } } return {value: ostr, overflow: oflow}; } HxG_1.prototype.replaceAll=function (s, ch1, ch2) { 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_1.prototype.allTrim=function (s) { var o=hX_1.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_1.prototype.Trim=function (s) { if (null == s || 0 == s.length) return s; var q=0; while (q < s.length && s.substr(q,1) == " ") q++; var o=s.substr(q); q=o.length-1; while (q >= 0 && o.substr(q,1) == " ") q--; return (o.slice(0,q+1)); } HxG_1.prototype.isChar=function (c, set) { return (set.indexOf(c) >= 0) ? true : false; } HxG_1.prototype.NLSFormatMsg=function (template, args) { r=""; if (template != null) { r=template; if (args != null) { for (var i=0; i < args.length; i++) r=hX_1.replaceAll (r, "{" + i + "}", args[i]); } } return r; } if (typeof(hX_1) == 'undefined' || !hX_1) { hX_1=new HxG_1(); } HxG_1.prototype.DateTimeConverter=function () { this.nStrict=hX_1.DTFMT_DEFAULTSTRICT; this.sFormat=hX_1.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_1.STR_AM_SUFFIX; this.sPM=hX_1.STR_PM_SUFFIX; this.base2DigitSpan=80; this.minMonthName=3; this.msgFail=""; this.intMsgFail=""; this.attributeTable=new Array(); this.attributeTable ['strict']=['nStrict', hX_1.ARG_TO_NUM, false, 0, 2]; this.attributeTable ['format']=['sFormat', hX_1.ARG_TO_NAS, false, null, null]; this.attributeTable ['base-2digit-span']=['base2DigitSpan', hX_1.ARG_TO_NUM, false, 0, 99]; this.attributeTable ['epoch']=['sEpoch', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['am']=['sAM', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['pm']=['sPM', hX_1.ARG_TO_NAN, false, null, null]; this.setAttribute(arguments); } HxG_1.prototype.DateTimeConverter.prototype.setAttribute=function(a) { hX_1.parseArg (this.attributeTable, this, a); this.parseFormatString(); this.bHasEpoch=(-1 != this.sFormatTokenized.indexOf("%G")); this.nEpoch=0; for (var i=0; i < hX_1.DATE_EPOCH_IDS.length; i++) { if (hX_1.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_1.STR_DATE_MONTHS[i].length > this.minMonthName) { for (var j=0; j < 12; j++) { if (i != j && hX_1.STR_DATE_MONTHS[i].length > this.minMonthName) { if (hX_1.STR_DATE_MONTHS[i].substr(0,this.minMonthName) == hX_1.STR_DATE_MONTHS[j].substr(0,this.minMonthName)) { this.minMonthName++; j=0; } } } } } return true; } HxG_1.prototype.DateTimeConverter.prototype.FormatToken=function (token, typ) { this.type=typ; this.token=token; } HxG_1.prototype.DateTimeConverter.prototype.parseFormatString=function () { var fmt=this.sFormat; this.sFormatTokenized=""; this.nLiteralCnt=0; this.nTokenCnt=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_1.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_1.isChar(xchar, "dhHms")) noT=true; if (lastlen >= 1 && hX_1.isChar(xchar, "DFwWkKaz")) 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_1.isChar(xchar, this.FMTDateChars); this.bHasTime=(this.bHasTime) ? this.bHasTime : hX_1.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_1.replaceAll(token, this.SEPChars.charAt(i), this.SEPChars.charAt(0)); token=hX_1.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++; } } } HxG_1.prototype.DateTimeConverter.prototype.getAttribute=function (attribute) { return (hX_1.getArg(this.attributeTable, this, attribute)); } HxG_1.prototype.DateTimeConverter.prototype.lastError=function () { if (this.msgFail.length > 0) return (this.msgFail); else return null; } HxG_1.prototype.DateTimeConverter.prototype.stringToValue=function (iDate) { this.intMsgFail=""; this.msgFail=""; var args=new Array; args[0]=iDate; if (iDate == null || typeof (iDate) != "string") { this.msgFail=(this.bHasDate && this.bHasTime) ? hX_1.ERR_datetime_empty : ((this.bHasDate) ? hX_1.ERR_date_empty : hX_1.ERR_time_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 ampm=""; var zOffset=null; var bShortYear=false; var bShortHour=false; var bJulianDate=false; var bNormalDate=false; var EpochBase=null; var EpochMax=null; if (this.bHasEpoch) { var epoch=hX_1.DATE_EPOCHS[this.nEpoch]; EpochBase=this.constantToValue(epoch[epoch.length-1][0]); EpochBase=(EpochBase) ? (EpochBase.getFullYear() - 1) : null; } var token, pose, i, j, r, n; while (this.msgFail.length == 0 && sDate.length > 0 && tokInd < this.nTokenCnt) { 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.parseFail(); this.intMsgFail="Failed parsing a strict 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 "K": 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.parseFail(); this.intMsgFail="Failed parsing two digit number + '" + 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": intHour=n.n - 1; break; case "K": intHour=n.n + 1; bShortHour=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.parseFail(); this.intMsgFail="Failed parsing three digit number + '" + token + "'"; break; } sDate=n.s; if (token == "D") { bJulianDate=true; intJDay=n.n; } else { } 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.parseFail(); this.intMsgFail="Failed parsing four digit number + '" + 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_1.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_1.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.parseFail(); this.intMsgFail="Failed parsing two digit number + '" + 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_1.STR_DATE_MONTHS[i].toUpperCase(); else pose=hX_1.STR_DATE_SHMONTHS[i].toUpperCase(); if (sDate.substr(0, pose.length).toUpperCase() == pose) { sDate=sDate.substr(pose.length); intMonth=i+1; r=true; break; } if (this.nStrict <= 1 && pose.length > this.minMonthName) { pose=pose.substr(0, this.minMonthName); j=this.countToSeparator(sDate,-1); 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_1.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_1.STR_DATE_SHDAYS[i].toUpperCase(); else pose=hX_1.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_1.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_1.ERR_ampm_name; } break; case "z": if (this.nStrict <= 1) if (this.skipIfMissing(sDate)) break; r=false; for (i=0; i < hX_1.STR_TIMEZONES.length; i++) { pose=hX_1.STR_TIMEZONES[i][1].toUpperCase(); if (sDate.substr(0, pose.length).toUpperCase() == pose) { zOffset=this.readTimeZoneOffset(hX_1.STR_TIMEZONES[i][0]); sDate=sDate.substr(pose.length); r=true; break; } pose=hX_1.STR_TIMEZONES[i][3].toUpperCase(); if (sDate.substr(0, pose.length).toUpperCase() == pose) { zOffset=this.readTimeZoneOffset(hX_1.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_1.ERR_tzone_name; break; default: break; } } tokInd++; } if (this.msgFail.length == 0 && this.nStrict > 1 && (tokInd != this.nTokenCnt || sDate.length > 0)) { this.parseFail(); this.intMsgFail="Failing at end of parse. " + " Remaining chars: |" + sDate + "|" + " token index: " + tokInd + " (" + this.nTokenCnt + ")"; } 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)) { intJDay=intJDay - Date.HxGetDaysInMonth(j); intMonth++; j++; } intDay=intJDay; } 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_1.ERR_epoch_range; } if (this.msgFail.length == 0 && (intMonth < 1 || intMonth > 12)) { this.msgFail=hX_1.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_1.ERR_month_rangelimit; args[1]=hX_1.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_1.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_1.ERR_hour_range_short; 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_1.ERR_minute_range; } if (this.msgFail.length == 0 && (intSec < 0 || intSec > 59)) { this.msgFail=hX_1.ERR_second_range; } if (this.msgFail.length > 0) { this.msgFail=hX_1.NLSFormatMsg (this.msgFail, args); return null; } r=new Date(intYear, intMonth-1, intDay, intHour, intMin, intSec); if (zOffset && (zOffset != -(r.getTimezoneOffset()))) { intMin=r.getMinutes(); intMin -= (zOffset + r.getTimezoneOffset()); r=new Date(intYear, intMonth-1, intDay, intHour, intMin, intSec); } return r; } HxG_1.prototype.DateTimeConverter.prototype.parseFail=function() { this.msgFail=(this.bHasDate && this.bHasTime) ? hX_1.ERR_datetime_parse_fail : ((this.bHasDate) ? hX_1.ERR_date_parse_fail : hX_1.ERR_time_parse_fail); } HxG_1.prototype.DateTimeConverter.prototype.getBaseYear=function() { var today=new Date(); var thisYear=today.getFullYear(); return (thisYear - this.base2DigitSpan); } HxG_1.prototype.DateTimeConverter.prototype.skipSeparators=function (str) { var r=str; while (r.length > 0 && hX_1.isChar (r.charAt(0), this.SEPChars)) r=r.substr(1); return r; } HxG_1.prototype.DateTimeConverter.prototype.skipToSeparator=function (str, max) { var i=this.countToSeparator(str, max); return (str.substr(i)); } HxG_1.prototype.DateTimeConverter.prototype.countToSeparator=function (str, max) { var r=str; var i=0; while (r.length > 0 && (i < max || max < 0) && !hX_1.isChar (r.charAt(0), this.SEPChars)) { r=r.substr(1); i++; } return i; } HxG_1.prototype.DateTimeConverter.prototype.skipIfMissing=function (str, notdigit) { var r=(hX_1.isChar (str.charAt(0), this.SEPChars)); if (!r) { var n=this.matchDigits (str, 1, true); r=(notdigit) ? n.fail : (!n.fail); } return r; } HxG_1.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_1.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_1.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_1.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_1.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_1.prototype.DateTimeConverter.prototype.valueToConstant=function (oDate) { var m=hX_1.fillZero(oDate.getMonth()+1, 2); var d=hX_1.fillZero(oDate.getDate(), 2); return (oDate.getFullYear() + m + d); } HxG_1.prototype.DateTimeConverter.prototype.valueToString=function (oDate, ifmt) { this.msgFail=""; if (oDate == null) return ""; var fmt=(ifmt != null) ? ifmt : this.sFormatTokenized; fmt=hX_1.replaceAll(fmt, "%MMMM", "@0"); fmt=hX_1.replaceAll(fmt, "%MMM", "@1"); fmt=hX_1.replaceAll(fmt, "%EEEE", "@2"); fmt=hX_1.replaceAll(fmt, "%EEE", "@3"); fmt=hX_1.replaceAll(fmt, "%GGGG", "@4"); fmt=hX_1.replaceAll(fmt, "%GGG", "@5"); fmt=hX_1.replaceAll(fmt, "%GG", "@6"); fmt=hX_1.replaceAll(fmt, "%G", "@7"); fmt=hX_1.replaceAll(fmt, "%a", "@8"); fmt=hX_1.replaceAll(fmt, "%z", "@9"); var y=oDate.getFullYear(); if (this.bHasEpoch) { if (this.bChristianEra) { fmt=hX_1.replaceAll(fmt, "%yyyyy", y); fmt=hX_1.replaceAll(fmt, "%yyyy", y); fmt=hX_1.replaceAll(fmt, "%yyyy", y); fmt=hX_1.replaceAll(fmt, "%yy", hX_1.fillZero(y % 100, 2)); fmt=hX_1.replaceAll(fmt, "%y", hX_1.fillZero(y % 100, 2)); } else { fmt=hX_1.replaceAll(fmt, "%yyyy",hX_1.fillZero(this.valueToYearEpoch(oDate).year, 4)); fmt=hX_1.replaceAll(fmt, "%yyy", hX_1.fillZero(this.valueToYearEpoch(oDate).year, 3)); fmt=hX_1.replaceAll(fmt, "%yy", hX_1.fillZero(this.valueToYearEpoch(oDate).year, 2)); fmt=hX_1.replaceAll(fmt, "%y", this.valueToYearEpoch(oDate).year); } } else { fmt=hX_1.replaceAll(fmt, "%yyyyy", y); fmt=hX_1.replaceAll(fmt, "%yyyy", y); fmt=hX_1.replaceAll(fmt, "%yyyy", y); fmt=hX_1.replaceAll(fmt, "%yy", hX_1.fillZero(y % 100, 2)); fmt=hX_1.replaceAll(fmt, "%y", hX_1.fillZero(y % 100, 2)); } var m=oDate.getMonth() + 1; fmt=hX_1.replaceAll(fmt, "%MM", hX_1.fillZero(m, 2)); fmt=hX_1.replaceAll(fmt, "%M", m); if (fmt.indexOf("%w") >= 0) fmt=hX_1.replaceAll(fmt, "%w", oDate.HxGetJulianWeekOfYear()); if (fmt.indexOf("%W") >= 0) fmt=hX_1.replaceAll(fmt, "%W", oDate.HxGetJulianWeekOfMonth()); var d=oDate.getDate(); fmt=hX_1.replaceAll(fmt, "%dd", hX_1.fillZero(d, 2)); fmt=hX_1.replaceAll(fmt, "%d", d); if (fmt.indexOf("%D") >= 0) fmt=hX_1.replaceAll(fmt, "%D", oDate.HxGetJulianDateOfYear()); if (fmt.indexOf("%F") >= 0) fmt=hX_1.replaceAll(fmt, "%F", oDate.HxGetJulianDateOfMonth()); var h=oDate.getHours(); var m=oDate.getMinutes(); var s=oDate.getSeconds(); var k=oDate.getMilliseconds(); fmt=hX_1.replaceAll(fmt, "%hh", (h % 12) == 0 ? 12 : hX_1.fillZero(h % 12, 2)); fmt=hX_1.replaceAll(fmt, "%h", (h % 12) == 0 ? 12 : (h % 12)); fmt=hX_1.replaceAll(fmt, "%k", ((h % 12) == 0 ? 12 : (h % 12)) - 1); fmt=hX_1.replaceAll(fmt, "%HH", hX_1.fillZero(h, 2)); fmt=hX_1.replaceAll(fmt, "%H", h); fmt=hX_1.replaceAll(fmt, "%K", h-1); fmt=hX_1.replaceAll(fmt, "%mm", hX_1.fillZero(m, 2)); fmt=hX_1.replaceAll(fmt, "%m", m); fmt=hX_1.replaceAll(fmt, "%ss", hX_1.fillZero(s, 2)); fmt=hX_1.replaceAll(fmt, "%s", s); fmt=hX_1.replaceAll(fmt, "%SSS", hX_1.fillZero(k, 3)); fmt=hX_1.replaceAll(fmt, "%SS", hX_1.fillZero(k, 3).substr(0,2)); fmt=hX_1.replaceAll(fmt, "%S", hX_1.fillZero(k, 3).substr(0,1)); fmt=hX_1.replaceAll(fmt, "@0", this.valueToMonthLabel(oDate)); fmt=hX_1.replaceAll(fmt, "@1", this.valueToShortMonthLabel(oDate)); fmt=hX_1.replaceAll(fmt, "@2", this.valueToDayLabel(oDate)); fmt=hX_1.replaceAll(fmt, "@3", this.valueToShortDayLabel(oDate)); fmt=hX_1.replaceAll(fmt, "@4", this.valueToYearEpoch(oDate).name); fmt=hX_1.replaceAll(fmt, "@5", this.valueToYearEpoch(oDate).nameabb); fmt=hX_1.replaceAll(fmt, "@6", this.valueToYearEpoch(oDate).nameabb); fmt=hX_1.replaceAll(fmt, "@7", this.valueToYearEpoch(oDate).nameabb); fmt=hX_1.replaceAll(fmt, "@8", this.valueToAmPmLabel(oDate)); fmt=hX_1.replaceAll(fmt, "@9", this.valueToTimeZone(oDate)); var str; for (var i=0; i < this.nLiteralCnt; i++) { str="^"+i; fmt=hX_1.replaceAll(fmt, str, this.sLiterals[i]); } return fmt; } HxG_1.prototype.DateTimeConverter.prototype.valueToAmPmLabel=function(oDate) { return (oDate.getHours() < 12) ? this.sAM : this.sPM; } HxG_1.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_1.STR_TIMEZONES.length; for (j=znames-1; j > 0; j--) { if (hX_1.STR_TIMEZONES[j][0] == null || hX_1.STR_TIMEZONES[j][0].length == 0) { } else { zoffset=this.readTimeZoneOffset(hX_1.STR_TIMEZONES[j][z1]); if (zoffset == z) { r=hX_1.STR_TIMEZONES[j][z2]; break; } } } if (r.length == 0) { r=hX_1.STR_TIMEZONES[0][1] + ((z < 0) ? "-" : "+"); z=Math.abs(z); var hr=Math.floor(z/60); var mn=z-(hr*60); hr=hX_1.fillZero(hr,2); mn=hX_1.fillZero(mn,2); r=r + hr + this.timeZoneSeparator + mn; } return (r); } HxG_1.prototype.DateTimeConverter.prototype.isDateFormat=function() { return this.bHasDate; } HxG_1.prototype.DateTimeConverter.prototype.isTimeFormat=function() { return this.bHasTime; } HxG_1.prototype.DateTimeConverter.prototype.valueToDayLabel=function(oDate) { return hX_1.STR_DATE_DAYS[oDate.getDay()]; } HxG_1.prototype.DateTimeConverter.prototype.valueToShortDayLabel=function(oDate) { return hX_1.STR_DATE_SHDAYS[oDate.getDay()]; } HxG_1.prototype.DateTimeConverter.prototype.valueToMonthLabel=function(oDate) { return hX_1.STR_DATE_MONTHS[oDate.getMonth()]; } HxG_1.prototype.DateTimeConverter.prototype.valueToShortMonthLabel=function(oDate) { return hX_1.STR_DATE_SHMONTHS[oDate.getMonth()]; } HxG_1.prototype.DateTimeConverter.prototype.valueToYearLabel=function (oDate) { if (this.bHasEpoch) { if (this.bChristianEra) return this.valueToString(oDate, hX_1.DTFMT_GCYEAR); else return this.valueToString(oDate, hX_1.DTFMT_GEYEAR); } else return this.valueToString(oDate, hX_1.DTFMT_YEAR); } HxG_1.prototype.DateTimeConverter.prototype.valueToYearEpoch=function (oDate) { var i, cDate; var epoch=hX_1.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_1.prototype.DateTimeValidator=function () { this.required=false; this.minimumBound=null; this.maximumBound=null; this.minimumDate=null; this.maximumDate=null; this.oMinimum=new Date (1000, 0, 1); this.attributeTable=new Array(); this.attributeTable ['required']=['required', hX_1.ARG_IS_TRUE, false, null, null]; this.attributeTable ['minimum-bound']=['minimumBound', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['min-bound']=['minimumBound', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['maximum-bound']=['maximumBound', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['max-bound']=['maximumBound', hX_1.ARG_TO_NAN, false, null, null]; this.setAttribute(arguments); this.msgFail=""; } HxG_1.prototype.DateTimeValidator.prototype.setAttribute=function(a) { var wasmax=this.maximumBound; var wasmin=this.minimumBound; var DTP=new hX_1.DateTimeConverter(); hX_1.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); return true; } HxG_1.prototype.DateTimeValidator.prototype.getAttribute=function (attribute) { return (hX_1.getArg(this.attributeTable, this, attribute)); } HxG_1.prototype.DateTimeValidator.prototype.lastError=function () { if (this.msgFail.length > 0) return (this.msgFail); else return null; } HxG_1.prototype.DateTimeValidator.prototype.validate=function (testdate, DTP, treatAsDate) { var test=null; this.msgFail=""; if (DTP == null || typeof (DTP) != "object") { this.msgFail=hX_1.ERR_required; return false; } var bTimeCompare=(treatAsDate) ? false : DTP.isTimeFormat(); if (testdate == null || typeof testdate == "string") { var r=!(this.required); if (testdate == null) return r; var e=hX_1.allTrim (testdate); if (e.length == 0) return r; test=DTP.stringToValue(e); } else { if (testdate.HxClone) test=testdate.HxClone(2); } if (test == null) { this.msgFail=hX_1.ERR_required; return false; } if (this.oMinimum) { if (-1 == test.HxCompareDate(this.oMinimum)) { this.msgFail=hX_1.ERR_minimum; return false; } } if (this.minimumDate) { if (-1 == test.HxCompareDate(this.minimumDate, bTimeCompare)) { this.msgFail=hX_1.ERR_minimum; return false; } } if (this.maximumDate) { if (1 == test.HxCompareDate(this.maximumDate, bTimeCompare)) { this.msgFail=hX_1.ERR_maximum; return false; } } return true; } HxG_1.prototype.DateTimeValidator.prototype.coerce=function (testdate, DTP, treatAsDate) { var o=null; this.msgFail=""; if (DTP == null || typeof (DTP) != "object") { this.msgFail=hX_1.ERR_required; return false; } var bTimeCompare=(treatAsDate) ? false : DTP.isTimeFormat(); if (testdate != null && typeof testdate == "string") { var e=hX_1.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 (this.oMinimum) { if (-1 == testdate.HxCompareDate(this.oMinimum)) o=this.oMinimum.HxClone(2); } if (this.minimumDate) { if (-1 == testdate.HxCompareDate(this.minimumDate, bTimeCompare)) o=this.minimumDate.HxClone(2); } if (this.maximumDate) { if (1 == testdate.HxCompareDate(this.maximumDate, bTimeCompare)) o=this.maximumDate.HxClone(2); } return o; } HxG_1.prototype.NumberConverter=function () { this.nStrict=hX_1.NFMT_DEFAULTSTRICT; this.pattern=hX_1.NFMT_DECIMAL0; this.locale=hX_1.NFMT_LOCALE0; this.invalidPattern=false; this.DF_GroupingSize=null; this.DF_NegativePrefix=null; this.DF_NegativeSuffix=null; this.DF_PositivePrefix=null; this.DF_PositiveSuffix=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.isExponent=false; this.isPercent=false; this.isMille=false; this.FMTChars=";0#.,E"; this.PREChars="%"+hX_1.STR_mille_char+hX_1.STR_icurrency_char; 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.msgFail=""; this.intMsgFail=""; this.attributeTable=new Array(); this.attributeTable ['strict']=['nStrict', hX_1.ARG_TO_NUM, false, 0, 2]; this.attributeTable ['pattern']=['pattern', hX_1.ARG_TO_NAS, false, null, null]; this.attributeTable ['locale']=['locale', hX_1.ARG_TO_NAS, false, null, null]; this.setAttribute(arguments); } HxG_1.prototype.NumberConverter.prototype.setAttribute=function(a) { hX_1.parseArg (this.attributeTable, this, a); this.parseLocaleString(); this.parsePatternString(); return true; } HxG_1.prototype.NumberConverter.prototype.parseLocaleString=function () { this.LC_groupingSymbol=(this.locale.charAt(0) == "") ? hX_1.NFMT_LOCALE0.charAt(0) : this.locale.charAt(0); this.LC_decimalSymbol=(this.locale.charAt(1) == "") ? hX_1.NFMT_LOCALE0.charAt(1) : this.locale.charAt(1); this.LC_percentSymbol=(this.locale.charAt(2) == "") ? hX_1.NFMT_LOCALE0.charAt(2) : this.locale.charAt(2); this.LC_milleSymbol=(this.locale.charAt(3) == "") ? hX_1.NFMT_LOCALE0.charAt(3) : this.locale.charAt(3); this.LC_minusSymbol=(this.locale.charAt(4) == "") ? hX_1.NFMT_LOCALE0.charAt(4) : this.locale.charAt(4); this.LC_currencySymbol=(this.locale.substr(5) == "") ? hX_1.NFMT_LOCALE0.substr(5) : this.locale.substr(5); } HxG_1.prototype.NumberConverter.prototype.parsePatternString=function () { this.DF_GroupingSize=0; this.DF_NegativePrefix=""; this.DF_NegativeSuffix=""; this.DF_PositivePrefix=""; this.DF_PositiveSuffix=""; 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.isExponent=false; this.isPercent=false; this.isMille=false; this.invalidPattern=false; var fmt=this.pattern; var len=fmt.length; var index, i, 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 (index=0; index < len; index++) { xchar=fmt.charAt(index); if (bInQuote) { if (xchar == "'") { nchar=fmt.charAt(index+1); if (nchar == "'") { this.addToPreSuf (bInPositivePattern, bInPrefix, bInQuote, xchar); index++; } else { bInQuote=false; } } else { this.addToPreSuf (bInPositivePattern, bInPrefix, bInQuote, xchar); } } else if (!hX_1.isChar(xchar, this.FMTChars)) { if (!bInPrefix) { bInNumber=bInMinInteger=bInMaxInteger=bInMinFraction=bInMaxFraction=bInExponent=false; } if (xchar == "'") { nchar=fmt.charAt(index+1); if (nchar == "'") { this.addToPreSuf (bInPositivePattern, bInPrefix, bInQuote, xchar); index++; } else { bInQuote=true; } } else { this.addToPreSuf (bInPositivePattern, bInPrefix, bInQuote, xchar); } } else { if (xchar == ";") { bInPositivePattern=bInNumber=bInMinInteger=bInMaxInteger=bInMinFraction=bInMaxFraction=bInExponent=false; 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 == "0") { 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 == "#") { 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 == ",") { if (!bInMinInteger && !bInMaxInteger) { this.invalidPattern=true; this.intMsgFail="Bad format: Bad grouping character: " + bInMaxInteger + "."; break; } if (bInMaxInteger || bInMinInteger) this.DF_GroupingSize=0; bHaveGroup=true; } else if (xchar == ".") { 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 == "E") { 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."; } } HxG_1.prototype.NumberConverter.prototype.addToPreSuf=function (bInPositivePattern, bInPrefix, bInQuote, c) { var xchar=c; if (!bInQuote && hX_1.isChar(xchar, this.PREChars)) { if (xchar == "%") { xchar=this.LC_percentSymbol; this.isPercent=true; } else if (xchar == hX_1.STR_mille_char){ xchar=this.LC_milleSymbol; this.isMille=true; } else if (xchar == hX_1.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_1.prototype.NumberConverter.prototype.getAttribute=function (attribute) { return (hX_1.getArg(this.attributeTable, this, attribute)); } HxG_1.prototype.NumberConverter.prototype.lastError=function () { if (this.msgFail.length > 0) return (this.msgFail); else return null; } HxG_1.prototype.NumberConverter.prototype.stringToValue=function (numString) { this.msgFail=""; this.intMsgFail=""; var argsFail=new Array(); argsFail[0]=numString; if (numString == null || numString == 'undefined' || typeof (numString) != "string") { this.msgFail=hX_1.ERR_number_empty; return null; } if (this.invalidPattern) { this.msgFail=hX_1.ERR_design; return null; } var sNum=hX_1.Trim(numString); if (sNum.length == 0) return null; var i, j; var 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 (noneg && sNum.charAt(0) == this.LC_minusSymbol) { sNum=sNum.substr(1); sign=-1; prenegmatch=true; postnegmatch=true; } if (sign > 0 && nopos && sNum.charAt(0) == "+") { sNum=sNum.substr(1); preposmatch=true; postposmatch=true; } var pre, post, match=false; if (!noneg) { pre=this.DF_NegativePrefix.toUpperCase(); post=this.DF_NegativeSuffix.toUpperCase(); while (pre.charAt(0) == " ") pre=pre.substr(1); while (post.charAt(post.length-1) == " ") post=post.substr(0, post.length-1); 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=this.DF_PositivePrefix.toUpperCase(); post=this.DF_PositiveSuffix.toUpperCase(); while (pre.charAt(0) == " ") pre=pre.substr(1); while (post.charAt(post.length-1) == " ") post=post.substr(0,post.length-1); 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 (prenegmatch && postnegmatch) { sign=-1; } else if (preposmatch && postposmatch) { sign=+1; } else if (!noneg || !nopos) { if (this.nStrict > 1) { if (!noneg && !nopos) this.msgFail=hX_1.ERR_number_fail; } } if (this.msgFail.length == 0) { var left, right; sNum=hX_1.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) { j=sNum.indexOf("E"); if (j >= 0) { left=sNum.substr(0,j); right= sNum.substr(j); } else { left=sNum; right=""; } } else { left=sNum; right=""; } } var leftc=""; 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_1.ERR_number_char; break; } } var bE=false, bS=false; if (this.msgFail.length == 0) { var rightc=""; while (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) == "E") || ((!bS && (right.charAt(0) == this.LC_minusSymbol || right.charAt(0) == "-" || right.charAt(0) == "+")))) { if (right.charAt(0) == "E") bE=true; else bS=true; rightc=rightc + right.charAt(0); right=right.substr(1); } else { argsFail[1]=right.charAt(0); this.msgFail=hX_1.ERR_number_char; break; } } else { argsFail[1]=right.charAt(0); this.msgFail=hX_1.ERR_number_char; break; } } } if (this.msgFail.length == 0 && this.isExponent) { rightc=(rightc.length == 0) ? "0" : rightc; sNum=((sign < 0) ? "-":"") + leftc + this.LC_decimalSymbol + rightc; var r=new Number(sNum); if (isNaN(r)) r=null; if (r == null) this.msgFail=hX_1.ERR_number_fail; } else if (this.msgFail.length == 0) { if (leftc.length == 0) leftc="0"; if (rightc.length == 0) rightc="0"; if (isNaN(leftc)) leftc="0"; if (isNaN(rightc)) rightc="0"; var o=leftc + "." + rightc; var r=new Number(o); if (isNaN(r)) r=null; if (r == null) { this.msgFail=hX_1.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_1.NLSFormatMsg (this.msgFail, argsFail); return null; } return (r); } HxG_1.prototype.NumberConverter.prototype.matchDigit=function (str) { var matchArr=str.match(/^\d{1,1}/); return (matchArr == null) ? false : true; } HxG_1.prototype.NumberConverter.prototype.valueToString=function (numValue) { this.msgFail=""; if (numValue == null || numValue == 'undefined' || isNaN(numValue) || this.invalidPattern) return ""; var strValue=null; var i, j; var sign=(numValue >= 0) ? +1 : -1; var abs=Math.abs(numValue); if (this.isExponent) { var nExp=0, fMant="", dMant=""; var expnum=new String(abs); expnum=expnum.toUpperCase(); i=expnum.indexOf("E"); 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(".") : i; dMant=expnum; if (i >= 0) { dMant=expnum.substr(0,i); fMant=expnum.substr(i+1); } while (dMant.length > 0 && dMant.charAt(0) == "0") dMant=dMant.substr(1); while (fMant.length > 0 && fMant.charAt(fMant.length-1) == "0") 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)=="0"; 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_1.fillZeroR(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="E" + ((nExp >= 0) ? "":this.LC_minusSymbol) + hX_1.fillZero(exp, this.DF_MinExponentDigits); while (dMant.length > tmp_DF_MinIntegerDigits && dMant.charAt(0) == "0") 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_1.truncateRoundHalfEven(fMant, sigDigits); fMant=fM.value; if (fM.overflow) { var n=new Number(dMant) + 1; dMant=((sign < 0)?"-":"") + n.toString() + "." + 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_1.fillZero (dMant, tmp_DF_MinIntegerDigits); fMant=hX_1.fillZeroR(fMant, sigDigits); while (fMant.length > sigDigits && fMant.charAt(fMant.length-1) == "0") 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; left=left.toString(); right=right.toString(); for (i=0; i < right.length; i++) { if (!this.matchDigit(right.charAt(i))) { right=right.substr(i+1); break; } } if (this.isPercent) { right=hX_1.fillZeroR(right,2); left=left + right.substr(0,2); right=right.substr(2); } else if (this.isMille) { right=hX_1.fillZeroR(right,3); left=left + right.substr(0,3); right=right.substr(3); } if (right.length > this.DF_MaxFractionDigits) { var fR=hX_1.truncateRoundHalfEven(right, this.DF_MaxFractionDigits); right=fR.value; if (fR.overflow) { var n=new Number(left); n=(n+1); left=n.toString(); } } right=hX_1.fillZeroR(right, this.DF_MinFractionDigits); left=hX_1.fillZero(left, this.DF_MinIntegerDigits); while (left.length > this.DF_MinIntegerDigits && left.charAt(0) == "0") left=left.substr(1); while (right.length > this.DF_MinFractionDigits && right.charAt(right.length-1) == "0") right=right.substr(0,right.length-1); var nR=new Number(right); var nL=new Number(left); var zero=(nR == 0) && (nL == 0); j=0; strValue=left; if (this.DF_GroupingSize > 0) { strValue=""; for (i=left.length-1; i >= 0; i--) { if (j == this.DF_GroupingSize) { strValue=this.LC_groupingSymbol + strValue; j=0; } strValue=left.charAt(i) + strValue; j++; } } if (this.DF_IsDecimalShown) strValue=strValue + this.LC_decimalSymbol + right; } if (sign > 0 || zero) { strValue=this.DF_PositivePrefix + strValue + this.DF_PositiveSuffix; } else { if (this.DF_NegativePrefix.length == 0 && this.DF_NegativeSuffix == 0) strValue=this.LC_minusSymbol + this.DF_PositivePrefix + strValue + this.DF_PositiveSuffix; else strValue=this.DF_NegativePrefix + strValue + this.DF_NegativeSuffix; } return strValue; } HxG_1.prototype.NumberConverter.prototype.constantToValue=function (sNum) { var left, right; var j=sNum.indexOf("."); if (j >= 0) { left=sNum.substr(0,j); right= sNum.substr(j+1); } else { left=sNum; right="0"; } if (left.length == 0) left="0"; if (right.length == 0) right="0"; var o=left + "." + right; return (new Number(o)); } HxG_1.prototype.NumberConverter.prototype.valueToConstant=function (nNum) { return (null); } HxG_1.prototype.NumberValidator=function () { this.minimumBound=null; this.maximumBound=null; this.minimum=null; this.maximum=null; this.required=null; this.attributeTable=new Array(); this.attributeTable ['required']=['required', hX_1.ARG_IS_TRUE, false, null, null]; this.attributeTable ['minimum-bound']=['minimumBound', hX_1.ARG_TO_NUM, false, -9999999,9999999]; this.attributeTable ['min-bound']=['minimumBound', hX_1.ARG_TO_NUM, false, -9999999,9999999]; this.attributeTable ['maximum-bound']=['maximumBound', hX_1.ARG_TO_NUM, false, -9999999,9999999]; this.attributeTable ['max-bound']=['maximumBound', hX_1.ARG_TO_NUM, false, -9999999,9999999]; this.setAttribute(arguments); } HxG_1.prototype.NumberValidator.prototype.setAttribute=function(a) { var wasmax=this.maximumBound; var wasmin=this.minimumBound; hX_1.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; } return true; } HxG_1.prototype.NumberValidator.prototype.getAttribute=function (attribute) { return (hX_1.getArg(this.attributeTable, this, attribute)); } HxG_1.prototype.NumberValidator.prototype.lastError=function () { if (this.msgFail.length > 0) return (this.msgFail); else return null; } HxG_1.prototype.NumberValidator.prototype.validate=function (testnum, NP) { this.msgFail=""; if (NP == null || typeof (NP) != "object") { this.msgFail=hX_1.ERR_required; return false; } this.msgFail=""; var test=null; if (testnum == null || typeof testnum == "string") { var r=!(this.required); if (testnum == null) return r; var e=hX_1.allTrim (testnum); if (e.length == 0) return r; test=NP.stringToValue(e); } else { test=testnum; } if (test == null || isNaN (test)) { this.msgFail=hX_1.ERR_required; return false; } if (this.minimum) { if (test < this.minimum) { this.msgFail=hX_1.ERR_minimum; return false; } } if (this.maximum) { if (test > this.maximum) { this.msgFail=hX_1.ERR_maximum; return false; } } return true; } HxG_1.prototype.NumberValidator.prototype.coerce=function (testnum, NP) { var o=null; this.msgFail=""; if (NP == null || typeof (NP) != "object") { this.msgFail=hX_1.ERR_required; return false; } if (testnum != null && typeof testnum == "string") { var e=hX_1.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_1.prototype.JSFPopup=function (parentid, defWidth, defHeight, srcValue, clickstyle) { this.parentid=parentid; this.DOMobj=null; this.parentDOMobj=null; this.parentCOMPobj=null; this.defaultWidth=defWidth; this.defaultHeight=defHeight; this.srcValue=""; this.clickstyle=(clickstyle) ? true : false; } HxG_1.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_1.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 winwidth=this.p.geo.getWindowClientWidth(); var winheight=this.p.geo.getWindowClientHeight(); var popperheight= this.p.geo.getElementRenderedHeight(ownertag); var popupheight=parseInt(popuptag.style.height, 10); var popupwidth=parseInt(popuptag.style.width, 10); var xtop=xtagtop + popperheight - 1; var xleft=xtagleft; if (this.srcValue == "") { if ((xtop + popupheight > winheight) && (winheight > popupheight)) { xtop=xtagtop - popupheight + 1; } if ((xleft + popupwidth > winwidth) && (winwidth > popupwidth)) { xleft=winwidth - popupwidth - 1; } popuptag.style.top=xtop + "px"; popuptag.style.left= xleft + "px"; popuptag.style.display="block"; } this.p.dragger.dragInit (popuptag, ownercomp, true, this.clickstyle); return true; } return false; } HxG_1.prototype.JSFPopup.prototype.uirelease=function () { if (this.DOMobj) { this.DOMobj.style.display="none"; return true; } return false; } HxG_1.prototype.JSFPopup.prototype.isPopped=function() { if (this.DOMobj) { if (this.DOMobj.style.display != "none") return true; } return false; } HxG_1.prototype.JSFImage=function () { this.type="image"; this.imageNormalSrc=""; this.imageMousedSrc=""; this.imageDepressedSrc=""; this.imageWidth=-1; this.imageHeight=-1; this.state=0; this.imageNormal=null; this.imageMoused=null; this.imageDepressed=null; this.imageRendered=false; this.attributeTable=new Array(); this.attributeTable ['normal']=['imageNormalSrc', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['moused']=['imageMousedSrc', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['depressed']=['imageDepressedSrc', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['width']=['imageWidth', hX_1.ARG_TO_NUM, false, null, null]; this.attributeTable ['height']=['imageHeight', hX_1.ARG_TO_NUM, false, null, null]; this.setAttribute(arguments); } HxG_1.prototype.JSFImage.prototype.onPageLoad=function () { this.redraw(); return true; } HxG_1.prototype.JSFImage.prototype.redraw=function () { this.sizeImageToAttributes(); return true; } HxG_1.prototype.JSFImage.prototype.uirelease=function () { this.setValue(0); return true; } HxG_1.prototype.JSFImage.prototype.setValue=function (value) { if (value == 0) { if (this.state != 0 && this.imageNormal && this.imageNormal.src != "") { this.DOMobj.src=this.imageNormal.src; } } else if (value == 1) { if (this.state != 1 && this.imageMoused && this.imageMoused.src != "") { this.DOMobj.src=this.imageMoused.src; } } else if (value == 2) { if (this.state != 2 && this.imageDepressed && this.imageDepressed.src != "") { this.DOMobj.src=this.imageDepressed.src; } } else { return false; } this.state=value return true; } HxG_1.prototype.JSFImage.prototype.getValue=function() { return this.state; return; } HxG_1.prototype.JSFImage.prototype.setAttribute=function(a) { hX_1.parseArg (this.attributeTable, this, a); this.state=0; this.imageRendered=false; if (this.HTMLrendered) this.redraw(); return true; } HxG_1.prototype.JSFImage.prototype.getAttribute=function (attribute) { return (hX_1.getArg(this.attributeTable, this, attribute)); } HxG_1.prototype.JSFImage.prototype.dispatchAction=function (item, evt, action, keycode) { var elem=this.DOMobj; var newvalue=-1; if (elem != null && elem.src) { if (action == "mouseover") { newvalue=1; } else if (action == "mouseout" || action == "mouseup" || action == "keyup") { newvalue=0; } else if (action == "mousedown") { newvalue=2; } else if (action == "keydown" && (keycode == 32 || keycode == 12)) { newvalue=2; } else { return; } } this.setValue(newvalue); return; } HxG_1.prototype.JSFImage.prototype.sizeImageToAttributes=function () { var elem=this.DOMobj; if (elem != null) { if (!this.imageRendered) { if (this.imageNormalSrc != "") { if (this.imageNormal == null) { this.imageNormal=new Image(0, 0); } this.imageNormal.src=this.imageNormalSrc; } else { this.imageNormal=null; } if (this.imageMousedSrc != "") { if (this.imageMoused == null) { this.imageMoused=new Image(0, 0); } this.imageMoused.src=this.imageMousedSrc; } else { this.imageMoused=null; } if (this.imageDepressedSrc != "") { if (this.imageDepressed == null) { this.imageDepressed=new Image(0, 0); } this.imageDepressed.src=this.imageDepressedSrc; } else { this.imageDepressed=null; } if (this.imageWidth >= 0 && this.imageHeight >= 0) { if (this.imageNormal != null) { this.imageNormal.width=this.imageWidth; this.imageNormal.height=this.imageHeight; } if (this.imageMoused != null) { this.imageMoused.width=this.imageWidth; this.imageMoused.height=this.imageHeight; } if (this.imageDepressed != null) { this.imageDepressed.width=this.imageWidth; this.imageDepressed.height=this.imageHeight; } } else { if (this.imageNormal != null) { this.imageNormal.width=""; this.imageNormal.height=""; } if (this.imageMoused != null) { this.imageMoused.width=""; this.imageMoused.height=""; } if (this.imageDepressed != null) { this.imageDepressed.width=""; this.imageDepressed.height=""; } } this.imageRendered=true; } if (!this.HTMLrendered) { if (this.imageNormal != null) { this.p.attachEvent (elem, "onmouseup", null, this.p.imp.dispatchAction); this.p.attachEvent (elem, "onkeyup", null, this.p.imp.dispatchAction); if (this.imageMoused != null) { this.p.attachEvent (elem, "onmouseover", null, this.p.imp.dispatchAction); this.p.attachEvent (elem, "onmouseout", null, this.p.imp.dispatchAction); } if (this.imageDepressed != null) { this.p.attachEvent (elem, "onmousedown", null, this.p.imp.dispatchAction); this.p.attachEvent (elem, "onkeydown", null, this.p.imp.dispatchAction); } } this.HTMLrendered=true; } return true; } return false; } HxG_1.prototype.JSFTwistie=function () { this.type="twistie"; this.direction=hX_1.TW_RT; this.style=hX_1.TW_VEE; this.barstyle=hX_1.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_1.ARG_TO_NUM, false, 0, 3]; this.attributeTable ['style']=['style', hX_1.ARG_TO_NUM, false, 0, 3]; this.attributeTable ['bar-style']=['barstyle', hX_1.ARG_TO_NUM, false, 0, 2]; this.attributeTable ['size']=['size', hX_1.ARG_TO_NUM, false, null, null]; this.attributeTable ['color-edge']=['sColorEdge',hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['color-fill']=['sColorFill',hX_1.ARG_TO_NAN, false, null, null]; this.setAttribute(arguments); } HxG_1.prototype.JSFTwistie.prototype.onPageLoad=function () { this.redraw(); return true; } HxG_1.prototype.JSFTwistie.prototype.redraw=function () { this.sizeImageToAttributes(); this.draw(); return true; } HxG_1.prototype.JSFTwistie.prototype.uirelease=function () { return true; } HxG_1.prototype.JSFTwistie.prototype.setValue=function (value) { return false; } HxG_1.prototype.JSFTwistie.prototype.getValue=function() { return null; } HxG_1.prototype.JSFTwistie.prototype.setAttribute=function(a) { hX_1.parseArg (this.attributeTable, this, a); if (this.HTMLrendered) this.redraw(); return true; } HxG_1.prototype.JSFTwistie.prototype.getAttribute=function (attribute) { return (hX_1.getArg(this.attributeTable, this, attribute)); } HxG_1.prototype.JSFTwistie.prototype.sizeImageToAttributes=function () { if (!this.DOMobj) return; if (this.DOMobj.tagName != "BUTTON" && this.DOMobj.tagName != "INPUT") return false; if (this.size="" || this.size==null) { var sSize=this.p.geo.getEffectiveStyle(this.DOMobj, "height"); var nSize=parseInt(sSize, 10); if (nSize == null || nSize == 0 || isNaN(nSize)) nSize=7; else nSize=Math.floor((nSize-2+1)/2); this.size=nSize; } 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_1.TW_TRI; else if (twistieType == "circle") this.style=hX_1.TW_PUG; else if (twistieType == "decimal") this.style=hX_1.TW_SNOUT; this.height=0; this.width=0; var even=((Math.floor(this.size/2)*2) == this.size); var b=(this.barstyle == hX_1.TW_BAR_INNER) ? 4: 0 var v=(this.style == hX_1.TW_SNOUT) ? (even ? this.size :this.size+1) : ((this.style == hX_1.TW_TRI) ? Math.floor(((this.size+1)/2)) : Math.floor(((this.size+1)/2) + 1)); if (this.direction == hX_1.TW_LT || this.direction == hX_1.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_1.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_1.geo.getElementRenderedHeight(this.DOMobj); var xWidth=hX_1.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_1.TW_LT || this.direction == hX_1.TW_RT) ? this.width : this.height); } HxG_1.prototype.JSFTwistie.prototype.onredirect=function (evt) { var thisp=hX_1; evt=(evt) ? evt : ((event) ? event: null); if (evt) { var src=(evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if (src && src.tagName == "INPUT") { var thisp=hX_1.getComponentById(src.id); if (thisp && !thisp.DOMobj.disabled) { thisp.drawState(evt); } } } } HxG_1.prototype.JSFTwistie.prototype.drawState=function (evt) { if (this.DOMobj.disabled) return; if (evt.type == "mousedown") { hX_1.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_1.prototype.JSFTwistie.prototype.draw=function() { if (!this.DOMobj || !this.canvas) return false; var stroke=(this.style == hX_1.TW_SNOUT) ? 2 : 1; var d, i, j, k=0, r, xs; if (this.direction == hX_1.TW_RT || this.direction == hX_1.TW_LT) { r=(this.direction == hX_1.TW_RT); j=this.height; i=(r) ? 0 : this.width-1; if (this.style != hX_1.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_1.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_1.TW_VEE)?2:1, this.colorEdge, (this.style == hX_1.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_1.TW_BAR_INNER) { var xs=(this.style == hX_1.TW_VEE || this.style == hX_1.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_1.TW_DN); i=(d) ? 0:this.height-1; j=this.width; if (this.style!=hX_1.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_1.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_1.TW_VEE)?2:1,this.colorEdge, (this.style == hX_1.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_1.TW_BAR_INNER) { xs=(this.style == hX_1.TW_VEE || this.style == hX_1.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_1.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_1.prototype.JSFBehaviorAlert=function () { this.type="alert"; this.message=""; this.type=0; this.attributeTable=new Array(); this.attributeTable ['message']=['message', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['prompt-type']=['type', hX_1.ARG_TO_NUM, false, 0, 1]; this.setAttribute(arguments); } HxG_1.prototype.JSFBehaviorAlert.prototype.onPageLoad=function () { this.setHTML(); return true; } HxG_1.prototype.JSFBehaviorAlert.prototype.setAttribute=function(a) { hX_1.parseArg (this.attributeTable, this, a); return true; } HxG_1.prototype.JSFBehaviorAlert.prototype.getAttribute=function (attribute) { return (hX_1.getArg(this.attributeTable, this, attribute)); } HxG_1.prototype.JSFBehaviorAlert.prototype.setHTML=function () { if (this.DOMobj != null) { if (!this.HTMLrendered) { this.p.attachEvent(this.DOMobj, this.eventname, this.p.imp.dispatchBehavior, null); this.HTMLrendered=true; } return true; } return false; } HxG_1.prototype.JSFBehaviorAlert.prototype.dispatchBehavior=function (evt, evtType, evtKeycode) { if (this.DOMobj != null && this.eventname != "" && this.message != "") { if (this.type == 1) { var rvalue=confirm(this.message); if (rvalue) return; else return false; } else { alert (this.message); return; } } return; } HxG_1.prototype.JSFSpinner=function () { this.type="spinner"; this.buttonBorder=-1; this.buttonColor="buttonface" this.interval=1; this.saveArgs=null; this.NPid=""; this.NP=null; this.NVid=""; this.NV=null; this.spinstate=0; this.attributeTable=new Array(); this.attributeTable ['validator']=['NVid', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['converter']=['NPid', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['increment']=['interval', hX_1.ARG_TO_NUM, false, 0.01, 9999999]; this.attributeTable ['button-color']=['buttonColor', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['btn-color']=['buttonColor', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['button-border']=['buttonBorder', hX_1.ARG_TO_NUM, false, -1, 3]; this.attributeTable ['btn-border']=['buttonBorder', hX_1.ARG_TO_NUM, false, -1, 3]; this.setAttribute(arguments); this.saveArgs=arguments; } HxG_1.prototype.JSFSpinner.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.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_1.prototype.JSFSpinner.prototype.redraw=function () { this.p.imp.sizeButtonsToInput(this.id); return true; } HxG_1.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_1.prototype.JSFSpinner.prototype.setValue=function (value, notify) { var r=false; if (this.DOMobj) { var ivalue=null; if (typeof value == "string") ivalue=this.NP.stringToValue (value); else ivalue=value; if (ivalue != null) { ivalue=this.NV.coerce (ivalue, this.NP); if (ivalue != null) this.DOMobj.value=this.NP.valueToString(ivalue); else this.DOMobj.value=""; r=true; } if (r && notify) this.p.imp.fireEvent (this.DOMobj, "onblur"); } return r; } HxG_1.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_1.prototype.JSFSpinner.prototype.reValue=function (buttonitem) { if (this.DOMobj) { var delta=0; var value=this.getValue(true); if (value == null || isNaN(value)){ value=new Number(0); } else { var delta=(buttonitem == "btn1") ? this.interval : -(this.interval); 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); } } } value=value + delta; value=this.NV.coerce (value, this.NP); this.setValue (value, true); } } HxG_1.prototype.JSFSpinner.prototype.setAttribute=function(a) { var wasvalidator=this.NVid; var wasconverter=this.NPid; hX_1.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_1.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_1.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_1.prototype.JSFSpinner.prototype.getAttribute=function (attribute) { return (hX_1.getArg(this.attributeTable, this, attribute)); } HxG_1.prototype.JSFSpinner.prototype.dispatchAction=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); this.p.uirelease(); break; case "dblclick": this.p.uirelease(); if (this.p.brw.isIE()) { this.p.imp.depressButton (this, item, true); this.reValue(item); 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 == 32) { this.spinstate=1; this.p.imp.depressButton (this, item, true); this.reValue(item); this.p.imp.cancelAction(evt); return false; } else if (keycode == 38) { this.spinstate=1; this.p.imp.depressButton (this, "btn1", true); this.reValue("btn1"); this.p.imp.cancelAction(evt); return false; } else if (keycode == 40) { this.spinstate=1; this.p.imp.depressButton (this, "btn2", true); this.reValue("btn2"); this.p.imp.cancelAction(evt); return false; } else if (keycode >= 32 && keycode <= 40) { this.p.imp.cancelAction(evt); return false; } break; case "keyup": if (keycode >= 32 && keycode <= 40) { if (this.spinstate == 1) { this.p.uirelease(); } this.p.imp.cancelAction(evt); return false; } break; case "keypress": if (keycode >= 32 && keycode <= 40) { 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 == 38) { this.reValue("btn1"); } else if (keycode == 40) { this.reValue("btn2"); } } } else { this.p.uirelease(); } return; } HxG_1.prototype.JSFSpinner.prototype.dispatchTimer=function (item, action) { if (item == "btn1" || item == "btn2") { if (action == "spin") { this.reValue(item); } else if (action == "start") { this.p.imp.startTimerInterval (this.id, item, "spin", 75); } } } HxG_1.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_1.CLASS_SLIDER; this.sliderLinesClass=hX_1.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_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['converter']=['NPid', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['scale-width']=['scale_width', hX_1.ARG_TO_NUM, false, 0, 9999]; this.attributeTable ['show-labels']=['show_labels', hX_1.ARG_IS_TRUE, false, null, null]; this.attributeTable ['increment']=['interval', hX_1.ARG_TO_NUM, false, 0.01, 9999999]; this.attributeTable ['class-name']=['sliderClass', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['lines-class-name']=['sliderLinesClass', hX_1.ARG_TO_NAN,false, null, null]; this.attributeTable ['button-color']=['buttonColor', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['btn-color']=['buttonColor', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['button-border']=['buttonBorder', hX_1.ARG_TO_NUM, false, -1, 3]; this.attributeTable ['btn-border']=['buttonBorder', hX_1.ARG_TO_NUM, false, -1, 3]; this.setAttribute(arguments); this.saveArgs=arguments; } HxG_1.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, 10, 10); this.redraw(); return true; } HxG_1.prototype.JSFSlider.prototype.redraw=function () { this.p.imp.sizeButtonsToInput(this.id); return true; } HxG_1.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_1.prototype.JSFSlider.prototype.setValue=function (value, notify) { var r=false; if (this.DOMobj) { var ivalue=null; if (typeof value == "string") ivalue=this.NP.stringToValue (value); else ivalue=value; if (ivalue != null) { ivalue=this.NV.coerce (ivalue, this.NP); if (ivalue != null) this.DOMobj.value=this.NP.valueToString(ivalue); else this.DOMobj.value=""; r=true; } if (r && notify) this.p.imp.fireEvent (this.DOMobj, "onblur"); } return r; } HxG_1.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_1.prototype.JSFSlider.prototype.reValue=function (buttonitem) { if (this.DOMobj) { var delta=0; var value=this.getValue(true); if (value == null || isNaN(value)) value=new Number(0); var delta=(buttonitem == "btn1") ? this.interval : -(this.interval); var absdelta=(delta < 0) ? -(delta) : delta; value+=delta; value=this.NV.minimum + ((Math.round((value-this.NV.minimum)/absdelta))* absdelta); value=this.NV.coerce (value, this.NP); this.setValue (value, true); } } HxG_1.prototype.JSFSlider.prototype.setAttribute=function(a) { var wasvalidator=this.NVid; var wasconverter=this.NPid; hX_1.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_1.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_1.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_1.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_1.prototype.JSFSlider.prototype.getAttribute=function (attribute) { return (hX_1.getArg(this.attributeTable, this, attribute)); } HxG_1.prototype.JSFSlider.prototype.dispatchAction=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 == 27) { if (this.objPopup.isPopped()) { this.setValue(this.escapeToValue, true); undropit=true; } } else if (keycode == 32 || keycode == 38 || keycode == 40) { if (this.objPopup.isPopped()) { undropit=true; } else { dropit=true; } this.p.imp.cancelAction(evt); rvalue=false; } else if (keycode >= 32 && keycode <= 40) { this.p.imp.cancelAction(evt); rvalue=false; } break; case "keypress": case "keyup": if (keycode >= 32 && keycode <= 40) { 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 == 40) { this.reValue("btn2"); } else if (keycode == 38) { this.reValue("btn1"); } else if (keycode == 27) { if (this.objPopup.isPopped()) { this.setValue(this.escapeToValue, 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.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_1.prototype.JSFSlider.prototype.dispatchTimer=function (item, action) { if (item == "popup") { if (action == "dragEnd") { this.p.uirelease(); } } } HxG_1.prototype.JSFSlider.prototype.dragStart=function (xOff, yOff) { } HxG_1.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_1.prototype.JSFSlider.prototype.dragKey=function (keyaction, keycode) { if (keycode == 27) { if (this.objPopup.isPopped()) { this.setValue(this.escapeToValue, true); this.p.uirelease(); } } else if (keycode == 32 || keycode == 13) { if (!this.p.dragger.keydown && this.objPopup.isPopped()) { this.dragEnd(); this.p.uirelease(); } } else if (keycode == 37) { this.reValue("btn2"); this.setStylusFromValue(); } else if (keycode == 39) { this.reValue("btn1"); this.setStylusFromValue(); } this.p.dragger.keydown=false; } HxG_1.prototype.JSFSlider.prototype.dragEnd=function () { this.setValue(this.getValue(), true); } HxG_1.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_1.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_1.prototype.JSFDatePicker=function () { this.type="datepicker"; this.buttonBorder=-1; this.buttonColor="buttonface" this.CSSPrefix=""; this.nFirstDayOfWeek=hX_1.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_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['converter']=['DTPid', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['CSS-prefix']=['CSSPrefix', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['first-day-of-week']=['nFirstDayOfWeek', hX_1.ARG_TO_NUM,false, 0, 6]; this.attributeTable ['button-color']=['buttonColor', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['btn-color']=['buttonColor', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['button-border']=['buttonBorder', hX_1.ARG_TO_NUM, false, -1, 3]; this.attributeTable ['btn-border']=['buttonBorder', hX_1.ARG_TO_NUM, false, -1, 3]; this.setAttribute(arguments); this.saveArgs=arguments; } HxG_1.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_1.R_IMG_CAL_HINKIES); this.objPopup=this.p.addPopup (this.id + "_popup", this.id, 10, 10, "", true); this.sUnique=this.id + "_hx_dp_popup_"; this.redraw(); return true; } HxG_1.prototype.JSFDatePicker.prototype.redraw=function () { this.p.imp.sizeButtonsToInput(this.id); return true; } HxG_1.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_1.prototype.JSFDatePicker.prototype.setValue=function (value, notify, raw) { r=false; if (this.DOMobj) { if (raw) { this.DOMobj.value=value; r=true; } else { var ivalue=null; if (typeof value == "string") ivalue=this.DTP.stringToValue (value); else if (typeof value == "object" && value.constructor && value.constructor == Date) ivalue=value.HxClone(0); else ivalue=null; if (ivalue && this.DTV.validate(ivalue, this.DTP)) { this.oDate=ivalue; this.DOMobj.value=this.DTP.valueToString(ivalue); r=true; } } } if (r && notify) this.p.imp.fireEvent (this.DOMobj, "onblur"); return r; } HxG_1.prototype.JSFDatePicker.prototype.reValue=function (y, m, d, setv, idate, noscroll) { if (this.DOMobj) { if (setv) { var value=this.getValue(true); if (value) { value.HxAdjustDate(y, m, d, 0, 0, 0); if (!this.DTV.validate(value, this.DTP)) return; this.setValue (value, true); } } else { 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_1.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_1.prototype.JSFDatePicker.prototype.getValue=function(cast) { if (this.DOMobj) { if (cast) { var d=this.DTP.stringToValue (this.DOMobj.value); if (d) return (d.HxClone(0)); else return null; } return (this.DOMobj.value); } return null; } HxG_1.prototype.JSFDatePicker.prototype.setAttribute=function(a) { var wasvalidator=this.DTVid; var wasconverter=this.DTPid; hX_1.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_1.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_1.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_1.prototype.JSFDatePicker.prototype.getAttribute=function (attribute) { return (hX_1.getArg(this.attributeTable, this, attribute)); } HxG_1.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_1.CLASS_DP_HEADER; for (i=0; i < document.styleSheets.length; i++) { sheets=document.styleSheets[i]; rulelist=(typeof sheets.cssRules != "undefined") ? sheets.cssRules : ((typeof sheets.rules != "undefined") ? sheets.rules : null); if (rulelist) { for (j=0; j < rulelist.length; j++) { if (rulelist[j].selectorText.indexOf(testname) >= 0) { validFamily=true; break; } } } } if (!validFamily) { alert ("Invalid stylesheet family"); } } } else { this.CSSPrefix=hX_1.CLASS_DP; } this.classDiv=this.CSSPrefix; this.classSize=this.CSSPrefix + "-" + hX_1.CLASS_DP_SIZE; this.classHeader=this.CSSPrefix + "-" + hX_1.CLASS_DP_HEADER; this.classHeader1= this.CSSPrefix + "-" + hX_1.CLASS_DP_HEADER1; this.classHeader2= this.CSSPrefix + "-" + hX_1.CLASS_DP_HEADER2; this.classHeaderYear=this.CSSPrefix + "-" + hX_1.CLASS_DP_HEADERYEAR; this.classHeaderMonth=this.CSSPrefix + "-" + hX_1.CLASS_DP_HEADERMONTH; this.classWHeader= this.CSSPrefix + "-" + hX_1.CLASS_DP_HEADER_WEEKDAY; this.classBody=this.CSSPrefix + "-" + hX_1.CLASS_DP_BODY; this.classButton=this.CSSPrefix + "-" + hX_1.CLASS_DP_BUTTON; this.classCurrMonth=this.CSSPrefix + "-" + hX_1.CLASS_DP_CURRMONTH; this.classOtherMonth= this.CSSPrefix + "-" + hX_1.CLASS_DP_OTHERMONTH; this.classCurrDay=this.CSSPrefix + "-" + hX_1.CLASS_DP_CURRDAY; this.classOtherDay=this.CSSPrefix + "-" + hX_1.CLASS_DP_OTHERDAY; this.classToday=this.CSSPrefix + "-" + hX_1.CLASS_DP_TODAY; this.classCurrToday=this.CSSPrefix + "-" + hX_1.CLASS_DP_CURRENTTODAY; this.classInvalidDay= this.CSSPrefix + "-" + hX_1.CLASS_DP_INVALIDDAY; } HxG_1.prototype.JSFDatePicker.prototype.dispatchDragAction=function (evt) { var r=false; evt=(evt) ? evt : ((event) ? event: null); if (evt) { var src=(evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); if (src) { src=(src.nodeType == 1 || src.nodeType == 9) ? 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 27: if (this.objPopup.isPopped()) { this.setValue(this.escapeToValue, true, true); this.p.uirelease(); } break; case 32: case 13: case 18: if (!this.p.dragger.keydown && this.objPopup.isPopped()) { this.setValue(this.oDate, true); this.p.uirelease(); } break; case 37: if (evt.shiftKey) nMonAdj=-1; else nDayAdj=-1; break; case 38: if (evt.shiftKey) nYrAdj=-1; else nDayAdj=-7; break; case 39: if (evt.shiftKey) nMonAdj=1; else nDayAdj=1; break; case 40: if (evt.shiftKey) nYrAdj=+1; else nDayAdj=7; break; case 9: nDayAdj=evt.shiftKey ? -1 : 1; break; default: break; } if (nYrAdj != 0 || nDayAdj != 0 || nMonAdj != 0) this.reValue (nYrAdj, nMonAdj, nDayAdj, false); 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.reValue (nYrAdj, nMonAdj, 0, false); 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.reValue (0, 0, 0, false, 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_1.prototype.JSFDatePicker.prototype.dispatchAction=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 == 27) { if (this.objPopup.isPopped()) { this.setValue(this.escapeToValue, true, true); undropit=true; } } else if (keycode == 32 || keycode == 38 || keycode == 40) { if (this.objPopup.isPopped()) { undropit=true; } else { dropit=true; } this.p.imp.cancelAction(evt); rvalue=false; } else if (keycode >= 32 && keycode <= 40) { this.p.imp.cancelAction(evt); rvalue=false; } } else if (action == "keypress" || action == "keyup") { if (keycode >= 32 && keycode <= 40) { this.p.imp.cancelAction(evt); rvalue=false; } } else { this.p.uirelease(); } } else if (item == "input") { if (action == "keydown") { this.p.uirelease(); if (keycode == 40) { this.reValue(0,0,-1, true); } else if (keycode == 38) { this.reValue(0,0,+1, true); } else if (keycode == 27) { if (this.objPopup.isPopped()) { this.setValue(this.escapeToValue, true, 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_1.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.reValue (nYrAdj, nMonAdj, 0, false); } else if (action == "start") { this.timerTimed=0; this.timerInterval=this.p.imp.startTimerInterval (this.id, item, "spin", 50); } } } HxG_1.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_1.STR_DATE_SHSHDAYS[i%7] + ''; } this.updateGrid(); return true; } return false; } HxG_1.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_1.STR_DATE_PREVIOUS_YEAR) this.hdrbtn2=thisp.getFirstChild(htd3); if (!this.hdrbtn2) this.hdrbtn2=thisp.emitButtonHTML (htd3, suffix + "_HDRBTN2", 0, 0, hX_1.STR_DATE_NEXT_YEAR) this.hdrbtn3=thisp.getFirstChild(htd4); if (!this.hdrbtn3) this.hdrbtn3=thisp.emitButtonHTML (htd4, suffix + "_HDRBTN3", 1, 0, hX_1.STR_DATE_PREVIOUS_MONTH) this.hdrbtn4=thisp.getFirstChild(htd6); if (!this.hdrbtn4) this.hdrbtn4=thisp.emitButtonHTML (htd6, suffix + "_HDRBTN4", 0, 0, hX_1.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_1.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_1.R_IMG_VLG_HINKIES, wellx, welly); btn.style.backgroundRepeat="no-repeat"; btn.style.margin="0px" parent.appendChild(btn); } return btn; } HxG_1.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_1.R_IMG_VLG_HINKIES, x, y); } } HxG_1.prototype.JSFDatePicker.prototype.getFirstChild=function (cell) { r=(cell) ? cell.firstChild : null; while (r && r.nodeType != 1) r=r.nextSibling; return r; } HxG_1.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; 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_1.prototype.JSFDatePicker.prototype.dateToTag=function(oDate) { var s=(oDate) ? this.sUnique + this.DTP.valueToConstant(oDate) : ""; return s; } HxG_1.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_1.prototype.HxSelection=function(bSelected) { this.bSelected=bSelected; this.arrSelectionListeners=new Array(); } HxG_1.prototype.HxSelection.prototype.setSelected=function (bSelected) { if(this.bSelected==bSelected) { return; } this.bSelected=bSelected; this.fireSelectionListeners(); } HxG_1.prototype.HxSelection.prototype.isSelected=function () { return this.bSelected; } HxG_1.prototype.HxSelection.prototype.addSelectionListener=function (objListener) { if(!objListener) { alert("RUNTIME ERROR: null SelectionListener added to HxSelection"); } if(!objListener.selectionChanged) { alert("RUNTIME ERROR: SelectionListener does not proide selectionChanged method"); } this.arrSelectionListeners[this.arrSelectionListeners.length]=objListener; } HxG_1.prototype.HxSelection.prototype.fireSelectionListeners=function () { var len=this.arrSelectionListeners.length; for(var i=0; i= this.styleList.length) { this.index=0; } return this.styleList[this.index++]; } HxG_1.prototype.HxCheckImageListener=function(strImgId, strUnselectedUrl, strSelectedUrl, strUnselected, strSelected) { if(!document.getElementById) { return; } this.objImg=document.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_1.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_1.prototype.HxCheckCellListener=function(strSpanId, strInputId, objGroup, objHxSelection){ if(!document.getElementById) { return; } this.objTd=document.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=document.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_1.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_1.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_1.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_1.prototype.HxCheckCellListener.prototype.setSelected=function(bSelected) { this.objHxSelection.setSelected(bSelected); this.objInput.value=bSelected; } HxG_1.prototype.HxCheckCellListener.prototype.isSelected=function() { return this.objHxSelection.isSelected(); } HxG_1.prototype.HxCheckCellListener.prototype.isInElementBoundary=function(mousex, mousey) { var x=this.findPosX(this.objTd); if(mousexy) { return false; } x+=this.objTd.offsetWidth; if(mousex>x) { return false; } return true; } HxG_1.prototype.HxCheckCellListener.prototype.findPosX=function (obj) { var curleft=0; if (obj.offsetParent) { while (obj.offsetParent) { curleft+=obj.offsetLeft obj=obj.offsetParent; } } else if (obj.x) { curleft+=obj.x; } return curleft; } HxG_1.prototype.HxCheckCellListener.prototype.findPosY=function (obj) { var curtop=0; if (obj.offsetParent) { while (obj.offsetParent) { curtop+=obj.offsetTop obj=obj.offsetParent; } } else if (obj.y) { curtop+=obj.y; } return curtop; } HxG_1.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_1.prototype.HxCheckCellGroup=function() { this.arrayMembers=new Array(); this.bSelected=true; if(!document.getElementById) { return; } } HxG_1.prototype.HxCheckCellGroup.prototype.GROUP=null; HxG_1.prototype.HxCheckCellGroup.prototype.addMember=function (objHxCheckCellListener) { this.arrayMembers[this.arrayMembers.length]=objHxCheckCellListener; } HxG_1.prototype.HxCheckCellGroup.prototype.isSelected=function() { return this.bSelected; } HxG_1.prototype.HxCheckCellGroup.prototype.setSelected=function(bSelected) { this.bSelected=bSelected; } HxG_1.prototype.HxCheckCellGroup.prototype.fireMouseDown=function(evt, bSelected) { this.setSelected(bSelected); HxG_1.prototype.HxCheckCellGroup.prototype.GROUP=this; this.registerWindowListeners(evt); } HxG_1.prototype.HxCheckCellGroup.prototype.registerWindowListeners=function(evt) { if(document.attachEvent) { document.attachEvent("onmousemove", HxG_1.prototype.HxCheckCellGroup.prototype.onMouseEnterStatic); document.attachEvent("onmouseup", HxG_1.prototype.HxCheckCellGroup.prototype.onMouseUpStatic); document.attachEvent("onselectstart", HxG_1.prototype.HxCheckCellGroup.prototype.onSelectStartStatic); window.event.cancelBubble=true; window.event.returnValue=false; } else if(document.addEventListener) { document.addEventListener("mousemove", HxG_1.prototype.HxCheckCellGroup.prototype.onMouseEnterStatic, true); document.addEventListener("mouseup", HxG_1.prototype.HxCheckCellGroup.prototype.onMouseUpStatic, true); evt.preventDefault(); } } HxG_1.prototype.HxCheckCellGroup.prototype.onSelectStartStatic=function(evt) { return false; } HxG_1.prototype.HxCheckCellGroup.prototype.onMouseEnterStatic=function(evt) { if(!evt) { var evt=window.event; } HxG_1.prototype.HxCheckCellGroup.prototype.GROUP.onMouseEnter(evt); } HxG_1.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_1.prototype.HxFocusChanger.prototype.getIndexInParent=function(objElement) { var objParent=objElement.parentNode; for(var i=0; i0); } HxG_1.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_1.prototype.HxFocusAdder=function(strTableId, nPrev, nNext) { if(!document.getElementById) { return; } var objTable=document.getElementById(strTableId); if(objTable==null) { return null; } var arrElements=objTable.getElementsByTagName("TD"); for(var i=0; i0) { var xOffset=pageW - spanW+spanL; if(xOffset<0) { spanL -= xOffset; } if(spanL<0) { spanL=0; } } var rowH=this.objTr.offsetHeight; var rowT=this.getY(this.objTr); var pageH=body.scrollHeight; var spanH=this.objSpan.offsetHeight; var spanT=rowT + (rowH/2) - (spanH/2); if(pageH>0) { var yOffset=pageH - spanH+spanT; if(yOffset<0) { spanT -= yOffset; } if(spanT<0) { spanT=0; } } this.objSpan.style.left=spanL; this.objSpan.style.top=spanT; this.objSpan.style.visibility="visible"; } HxG_1.prototype.HxEditShowHide.prototype.getX=function(obj) { var curleft=0; if (obj.offsetParent) { while (obj.offsetParent) { curleft+=obj.offsetLeft obj=obj.offsetParent; } } else if (obj.x) curleft+=obj.x; return curleft; } HxG_1.prototype.HxEditShowHide.prototype.getY=function(obj) { var curtop=0; if (obj.offsetParent) { while (obj.offsetParent) { curtop+=obj.offsetTop obj=obj.offsetParent; } } else if (obj.y) curtop+=obj.y; return curtop; } HxG_1.prototype.HxEditSave=function(strCtrlId, strSpanId, strTableId, strHiddenFieldId) { if(!document.getElementById) { return; } this.objCtrl=document.getElementById(strCtrlId); if(this.objCtrl==null) { alert("RUNTIME ERROR: can't find element "+strCtrlId); } this.objSpan=document.getElementById(strSpanId); if(this.objSpan==null) { alert("RUNTIME ERROR: can't find element "+strSpanId); } this.objTable=document.getElementById(strTableId); if(this.objTable==null) { alert("RUNTIME ERROR: can't find element "+strTableId); } this.objSave=document.getElementById(strHiddenFieldId); if(this.objSave==null) { alert("RUNTIME ERROR: can't find element "+objSave); } this.bindToDom(this.objCtrl); } HxG_1.prototype.HxEditSave.prototype.bindToDom=function(objCtrl) { var thisObj=this; objCtrl.onclick=function(evt) { if(!evt) { var evt=window.evt; } thisObj.onClick(evt); return false; } } HxG_1.prototype.HxEditSave.prototype.onClick=function(evt) { var formNode=this.getParentOfType(this.objTable, "FORM"); if(formNode==null) { return; } this.objSave.value="clicked"; formNode.submit(); } HxG_1.prototype.HxEditSave.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_1.prototype.hxWebPagerSubmit=function(strId, nIndex, strFormId) { if(strId==null) return; if(nIndex==null) return; if(strFormId==null) return; var objHiddenField=null; var objForm=null; if(document.getElementById) { objHiddenField=document.getElementById(strId); objForm=document.getElementById(strFormId); } if((objHiddenField==null)||(objForm==null)) { if((!document.forms[strFormId])||(!document.forms[strFormId].strId)) { return; } document.forms[strFormId].strId.value=nIndex; document.forms[strFormId].submit(); } else { objHiddenField.value=nIndex; objForm.submit(); } } HxG_1.prototype.JSFBehaviorHS=function () { this.type="hideshow"; this.hideObject=null; this.hideField=null; this.hideTree=null; this.inHideObject= ""; this.inHideTree=""; this.inHideField=""; this.inHideFieldValue=null; this.attributeTable=new Array(); this.attributeTable ['hide-object']=['inHideObject', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['hide-tree']=['inHideTree', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['hide-field']=['inHideField', hX_1.ARG_TO_NAN, false, null, null]; this.attributeTable ['hide-field-value']=['inHideFieldValue', hX_1.ARG_TO_NAN, false, null, null]; this.setAttribute(arguments); } HxG_1.prototype.JSFBehaviorHS.prototype.onPageLoad=function () { this.setHTML(); return true; } HxG_1.prototype.JSFBehaviorHS.prototype.setValue=function (value) { if (this.hideField) this.hideField.value=value; return true; } HxG_1.prototype.JSFBehaviorHS.prototype.getValue=function () { if (this.hideField) return (this.hideField.value); return null; } HxG_1.prototype.JSFBehaviorHS.prototype.setAttribute=function(a) { hX_1.parseArg (this.attributeTable, this, a); this.hideObject=hX_1.getElementById(this.inHideObject); this.hideTree=hX_1.getElementById(this.inHideTree); this.hideField=hX_1.getElementById(this.inHideField); if (this.inHideFieldValue != null && this.hideField != null) this.hideField.value=this.inHideFieldValue; return true; } HxG_1.prototype.JSFBehaviorHS.prototype.getAttribute=function (attribute) { return (hX_1.getArg(this.attributeTable, this, attribute)); } HxG_1.prototype.JSFBehaviorHS.prototype.setHTML=function () { if (this.DOMobj != null) { if (!this.HTMLrendered) { this.p.attachEvent(this.DOMobj, "onclick", this.p.imp.dispatchBehavior, null); this.HTMLrendered=true; } return true; } return false; } HxG_1.prototype.JSFBehaviorHS.prototype.dispatchBehavior=function (evt, evtType, evtKeycode) { if (this.DOMobj != null && this.hideObject != null) { var bHidden=(this.hideObject.style.display == "none"); 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=this.findNestedObject(this.hideTree.rows[r], "TABLE"); if (child != null) { if (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 (bHidden) { this.hideObject.style.display=""; if (this.hideField) { this.hideField.value="visible"; } } else { this.hideObject.style.display="none"; if (this.hideField) { this.hideField.value="none"; } } } return; } HxG_1.prototype.JSFBehaviorHS.prototype.findNestedObject=function(obj, tag) { if(obj == null || obj.childNodes == null || obj.childNodes.length == 0) return null; var child, i, nested_child; var children=obj.childNodes; for(i=0; i < children.length; i++) { child=children[i]; if(child.nodeName == tag) return child; } for(i=0; i < children.length; i++) { child=children[i]; nested_child=this.findNestedObject(child, tag); if (nested_child != null) { return nested_child; } } return null; } HxG_1.prototype._iaRegistry=function() { this.assistFunction=null; this.behaviorAssist=null; this.dateAssist=null; this.keybindAssist=null; this.maskAssist=null; this.numberAssist=null; this.utils=null; this.inputState=null; this.navigator=null; this.iterator=null; } if ( hX_1 && !hX_1._iaReg ) { hX_1._iaReg=new hX_1._iaRegistry() } HxG_1.prototype._iaUtils=function() { var dispatcher=new Array(); var keyHandler=new Array(); this.addEventHandler=addEventHandler; this.addEventHandler4obj=addEventHandler; this.getDispatcher=getDispatcher; this.addEventMonitor=addEventMonitor; this.addPropertyMonitor=addPropertyMonitor; this.addKeyHandler=addKeyHandler; this.getKeyHandler=getKeyHandler; this.doAction=doAction; this.doAction4Obj=doAction; this.doCssStyleClass=doCssStyleClass; this.invokeHook=invokeHook; this.getEventObj=getEventObj; this.isInputTextTag=isInputTextTag; this.isString=isString; this.getSelection=getSelection; this.setSelection=setSelection; this.getCaretPos=getCaretPos; this.setCaretPos=setCaretPos; this.checkKey=checkKey; this.isMasked=isMasked; this.isMaskFilled=isMaskFilled; this.isNumber=isNumber; this.isNumberFilled=isNumberFilled; this.qq=qq; this.trace=trace; this.isAnyInputSpace=isAnyInputSpace; this.matchOneByOne=matchOneByOne; function addEventHandler(id, event, handler, monitor) { var obj=isString(id) ? document.getElementById(id) : id; var d=attachDispatcher(obj,event); d.add(handler,monitor); } function getIEVersion() { var appVer=navigator.userAgent; var start=appVer.indexOf("MSIE ", 0) + 5; var end=appVer.indexOf(";", start); return appVer.substring(start, end); } function attachDispatcher(obj, event) { var event_str="dispatch_" + event; var ix=obj[event_str]; if (typeof(ix) == "undefined") { ix=obj[event_str]=dispatcher.length; dispatcher.push(new Dispatcher()); var handler="hX_1._iaReg.utils.getDispatcher("+ix+").dispatch(event)" ; if (navigator.appName.match(/explorer/i)) obj[event]=new Function("return "+handler+(obj[event]?"?"+obj[event]+"():false":"")+";"); else obj.setAttribute(event, "if ("+handler+"){"+obj.getAttribute(event)+"}else{return false;}"); } return dispatcher[ix]; } function getDispatcher(ix, event) { return (typeof(ix) == "number") ? dispatcher[ix] : attachDispatcher(ix, event); } function Dispatcher() { var chain=new Array(); var enabled=true; this.add=add; this.dispatch=dispatch; this.enable=enable; function add(s,monitor) { function convertFunction(obj) { function convertFunctionFromString(str) { return new Function("event","return " + str + ";"); } function convertFunctionFromObject(obj) { return function(event) { return obj.handleEvent(event); }; } var func=obj; var type=typeof(func); if (type == "object") { func=convertFunctionFromObject(func); } else if (type != "function") { func=convertFunctionFromString(func); } return func; } var h=convertFunction(s); h["monitor"]=monitor; chain.unshift(h); } function enable(x) { var prev=enabled; enabled=x; return prev; } function dispatch(ev) { var a=enabled; for (var i=0; i 0) { if ((e.altKey && modKey.toUpperCase() == "ALT") || (e.shiftKey && modKey.toUpperCase() == "SHIFT") || (e.ctrlKey && modKey.toUpperCase() == "CTRL")) { if (e.keyCode != 0) return (e.keyCode == keyCode) ; else return (e.which == keyCode) ; } } else { if (!e.altKey && !e.shiftKey && !e.ctrlKey) if (e.keyCode != 0) return (e.keyCode == keyCode) ; else return (e.which == keyCode) ; } return false; } function isMasked (obj) { var a=obj.getAttribute("mask"); return (a != null && a.length > 0); } function isMaskFilled (obj) { var value=obj.value; if (value.length > 0) { var mask=obj.getAttribute("maskFilledPattern"); if (mask && mask.length > 0) { if (value.match(mask) == null) { return false; } return true; } } return false; } function isPrompt(ch) { if (ch == '#' || ch == '?') { return true; } return false; } function isAnyInputSpace(obj) { var value=obj.value; var len=value.length; var promptCharacter=obj.getAttribute("promptCharacter"); var mask=obj.getAttribute("mask"); for (var i=0; i mask.length) return false; for (var i=0; i= 0; --i) { var c=value.charAt(i); if (c.match(/[0-9]/)) { if (--maxDigits <= 0) { return true; } } } return false; } function qq(s) { return s != null ? "\"" + s.replace(/\\/g,"\\\\").replace(/\"/g,"\\\"") + "\"" : null; } function trace(s) { var out=document.getElementById("_trace"); if (out == null) { var out=document.createElement("TEXTAREA"); out.id="_trace"; out.cols=80; out.rows=20; document.body.insertBefore(out,document.body.firstChild); } out.value+=s + "\n"; } } if (!hX_1._iaReg.utils) { hX_1._iaReg.utils=new hX_1._iaUtils(); } if (!hX_1._iaReg.selector) { hX_1._iaReg.selector=new function() { function Selection() {} Selection.prototype.element=-1; Selection.prototype.start=-1; Selection.prototype.end=-1; Selection.prototype.getCaretPos=function() { return this.end; } Selection.prototype.setCaretPos=function(pos) { this.end=pos; } if (document.selection) { new function() { hX_1._iaReg.utils.addEventHandler( document, "onselectstart", this ); var getPosition=function(element, start) { var value=element.value; if (!value) { return -1; } var r=document.selection.createRange(); r.collapse(start); r.moveEnd("textedit"); return value.length - r.text.length; } this.handleEvent=function(event) { var element=getEventObj(event); Selection.prototype.element=element; Selection.prototype.start=getPosition(element, true); } } } var getEventObj=hX_1._iaReg.utils.getEventObj this.getSelection=getSelection; if (document.getSelection) { this.getSelection=getSelectionNS6; } else if (document.selection) { this.getSelection=getSelectionIE; } function getSelection(element) { return new Selection(); } function getSelectionNS6(element) { var sel=new Selection(); sel.element=element; sel.start=element.selectionStart; sel.end=element.selectionEnd; return sel; } function getSelectionIE(element) { var sel=new Selection(); sel.element=element; var selection=document.selection; var valueLength=element.value.length; var r=selection.createRange(); r.collapse(true); r.moveEnd("textedit"); var s1=valueLength - r.text.length; var r=selection.createRange(); r.collapse(false); r.moveEnd("textedit"); var s2=valueLength - r.text.length;; if (s1 == s2) { sel.start=s1; sel.end=s1; } else if (s1 == sel.start) { sel.end=s2; } else { sel.start=s2; sel.end=s1; } return sel; } this.setSelection=function(sel) { hX_1._iaReg.utils.setSelection(sel.element, sel.start, sel.end); } this.setPosition=function(obj, pos) { hX_1._iaReg.utils.setSelection(obj, pos, pos); } } } HxG_1.prototype._iaNavigator=function() { var ELEMENT_NODE=1; var TEXT_NODE=3; var tabElements=new Array("", "