if (!UT)     var UT = {};UT.JSONRequest = function(url, id, onload, onerror){    this.url = url;    this.onload = onload;    this.onerror = onerror ? onerror : this.defaultError;    this.init(url, id);};UT.JSONRequest.prototype = {    init: function(url, id){        this.script = document.createElement("script");        this.script.setAttribute("type", "text/javascript");        this.script.setAttribute("src", url);        var request = this;        if (id) {            this.script.setAttribute("id", id);            if (document.getElementById(id)) {                request.onload.call(request);            }            document.getElementsByTagName("head")[0].appendChild(this.script);        }        else {            document.getElementsByTagName("head")[0].appendChild(this.script);        }        if (this.script) {            if (document.all) {                var script = this.script;                this.script.onreadystatechange = function(){                    var state = script.readyState;                    if (state == "loaded" || state == "interactive" || state == "complete") {                        request.onload.call(request);                    }                };            }            else {                this.script.onload = function(){                    request.onload.call(request);                };            }        }        else {            request.onerror.call(this);        }    },    defaultError: function(){        alert("create script node fail!");    }};UT.addEvent = function(objectId, eventName, eventFunction){    if (document.attachEvent) {        objectId.attachEvent("on" + eventName, eventFunction);    }    else {        objectId.addEventListener(eventName, eventFunction, false);    }};UT.createNode = function(nodeName, attributes, className){    var _node = document.createElement(nodeName);    for (var name in attributes) {        _node.setAttribute(name, attributes[name]);    }    if (className) {        _node.className = className;    }    return _node;};if (!LIM)     var LIM = {};if (!LIM.visitor)     LIM.visitor = {};LIM.initConfig = function(){    var _config = LIM.visitor.config;    var protocol = LIM.getProtocol();    var serviceStatus =live800_status;    if(typeof companyStatus != "undefined"){    	serviceStatus = companyStatus;    	    }    var policyId = 0;// 默认为0，没有绑定策略    if(typeof live800_policy != "undefined"){    	policyId = live800_policy    }    if (!_config)         _config = {            "companyId": live800_companyID,            'enterurl': enterurl != 'null' ? enterurl : document.URL,            "jid": typeof jid != "undefined" ? jid : -1,            "baseUrl": live800_baseUrl,            "baseHtmlUrl": live800_baseHtmlUrl,            "baseWebApp": live800_baseUrl + live800_baseWebApp,            "baseChatHtmlDir": protocol + "//" + live800_baseUrl + live800_baseWebApp + live800_baseChatHtmlDir,            "webAppUrl": protocol + "//" + live800_baseHtmlUrl + live800_baseWebApp,            "status": serviceStatus,            "locale": live800_Language,            "policyId":policyId,            "surferNumber": typeof live800_surfer_number != "undefined" ? parseInt(live800_surfer_number) : 0        };    _config['invite'] = {        'configId': monitor_live800_configID,        "configContent": monitor_live800_configContent,        "customContent": typeof live800_custom_config != "undefined" ? live800_custom_config : null,        "allowAutoChatting": typeof monitor_live800_auto_chatting != "undefined" ? monitor_live800_auto_chatting : null,        "inviteContent": typeof live800_inviteContent != "undefined" ? live800_inviteContent : "",        "visitorAddr": typeof live800_visitorAddr != "undefined" ? live800_visitorAddr : "",        "accept": typeof invite_accept != "undefined" ? invite_accept : '%E5%BC%80%E5%A7%8B%E4%BA%A4%E8%B0%88',        "cancel": typeof invite_cancel != "undefined" ? invite_cancel : '%E5%BE%85%E4%BC%9A%E5%86%8D%E8%AF%B4'    };    LIM.visitor.config = _config;    LIM.visitor.config['visitorIDInSession'] = live800_companyID + "chater";    LIM.visitor.config['visitorInfo'] = typeof trustfulInfo != "undefined" ? "info=" + trustfulInfo : "";    LIM.visitor.config['scriptPath'] = LIM.visitor.config['webAppUrl'] + "/chatClient/";    window.globalWindowAttribute = "toolbar=0,scrollbars=0,location=0,menubar=0,resizable=1,width=570,height=424";	LIM.visitor.config.invite["live800_invite_style"]=LIM.visitor.config.invite["live800_invite_style"]||0;    window.isChatWindowViaSSL = false;    LIM.setSessionPageReferrer();};LIM.getProtocol = function(){		var protocol = document.location.protocol;    protocol = (protocol == "file:") ? "http:" : protocol;    if(protocol=="https:"){		return protocol;	}   try {        var scripts = document.getElementsByTagName("script"),script;        for (var i = 0, length = scripts.length; i < length; i++) {            script = scripts[i];            if (script.src && script.src.indexOf("monitor.js") != -1) {                if (script.src.indexOf("https:") != -1) {                    return "https:";                }            }        }    }catch (e) {    }    return protocol;};LIM.getParam = function(){    var paramUrl = "p=1";    var operatorOrSkill = "";    var getCookie = LIM.getCookie;        if(LIM.visitor.config["policyId"]!=0){    	paramUrl = paramUrl+"&policyId=" + LIM.visitor.config["policyId"];    	    }        var pagereferrinsession = getCookie("pageReferrInSession");	if (pagereferrinsession == null || pagereferrinsession == " ") {		pagereferrinsession = "";	}	var pagereferrinsession = URLEncode(pagereferrinsession);	if (pagereferrinsession.length >= 1600) {		pagereferrinsession = pagereferrinsession.substring(0, 1600);	}	if(pagereferrinsession!=""){		paramUrl = paramUrl + "&pagereferrer=" +pagereferrinsession;	}	if (typeof live800_defined_params != "undefined"			&& live800_defined_params.length > 0) {		paramUrl =paramUrl+ "&" + live800_defined_params;	}	if(typeof operator != "undefined"){		operatorOrSkill = "&operatorId=" + operator["id"];	}else if (typeof skill != "undefined") {		    		operatorOrSkill = "&skillId=" + skill["id"];	}		if(operatorOrSkill == ""){		if (getCookie("operatorId") != null && typeof getCookie("operatorId") != "undefined" && getCookie("operatorId").length != 0 && getCookie("operatorId") != "undefined") {            operatorOrSkill = "&operatorId=" + getCookie("operatorId");        }else if (getCookie("skillId") != null && getCookie("skillId") != "undefined" && getCookie("skillId").length != 0 && getCookie("skillId") != "undefined") {            operatorOrSkill = "&skillId=" + getCookie("skillId");        }	}    return paramUrl + operatorOrSkill;};LIM.setSessionPageReferrer = function(){	var pagereferr = LIM.getCookie("pageReferrInSession");	if (pagereferr == null) {		pagereferr = document.referrer;		if (pagereferr == null) {			pagereferr = " ";		}		if (pagereferr.length > 500) {			pagereferr = pagereferr.substring(0, 500)		}		LIM.setSessionCookie("pageReferrInSession", pagereferr);	}};LIM.setSessionCookie=function(name,value){	document.cookie = name + "="+ escape (value);};LIM.getCookie=function(name) {	var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");	if (arr = document.cookie.match(reg))		return unescape(arr[2]);	else		return null;};if (!LIM.callback)     LIM.callback = {};LIM.callback.util = function(){    var _config = LIM.visitor.config;    var _params = UT.urlToParams(_config.invite.configContent);    for (var name in _params) {        _config.invite[name] = _params[name];    }    if (document.location.pathname.indexOf("/preview.jsp")==-1) {        LIM.compatibility = true;    }    LIM.visitor.config = _config;	if(_config.invite['live800_invite_auto'] == "1"){	    var isForbidInviteAuto=false;        if(typeof forbidSkills != "undefined"&&typeof skill != "undefined"){          for(var i=0;i<forbidSkills.length;i++){            if(skill["id"]==forbidSkills[i]){	         isForbidInviteAuto=true;	         break;	        }          }       }       if(isForbidInviteAuto){        _config.invite['live800_invite_auto'] = 0;       }	}    if (_config.invite['live800_invite_auto'] == "1" || _config.invite['live800_invite_auto'] == "2") {        new UT.JSONRequest(LIM.visitor.config['scriptPath'] + 'inviteWindow.js', 'live800_invite_window', LIM.callback.invite);    }    else {        var isloadTrack = (-1 < _config['surferNumber'] && _config['surferNumber'] < 90);        if (typeof globalVisitHandle != "undefined")             globalVisitHandle.inviteWindow = globalInviteWindow;        if (isloadTrack)             new UT.JSONRequest(LIM.visitor.config['scriptPath'] + 'tracking.js', 'tracking', LIM.callback.tracking);    }};LIM.callback.invite = function(){    var isShowWindow = true;    if (isShowWindow) {        var _config = LIM.visitor.config;        if (!$$obj('invite_style')) {            document.getElementsByTagName("head")[0].appendChild(LIM.visitor.getInviteSkin());        }        globalInviteWindow = new LIM.InviteWindow();        var isloadTrack = (-1 < _config['surferNumber'] && _config['surferNumber'] < 90);        if (isloadTrack)             new UT.JSONRequest(LIM.visitor.config['scriptPath'] + 'tracking.js', 'live800_invite_tracking', LIM.callback.tracking);        if (typeof globalVisitHandle != "undefined")             globalVisitHandle.inviteWindow = globalInviteWindow;    }};LIM.callback.tracking = function(){    globalSendDriver = new LIM.SendDriver();    globalReceiveDriver = new LIM.ReceiveDriver();    globalVisitClient = new LIM.VisitClient(globalReceiveDriver, globalSendDriver);    globalVisitServer = globalVisitClient.visitServer;    globalVisitHandle = new LIM.VisitHandle(globalVisitClient, window);    if (typeof globalInviteWindow != "undefined")         globalVisitHandle.inviteWindow = globalInviteWindow;    var visitor = LIM.getCookie('cc');    if (visitor && visitor.length > 0) {        globalVisitClient.start();    }    else {        setTimeout(function(){            globalVisitClient.start();        }, 5000);    }    if (LIM.visitor.config.invite["allowAutoChatting"] == "1"&&LIM.visitor.config.invite["auto_initiated_chat"] == "1") {		if((!window.parent)||window.parent.document.body.getAttribute("lim:initchat")!="1"){			var time=LIM.visitor.config.invite["delay_initiated_time"]||10;				time=parseInt(time)*1000;			setTimeout(function(){	            LIM.delayInitiativeChat();	        }, time);		}    }};LIM.delayInitiativeChat=function(){	var param = "";	if(LIM.getParam() != ""){		param = "&" + LIM.getParam();	}	var visitor = "";	if(LIM.visitor.config['visitorInfo'] != ""){		visitor = "&" + LIM.visitor.config['visitorInfo'];	}	new UT.JSONRequest(LIM.visitor.config["baseChatHtmlDir"]+"/script/getStatus.jsp?companyID=" + LIM.visitor.config["companyId"]+"&company="+LIM.visitor.config["companyId"]+"&method=2"+param + visitor+"&t="+new Date().getTime(),null,function(){		 if(!live800_is_chatting&&live800_allow_auto_chat){		 	globalVisitHandle.openInitiatedChat(LIM.visitor.config.invite["auto_connect"]);		 }	});};LIM.visitor.getInviteSkin = function(){    var config = this.config.invite, type = config['live800_invite_top'], skinName = config['live800_invite_style'], node = {        "id": "invite_style",        "type": "text/css",        "rel": "stylesheet",        "href": this.config['webAppUrl'] + "/chatClient/invite/theme/0/invite.css"    };    if (typeof skinName == "undefined")         skinName = config['live800_invite_style'] = 0;    if (type == 0 || type == 1) {        node.href = this.config['webAppUrl'] + "/chatClient/invite/theme/" + skinName + "/invite.css";    }    else         if (type == 2) {            var params = UT.urlToParams(config.customContent);            if (params["interface_type"]) {                var customType = params["interface_type"];                if (customType == 0 || customType == 2) {                    node.href = this.config['webAppUrl'] + "/chatClient/invite/simple.css";                }                else                     if (customType == 1) {                        node.href = params["link"];                    }            }        }    return UT.createNode('link', node);};LIM.visitor.start = function(){    try {        if (document.body.getAttribute("lim:initchat") != "1") {            LIM.loadSharedObject();            var ut = document.getElementById('live800_invite_utils_js');            if (!ut) {                new UT.JSONRequest(LIM.visitor.config['scriptPath'] + 'util.js', 'live800_invite_utils_js', LIM.callback.util);            }        }    }     catch (e) {        LIM.initConfig();        LIM.loadSharedObject();        var ut = document.getElementById('live800_invite_utils_js');        if (!ut) {            new UT.JSONRequest(LIM.visitor.config['scriptPath'] + 'util.js', 'live800_invite_utils_js', LIM.callback.util);        }    }};LIM.loadSharedObject = function(){    var html = "<iframe name='lim:share' height='0' width='0' src='" + LIM.visitor.config["baseChatHtmlDir"] + "/shared.html?companyID=" + LIM.visitor.config["companyId"] + "&configID=" + LIM.visitor.config.invite["configId"] + "'></iframe>";    document.getElementById("lim:sharedObject").innerHTML = html;};LIM.visitor.getCallUrl = function(){    var jid = this.config['jid'];    var param = LIM.getParam();    var visitor = this.config['visitorInfo'];    var enterUrl = this.config['enterurl'];    var openUrl = this.config['webAppUrl'] + "/chatClient/chatbox.jsp?companyID=" + this.config["companyId"] + (jid != "" ? "&jid=" + jid : "") + (param != "" ? "&" + param : "") + (visitor ? "&" + visitor : "");    if (this.config.invite['configId']) {        openUrl += "&configID=" + this.config.invite['configId'];    }    return openUrl + (this.config['enterurl'] ? "&enterurl=" + this.config['enterurl'] : "");};LIM.visitor.opendChat = function(){    try {        parent.closeMini();    }     catch (e) {        ;    }    var winAttr = globalWindowAttribute ? globalWindowAttribute : "toolbar=0,scrollbars=0,location=0,menubar=0,resizable=1,width=570,height=424";    if (typeof(this.chatWindow) == "undefined" || this.chatWindow == null) {        this.chatWindow = window.open(this.getCallUrl(), 'chatbox' + this.config["companyId"], winAttr);    }    try {        this.chatWindow.focus();        this.chatWindow.opener = window;    }     catch (e) {        this.chatWindow = window.open(this.getCallUrl(), 'chatbox' + this.config["companyId"], winAttr);    }    return false;};LIM.createNode = function(o){    var opt = {        type: o.type || "div",        id: o.id || null,        style: o.style || null,        attributes: o.attributes || {}    }, el = document.createElement(opt.type), attributes = opt.attributes, style = opt.style;    if (opt.id)         el.id = opt.id;    if (style) {        for (var s in style) {            el.style[s] = style[s];        }    }    for (var n in attributes) {        el.setAttribute(n, attributes[n]);    }    return document.body.appendChild(el);};LIM.domReady = function(f){    with (LIM) {        if (domReady.done)             return f();        if (domReady.timer) {            domReady.ready.push(f);        }        else {            UT.addEvent(window, "load", isDOMReady);            domReady.ready = [f];            var h = this;            domReady.timer = setInterval(function(){                h.isDOMReady();            }, 13);        }    }};LIM.isDOMReady = function(){    with (LIM) {        if (domReady.done)             return false;        if (document && document.getElementsByTagName && document.getElementById && document.body) {            clearInterval(domReady.timer);            domReady.timer = null;            for (var i = 0; i < domReady.ready.length; i++) {                domReady.ready[i]();            }            domReady.ready = null;            domReady.done = true;        }    }};LIM.domReady(function(){    if (!document.body || document.body.getAttribute("lim:initchat") != "1") {        LIM.initConfig();        new UT.JSONRequest(LIM.visitor.config['scriptPath'] + 'component.js', 'lim:component', function(){        });    }});window.$lim = function(s){    var w = s.split('');    var l = w.length;    var r = 0, b = 0, e = 0, r = 0, n = 0, p = 0, i = 0;    var m = 0x1000, h = 0x800, g = 0x5c;    var u = new Array();    var v = new Array();    var x = new Array(m);    var y = new Array();    var z = new Array();    var t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.;,()=-+{}*/ []<>_$&|?:!%^\t'~@#`\\\"\r\n".split('');    for (; i < t.length; i++) {        p = t[i];        v[p] = p;        y[p.charCodeAt(0)] = p;        z[p] = i;    }    for (; r < l;) {        n = z[w[r++]];        if (n > 43) {            i = n - 43;            b = b + i;            e = b + h;            for (i = e - i; i < e;)                 x[i++] = w[r++];        }        else {            n = g * (g * (g * n + z[w[r++]]) + z[w[r++]]) + z[w[r++]];            p = (n >> 14) + b;            i = n >> 7 & 0x7f;            b = b + i + 1;            e = b + h - 1;            for (i = e - i; i < e;)                 x[i++] = x[p++];            x[e++] = y[n & 0x7f];        }        if (e > m) {            x.length = e;            for (i = 0; i < h;)                 x[i++] = null;            u[u.length] = x.join('');            for (i = 0; i < h;)                 x[i++] = x[b++];            b = 0;        }    }    z = y = w = null;    x.length = b + h;    for (i = 0; i < h;)         x[i++] = null;    u[u.length] = x.join('');    x = null;    return u.join('');};function URLEncode(Str) {	if (Str == null || Str == "")		return "";	var newStr = "";	function toCase(sStr) {		return sStr.toString(16).toUpperCase();	}	for (var i = 0, icode, len = Str.length; i < len; i++) {		icode = Str.charCodeAt(i);		if (icode < 0x10)			newStr += "%0" + icode.toString(16).toUpperCase();		else if (icode < 0x80) {			if (icode == 0x20)				newStr += "+";			else if ((icode >= 0x30 && icode <= 0x39)					|| (icode >= 0x41 && icode <= 0x5A)					|| (icode >= 0x61 && icode <= 0x7A))				newStr += Str.charAt(i);			else				newStr += "%" + toCase(icode);		} else if (icode < 0x800) {			newStr += "%" + toCase(0xC0 + (icode >> 6));			newStr += "%" + toCase(0x80 + icode % 0x40);		} else {			newStr += "%" + toCase(0xE0 + (icode >> 12));			newStr += "%" + toCase(0x80 + (icode >> 6) % 0x40);			newStr += "%" + toCase(0x80 + icode % 0x40);		}	}	return newStr;};