var win = window, doc = document, loc = location;var agent = navigator.userAgent.toLowerCase();var isIE7 = agent.indexOf("msie 7.0") > -1;var isIE8 = agent.indexOf("msie 8.0") > -1;var isIE9 = agent.indexOf("msie 9.0") > -1;var isIE10 = agent.indexOf("msie 10.0") > -1;var isIE11 = agent.indexOf("trident/7.0") > -1;var isTWeb = doc.addEventListener && agent.indexOf("msie 7.0") > -1;/* * [Begin] FireFox key events bug fix. */if(typeof(keyFix) == "undefined") {_keyFix = keyFix = {};}if(typeof(_keyFix.fix) == "undefined") {_keyFix.fix = {};}if(typeof(win.keyFix.instances) == "undefined") {win.keyFix.instances = new Array();}_keyFix.fix = function(targetId) {if(navigator.userAgent.toLowerCase().indexOf("firefox") < 0) {return false;} var thisClass = this; this.keyEventCheck = null; this.db = null; this.targetId = targetId; win.keyFix.instances[this.targetId] = this; var focusFunc = function() { if(!thisClass.keyEventCheck) thisClass.watchInput(); }; var blurFunc = function() { if(thisClass.keyEventCheck) { win.clearInterval(thisClass.keyEventCheck); thisClass.keyEventCheck = null; } }; doc.getElementById(this.targetId).bind("focus", focusFunc); doc.getElementById(this.targetId).bind("blur", blurFunc);};_keyFix.fix.prototype.watchInput = function() { if(this.db != doc.getElementById(this.targetId).value) { doc.getElementById(this.targetId).trigger("keyup"); } this.db = doc.getElementById(this.targetId).value; if(this.keyEventCheck) { win.clearInterval(this.keyEventCheck); } this.keyEventCheck = win.setInterval("win.keyFix.instances['" + this.targetId + "'].watchInput()", 100);};/* * [End] */function _blind(_isShow, _function) {var blind = $("#blind");var loadingImg, ht, tp, mt;if(_isShow) {if(blind[0]) {blind.remove();}ht = _scrollHeight();blind = $(doc.createElement("div"));blind.attr({"id": "blind"});blind.css({"height": ht + "px"});$("body").append(blind);tp = ($(win).height() * 0.5);mt = 40 - $(win).scrollTop();loadingImg = $(doc.createElement("img"));loadingImg.attr({"src": "/common/images/system/loading.gif","alt": "Loding Image"});loadingImg.css({"top": tp + "px","margin-top": -mt + "px"});blind.append(loadingImg);blind.stop().animate({"opacity": "0.5","filter": "alpha(opacity=50)"}, animationSpeed, _function);}else {if(blind[0]) {blind.stop().animate({"opacity": "0","filter": "alpha(opacity=0)"}, animationSpeed, function() {blind.remove();});}}}function _removeBlindImg() {var loadingImg = $("#blind > img");if(loadingImg[0]) {loadingImg.remove();}}function _createBox(_msg, _id, _class) {var div = $("#" + _id);var p, span;_removeBlindImg();if(div[0]) {div.remove();}div = $(doc.createElement("div"));div.attr({"id": _id,"class": _class});p = $(doc.createElement("p"));p.attr({"class": "title"});span = $(doc.createElement("span"));span.html(_class == "err" ? "Error" : "Message");p.append(span);div.append(p);p = $(doc.createElement("p"));p.html(_msg);div.append(p);return div;}function _getBoxWidth(_splits) {var fs = body.css("font-size").replace("px", "");var cnt = 0;var wd, pl;for(var idx in _splits) {cnt = _splits[idx].length > cnt ? _splits[idx].length : cnt;}wd = fs * cnt;wd = wd > boxMinWD ? boxMinWD : wd;wd = wd >= $(win).width() ? $(win).width() * 0.9 : wd;return wd;}function _layoutForBox(_div, _msg) {var delimiter = _msg.indexOf("
") > -1 ? "
" : "
";var splits = _msg.split(delimiter);var wd, ht;wd = _getBoxWidth(splits);ht = _div.outerHeight();if(_msg.indexOf("
") > -1) {wd = 280;}_div.css({"width": wd + "px","margin-top": -((ht * 0.5) - msgBoxMarginTop) + "px","margin-left": -(wd * 0.5) + "px"});}function _alert(_obj, _msg, _class, _function) {var div = _createBox(_msg, "alert", _class);var p, a, i, mt;p = div.children("p").not(".icon");a = $(doc.createElement("a"));a.attr({"href": "javascript:void(0);"});a.click(function() {var alertDiv, mt;alertDiv = $("#alert");mt = Math.abs(alertDiv.css("margin-top").replace("px", ""));if(alertDiv[0]) {alertDiv.stop().animate({"margin-top": -(mt + msgBoxMarginTop) + "px","opacity": "0","filter": "alpha(opacity=0)"}, animationSpeed, function() {alertDiv.remove();if(_obj != null && _obj) {_obj.value = "";_obj.focus();}_blind(false);if(typeof(_function) == "function") {_function();}});}});i = $(doc.createElement("i"));i.attr({"class": "fa fa-check"});a.append(i);div.append(p);div.append(a);body.append(div);_layoutForBox(div, _msg);mt = Math.abs(div.css("margin-top").replace("px", ""));div.stop().animate({"margin-top": -(mt + msgBoxMarginTop) + "px","opacity": "1.0","filter": "alpha(opacity=100)"}, animationSpeed, function() {a.focus();});}function _confirm(_msg, _class, _agreeFunction, _disFunction) {var div = _createBox(_msg, "confirm", _class);var p, a, focus, mt;function _createAnchor(_function, _class, _iClass) {var a, i;a = $(doc.createElement("a"));a.attr({"href": "javascript:void(0);","class": _class});a.click(function() {var confirmDiv, mt;confirmDiv = $("#confirm");mt = Math.abs(confirmDiv.css("margin-top").replace("px", ""));if(confirmDiv[0]) {confirmDiv.stop().animate({"margin-top": -(mt + msgBoxMarginTop) + "px","opacity": "0","filter": "alpha(opacity=0)"}, animationSpeed, function() {confirmDiv.remove();_blind(false);if(typeof(_function) == "function") {_function();}});}});i = $(doc.createElement("i"));i.attr({"class": _iClass});a.append(i);return a;}p = div.children("p");a = _createAnchor(_agreeFunction, "", "fa fa-check");div.append(a);focus = a;a = _createAnchor(_disFunction, "last", "fa fa-times");div.append(a);body.append(div);_layoutForBox(div, _msg);mt = Math.abs(div.css("margin-top").replace("px", ""));div.stop().animate({"margin-top": -(mt + msgBoxMarginTop) + "px","opacity": "1.0","filter": "alpha(opacity=100)"}, animationSpeed, function() {focus.focus();});}