/*__________________________________________________________ form control systems (rev001_JAL_BRANCH_2) _____________________________________________________________*/ var MSG_ENTER_MEMNO = '\u304A\u5F97\u610F\u69D8\u756A\u53F7\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002'; var MSG_ENTER_PASSWD = '\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002'; var MSG_CONFIRM_AIRPORT = '\u767A\u7740\u7A7A\u6E2F\u540D\u3092\u3054\u78BA\u8A8D\u304F\u3060\u3055\u3044\u3002'; /* ------ JLJS_InteractiveTextField ------ */ function JLJS_InteractiveTextField (node) { if (!node || !node.nodeName || !node.nodeName.match(/^(input|textarea)$/i)) return; this.node = node; this.searchAttr = 'title'; this.status = ''; this.prepopulated = false; this.focused = false; this.classNames = { 'default' : 'pseudo-default', 'focus' : 'pseudo-focus', 'disabled' : 'pseudo-disabled' }; if (!JLJS.getAttr(this.node, this.searchAttr)) return null; this.node._ITF_instance_ = this; this.prepopulateInfoText(); this.setStatus((this.prepopulated) ? 'disabled' : 'default'); } JLJS_InteractiveTextField.prototype = { prepopulateInfoText : function () { var value0 = this.node.value; var value1 = JLJS.getAttr(this.node, this.searchAttr); var value2 = JLJS.getAttr(this.node, JLJS.prfx.bAattrs + this.searchAttr); if (value0 && value0 != value1) { this.prepopulated = false; return; } if (value1) { this.node.value = value1; JLJS.setAttr(this.node, this.searchAttr, ''); JLJS.setAttr(this.node, JLJS.prfx.bAattrs + this.searchAttr, value1); } else if (value2) { this.node.value = value2; } this.prepopulated = true; }, removeInfoText : function () { var value = JLJS.getAttr(this.node, JLJS.prfx.bAattrs + this.searchAttr); if (this.node.value == value) { this.node.value = ''; } }, setStatus : function (status) { if (!status || typeof status != 'string' || !this.classNames[status]) return; this.status = status; for (var i in this.classNames) { JLJS.classAttr.remove(this.node, this.classNames[i]); } if (this.classNames[this.status]) { JLJS.classAttr.add(this.node, this.classNames[this.status]); } } }; function JLJS_InteractiveTextField_Setup () { var nodes1 = JLJS.getElementsByTagName('input'); var nodes2 = JLJS.getElementsByTagName('textarea'); var nodes = JLJS.concatNodeList(nodes1, nodes2); for (var i = 0; i < nodes.length; i++) { var type = (nodes[i].nodeName.match(/^input$/i)) ? JLJS.getAttr(nodes[i], 'type') : 'textarea'; if (!type || !type.match(/^(text|password|textarea)$/i)) continue; var ITF = new JLJS_InteractiveTextField(nodes[i]); if (ITF && ITF.node && ITF.node._ITF_instance_) { JLJS.addEvent(ITF.node, 'focus', function (e) { var obj = e.currentTarget._ITF_instance_; obj.focused = true; obj.removeInfoText(); obj.setStatus('focus'); }); JLJS.addEvent(ITF.node, 'blur' , function (e) { var obj = e.currentTarget._ITF_instance_; obj.focused = false; obj.prepopulateInfoText(); obj.setStatus((obj.prepopulated) ? 'disabled' : 'default'); }); } } } JLJS.addOnload(JLJS_InteractiveTextField_Setup); /* ------ JLJS_Selector ----- */ function JLJS_Selector (selectNode) { this.setNode(selectNode); } JLJS_Selector.prototype = { setNode : function(node) { if (typeof node == 'object' && node.nodeName && node.nodeName.match(/^select$/i)) { this.node = node; } }, adjust : function(target, arg) { if (this.node && typeof target == 'string' && arg) { this.node.options[0].selected = true; for (var i = 0; i < this.node.options.length; i++) { var value = this.node.options[i][target]; if (value && (typeof arg == 'number' && parseInt(value, 10) == arg || typeof arg == 'string' && value == arg)) { this.node.options[i].selected = true; break; } } } }, adjustByLabel : function (arg) { this.adjust('text', arg); }, adjustByValue : function (arg) { this.adjust('value', arg); } } /* ------ JLJS_DateSelector ----- */ function JLJS_DateSelector() { this.Date = new Date(); this.today = new Date(); this.days = new Array("\u65e5","\u6708","\u706b","\u6c34","\u6728","\u91d1","\u571f"); this.dayOfWeekFlag = false; this.end = new Date(); this.endDay = null; if (arguments.length == 3) { this.year = new JLJS_Selector(arguments[0]); this.month = new JLJS_Selector(arguments[1]); this.day = new JLJS_Selector(arguments[2]); this.format = (this.year.node && this.month.node && this.day.node) ? 3 : 0; } else if (arguments.length == 2) { this.month = new JLJS_Selector(arguments[0]); this.day = new JLJS_Selector(arguments[1]); this.format = (this.month.node && this.day.node) ? 2 : 0; } } JLJS_DateSelector.prototype = { adjust : function() { if (this.year) this.year.adjustByLabel(this.Date.getFullYear()); if (this.month) this.month.adjustByLabel(this.Date.getMonth() + 1); if (this.day) this.day.adjustByLabel(this.Date.getDate()); }, applyOffset : function () { var offset = { y : 0, m : 0, d : 0 }; var ptn = /^((\+|\-)\d+)(y|m|d)$/; for (var i = 0; i < arguments.length; i++) { if (typeof arguments[i] == 'string' && arguments[i].match(ptn)) { offset[RegExp.$3] = eval(RegExp.$1); } } this.Date.setFullYear(this.Date.getFullYear() + offset.y); this.Date.setMonth(this.Date.getMonth() + offset.m); this.Date.setDate(this.Date.getDate() + offset.d); if (!this.dayOfWeekFlag) this.adjust(); }, adjustToToday : function () { this.Date = new Date(); if (!this.dayOfWeekFlag) this.adjust(); }, adjustToDate : function (arg) { if (arg.constructor == Date) { this.Date = arg } else if (typeof arg == 'string' && arg.match(/^[\d\-\/]*$/)) { var date = (arg.match(/\-/)) ? arg.split('-') : arg.split('/'); if (date.length == 3) { this.Date.setDate(1); this.Date.setFullYear(parseInt(date[0], 10)); this.Date.setMonth(parseInt(date[1], 10) - 1); this.Date.setDate(parseInt(date[2], 10)); } else if (date.length == 2) { this.Date.setDate(1); this.Date.setMonth(parseInt(date[0], 10) - 1); this.Date.setDate(parseInt(date[1], 10)); } else { return; } } if (!this.dayOfWeekFlag) this.adjust(); }, setDateBySelecter : function () { this.Date.setDate(1); if (this.month) this.Date.setMonth(parseInt(this.month.node.value, 10) - 1); if (this.year) { this.Date.setFullYear(this.year.node.value); }else{ this.Date.setFullYear(this.getFullYear()); } if (this.day) { if (this.dayOfWeekFlag){ var endDate = new Date(this.Date.getFullYear(), this.Date.getMonth() + 1, 1) endDate.setDate(0); if (endDate.getDate() >= this.day.node.value) { this.Date.setDate(this.day.node.value); } }else{ this.Date.setDate(this.day.node.value); } } }, setDay : function (zeroPadFlg) { var day = this.Date.getDate(); this.day.node.options.length = 0; var fullYear = this.getFullYear(); this.end.setFullYear(fullYear); this.end.setDate(1); this.end.setMonth(this.Date.getMonth() + 1); this.end.setDate(0); this.endDay = parseInt(this.end.getDate()); for (i=0;i 0) { if (this.memberNoField) { this.memberNoField.style.backgroundImage = ''; this.memberNoField.value = this.memberNo; } } }, checkInputData : function () { if (!this.memberNoField || !this.memberPwField || this.submitLock) return; if (this.memberNoField.value.length != 9 && this.memberNoField.value.length != 7) { alert(MSG_ENTER_MEMNO); this.memberNoField.focus(); return; } if (this.memberPwField.value.length != 4 && this.memberPwField.value.length != 6) { alert (MSG_ENTER_PASSWD); this.memberPwField.focus(); return; } this.submitLock = true; this.memberNoField.value = this.memberNoField.value.replace(/[\uff10-\uff19]/g, function(str){return String.fromCharCode(str.charCodeAt(0)-65248);}); this.setFormAction(); this.formNode.submit(); }, setFormAction : function () { this.formNode[this.PARAM_ACTION].value = ""; if(this.AutoCompCBox.checked){ var autoLoginCookie = JLJS_CookieMgr.getCookie(this.AUTO_LOGIN_COOKIE_KEY); if(!autoLoginCookie){ this.setAction(); return; } var memberCookie = autoLoginCookie.split(","); for (var i=0;i