Deprecated: Creation of dynamic property Gcms\Config::$version is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$booking_w is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$inventory_w is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$repair_first_status is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$repair_send_mail is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$edocument_format_no is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$edocument_send_mail is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$edocument_file_typies is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$edocument_upload_size is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$edocument_download_action is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$booking_line_id is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$booking_send_mail is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$personnel_w is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$personnel_h is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$personnel_status is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$booking_status is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$booking_notifications is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$edocument_line_id is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$repair_line_id is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$repair_status_success is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Deprecated: Creation of dynamic property Gcms\Config::$booking_approving is deprecated in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php on line 242

Warning: Cannot modify header information - headers already sent by (output started at /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Config.php:242) in /home/lat6/domains/latyao.ac.th/public_html/eoffice/Kotchasan/Language.php on line 408
window.$K = (function() { "use strict"; var domloaded = false; var $K = { emptyFunction: function() {}, resultFunction: function() { return true; }, isMobile: function() { return (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1); }, init: function(element) { forEach(element.querySelectorAll("input,textarea"), function(elem) { var tagName = $G(elem).tagName.toLowerCase(), type = elem.get("type"), type = type ? type.toLowerCase() : ""; if (elem.initObj !== true && (tagName == "textarea" || (type !== "hidden" && type !== "radio" && type !== "checkbox" && type !== "button" && type !== "submit"))) { var obj = new Object(); obj.tagName = tagName; obj.type = type; elem.initObj = true; obj.title = elem.title; obj.required = elem.get("required"); obj.disabled = elem.get("disabled") !== null; obj.maxlength = floatval(elem.get("maxlength")); obj.pattern = elem.get("pattern"); if (obj.pattern !== null) { obj.pattern = new RegExp("^(?:" + obj.pattern + ")$"); elem.setAttribute("pattern", "(.*){0,}"); } obj.dataset = elem.dataset; if (typeof obj.dataset == "undefined") { obj.dataset = {}; forEach(elem.attributes, function() { var hs = this.name.match(/^data\-(.+)/); if (hs) { obj.dataset[hs[0]] = this.value; } }); } if (obj.tagName == "textarea") { if (obj.maxlength > 0 || obj.required || obj.pattern) { var _docheck = function() { if (this.value == "" && obj.required !== null) { this.addClass("required"); this.invalid(obj.title !== "" ? obj.title : trans("Please fill in") + (this.placeholder == "" ? "" : " " + this.placeholder)); } else if (this.value != "" && obj.pattern && !obj.pattern.test(this.value)) { this.invalid(obj.title !== "" ? obj.title : trans("Invalid data")); } else if (obj.required !== null || obj.pattern) { this.reset(); } }; elem.srcObj = obj; elem.addEvent("keyup", _docheck); elem.addEvent("change", _docheck); } } else if (obj.tagName == "input") { var c = elem.hasClass("currency number integer color inputgroup"); if (c !== false) { obj.type = c; } if (elem.min) { obj.min = elem.min; } if (elem.max) { obj.max = elem.max; } var autofocus = elem.get("autofocus"); var text = elem; if (obj.type == "date") { new GCalendar(text); } else if (obj.type == "number" || obj.type == "integer" || obj.type == "tel" || obj.type == "email" || obj.type == "url" || obj.type == "color" || obj.type == "currency" || obj.type == "time") { var o = { type: "text", name: elem.name, disabled: obj.disabled }; if (elem.id != "") { o.id = elem.id; } text = $G().create("input", o); if (elem.value != "") { text.value = elem.value; } if (obj.title != "") { text.title = obj.title; } if (elem.size) { text.size = elem.size; } if (elem.placeholder) { text.placeholder = elem.placeholder; } if (obj.maxlength > 0) { text.maxlength = obj.maxlength; } if (elem.readOnly) { text.readOnly = true; } if (obj.type == "currency") { text.digit = floatval(obj.dataset['digit'] ? obj.dataset['digit'] : 2); } text.className = elem.className; text.initObj = true; elem.replace(text); if (obj.type == "color") { new GDDColor(text, function(c) { this.input.style.backgroundColor = c; this.input.style.color = this.invertColor(c); this.input.value = c; this.input.callEvent("change"); }); } else if (obj.type == "time") { new GTime(text); } else if (obj.type == "email" || obj.type == "url") { if (obj.pattern == null) { if (obj.type == "email") { obj.pattern = /^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/; } else { obj.pattern = /^[a-z0-9\-\.:\/\#%\?\&\=_@~]{3,}$/i; } } text.addEvent("keyup", _docheck); text.addEvent("change", _docheck); } else { if (!obj.dataset["keyboard"]) { if (obj.type == "integer") { obj.dataset["keyboard"] = "1234567890-"; } else if (obj.type == "currency") { obj.dataset["keyboard"] = "1234567890-.,"; } else if (obj.type == "number" || obj.type == "tel") { obj.dataset["keyboard"] = "1234567890"; } } if (obj.dataset["keyboard"]) { obj.pattern = new RegExp("^(?:[" + obj.dataset["keyboard"].preg_quote() + "]+)$"); if (obj.type == "integer" || obj.type == "currency" || obj.type == "number") { new GInput(text, obj.dataset["keyboard"], function() { if (obj.min) { this.value = Math.max(obj.min, floatval(this.value)); } if (obj.max) { this.value = Math.min(obj.max, floatval(this.value)); } if (obj.type == "currency") { this.value = toCurrency(this.value, this.digit); } }); } else { new GInput(text, obj.dataset["keyboard"]); } } } } else if (obj.type == "file") { if (elem.hasClass("g-file")) { var p = elem.parentNode; elem.setStyle("opacity", 0); elem.style.cursor = "pointer"; elem.style.position = "absolute"; elem.style.left = 0; elem.style.top = 1; p.style.position = "relative"; var display = document.createElement("input"); display.setAttribute("type", "text"); display.id = elem.id; elem.id = elem.id + "_tmp"; display.disabled = true; display.placeholder = elem.placeholder; p.appendChild(display); elem.style.zIndex = text.style.zIndex + 1; elem.style.height = "100%"; elem.style.width = "100%"; elem.addEvent("change", function() { if (this.files) { var input = this, hs, files = [], preview = $E(this.get("data-preview")), max = floatval(input.get("data-max")), validImageTypes = ['image/gif', 'image/jpeg', 'image/jpg', 'image/png']; if (preview) { preview.innerHTML = ''; } forEach(input.files, function() { if (max > 0 && this.size > max) { input.invalid(input.title); } else { files.push(this.name); input.valid(); if (preview) { hs = /\.([a-z0-9]+)$/.exec(this.name.toLowerCase()); var div = document.createElement('div'); div.className = 'file-thumb'; if (hs) { div.innerHTML = hs[1]; } preview.appendChild(div); if (validImageTypes.includes(this.type) && window.FileReader) { var r = new FileReader(); r.onload = function(evt) { div.innerHTML = ''; div.style.backgroundImage = 'url(' + evt.target.result + ')'; }; r.readAsDataURL(this); } } } }); display.value = files.join(', '); display.callEvent("change", { value: this.value, files: this.files }); } }); elem.initObj = true; } } else if (obj.type == "range") { new GRange(elem); } else if (obj.type == "inputgroup") { new GInputGroup(elem); } else if (elem.get("list")) { new Datalist(elem); } else if (obj.pattern) { new GMask(text, function() { return obj.pattern.test(this.value); }); } if (typeof obj.dataset !== "undefined") { for (var prop in obj.dataset) { if (obj.dataset[prop] !== null) { text.setAttribute("data-" + prop, obj.dataset[prop]); } } } if (autofocus !== null) { text.focus(); if (obj.type == "text") { text.select(); } } if (obj.pattern || obj.required) { text.srcObj = obj; } } } }); } }; if (typeof Array.prototype.indexOf != "function") { Array.prototype.indexOf = function(t, i) { i || (i = 0); var l = this.length; if (i < 0) { i = l + i; } for (; i < l; i++) { if (this[i] == t) { return i; } } return -1; }; } if (typeof forEach != "function") { window.forEach = function(a, f) { var i, l = a.length, x = []; for (i = 0; i < l; i++) { x.push(a[i]); } for (i = 0; i < l; i++) { if (f.call(x[i], x[i], i) == true) { break; } } }; } window.floatval = function(val) { var n = parseFloat(typeof val == 'string' ? val.replace(/[^0-9\-\.]/g, '') : val); return isNaN(n) ? 0 : n; }; window.toCurrency = function(val, digit) { return floatval(val).toFixed(Object.isNull(digit) ? 2 : digit).replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,') }; window.round = function(val, digit) { var value = Math.round(val * Math.pow(10, digit)) / Math.pow(10, digit); if (val - value > 0) { return value + Math.floor((2 * Math.round((val - value) * Math.pow(10, digit + 1))) / 10) / Math.pow(10, digit); } else { return value; } }; window.copyToClipboard = function(text) { var el = document.createElement("textarea"); el.value = text; el.setAttribute('readonly', ''); el.style.position = 'absolute'; el.style.top = '-1000px'; document.body.appendChild(el); el.select(); document.execCommand("copy"); document.body.removeChild(el); }; window.trans = function(val) { try { var patt = /^[_]+|[_]+$/g; return eval(val.replace(/[\s]/g, "_").replace("?", "").replace(patt, "").toUpperCase()); } catch (e) { return val; } }; window.debug = function(val) { var p = document.createElement("p"), div = $E("gdebug"); if (!div) { div = document.createElement("div"); div.id = "gdebug"; document.body.appendChild(div); div.style.cssText = "left:0;bottom:0;width:100%;height:100px;color:#F00;background-color:#FFF;position:fixed;line-height:1;padding:10px;overflow:auto;"; } p.style.cssText = "margin:0;"; p.innerText = val; div.appendChild(p); div.scrollTop = div.scrollHeight; }; window.timeToMinute = function(time) { var sp = time.split(':'); if (sp.length == 1) { return 0; } else { return (floatval(sp[0]) * 60) + floatval(sp[1]); } }; window.timeToSecond = function(time) { var sp = time.split(':'); if (sp.length == 1) { return 0; } else { return (floatval(sp[0]) * 60) + (floatval(sp[1] * 60) + floatval(sp[2])); } }; Function.prototype.bind = function(o) { var __method = this; return function() { return __method.apply(o, arguments); }; }; Date.prototype.fromTime = function(mktime) { return new Date(mktime * 1000); }; Date.prototype.format = function(fmt) { var result = ""; for (var i = 0; i < fmt.length; i++) { result += this.formatter(fmt.charAt(i)); } return result; }; Date.prototype.formatter = function(c) { switch (c) { case "d": return this.getDate().toString().leftPad(2, "0"); case "D": return Date.dayNames[this.getDay()]; case "y": return this.getFullYear().toString(); case "Y": return (this.getFullYear() + Date.yearOffset).toString(); case "m": return (this.getMonth() + 1).toString().leftPad(2, "0"); case "M": return Date.monthNames[this.getMonth()]; case "F": return Date.longMonthNames[this.getMonth()]; case "H": return this.getHours().toString().leftPad(2, "0"); case "h": return this.getHours(); case "A": return this.getHours() < 12 ? "AM" : "PM"; case "a": return this.getHours() < 12 ? "am" : "pm"; case "I": return this.getMinutes().toString().leftPad(2, "0"); case "i": return this.getMinutes(); case "S": return this.getSeconds().toString().leftPad(2, "0"); case "s": return this.getSeconds(); default: return c; } }; Date.prototype.tomktime = function() { return Math.floor(this.getTime() / 1000); }; Date.prototype.moveDate = function(value) { this.setDate(this.getDate() + value); return this; }; Date.prototype.moveMonth = function(value) { this.setMonth(this.getMonth() + value); return this; }; Date.prototype.moveYear = function(value) { this.setFullYear(this.getFullYear() + value); return this; }; Date.prototype.isLeapYear = function() { var year = this.getFullYear(); return (year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)); }; Date.prototype.daysInMonth = function() { var arr = Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); arr[1] = this.isLeapYear() ? 29 : 28; return arr[this.getMonth()]; }; Date.prototype.dayOfWeek = function() { var a = parseInt((14 - this.getMonth()) / 12); var y = this.getFullYear() - a; var m = this.getMonth() + 12 * a - 2; var d = (this.getDate() + y + parseInt(y / 4) - parseInt(y / 100) + parseInt(y / 400) + parseInt((31 * m) / 12)) % 7; return d; }; Date.prototype.compare = function(d) { if (Object.isString(d)) { d = new Date(d.replace(/-/g, '/')); } var date = d.getDate(), month = d.getMonth(), year = d.getFullYear(), dateStr = this.getDate(), monthStr = this.getMonth(), yearStr = this.getFullYear(), theYear = yearStr - year, theMonth = monthStr - month, theDate = dateStr - date, days = 0; if ( monthStr == 0 || monthStr == 2 || monthStr == 4 || monthStr == 6 || monthStr == 7 || monthStr == 9 || monthStr == 11 ) { days = 31; } if (monthStr == 3 || monthStr == 5 || monthStr == 8 || monthStr == 10) { days = 30; } if (monthStr == 1) { days = 28; } var inYears = theYear; var inMonths = theMonth; if (month < monthStr && date > dateStr) { inYears = floatval(inYears) + 1; inMonths = theMonth - 1; } if (month < monthStr && date <= dateStr) { inMonths = theMonth; } else if (month == monthStr && (date < dateStr || date == dateStr)) { inMonths = 0; } else if (month == monthStr && date > dateStr) { inMonths = 11; } else if (month > monthStr && date <= dateStr) { inYears = inYears - 1; inMonths = 12 - -theMonth + 1; } else if (month > monthStr && date > dateStr) { inMonths = 12 - -theMonth; } var inDays = theDate; if (date > dateStr) { inYears = inYears - 1; inDays = days - -theDate; } else if (date == dateStr) { inDays = 0; } return { day: inDays, month: inMonths, year: inYears, days: Math.floor(Math.abs(this.getTime() - d.getTime()) / 86400000) }; }; Date.monthNames = [ "Jan.", "Feb.", "Mar.", "Apr.", "May.", "Jun.", "Jul.", "Aug.", "Sep.", "Oct.", "Nov.", "Dec." ]; Date.longMonthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; Date.longDayNames = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]; Date.dayNames = ["Su.", "Mo.", "We.", "Tu.", "Th.", "Fr.", "Sa."]; Date.yearOffset = 0; String.prototype.entityify = function() { return this.replace(//g, ">") .replace(/"/g, """) .replace(/'/g, "'") .replace(/\\/g, "\") .replace(/&/g, "&") .replace(/\{/g, "{") .replace(/\}/g, "}"); }; String.prototype.unentityify = function() { return this.replace(/</g, "<") .replace(/>/g, ">") .replace(/"/g, '"') .replace(/&#[0]?39;/g, "'") .replace(/\/g, "\\") .replace(/&/g, "&") .replace(/{/g, "{") .replace(/}/g, "}"); }; String.prototype.toJSON = function() { try { return JSON.parse(this); } catch (e) { return false; } }; String.prototype.toInt = function() { return floatval(this); }; String.prototype.currFormat = function() { return floatval(this).toFixed(2); }; String.prototype.preg_quote = function() { return this.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1"); }; String.prototype.capitalize = function() { return this.replace(/\b[a-z]/g, function(m) { return m.toUpperCase(); }); }; String.prototype.evalScript = function() { var regex = /(.*?)<\/script>/g; var t = this.replace(/[\r\n]/g, "").replace(/\/\/<\!\[CDATA\[/g, "").replace(/\/\/\]\]>/g, ""); var m = regex.exec(t); while (m) { try { eval(m[1]); } catch (e) {} m = regex.exec(t); } return this; }; String.prototype.leftPad = function(c, f) { var r = ""; for (var i = 0; i < c - this.length; i++) { r = r + f; } return r + this; }; String.prototype.trim = function() { return this.replace(/^(\s| )+|(\s| )+$/g, ""); }; String.prototype.ltrim = function() { return this.replace(/^(\s| )+/, ""); }; String.prototype.rtrim = function() { return this.replace(/(\s| )+$/, ""); }; String.prototype.strip_tags = function(allowed) { allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(""); var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi; var php = /|<\?(?:php)?[\s\S]*?\?>/gi; return this.replace(php, "").replace(tags, function($0, $1) { return allowed.indexOf("<" + $1.toLowerCase() + ">") > -1 ? $0 : ""; }); }; String.prototype.toDOM = function() { var s = function(a) { return a .replace(/>/g, ">") .replace(/</g, "<") .replace(/ /g, " ") .replace(/"/g, '"') .replace(/&#[0]?39;/g, "'") .replace(/\/g, "\\") .replace(/&/g, "&"); }; var t = function(a) { return a.replace(/ /g, ""); }; var u = function(a) { var b = document.createDocumentFragment(); var c = a.indexOf(" "); if (c == -1) { var d = a.toLowerCase(); b.appendChild(document.createElement(d)); } else { d = t(a.substring(0, c)).toLowerCase(); if (document.all && (d == "input" || d == "iframe")) { try { b.appendChild(document.createElement("<" + a + "/>")); return b; } catch (e) {} } a = a.substring(c + 1); b.appendChild(document.createElement(d)); while (a.length > 0) { var e = a.indexOf("="); if (e >= 0) { var f = t(a.substring(0, e)).toLowerCase(); var g = a.indexOf('"'); a = a.substring(g + 1); g = a.indexOf('"'); var h = s(a.substring(0, g)); a = a.substring(g + 2); if (document.all && f == "style") { b.lastChild.style.cssText = h; } else if (f == "class") { b.lastChild.className = h; } else { b.lastChild.setAttribute(f, h); } } else { break; } } } return b; }; var v = function(a, b, c) { var d = a; var e = b; c = c.toLowerCase(); var f = e.indexOf(""); d = d.concat(e.substring(0, f)); e = e.substring(f); while (d.indexOf("<" + c) != -1) { d = d.substring(d.indexOf("<" + c)); d = d.substring(d.indexOf(">") + 1); e = e.substring(e.indexOf(">") + 1); f = e.indexOf(""); d = d.concat(e.substring(0, f)); e = e.substring(f); } return b.length - e.length; }; var w = function(a) { var b = document.createDocumentFragment(); while (a && a.length > 0) { var c = a.indexOf("<"); if (c == -1) { a = s(a); b.appendChild(document.createTextNode(a)); a = null; } if (c > 0) { var d = s(a.substring(0, c)); b.appendChild(document.createTextNode(d)); a = a.substring(c); } if (c == 0) { var e = a.indexOf(""); var g = a.substring(4, f); g = s(g); b.appendChild(document.createComment(g)); a = a.substring(f + 3); } else { var h = a.indexOf(">"); if (a.substring(h - 1, h) == "/") { var i = a.indexOf("/>"); var j = a.substring(1, i); b.appendChild(u(j)); a = a.substring(i + 2); } else { var k = a.indexOf(">"); var l = a.substring(1, k); var m = document.createDocumentFragment(); m.appendChild(u(l)); a = a.substring(k + 1); var n = a.substring(0, a.indexOf("") + 1); m.lastChild.appendChild(w(n)); b.appendChild(m); } } } } return b; }; return w(this); }; String.prototype.toDate = function() { var patt = /(([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})|today|tomorrow|yesterday)([\s]{0,}([+-])[\s]{0,}([0-9]+))?/, hs = patt.exec(this), d; if (hs) { if (typeof hs[2] == "undefined") { d = new Date(); } else { d = new Date(floatval(hs[2]), floatval(hs[3]) - 1, hs[4], 0, 0, 0, 0); } if (hs[1] == "yesterday") { d.setDate(d.getDate() - 1); } else if (hs[1] == "tomorrow") { d.setDate(d.getDate() + 1); } if (hs[6] == "+" && floatval(hs[7]) > 0) { d.setDate(d.getDate() + floatval(hs[7])); } else if (hs[6] == "-" && floatval(hs[7]) > 0) { d.setDate(d.getDate() - floatval(hs[7])); } return d; } else { return null; } }; Number.prototype.format = function(decimals, dec_point, thousands_sep) { decimals = isNaN((decimals = Math.abs(decimals))) ? 2 : decimals; dec_point = dec_point == undefined ? "." : dec_point; thousands_sep = thousands_sep == undefined ? "," : thousands_sep; var n = this, s = n < 0 ? "-" : "", i = String(parseInt((n = Math.abs(Number(n) || 0).toFixed(decimals)))), j = (j = i.length) > 3 ? j % 3 : 0; return (s + (j ? i.substr(0, j) + thousands_sep : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands_sep) + (decimals ? dec_point + Math.abs(n - i).toFixed(decimals).slice(2) : "")); }; document.viewport = { getWidth: function() { return ( document.documentElement.clientWidth || document.body.clientWidth || self.innerWidth ); }, getHeight: function() { return ( document.documentElement.clientHeight || document.body.clientHeight || self.innerHeight ); }, getscrollTop: function() { return ( window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop ); }, getscrollLeft: function() { return ( window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft ); } }; document.css = function(css, id) { var style = document.createElement("style"); if (id) { style.id = "css_" + id; if ($E("css_" + id)) { $E("css_" + id).parentNode.removeChild($E("css_" + id)); } } if (css !== null) { if (style.styleSheet) { style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } document.getElementsByTagName("head")[0].appendChild(style); } }; Object.extend = function(d, s) { for (var property in s) { d[property] = s[property]; } return d; }; Object.extend(Object, { isObject: function(o) { return typeof o == "object"; }, isFunction: function(o) { return typeof o == "function"; }, isString: function(o) { return typeof o == "string"; }, isNumber: function(o) { return typeof o == "number"; }, isNull: function(o) { return typeof o == "undefined"; }, isGElement: function(o) { return ( o != null && typeof o == "object" && "Ready" in o && "element" in o ); }, toArray: function(o) { var prop, result = []; for (prop in o) { result.push(o[prop]); } return result; } }); window.GClass = { create: function() { return function() { this.initialize.apply(this, arguments); }; } }; window.GNative = GClass.create(); GNative.prototype = { initialize: function() { this.elem = null; }, Ready: function(f) { var s = this; var p = function() { if (domloaded && s.element()) { f.call($G(s.elem)); } else { window.setTimeout(p, 10); } }; p(); }, after: function(e) { var p = this.parentNode; if (this.nextSibling == null) { p.appendChild(e); } else { p.insertBefore(e, this.nextSibling); } return e; }, before: function(e) { var p = this.parentNode; if (p.firstChild == this) { p.appendChild(e); } else { p.insertBefore(e, this); } return e; }, insert: function(e) { e = $G(e); this.appendChild(e); return e; }, copy: function(o) { return $G(this.cloneNode(o || true)); }, replace: function(e) { var p = this.parentNode; p.insertBefore(e, this.nextSibling); p.removeChild(this); return $G(e); }, remove: function() { if (this.element()) { this.parentNode.removeChild(this); } return this; }, setHTML: function(o) { try { this.innerHTML = o; } catch (e) { o = o .replace(/[\r\n\t]/g, "") .replace(/]*>.*?<\/script>/gi, ""); this.appendChild(o.toDOM()); } return this; }, getTop: function() { return this.viewportOffset().top; }, getLeft: function() { return this.viewportOffset().left; }, getWidth: function() { return this.getDimensions().width; }, getHeight: function() { return this.getDimensions().height; }, getClientWidth: function() { return ( this.clientWidth - parseInt(this.getStyle("paddingLeft")) - parseInt(this.getStyle("paddingRight")) ); }, getClientHeight: function() { return ( this.clientHeight - parseInt(this.getStyle("paddingTop")) - parseInt(this.getStyle("paddingBottom")) ); }, viewportOffset: function() { var t = 0, l = 0, p = this; while (p) { t += parseInt(p.offsetTop); l += parseInt(p.offsetLeft); p = p.offsetParent; } if (this.getBoundingClientRect) { return { top: t, left: this.getBoundingClientRect().left }; } else { return { top: t, left: l }; } }, getDimensions: function() { var ow, oh; if (this == document) { ow = Math.max( Math.max( document.body.scrollWidth, document.documentElement.scrollWidth ), Math.max( document.body.offsetWidth, document.documentElement.offsetWidth ), Math.max( document.body.clientWidth, document.documentElement.clientWidth ) ); oh = Math.max( Math.max( document.body.scrollHeight, document.documentElement.scrollHeight ), Math.max( document.body.offsetHeight, document.documentElement.offsetHeight ), Math.max( document.body.clientHeight, document.documentElement.clientHeight ) ); } else { var d = this.getStyle("display"); if (d != "none" && d !== null) { ow = this.offsetWidth; oh = this.offsetHeight; } else { var s = this.style; var ov = s.visibility; var op = s.position; var od = s.display; s.visibility = "hidden"; s.position = "absolute"; s.display = "block"; ow = this.clientWidth; oh = this.clientHeight; s.display = od; s.position = op; s.visibility = ov; } } return { width: ow, height: oh }; }, getOffsetParent: function() { var e = this.offsetParent; if (!e) { e = this.parentNode; while (e != document.body && e.style.position == "static") { e = e.parentNode; } } return GElement(e); }, getCaretPosition: function() { if (document.selection) { var range = document.selection.createRange(), textLength = range.text.length; range.moveStart("character", -this.value.length); var caretAt = range.text.length; return { start: caretAt, end: caretAt + textLength }; } else if (this.selectionStart || this.selectionStart == "0") { return { start: this.selectionStart, end: this.selectionEnd }; } }, setCaretPosition: function(start, length) { if (this.setSelectionRange) { this.focus(); this.setSelectionRange(start, start + length); } else if (this.createTextRange) { var range = this.createTextRange(); range.collapse(true); range.moveEnd("character", start + length); range.moveStart("character", start); range.select(); } return this; }, getStyle: function(s) { s = s == "float" && this.currentStyle ? "styleFloat" : s; s = s == "borderColor" ? "borderBottomColor" : s; var v = this.currentStyle ? this.currentStyle[s] : null; v = !v && window.getComputedStyle ? document.defaultView.getComputedStyle(this, null).getPropertyValue(s.replace(/([A-Z])/g, "-$1").toLowerCase()) : v; if (s == "opacity") { return Object.isNull(v) ? 100 : floatval(v) * 100; } else { return v; } }, setStyle: function(p, v) { if (p == "opacity") { if (window.ActiveXObject) { this.style.filter = "alpha(opacity=" + v * 100 + ")"; } this.style.opacity = v; } else if (p == "float" || p == "styleFloat" || p == "cssFloat") { if (Object.isNull(this.style.styleFloat)) { this.style["cssFloat"] = v; } else { this.style["styleFloat"] = v; } } else if ( p == "backgroundColor" && this.tagName.toLowerCase() == "iframe" ) { if (document.all) { this.contentWindow.document.bgColor = v; } else { this.style.backgroundColor = v; } } else if (p == "borderColor") { this.style.borderLeftColor = v; this.style.borderTopColor = v; this.style.borderRightColor = v; this.style.borderBottomColor = v; } else { this.style[p] = v; } return this; }, center: function() { var size = this.getDimensions(); if (this.getStyle("position") == "fixed") { this.style.top = (document.viewport.getHeight() - size.height) / 2 + "px"; this.style.left = (document.viewport.getWidth() - size.width) / 2 + "px"; } else { this.style.top = document.viewport.getscrollTop() + (document.viewport.getHeight() - size.height) / 2 + "px"; this.style.left = document.viewport.getscrollLeft() + (document.viewport.getWidth() - size.width) / 2 + "px"; } return this; }, get: function(p) { try { return this.getAttribute(p); } catch (e) { return null; } }, set: function(p, v) { try { this.setAttribute(p, v); } catch (e) {} return this; }, hasClass: function(v) { var vs = v.split(" "); var cs = this.className.split(" "); for (var c = 0; c < cs.length; c++) { for (v = 0; v < vs.length; v++) { if (vs[v] != "" && vs[v] == cs[c]) { return vs[v]; } } } return false; }, addClass: function(v) { if (this.className || this.className === '') { if (!v) { this.className = ""; } else { var rm = v.split(" "), cs = []; forEach(this.className.split(" "), function(c) { if (c !== "" && rm.indexOf(c) == -1) { cs.push(c); } }); cs.push(v); this.className = cs.join(" "); } } return this; }, removeClass: function(v) { if (this.className || this.className === '') { var rm = v.split(" "); var cs = []; forEach(this.className.split(" "), function(c) { if (c !== "" && rm.indexOf(c) == -1) { cs.push(c); } }); this.className = cs.join(" "); } return this; }, replaceClass: function(source, replace) { if (this.className || this.className === '') { var rm = (replace + " " + source).split(" "); var cs = []; forEach(this.className.split(" "), function(c) { if (c !== "" && rm.indexOf(c) == -1) { cs.push(c); } }); cs.push(replace); this.className = cs.join(" "); } return this; }, hide: function() { this.display = this.getStyle("display"); this.setStyle("display", "none"); return this; }, show: function() { if (this.getStyle("display") == "none") { this.setStyle("display", "block"); } return this; }, visible: function() { return this.getStyle("display") != "none"; }, toggle: function() { if (this.visible()) { this.hide(); } else { this.show(); } return this; }, nextNode: function() { var n = this; do { n = n.nextSibling; } while (n && n.nodeType != 1); return n; }, previousNode: function() { var p = this; do { p = p.previousSibling; } while (p && p.nodeType != 1); return p; }, firstNode: function() { var p = this.firstChild; do { p = p.nextSibling; } while (p && p.nodeType != 1); return p; }, nextTab: function() { var tag, result, self = this, check = null; forEach(document.forms, function() { return forEach(this.getElementsByTagName("*"), function() { if (this == self.elem) { check = this; } else if (check != null) { if ( this.tabIndex >= 0 && this.disabled != true && this.style.display != "none" && this.offsetParent != null ) { result = this; return true; } } }); }); return result; }, sendKey: function(keyCode) { return this.callEvent("keypress", { keyCode: keyCode }); }, callEvent: function(t, params) { var evt; if (document.createEvent) { evt = document.createEvent("Events"); evt.initEvent(t, true, true); for (var prop in params) { evt[prop] = params[prop]; } this.dispatchEvent(evt); } else if (document.createEventObject) { evt = document.createEventObject(); for (var prop in params) { evt[prop] = params[prop]; } this.fireEvent("on" + t, evt); } return this; }, addEvent: function(t, f, c) { var ts = t.split(/[\s,]/), input = this; forEach(ts, function(e) { if (input.addEventListener) { c = !c ? false : c; input.addEventListener(e, f, c); } else if (input.attachEvent) { input["e" + e + f] = f; input[e + f] = function() { input["e" + e + f](window.event); }; input.attachEvent("on" + e, input[e + f]); } }); return this; }, removeEvent: function(t, f, c) { var ts = t.split(" "), input = this; forEach(ts, function(e) { if (input.removeEventListener) { c = !c ? false : c; input.removeEventListener(e == "mousewheel" && window.gecko ? "DOMMouseScroll" : e, f, c); } else if (input.detachEvent) { input.detachEvent("on" + e, input[e + f]); input["e" + e + f] = null; input[e + f] = null; } }); return this; }, highlight: function(o) { this.addClass("highlight"); var self = this; window.setTimeout(function() { self.removeClass("highlight"); }, 1); return this; }, fadeIn: function(oncomplete) { this.addClass("fadein"); var self = this; window.setTimeout(function() { self.removeClass("fadein"); if (Object.isFunction(oncomplete)) { oncomplete.call(this); } }, 1000); return this; }, fadeOut: function(oncomplete) { this.addClass("fadeout"); var self = this; window.setTimeout(function() { self.removeClass("fadeout"); if (Object.isFunction(oncomplete)) { oncomplete.call(this); } }, 1000); return this; }, setValue: function(v) { function _find(e, a) { var s = e.getElementsByTagName("option"); for (var i = 0; i < s.length; i++) { if (s[i].value == a) { return i; } } return -1; } v = decodeURIComponent(v); var t = this.tagName.toLowerCase(); if (t == "img") { this.src = v; } else if (t == "select") { this.selectedIndex = _find(this, v); } else if (t == "input") { if (this.type == "checkbox" || this.type == "radio") { this.checked = v == this.value; } else { this.value = v.unentityify(); } } else if (t == "textarea") { this.value = v.unentityify(); } else { this.setHTML(v); } return this; }, getText: function() { if (!Object.isNull(this.elem.selectedIndex)) { if (this.elem.selectedIndex == -1) { return null; } return this.elem.options[this.elem.selectedIndex].text; } else if (this.elem.innerHTML) { return this.elem.innerHTML; } return this.elem.value; }, setOptions: function(json, value) { if (this.tagName.toLowerCase() == "select") { for (var i = this.options.length; i > 0; i--) { this.removeChild(this.options[i - 1]); } var selectedIndex = 0; if (json) { var i = 0; for (var key in json) { if (key == value) { selectedIndex = i; } var option = document.createElement("option"); option.innerHTML = json[key]; option.value = key; this.appendChild(option); i++; } } this.selectedIndex = selectedIndex; } }, getSelectedText: function() { var text = ""; if (this.selectionStart) { if (this.selectionStart != this.selectionEnd) { text = this.value.substring(this.selectionStart, this.selectionEnd); } } else if (document.selection) { var range = document.selection.createRange(); if (range.parentElement() === this) { text = range.text; } } return text; }, setSelectedText: function(value) { if (this.selectionStart) { if (this.selectionStart != this.selectionEnd) { this.value = this.value.substring(0, this.selectionStart) + value + this.value.substring(this.selectionEnd); } } else { var range = document.selection.createRange(); if (range.parentElement() === this) { range.text = value; } } return this; }, findLabel: function() { var result = null, id = this.id; forEach(document.getElementsByTagName("label"), function() { if (this.htmlFor != "" && this.htmlFor == id) { result = this; return true; } }); return result; }, element: function() { return Object.isString(this.elem) ? document.getElementById(this.elem) : this.elem; }, elems: function(tagname) { return this.getElementsByTagName(tagname); }, create: function(tagname, o) { var v; if (tagname == "iframe" || tagname == "input") { var n = o.name || o.id || ""; var i = o.id || o.name || ""; if (window.ActiveXObject) { try { if (tagname == "iframe") { v = document.createElement( '