function Formular(id) { this.id = id; this.formItems = new Array(); } function sU(Bd, GD, Ol, Po) { this.Bd = Bd; this.GD = GD; this.Ol = Ol; this.Po = Po; } Formular.prototype.defineStatusColors = sU; function ws(ja, XT, XN) { XT.ja = ja; this.formItems[ja] = new Array(); this.formItems[ja]["item"] = XT; this.formItems[ja]["status"] = XN; } Formular.prototype.addItem = ws; function LI(BD) { for (var ja in this.formItems) { var Tp = document.getElementById(ja); if (this.formItems[ja]["status"] != -2) { var sA = this.checkFormItem(ja, Tp, BD); if (sA == false && BD) { return false; } else { continue; } } else { this.setNewClass(Tp, this.Bd); } } if (BD) { return true; } return false; } Formular.prototype.check = LI; function fS(BT) { var ja = BT.id.slice(0, BT.id.lastIndexOf("_")); var dx = document.getElementById(ja);  this.checkFormItem(ja, dx, false); } Formular.prototype.checkPwdItem = fS; function JH(ja, Tp, BD) { var ca = this.formItems[ja]["item"]; var Dp = false; var JG = ca.check(); var iJ = JG["res"]; var pt = JG["value"]; if (gF(ca, textItem)) { var dP = textItemMsg; } if (gF(ca, numberItem)) { var dP = numberItemMsg; } if (gF(ca, bornItem)) { var dP = bornItemMsg; } if (gF(ca, emailItem)) { var dP = emailItemMsg; } if (gF(ca, icoItem)) { var dP = icoItemMsg; } if (gF(ca, phoneItem)) { var dP = phoneItemMsg; } if (gF(ca, reItem)) { var dP = reItemMsg; } if (gF(ca, sbItem)) { var dP = sbItemMsg; } if (gF(ca, passwordItem)) { var Dp = true; var lU = document.getElementById(ca.ja+'_ctrl'); if (lU == undefined) { alert('PASSWORD ERROR'); } var dP = passwordItemMsg; } if (iJ == 1) { this.setNewClass(Tp, this.Po); if (Dp) { if (lU.value == Tp.value) { this.setNewClass(lU, this.Po); } else { this.setNewClass(Tp, this.Ol); this.setNewClass(lU, this.Ol); } } return true; } if (Dp) { this.setNewClass(lU, this.Ol); } switch (this.formItems[ja]["status"]) { case -1: if (BD == false) { this.setNewClass(Tp, this.GD); return false; } break; case 0: this.setNewClass(Tp, this.GD); if (BD) { var Vc = confirm(dP[iJ].replace(/{value}/g, pt) + confirmText); if (Vc) { return true; } else { Tp.focus(); return false; } } else { return false; } break; case 1: this.setNewClass(Tp, this.Ol);  if (BD) { alert(dP[iJ].replace(/{value}/g, pt)); Tp.focus(); } return false; break; } } Formular.prototype.checkFormItem = JH; function hE (BT, CZ) { var sq = BT.className.lastIndexOf(" "); if (sq == -1) { BT.className += " " + CZ; } else { var dj = BT.className.slice(sq+1); if (dj == this.Bd || dj == this.Ol || dj == this.GD || dj == this.Po) { BT.className = BT.className.slice(0, sq) + " " + CZ; } else { BT.className += " " + CZ; } } } Formular.prototype.setNewClass = hE; function aS(BT) { var ja = BT.id; var Wc = this.checkFormItem(ja, BT, false); } Formular.prototype.checkItem = aS; function textItem (TZ, GH, tr, ix) { this.TZ = TZ; this.GH = GH; this.tr = tr; this.ix = ix; } function Hl() { var Wc = new Array(); var Iu = document.getElementById(this.ja); if (Iu.value.length < this.GH && this.GH != -1) { Wc["res"] = -1; Wc["value"] = this.GH; return Wc; } if (Iu.value.length > this.tr && this.tr != -1) { Wc["res"] = -2; Wc["value"] = this.tr; return Wc; }  if (this.TZ == 'plain') { var LG = Iu.value.match(/\<[a-zA-Z]+\>/gim); if (LG != null) { Wc["res"] = -3; Wc["value"] = ""; return Wc; } } else if (this.ix != '') { var dk = true; var LG = Iu.value.match(/\<[a-zA-Z]+\>/gim); for (var tag in LG) { var fC = LG[tag]; if (this.ix.indexOf(fC) == -1) { dk = false; break; } } if (dk == false) { Wc["res"] = -4; Wc["value"] = this.ix; return Wc; } } Wc["res"] = 1; Wc["value"] = ""; return Wc; } textItem.prototype.check = Hl; function numberItem (TZ, SH, Km, TJ) { this.TZ = TZ; this.SH = SH; this.Km = Km; this.TJ = TJ; } function PN_check() { var Wc = new Array(); var Iu = document.getElementById(this.ja); if (this.TZ == 'int') { if (Iu.value.match(/^[+-]{0,1}[0-9]+$/gim) == null) { Wc["res"] = -3; Wc["value"] = ""; return Wc; } } else { if (Iu.value.match(/^[+-]{0,1}[0-9]+[,.]{0,1}[0-9]*$/gim) == null) { Wc["res"] = -4; Wc["value"] = ""; return Wc; } else { var Vr = Iu.value.lastIndexOf("."); if (Vr == -1) {Wc["res"] = 1; Wc["value"] = ""; return Wc;} var YQ = Iu.value.length - (Vr + 1); if (YQ > this.TJ && this.TJ != -1) { Wc["res"] = -5; Wc["value"] = this.TJ; return Wc; } } } if (Iu.value < this.SH && this.SH != -1) { Wc["res"] = -1; Wc["value"] = this.SH; return Wc; } if (Iu.value > this.Km && this.Km != -1) { Wc["res"] = -2; Wc["value"] = this.Km; return Wc; } Wc["res"] = 1; Wc["value"] = ""; return Wc; } numberItem.prototype.check = PN_check; function bornItem () {} function fI() { var Wc = new Array(); var Iu = document.getElementById(this.ja); if (Iu.value.match(/^[0-9]{6}\/[0-9]{3,4}$/gim) == null) { Wc["res"] = -1; Wc["value"] = ""; return Wc; } var tO = parseInt(Iu.value.slice(0,2)); var xH = parseInt(Iu.value.slice(2,4)); var mc = parseInt(Iu.value.slice(4,6)); if (xH > 62 || xH < 0 || mc < 0 || mc > 31) { Wc["res"] = -1; Wc["value"] = ""; return Wc; } if (Iu.value.length == 11) { var LK = parseInt(Iu.value.slice(-4)); if (((tO+xH+mc+LK) % 11) != 0) { Wc["res"] = -1; Wc["value"] = ""; return Wc; } } Wc["res"] = 1; Wc["value"] = ""; return Wc; } bornItem.prototype.check = fI; function emailItem () {} function eE() { var Wc = new Array(); var Iu = document.getElementById(this.ja); if (Iu.value.match(/^[^. ]+(\.[^. ]+)*@([^. ]+[.])+[a-z]{2,4}$/gim) == null) { Wc["res"] = -1; Wc["value"] = ""; return Wc; } Wc["res"] = 1; Wc["value"] = ""; return Wc; } emailItem.prototype.check = eE; function icoItem () {} function gB() { var Wc = new Array(); var Iu = document.getElementById(this.ja); if (Iu.value.match(/^[0-9]{8}$/gim) == null) { Wc["res"] = -1; Wc["value"] = ""; return Wc; } var BA = parseInt(Iu.value.slice(-1)); var vn = 0; var Th = 2; for (var Ft=6; Ft>=0; Ft--) { var PN = parseInt(Iu.value.slice(Ft,Ft+1)); vn += PN*Th; Th++; } var KM = (11 - (vn % 11)); if (KM != BA) { Wc["res"] = -1; Wc["value"] = ""; return Wc; } Wc["res"] = 1; Wc["value"] = ""; return Wc; } icoItem.prototype.check = gB; function phoneItem (TZ) { this.TZ = TZ; } function VL() { var Wc = new Array(); var Iu = document.getElementById(this.ja); if (this.TZ == 'int') { if (Iu.value.match(/^\+[0-9]{12}$/gim) == null) { Wc["res"] = -1; Wc["value"] = ""; return Wc; } } else { if (Iu.value.match(/^[0-9]{9}$/gim) == null) { Wc["res"] = -2; Wc["value"] = ""; return Wc; } } Wc["res"] = 1; Wc["value"] = ""; return Wc; } phoneItem.prototype.check = VL; function passwordItem (UN) { this.UN = UN; } function SF() { var Wc = new Array(); Wc["value"] = ""; var Iu = document.getElementById(this.ja); var nm = new Array(); nm["res"] = 1; nm["value"] = ""; if (Iu.value.length == 0) { Wc["res"] = -1; return Wc; } if (this.UN == 1) { return nm; } if (Iu.value.length < 6) { Wc["res"] = -2; return Wc; } if (this.UN == 2) { return nm; } if (Iu.value.match(/^[0-9]+$/gim) != null) { Wc["res"] = -3; return Wc; } if (Iu.value.match(/[0-9]+/gim) == null) { Wc["res"] = -3; return Wc; } if (this.UN == 3) { return nm; } if (Iu.value.length < 8) { Wc["res"] = -4; return Wc; } if (this.UN == 4) { return nm; } if (Iu.value.match(/[^0-9a-zA-Z]+/gm) == null) { Wc["res"] = -5; return Wc; } if (this.UN == 5) { return nm; } if (Iu.value.match(/[A-Z]+/gm) == null) { Wc["res"] = -6; return Wc; } if (Iu.value.match(/[a-z]+/gm) == null) { Wc["res"] = -6; return Wc; } if (Iu.value.match(/[0-9]+.*[0-9]+/gim) == null) { Wc["res"] = -6; return Wc; } return nm; } passwordItem.prototype.check = SF; function reItem (SO, Wv) { var LR = new RegExp(SO, "gm"); this.fj = LR; this.Wv = Wv; } function TG() { var Wc = new Array(); var Iu = document.getElementById(this.ja); if (Iu.value.match(this.fj) == null) { Wc["res"] = -1; Wc["value"] = this.Wv; return Wc; } Wc["res"] = 1; Wc["value"] = ""; return Wc; } reItem.prototype.check = TG; function sbItem (GX, dp) { this.GX = GX; this.dp = dp; } function QS() { var Wc = new Array(); var Iu = document.getElementById(this.ja); if (this.GX > 0 && Iu.selectedIndex == -1) { Wc["res"] = -1; Wc["value"] = this.GX; return Wc; } var mk = 0; for (var Ft=0; Ft<Iu.options.length; Ft++) { if (Iu.options[Ft].selected) { mk++; } } if (mk < this.GX && this.GX != -1) { Wc["res"] = -1; Wc["value"] = this.GX; return Wc; } if (mk > this.dp && this.dp != -1) { Wc["res"] = -2; Wc["value"] = this.dp; return Wc; } Wc["res"] = 1; Wc["value"] = ""; return Wc; } sbItem.prototype.check = QS; function gF(Ao, KB) { var res = (Ao instanceof KB); return res; }  