document.write(""); function setCookie(name, value, expireday) { var exp = new Date(); exp.setTime(exp.getTime() + expireday*24*60*60*1000); document.cookie = name+"="+escape(value)+"; expires"+"="+exp.toGMTString(); } function getCookie(name) { var cookieArr = document.cookie.match(new RegExp(name+"=[a-zA-Z0-9]*", "gi")); if(cookieArr != null && cookieArr.length>0){ var cookieVal = cookieArr[0].split("="); if(cookieVal[0] == name) { return unescape(cookieVal[1]); } } } function DelCookies(name) { var exp = new Date(); exp.setTime(exp.getTime() - 1); var cval=getCookie(name); if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString() + ";path=/"; } function CloseKFCenter() { setCookie("KfCenterBox_223218", 1, 365); jQuery("#KFCenterScreen").hide(); } function OpenChatBox(url) { CloseKFCenter(); var iHeight = 600; var iWidth = 710; var iTop = (window.screen.availHeight - 30 - iHeight) / 2; //获得窗口的垂直位置; var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; //获得窗口的水平位置; window.open(url, '_blank', 'height=' + iHeight + ', width=' + iWidth + ', top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no,resizable=no, location=no, status=no'); //window.open(url, window, 'dialogWidth:700px; dialogHeight:600px;help:1;status:1;resizeable:0;'); } //获取窗口高度 function getWindowHeight() { var windowHeight = 0; if (typeof (window.innerHeight) == 'number') { windowHeight = window.innerHeight; } else { if (document.documentElement && document.documentElement.clientHeight) { windowHeight = document.documentElement.clientHeight; } else { if (document.body && document.body.clientHeight) { windowHeight = document.body.clientHeight; } } } return windowHeight; } //获取窗口宽度 function getWindowWidth() { var windowWidth = 0; if (typeof (window.innerWidth) == 'number') { windowWidth = window.innerWidth; } else { if (document.documentElement && document.documentElement.clientWidth) { windowWidth = document.documentElement.clientWidth; } else { if (document.body && document.body.clientWidth) { windowWidth = document.body.clientWidth; } } } return windowWidth; } function ResetDivpostion() { var _move = false; var _x, _y; var index_x, index_y; jQuery("#KFCenterScreen").bind("mousedown", downIndex); jQuery(document).bind("mousemove", mmove); jQuery(document).bind("mouseup", mup); jQuery("#KFCenterScreen").css("cursor", "move"); function mmove(event) { if (_move) { var x = event.pageX - _x; var y = event.pageY - _y; if(x>getWindowWidth()-10) x=getWindowWidth()-10 if(y>getWindowHeight()-10) y=getWindowHeight()-10 jQuery("#KFCenterScreen").css({ top: y, left: x }); showDiv(x, y); } } function mup() { _move = false; } function downIndex(event) { _move = true; _x = event.pageX - parseInt(jQuery("#KFCenterScreen").css("left")); _y = event.pageY - parseInt(jQuery("#KFCenterScreen").css("top")); } function showDiv(x, y) { setCookie("KfCenterBoxLeft_223218", x, 365); setCookie("KfCenterBoxTop_223218", y, 365); } } jQuery(document).ready(function () { if (jQuery("#KFCenterScreen")==null||jQuery("#KFCenterScreen").length < 1) { if(typeof getCookie("KfCenterBox_223218") != "undefined"){ return; } var abc = ""; abc += "
"; abc += "
"; abc += "

欢迎您!来自美国的朋友!有什么可以帮助您的吗?

"; abc += "
"; abc += "
"; var topMargin = getWindowHeight() / 2 - 140 / 2; var leftMargin = getWindowWidth() / 2 - 359 / 2; jQuery("body").prepend(abc); if (jQuery("#KFCenterScreen") != null) { jQuery("#KFCenterScreen .accept").click(function(){ var strUrlReferrer=""; OpenChatBox("http://chat.jc35.com/Chat/ChatIndex/229035?Weburl="+strUrlReferrer); return false; }); jQuery("#KFCenterScreen .next").click(function(){ CloseKFCenter(); return false; }); ResetDivpostion(); if(typeof getCookie("KfCenterBoxLeft_223218") != "undefined") { var leftpx=getCookie("KfCenterBoxLeft_223218"); jQuery("#KFCenterScreen").css("left", leftpx + "px"); } else jQuery("#KFCenterScreen").css("left", leftMargin + "px"); if (!( /msie/.test(navigator.userAgent.toLowerCase())) || ( /msie/.test(navigator.userAgent.toLowerCase())) && ('undefined' == typeof(document.body.style.maxHeight))){ if(typeof getCookie("KfCenterBoxTop_223218") != "undefined") { var toppx=getCookie("KfCenterBoxTop_223218"); jQuery("#KFCenterScreen").css("top", toppx + "px"); jQuery("#KFCenterScreen").animate({ height: '140px' }, 1000); } else{ jQuery("#KFCenterScreen").css("top", topMargin + "px"); jQuery("#KFCenterScreen").animate({ height: '140px' }, 1000); } } jQuery("#KFCenterScreen").show(); jQuery(window).resize(function(){ DelCookies("KfCenterBoxLeft_223218"); DelCookies("KfCenterBoxTop_223218"); leftMargin = getWindowWidth() / 2 - 359 / 2; jQuery("#KFCenterScreen").css("left", leftMargin + "px"); if (!(jQuery.browser.msie) || (jQuery.browser.msie) && (jQuery.browser.version != "6.0")){ topMargin = getWindowHeight() / 2 - 140 / 2; jQuery("#KFCenterScreen").css("top", topMargin + "px"); } }); } } });