var userAgent = navigator.userAgent.toLowerCase(); var browser = { version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [0, '0'])[1], safari: /webkit/.test(userAgent), opera: /opera/.test(userAgent), msie: /msie/.test(userAgent) && !/opera/.test(userAgent), mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent) }; if(userAgent.match(/iphone|ipad|android/i)) { var IS_MOBILE = true; }else{ var IS_MOBILE = false; } var Common = { browserCheck: function () { var result = ''; switch (navigator.appName) { case 'Netscape': result = 'FF'; break; default: result = 'IE'; break } return result }, int: function (v) { return parseInt(v) }, str: function (v) { return String(v) }, addEvent: function (obj, evt, fn) { switch (__BR__) { case 'IE': obj.attachEvent(evt, fn); break; default: evt = evt.replace('on', ''); obj.addEventListener(evt, fn, true); break } }, delEvent: function (obj, evt, fn) { switch (__BR__) { case 'IE': obj.detachEvent(evt, fn); break; default: evt = evt.replace('on', ''); obj.removeEventListener(evt, fn, true); break } }, getObj: function (obj_name, mode) { var result = ''; switch (mode) { case 'name': result = document.getElementsByName(obj_name); break; case 'tagname': result = document.getElementsByTagName(obj_name); break; default: result = document.getElementById(obj_name); break } return result }, brWidthHeight: function () { var result = new Array(); var win_width = 0; var win_height = 0; var scroll_width = 0; var scroll_height = 0; switch (__BR__) { case 'IE': win_width = document.documentElement.clientWidth; win_height = document.documentElement.clientHeight; scroll_width = document.body.scrollLeft == 0 ? document.documentElement.scrollLeft : document.body.scrollLeft; scroll_height = document.body.scrollTop == 0 ? document.documentElement.scrollTop : document.body.scrollTop; break; case 'FF': default: win_width = Common.int(self.innerWidth); win_height = Common.int(self.innerHeight); scroll_width = Common.int(self.pageXOffset); scroll_height = Common.int(self.pageYOffset); break } result['win_width'] = win_width; result['win_height'] = win_height; result['scroll_width'] = scroll_width; result['scroll_height'] = scroll_height; return result }, rand: function (num) { var index = ''; var result = ''; var r = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; var count = r.length; for (var x = 0; x < num; x++) { index = this.Common.int(Math.random() * 62); if (r[index]) result += r[index] } return result }, dateCal: function (mode, obj_sname, obj_ename) { var edit_date; switch (mode) { case 'day': edit_date = 0; break; case 'week': edit_date = 7; break; case '1month': edit_date = 30; break; case '3month': edit_date = 90; break } var objDate = new Date(); var now = new Date(); objDate.setDate(now.getDate() - edit_date); var sMonth = now.getMonth() + 1; var eMonth = objDate.getMonth() + 1; var sMonth = new String(sMonth); var eMonth = new String(eMonth); var sDay = now.getDate(); var eDay = objDate.getDate(); var sDay = new String(sDay); var eDay = new String(eDay); sMonth = (sMonth.length == 1) ? '0' + sMonth : sMonth; eMonth = (eMonth.length == 1) ? '0' + eMonth : eMonth; sDay = (sDay.length == 1) ? '0' + sDay : sDay; eDay = (eDay.length == 1) ? '0' + eDay : eDay; Common.getObj(obj_ename).value = now.getFullYear() + '-' + sMonth + '-' + sDay; Common.getObj(obj_sname).value = objDate.getFullYear() + '-' + eMonth + '-' + eDay }, number_format: function (number, decimals, dec_point, thousands_sep) { var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals; var d = dec_point == undefined ? "," : dec_point; var t = thousands_sep == undefined ? "," : thousands_sep, s = n < 0 ? "-" : ""; var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "") }, trim: function (str, charlist) { var whitespace, l = 0, i = 0; str += ''; if (!charlist) { whitespace = " \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000" } else { charlist += ''; whitespace = charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\$1') } l = str.length; for (i = 0; i < l; i++) { if (whitespace.indexOf(str.charAt(i)) === -1) { str = str.substring(i); break } } l = str.length; for (i = l - 1; i >= 0; i--) { if (whitespace.indexOf(str.charAt(i)) === -1) { str = str.substring(0, i + 1); break } } return whitespace.indexOf(str.charAt(0)) === -1 ? str : '' }, thisFileName: function () { var len = location.href.indexOf('?'); return location.href.substring(0, len) }, getParam: function (key) { var result = null; var len = location.href.indexOf(key); if (len > 0) { var params = location.href.substring(len, location.href.length); var ex_params1 = params.split('='); if (ex_params1[1].indexOf('&') == 0) { result = '' } else if (ex_params1[1].indexOf('&') > 0) { var ex_params2 = ex_params1[1].split('&'); result = ex_params2[0] } else { result = ex_params1[1] } return result } }, setCookie: function (cookieName, cookieVal, time) { var date = new Date(); var lifeTime = 0; if (time) { lifeTime = date.setDate((date.getTime() + 1000 * 60 * 60 * 24 * 365) + time); document.cookie = cookieName + '=' + escape(cookieVal) + '; expires=' + lifeTime } else { document.cookie = cookieName + '=' + escape(cookieVal) } }, getCookie: function (cookieName) { var result = null; var allCookies = document.cookie.split('; '); var cookieArray = null; for (i = 0; i < allCookies.length; i++) { cookieArray = allCookies[i].split('='); if (cookieName == cookieArray[0]) { result = cookieArray[1]; break } } return result }, delCookie: function (cookieName) { var date = new Date(); lifeTime = date.setDate((date.getTime() + 1000 * 60 * 60 * 24 * 365) - 3600); document.cookie = cookieName + '=; expires=' + lifeTime }, windowClose: function () { if (/MSIE/.test(navigator.userAgent)) { if (navigator.appVersion.indexOf("MSIE 7.0") >= 0) { window.open("about:blank", "_self").close() } else { window.opener = self; self.close() } } } }; var __BR__ = Common.browserCheck(); if (typeof (Ajax) != 'Object') { var Ajax = { init: function (file, param, type, function_name, loding_chk, async) { this.file = file; this.param = param; this.type = type; this.async = (async == false) ? false : true; this.function_name = (function_name) ? function_name : ''; this.loding_chk = (!loding_chk) ? false : true; return this.ajaxLoding() }, ajaxLoding: function () { if (this.loding_chk == true) { if (typeof Common.getObj('ajax_loding') == 'object') { this.obj_width = 100; this.obj_height = 100; this.wh = Common.brWidthHeight(); this.sc_width = Common.int((this.wh['win_width'] / 2) - (this.obj_width / 2)) + this.wh['scroll_width']; this.sc_height = Common.int((this.wh['win_height'] / 2) - (this.obj_height / 2)) + this.wh['scroll_height']; this.div_html = ''; Common.getObj('ajax_loding').style.zIndex = 1000; Common.getObj('ajax_loding').style.position = 'absolute'; Common.getObj('ajax_loding').style.top = this.sc_height + 'px'; Common.getObj('ajax_loding').style.left = this.sc_width + 'px'; Common.getObj('ajax_loding').innerHTML = this.div_html } } this.ajaxCreate(); return this.ajaxSend() }, ajaxCreate: function () { switch (__BR__) { case 'IE': this.req = new ActiveXObject("Microsoft.XMLHTTP"); break; default: this.req = new XMLHttpRequest(); break } }, ajaxSend: function () { if (this.loding_chk == true) { if (typeof Common.getObj('ajax_loding') == 'object') { if (Common.getObj('ajax_loding').style.display == 'none') { Common.getObj('ajax_loding').style.display = '' } } } switch (__BR__) { case 'IE': if (this.file.indexOf('?') > 0) { this.file += (this.type == 'POST') ? '&charset=utf-8' : '&charset=euc-kr' } else { this.file += (this.type == 'POST') ? '?charset=utf-8' : '?charset=euc-kr' } break; default: this.file += (this.file.indexOf('?') > 0) ? '&charset=utf-8' : '?charset=utf-8'; break } this.req.onreadystatechange = function () { if (Ajax.req.readyState == 4) { if (Ajax.req.status == 200) { if (Ajax.loding_chk == true) { if (typeof Common.getObj('ajax_loding') == 'object') { if (Common.getObj('ajax_loding').style.display == '') { Common.getObj('ajax_loding').style.display = 'none' } } } if (Ajax.function_name) { return Ajax.function_name(Ajax.req) } } } } this.req.open(this.type, this.file, this.async); if (this.type == 'POST') this.req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;'); this.req.send(this.param); }, rltXml: function (req) { if (typeof (this.req) != 'undefined') { req = this.req } return req.responseXML }, rltText: function (req) { if (typeof (this.req) != 'undefined') { req = this.req } return req.responseText }, rltXmlLoop: function (obj, tag) { var xmlObj = obj.getElementsByTagName(tag); return xmlObj }, rltXmlOnce: function (obj, tag) { var result; var obj = obj.getElementsByTagName(tag); if (obj[0]) { result = obj[0].firstChild.nodeValue } else { return false } return result }, encode: function (data) { return encodeURIComponent(data) }, decode: function (data) { return decodeURIComponent(data) }, value: function (obj_name, num) { var result = ''; if (num) { result = Common.getObj(obj_name, 'name')[num - 1].name + '=' + Common.getObj(obj_name, 'name')[num - 1].value + '&' } else { result = Common.getObj(obj_name).id + '=' + Common.getObj(obj_name).value + '&' } return result }, post: function (form_name) { if (!form_name) { alert('汽捞抚捞 绝嚼聪促.'); return false } var result = ''; var item = ''; var item_name = ''; var obj_form = document.forms[form_name]; var count = obj_form.length; for (var x = 0; x < count; x++) { item = obj_form.elements[x]; item_name = (item.name) ? item.name : item.id; if (item_name) { result += item_name + '=' + item.getAttribute('value') + '&' } } return result }, xmlDoc: function (value) { var xmlDoc = null; switch (__BR__) { case 'IE': xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0"); xmlDoc.loadXML(value); break; default: xmlDoc = new DOMParser().parseFromString(value, 'application/xml'); break } return xmlDoc }, debug: function (req) { if (typeof (this.req) != 'undefined') { req = this.req } var debug = document.createElement('DIV'); debug.innerHTML = this.rltText(); document.body.appendChild(debug) } } }; function stripHTMLtag(string) { return string.replace(/[<][^>]*[>]|( )/gi, ''); } function trim(str) { return str.replace(/(^\s*)|(\s*$)/gi, ''); } var FormCheck = { init: function (formName) { this.objForm = document.forms[formName]; this.formName = formName; this.count = this.objForm.length; this.chk = ''; this.msg = ''; this.kind = ''; this.from = ''; this.item = ''; this.len = ''; this.ex_len = ''; this.len_chk = ''; this.len_text = ''; this.min = ''; this.max = ''; this.result = ''; this.first = ''; this.checkcount = ''; this.chk_cnt = ''; this.on_focus_color = ''; this.off_focus_color = ''; this.ret_chk = false; return this.check() }, setCheck: function (formName, itemName, chk, msg, kind, len, from, checkcount) { this.setFrom = document.forms[formName]; this.setCount = this.setFrom.length; for (var i = 0; i < this.setCount; i++) { this.itemName = this.setFrom.elements[i]; if (this.itemName.name == itemName) { if (chk != "") this.itemName.setAttribute("chk", chk); if (msg != "") this.itemName.setAttribute("msg", msg); if (kind != "") { this.itemName.setAttribute("kind", kind) } else { this.itemName.setAttribute("kind", '') } if (len != "") this.itemName.setAttribute("len", len); if (from != "") this.itemName.setAttribute("from", from); if (checkcount != "") this.itemName.setAttribute("checkcount", checkcount) } } }, check: function () { for (var x = 0; x < this.count; x++) { this.item = this.objForm.elements[x]; if (this.item.name) { if (this.item.getAttribute('chk')) { this.chk = this.item.getAttribute('chk'); this.msg = this.item.getAttribute('msg'); this.kind = this.item.getAttribute('kind'); this.from = this.item.getAttribute('from'); this.len = (this.item.getAttribute('len')) ? this.item.getAttribute('len') : ''; this.checkcount = this.item.getAttribute('checkcount'); if (this.chk == 'y' || this.chk == 'Y') { this.first = "this.item.value == '' || (" } else { this.first = "this.item.value && (" } if (this.len) { if (this.len.indexOf('-') > 0) { this.ex_len = this.len.split('-'); this.min = this.ex_len[0]; this.max = this.ex_len[1]; if (this.min == this.max) { this.len_chk = " || this.item.value.length != " + this.min } else { this.len_chk = " || this.item.value.length < " + this.min + " || this.item.value.length > " + this.max } if (typeof (this.min) != 'undefined' || typeof (this.max) != 'undefined') { this.len_text = " [" + this.min + " ~ " + this.max + " 臂磊]" } } } if (this.checkcount) { this.chk_cnt = "if(chk < " + this.checkcount + ") {"; this.chk_cnt += "alert('" + this.msg + "阑(甫) " + this.checkcount + "俺 捞惑 急琶秦林技夸.');"; this.chk_cnt += "this.ret_chk = true;"; this.chk_cnt += "}" } else { this.chk_cnt = "if(chk < 1) {"; this.chk_cnt += "alert('" + this.msg + "阑(甫) 急琶秦林技夸.');"; this.chk_cnt += "this.ret_chk = true;"; this.chk_cnt += "}" } switch (this.kind) { default: if (this.item.name == 'description') { if (__BR__ == 'IE') { this.result += "if(Common.getObj('description','name')[0].value == '
') {"; this.result += "alert('郴侩阑 涝仿秦林技夸.');"; this.result += "this.ret_chk = true;"; this.result += "}" } else if (__BR__ == 'FF') { if (Common.getObj('descriptionView_TEXTAREA') == '[object HTMLTextAreaElement]') { this.result += "if(trim(stripHTMLtag(Common.getObj('descriptionView_TEXTAREA').value)).length<1) {"; this.result += "alert('郴侩阑 涝仿秦林技夸.');"; this.result += "document.getElementById('descriptionView_IFRAME').contentWindow.document.body.focus();"; this.result += "this.ret_chk = true;"; this.result += "}" } } } else { this.result = "if(" + this.first + "Common.trim(this.item.value) == ''" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + "阑(甫) 沥犬洒 涝仿窍技夸." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}" } break; case 'float': this.result = "var num_pattern = /(^[0-9]+)\.([0-9]+$)/gi;"; this.result += "if(" + this.first + "!num_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + "阑(甫) 箭磊客 家箭痢栏肺父 沥犬洒 涝仿窍技夸." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'num': this.result = "var num_pattern = /(^[0-9]+$)/gi;"; this.result += "if(" + this.first + "!num_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + "阑(甫) 箭磊肺父 沥犬洒 涝仿窍技夸." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'eng': this.result = "var eng_pattern = /(^[a-zA-Z]+$)/gi;"; this.result += "if(" + this.first + "!eng_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + "阑(甫) 康绢肺父 沥犬洒 涝仿窍技夸." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'kor': this.result = "var kor_pattern = /(^[啊-窍]+$)/gi;"; this.result += "if(" + this.first + "!kor_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + "阑(甫) 茄臂肺父 沥犬洒 涝仿窍技夸." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'eng+kor+num': this.result = "var eng_kor_num_pattern = /(^[a-zA-Z0-9啊-窍]+$)/gi;"; this.result += "if(" + first + "!eng_kor_num_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + "阑(甫) 康绢,茄臂,箭磊肺父 沥犬洒 涝仿窍技夸." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'num+eng': case 'eng+num': this.result = "var eng_num_pattern = /(^[a-zA-Z0-9]+$)/gi;"; this.result += "if(" + this.first + "!eng_num_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + "阑(甫) 箭磊 棺 康绢肺父 沥犬洒 涝仿窍技夸." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'num+eng2': this.result = "var eng_num_pattern = /(^[a-z0-9]+$)/gi;"; this.result += "if(" + this.first + "!eng_num_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + "阑(甫) 箭磊 棺 康绢肺父 沥犬洒 涝仿窍技夸." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'email': this.result = "var email_pattern = /([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/;"; this.result += "if(" + this.first + "!email_pattern.test(this.item.value)" + this.len_chk + ")) {"; this.result += "alert('" + this.msg + "阑(甫) 沥犬洒 涝仿窍技夸." + this.len_text + "');"; this.result += "this.ret_chk = true;"; this.result += "}"; break; case 'checkbox': this.result = "var obj = Common.getObj('" + this.item.name + "', 'name');"; this.result += "var count = obj.length;"; this.result += "var chk = 0;"; this.result += "for(var c=0; c