<?php
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
header('content-type:text/javascript; charset=utf-8');
define("IN_OK", true);
require_once ("include/global_kf.php");
require_once ($www_path . "/include/memcache_function_kf.php");

$arg = get_value("arg");
if (strtolower($arg) == "dotgoo")
	return;
if ($arg == "")
	return;

//区分HTTP请求和HTTPS请求
$http = 'http';
if ( (isset( $_SERVER["HTTPS"] ) && strtolower( $_SERVER["HTTPS"] ) == "on") || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https' )) {
    $http = 'https';
    $acc_host = str_replace('acc.','acc',$acc_host);
}
require_once ('ivt_filter.php');

if (is_array($arr_filter))
{
	if (array_key_exists("all", $arr_filter))
	{
		$filter_time = $arr_filter["all"];
	} else
	{
		if (array_key_exists($arg, $arr_filter))
		{
			$filter_time = $arr_filter[$arg];
		}
	}
}

$domain_name = $cfg["prefix"] . $arg;

$style_id = get_value("style", 1);
$lang = get_value("lang", "cn");
$resize = get_value("resize", "no");
$charset = get_value("charset", "GBK");

$isonline = get_value("isonline", 0);
$kfonline = get_value("kfonline", 0);
$kflist = get_value("kflist", "off");
$zdkf_type = get_value("zdkf_type", 1);
$kf = get_value("kf");
$referer = get_value("referer");
$keyword = get_value("keyword");
$from_page = get_value("keyword");

$lytype = get_value("lytype", 0);
$lyurl = get_value("lyurl");
$copartner = get_value("copartner");
$username = get_value("username");
$userinfo = get_value("userinfo");
$introurl = get_value("introurl");
$brief = get_value("brief");
$logo = get_value("logo");
$question = get_value("question");

$company_tpl = get_value("tpl_name");
$company_tpl_width = get_value("tpl_width");
$company_tpl_height = get_value("tpl_height");


$mem_re = mem_get($domain_name, array("style" => $style_id));
if ($mem_re === false)
	return;


$visitorurl = "webCompany.php";


$styles = $mem_re["company_style"];
if ($style_id > count($styles))
{
	$style_id = 1;
}
$style_real_id = $styles[$style_id - 1]["id"];

$re_config_no_style = get_style_result($mem_re["company_config"], 0);
$ivt_tpl = "";
if ($re_config_no_style !== false)
{
	foreach ($re_config_no_style as $vv)
	{
		if (get_config_value($vv["config_id"], $vv["config_value"], "ivt_tpl", $ivt_tpl))
			break;
	}
}

$re_config = get_style_result($mem_re["company_config"], $style_real_id);

$cus_web_msg_gids = implode(",", $mem_re["cus_web_msg"]); // 留言回复的gids

//////////////设置中心->主动发起设置 //////////////////////////////////
$zdfq = "yes"; //主动发起开启 (邀请框和acc)
$acc_city = ""; //范围限制 (邀请框和acc)
$acc_poptype = 2; //自动发起：0：关闭，1：邀请：2：对话 (邀请框)
$acc_pop = 1; //1：延迟弹出
$acc_poptime = 10000; //延迟时间
$acc_reauto = 1; //开启反复弹出
$acc_reauto_time = 60000; //间隔时间
$acc_pop_page = 0; //页面弹出次数限制 0：不限制
$acc_pop_pagenum = 1; //限制次数
$acc_pop_total = 0; //总弹出次数限制	0：不限制
$acc_pop_totalnum = 1; //总限制次数
$acc_autotype = 0; //点击后不再弹出 0：不限制 3：刷新后不再弹出
$acc_reinvite = 1; //重复邀请 1：不受限制
$acc_chattype = 3; //强制对话方式 1：覆盖当前窗口 2：弹出新窗口，如失败，则覆盖 3：悬浮对话窗口
$sqb_show_type = 1;//省钱宝样式选择 1；是新版的 2是老版的
$ivt_off = "off"; //离线邀请 off：不启用(邀请框)
$talk_right = "0";//强制对话框位置
$talk_bottom = "0";//强制对话框位置
$interface_color = 1;//强制对话框颜色
$interface_theme = 1;//强制对话框背景
$qzzk = 0;//新消息强制展开
$minchat_style = 1;//强制对话框风格：普通，定制
//////////////////////////////////////////////////////////////////////

//////////////设置中心->界面样式设置->主动发起界面 ////////////////////
$acc_middle = 0; //邀请框位置定位：0：手动设置 1：自动居中
$how_float = 0; //显示效果 0：浮动漂浮 1：浮动固定
$acc_lr = 1; //水平定位：1：距左 2：距右
$acc_tb = 1; //垂直定位：1：距顶 2：距底
$acc_left = 280; //距左
$acc_pos = 1; //=acc_lr 暂已取消
$acc_top = 230; //距顶
$acc_ip = "off"; //客户地理位置显示 on：显示
$acc_freeze = "off"; //冰冻效果 on：开启
$acc_img = ""; //邀请框内图片URL，53kf_v01有用
$acc_title = ""; //邀请框标题
$acc_content = ""; //邀请框内容
$ivt_off_title = ""; //离线邀请框标题
$ivt_off_content = ""; //离线邀请框内容
$ivt_effect = 0; //邀请框特效
//////////////////////////////////////////////////////////////////////


$ocharset = $charset; //编码

$zdyivt = 0;
$zdyivtarr = array();
$zdyivtstr = "";
$zdyivt_width = "0px";
$zdyivt_height = "0px";

$zdyurl = ""; //自定义url

$company_name = ""; // 迷你对话框上的公司名字
$count_code="";


// 新版min访客端
$webclient_min = '0'; // 是否开启新版访客端，1 开 0 关

if ($re_config !== false)
{
	foreach ($re_config as $vv)
	{
		if (get_config_value($vv["config_id"], $vv["config_value"], "zdfq", $zdfq))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_city", $acc_city))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_poptype", $acc_poptype))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_pop", $acc_pop))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_poptime", $acc_poptime))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_reauto", $acc_reauto))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_reauto_time", $acc_reauto_time))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_pop_page", $acc_pop_page))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_pop_pagenum", $acc_pop_pagenum))
			continue;
        if (get_config_value($vv["config_id"], $vv["config_value"], "talk_bottom", $talk_bottom))
			continue;
        if (get_config_value($vv["config_id"], $vv["config_value"], "talk_right", $talk_right))
			continue;
        if (get_config_value($vv["config_id"], $vv["config_value"], "interface_color", $interface_color))
			continue;
        if (get_config_value($vv["config_id"], $vv["config_value"], "qzzk", $qzzk))
			continue;
        if (get_config_value($vv["config_id"], $vv["config_value"], "minchat_style", $minchat_style))
			continue;
        if (get_config_value($vv["config_id"], $vv["config_value"], "interface_theme", $interface_theme))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_pop_total", $acc_pop_total))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_pop_totalnum", $acc_pop_totalnum))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_autotype", $acc_autotype))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_reinvite", $acc_reinvite))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_chattype", $acc_chattype))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "sqb_show_type", $sqb_show_type))
			continue;

		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_left", $acc_left))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_middle", $acc_middle))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "how_float", $how_float))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_lr", $acc_lr))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_tb", $acc_tb))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_pos", $acc_pos))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_top", $acc_top))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_ip", $acc_ip))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_freeze", $acc_freeze))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_img", $acc_img))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_title", $acc_title))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "acc_content", $acc_content))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "ivt_tpl", $ivt_tpl))
			continue;

		if (get_config_value($vv["config_id"], $vv["config_value"], "ivt_off", $ivt_off))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "ivt_off_title", $ivt_off_title))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "ivt_off_content", $ivt_off_content))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "ivt_effect", $ivt_effect))
			continue;

		if (get_config_value($vv["config_id"], $vv["config_value"], "zdyurl", $zdyurl))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "company_name", $company_name))
			continue;

		if (get_config_value($vv["config_id"], $vv["config_value"], "zdyivt", $zdyivt))
			continue;
		if (get_config_value($vv["config_id"], $vv["config_value"], "webclient_min", $webclient_min))
			continue;
		if (strpos($vv["config_id"], "zdyivt_53kf") !== false)
		{
			$keyid = str_replace("zdyivt_53kf_", "", $vv["config_id"]);
			$zdyivtarr[$keyid] = $vv["config_value"];
		}
		if (get_config_value($vv["config_id"], $vv["config_value"], "now_temp", $now_temp))//当前在用模版
			continue;
		if($now_temp !='')
		{
			$nums = str_replace('temp_','',$now_temp);
			if (get_config_value($vv["config_id"], $vv["config_value"], "zdyyqk_$nums", $ivtstrs))//当前在用模版
				continue;
		}
                if (get_config_value($vv["config_id"], $vv["config_value"], "count_code", $count_code))
			continue;
	}
}
$langs_intro = array(
		"cn" => "公司简介",
		"tw" => "公司簡介",
		"en" => "Company profile",
		"ja" => "会社概要",
		"ko" => "회사 소개",
		"ge" => "Ltd.",
		"ru" => "компания введение ",
		"fr" => "Ltd.");
$lang_new=  str_replace("zh-","", $lang);
	$com_intro = $langs_intro[$lang_new];
$company_name = $company_name != '' ? $company_name : $com_intro;
$company_name = str_replace(array("\\", '"'), array("\\\\", '\"'), $company_name);
$company_name = mb_convert_encoding($company_name, "HTML-ENTITIES", "UTF-8");

if (isset($agent_config))
{
	//此处进行风格继承
	if (get_style_lock("zdfq"))
	{
		get_agent_config_value("zdfq", $zdfq);

		get_agent_config_value("acc_poptype", $acc_poptype);
		get_agent_config_value("acc_pop", $acc_pop);
		get_agent_config_value("acc_poptime", $acc_poptime);
		get_agent_config_value("acc_reauto", $acc_reauto);
		get_agent_config_value("acc_reauto_time", $acc_reauto_time);
		get_agent_config_value("acc_pop_page", $acc_pop_page);
		get_agent_config_value("acc_pop_pagenum", $acc_pop_pagenum);
		get_agent_config_value("acc_pop_total", $acc_pop_total);
		get_agent_config_value("acc_pop_tote", $acc_autotype);
		get_agent_config_value("acc_reinvialnum", $acc_pop_totalnum);
		get_agent_config_value("acc_autotypte", $acc_reinvite);
		get_agent_config_value("acc_chattype", $acc_chattype);
		get_agent_config_value("sqb_show_type", $sqb_show_type);
		get_agent_config_value("ivt_off", $ivt_off);

		get_agent_config_value("acc_left", $acc_left);
		get_agent_config_value("acc_pos", $acc_pos);
		get_agent_config_value("acc_top", $acc_top);
		get_agent_config_value("acc_ip", $acc_ip);
		get_agent_config_value("acc_freeze", $acc_freeze);
		get_agent_config_value("acc_img", $acc_img);
		get_agent_config_value("acc_title", $acc_title);
		get_agent_config_value("acc_content", $acc_content);
		get_agent_config_value("ivt_tpl", $ivt_tpl);
	}
	if (get_style_lock("zdyurl"))
	{
		get_agent_config_value("zdyurl", $zdyurl);
	}
}
//填充来源 new
if($ivtstrs)
	$acc_ip = 'on';
if ($zdyurl != "" && strpos($zdyurl, "http://") === false)
{
	$zdyurl = "$http://" . $zdyurl;
}

// 检查是否为IE6
if (strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE 6.0') !== false)
{
	$how_float = 0;
}

$master_host = $cfg["master_host"] . "." . $cfg["base_host"];
$talk_host = $_SERVER['HTTP_HOST'];
$server_path = "$http://" . $talk_host;

$companyid = $mem_re["company"]["id"];


$from_page = urlencode($from_page);

if ($acc_pop_pagenum == "")
{
	$acc_pop_pagenum = 1;
}
if ($acc_pop_totalnum == "")
{
	$acc_pop_totalnum = 1;
}

if ($acc_left == "")
{
	$acc_left = 230;
}
if ($acc_top == "")
{
	$acc_top = 280;
}


$ipstr = '';
$ip = get_ip();
//范围内启用
if ("partson" == $zdfq)
{
	if ($acc_city != '')
	{
		if ($ipinfo == "")
		{
			$ipinfo = get_ip_info($ip);
		}
		$zdfq_old = $zdfq;
		$ivt_off_old = $ivt_off;
		$zdfq = 'no';
		$ivt_off = 'off';
		$arr_c = explode(',', $acc_city);
		foreach ($arr_c as $k => $v)
		{
			if (strpos($ipinfo['area'], $v) !== false)
			{
				$zdfq = "yes";
				$ivt_off = $ivt_off_old;
				break;
			}
		}
		unset($arr_c);
	} else
	{
		$zdfq = "yes";
	}
}


// 在线离线都要用到
$language = "&language=" . urlencode($lang);
$charset = "&charset=" . urlencode($charset);
$kf = "&kflist=" . urlencode($kflist) . "&kf=" . urlencode($kf) . "&zdkf_type=" . urlencode($zdkf_type);
$tfrom = "&tfrom=2";
$referer = "&referer=" . urlencode($referer);
$keyword = "&keyword=" . urlencode($keyword);
$username = "&username=" . urlencode($username);
$userinfo = "&userinfo=" . urlencode($userinfo);
$introurl = "&introurl=" . urlencode($introurl);
$lytype = "&lytype=" . urlencode($lytype);
$lyurl = "&lyurl=" . urlencode($lyurl);
$copartner = "&copartner=" . urlencode($copartner);
$brief = "&brief=" . urlencode($brief);
$logo = "&logo=" . urlencode($logo);
$question = "&question=" . urlencode($question);

$u_stat_id = get_value('u_stat_id');
$u_stat_id = $u_stat_id == '' ? '' : '&u_stat_id='.$u_stat_id;
$openurl = $server_path . "/$visitorurl?arg=$arg&style=$style_id$kf$language$charset$username$userinfo$introurl$lyurl$lytype$copartner$referer$keyword$brief$logo$question$u_stat_id";
// 省钱宝对话连接
$openurl_minkh = $server_path . "/webClientMin.php?company_id=$companyid&style=$style_id$kf$language$charset$username$userinfo$introurl$lyurl$lytype$copartner$referer$keyword$brief$logo$question";
$minkh_params = "$language$charset$username$userinfo$introurl$lyurl$lytype$copartner$referer$keyword$brief$logo$question" . '&tfrom=6';
if ($zdyurl != "")
{
	if (strpos($zdyurl, "?") === false)
	{
		$zdyurl .= "?arg=$arg&style=$style_id&kf=$kf$language$charset$username$userinfo$introurl$lyurl$lytype$copartner$referer$keyword$brief$logo$question$u_stat_id";
	} else
	{
		$zdyurl .= "arg=$arg&style=$style_id&kf=$kf$language$charset$username$userinfo$introurl$lyurl$lytype$copartner$referer$keyword$brief$logo$question$u_stat_id";
	}
	$openurl = $zdyurl;
}

$block_trace_guest_id = $mem_re['block_trace']['guest_id']; // 黑名单拦截客户编码
$block_trace_guest_ip = $mem_re['block_trace']['guest_ip']; // 黑名单拦截客户IP

$is_block_trace = 0;		//是否阻止轨迹

$ips = explode('.', $ip);
$ip_tmp = intval($ips[0])*16777216 + intval($ips[1])*65536 + intval($ips[2])*256 + intval($ips[3]);
	
foreach ($block_trace_guest_ip as $k=>$v) {
	if ($k <= $ip_tmp && $ip_tmp <= $v) {
		$is_block_trace = 1;
	}
}


$count_code1= str_replace(PHP_EOL, '', $count_code);
$count_code1 =preg_replace("/\s/","",$count_code1);
$pattern='/\<script(.{0,30})\>(.*)\<\/script\>/';
if(preg_match($pattern,$count_code1)){
    $count_code=preg_replace('/\<script(.{0,30})\>/','',$count_code);
  	$count_code=str_replace('</script>','',$count_code);
  	echo "try{".$count_code."}catch(e){}";
}
{
echo <<< HTML
	var hz6d_guest_id = $53.getCookie('53gid2');
	var hz6d_get_guest_id_over = 0;
	var hz6d_get_guest_id_num = 5;
	var hz6d_get_guest_id_timer = 0;
	var hz6d_cus_web_msg_gids = "$cus_web_msg_gids";
	var hz6d_block_trace_guest = false;
	var hz6d_block_trace_over = false;

	var hz6d_flash_html='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="1" height="1" align="middle" id="mainserverim" style="position:absolute;bottom:0;left:0"><param name="allowScriptAccess" value="always" /><param name="movie" value="http://{$master_host}/flash/hz6d_53kf_kf_gid.swf"/><param name="quality" value="high" /><param name="wmode" value="transparent"><param name="bgcolor" value="#ffffff" /><embed name="mainserverim" src="http://{$master_host}/flash/hz6d_53kf_kf_gid.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="1" height="1" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" swLiveConnect="true" style="position:absolute;bottom:0;left:0" /></object>';
	if (hz6d_guest_id == '') {
		$53.creElm({
			'style':"position:absolute;bottom:0;left:0",
			'id':'hz6d_flash_html',
			'innerHTML': hz6d_flash_html
		},'div');
	}

	function returnGid(args){
		hz6d_guest_id = args[0];
		hz6d_get_guest_id_over = 1;
	}

	function hz6d_get_guest_id(){
		if(hz6d_get_guest_id_over==0 && hz6d_get_guest_id_num>0){
			hz6d_get_guest_id_num--;
			setTimeout("hz6d_get_guest_id()", 500);
		}else{
			// 已经获得guest_id或者重复获取次数已满 
			clearTimeout(hz6d_get_guest_id_timer);

			// guest_id guest_ip 是否在block_trace中，即是否阻止轨迹 
			hz6d_block_trace_guest = (function(){
				var ip = "$ip",
					id = hz6d_guest_id,
					block_trace_guest_id = $block_trace_guest_id,
					block_trace_guest_ip = $block_trace_guest_ip;
					
				for (var i = 0; i < block_trace_guest_id.length; i++)
				{
					if (id == block_trace_guest_id[i] && id != '') return true;
				}
				
				if ($is_block_trace) return true;
				
				return false;
			})();
			// 取消轨迹采集锁定 
			hz6d_block_trace_over = true;

			if(hz6d_guest_id!="" && hz6d_guest_id>0){
				if(hz6d_cus_web_msg_gids.indexOf(hz6d_guest_id)>=0){
					var url = "$server_path/lword_reply.php?company_id=$companyid&guest_id="+hz6d_guest_id;
					//$53.createScript("hz6d_lword_reply", url);
				}
			}
		}
	}

	function hz6d_cus_web_msg_open(){
		var openurl = "$openurl";
		try{
			window.open(openurl,"_blank","height=473,width=703,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable=$resize,scrollbars=no,location=no,titlebar=no");
		}catch(e){}
	}

	hz6d_get_guest_id_timer = setTimeout("hz6d_get_guest_id()", 500);
	
	var create_flp_jquery_timer = window.setInterval(function(){
		if (!document.getElementById('hz6d_flp_jquery')) {
			$53.creElm({
				id: 'hz6d_flp_jquery',
				src: '$server_path/minkh/js/jquery-1.4.2.flp.js?20121127002',
				charset: "utf-8",
				type: 'text/javascript'
			},'script', document.body, 1);
			clearInterval(create_flp_jquery_timer);
		}
	},500);
HTML;
}
if ('1' == $webclient_min || $_COOKIE['hz6d_mem_login']['member_id'])
{
	
	echo <<< HTML
	var openurl_minkh = "$openurl_minkh";
	var minkh_params = "$minkh_params";

	var create_minkh_js_timer = setInterval(function(){
		if (!document.getElementById('hz6d_minkh_js') && typeof window.FLP !== 'undefined') {
			$53.creElm({
				id: 'hz6d_minkh_js',
				src: '$server_path/minkh.php?company_id=$companyid&domain_name=$arg$kf&style_id=$style_id&sqb_show_type=$sqb_show_type&guest_id=' + hz6d_guest_id,
				charset: "utf-8",
				type: 'text/javascript'
			},'script');
			clearInterval(create_minkh_js_timer);
		}
	},500);

\r\n
HTML;

}else{
    if($acc_poptype == 2) {
	echo <<< HTML
	var new_fk_count=0; //访客消息条数
		
	var HZ6D_CONFIGSNEW = {
	'com_id': "$companyid",
	'flashingInterval' : {},
	'newMsgInterval' : 0
	
};
	var HZ6D_TMP_VARSNEW = {};
	setInterval(function(){
		recvDataFromIframeProxy();
	},100); 
	function recvDataFromIframeProxy() {
    	try {
    		var wlh = window.location.href,
    		hz6d_index = wlh.indexOf('hz6d{'),
    		d6zh_index = wlh.indexOf('}d6zh');
    		if (hz6d_index == -1 || d6zh_index == -1) return;
    		window.location = wlh.replace(/#hz6d\{.*?\}d6zh/gi,'#6d');
    		hz6d_index += 4;
    		d6zh_index += 1;
    		var my_data = wlh.substring(hz6d_index, d6zh_index).replace(/%27/g,'"').replace(/%22/g,'"');
    				my_data = decodeURI(my_data);
    		if ((HZ6D_TMP_VARSNEW.iframeData != my_data)){
    			var _data = (new Function('','return ' + my_data))();
    			switch(_data.cmd) {
    				case 'new_msg':
    					hz6d_flashing(_data.comid);
    					break;
    				default:
    					break;
    			}
    			HZ6D_TMP_VARSNEW.iframeData = my_data;
    			cid=_data.comid;
    		}
    	} catch(e) {}
}
	
	function hz6d_flashing(cid) {
		if(flp("#div_company_mini").css("height") == "36px") {//对话框缩小时
			if($qzzk == 1) {//强制展开是否开启
                max_min_company_mini(document.getElementById("hz6d_cname_mini_div").nextSibling);
			}else{
    			if(!HZ6D_CONFIGSNEW.newMsgInterval) {
    	            flp('#hz6d_cname_mini_div').html("您有新消息");
    		      	HZ6D_CONFIGSNEW.newMsgInterval = setInterval("flp('#hz6d_cname_mini_div').fadeOut(150).fadeIn(150)",400);
    			} 
			}	            		    			
		}
	}
    
	function hz6d_re_flashing(cid) {	
        clearInterval(HZ6D_CONFIGSNEW.newMsgInterval);
    	HZ6D_CONFIGSNEW.newMsgInterval = 0;
	    flp('#hz6d_cname_mini_div').html(hz6d_cname);
	}
HTML;
	}
}

//主动发起
if ("yes" == $zdfq)
{
	if ($acc_poptype == 0)
	{
		$pop = 'man';
	} else
	{
		$pop = 'auto';
	}

	if ($acc_pop != 1)
	{
		$acc_poptime = 0;
	}

	if ($companyid != 600617 && $lang != "en")
	{
		$cfg["ivt_tpl_config"] = '../templates/ivt/53kf_v01/kf.tpl.config.php';
		$cfg["ivt_tpl"] = '../templates/ivt/53kf_v01/kf.tpl';
	}
	if ($companyid == 61446854)
	{
		$ivt_tpl = "../templates/ivt/hospital/kf.tpl";
	} else
		if ($companyid == 61431529 && $style_id == 2)
		{
			$ivt_tpl = "../templates/ivt/huamei/kf.tpl";
		}

	if ($ivt_tpl != "")
	{ //后台保存格式为：new2011_01,new2011_02...
		$new_ivt_tpl = array(
			"new2011_01",
			"new2011_02",
			"new2011_03",
			"new2011_04",
			"new2011_05",
			"new2011_06",
			"new2011_07",
			"new2011_08",
			"new2011_09",
			"new2011_10");
		if (in_array($ivt_tpl, $new_ivt_tpl))
		{
			$ivt_tpl = "../templates/ivt/" . $ivt_tpl . "/kf.tpl";
		}
	}

	if ($ivt_tpl != "")
	{
		$cfg["ivt_tpl"] = $ivt_tpl;
		$cfg["ivt_tpl_config"] = $ivt_tpl . ".config.php";
	}

	require ($cfg["ivt_tpl_config"]);
	$lang = str_replace("zh-", "", $lang);


	$ivt_ip = $ivtTplCfg["ivt_ip_" . $lang];

	$langs_talk = array(
		"cn" => "点击咨询",
		"tw" => "點擊諮詢",
		"en" => "Chatting",
		"ja" => "Chatting",
		"ko" => "Chatting",
		"ge" => "Chatting",
		"ru" => "Chatting",
		"fr" => "Chatting");
	$ivt_talk = $langs_talk[$lang];

	$langs_close = array(
		"cn" => "下次再说",
		"tw" => "下次再說",
		"en" => "Next",
		"ja" => "Next",
		"ko" => "Next",
		"ge" => "Next",
		"ru" => "Next",
		"fr" => "Next");
	$ivt_close = $langs_close[$lang];

	if ($ip == "")
		$ip = get_ip();
	if ($ipinfo == "" && ($isonline == 1 || ($ivt_off == "on" && $acc_ip == "on")))
	{
		$ipinfo = get_ip_info($ip);
	}

	if ("" != $ipinfo['isp'])
	{
		$ipstr = $ipinfo['area'] . "[" . $ipinfo['isp'] . "]";
	} else
	{
		$ipstr = $ipinfo['area'];
	}
	$ipstr = urlencode($ipstr);

	if ($acc_ip == "on")
	{
		if ($lang == "cn")
		{
			$ivt_ip .= "来自" . $ipinfo['area'] . "[" . $ipinfo['isp'] . "]" . "的朋友";
		}
	}

	$ivt_logo = $talk_host . "/" . $ivtTplCfg["ivt_logo_" . $lang];
	if ($lang == "fr")
	{
		$ivt_logo = $talk_host . "/img/kflogo/ivt.gif";
	}
	if (trim($acc_img) != "")
	{
		$ivt_logo = $acc_img;
	}
	if ($companyid == 600617)
	{
		$ivt_logo_com = $talk_host . "/img/ivt/acc_logo.gif";
	} else
	{
		$ivt_logo_com = $talk_host . "/img/ivt/ivt.gif";
	}

	$ivt_width = $ivtTplCfg['width'];
	$ivt_height = $ivtTplCfg['height'];
	$width_num = str_replace("px", "", $ivt_width);
	$height_num = str_replace("px", "", $ivt_height);
	$ivt_fontsize = $ivtTplCfg['fontsize'];
	$iframe_add_width = (int)$ivtTplCfg['iframe_add_width'];
	$iframe_add_height = (int)$ivtTplCfg['iframe_add_height'];

	if ($acc_title == "")
	{
		$acc_title = $cfg["acc_title"];
		if ($lang != "cn")
		{
			$acc_title = $cfg["name_jc"] . " Invite!";
		}
	}
	if ($acc_content == "")
	{
		$acc_content = $cfg["acc_content"];
		if ($lang != "cn")
		{
			$acc_content = "May I help you!";
		}
	}
	// mini浮动窗口 按钮提醒语
	if ($lang == 'cn')
	{
		$mini_narrow = '缩小';
		$mini_recover = '还原';
		$mini_maxto = '切换到正常窗口';
		$mini_close_title = '关闭';
	}
	if ($lang != "cn")
	{
		$mini_narrow = 'Narrow';
		$mini_recover = 'Recover';
		$mini_maxto = 'Switch to normal window';
		$mini_close_title = 'Close';
	}
	$mini_narrow = mb_convert_encoding($mini_narrow, "HTML-ENTITIES", "UTF-8");
	$mini_recover = mb_convert_encoding($mini_recover, "HTML-ENTITIES", "UTF-8");
	$mini_maxto = mb_convert_encoding($mini_maxto, "HTML-ENTITIES", "UTF-8");
	$mini_close_title = mb_convert_encoding($mini_close_title, "HTML-ENTITIES", "UTF-8");

	$acc_content = str_replace(" ", "&nbsp;", $acc_content);
	$acc_content = str_replace(array(
		"\"",
		"'",
		"<",
		">"), array(
		"&quot;",
		"&#039;",
		"&lt;",
		"&gt;"), $acc_content);
	$acc_content = str_replace("\r\n", "<br />", $acc_content);
	$acc_content = str_replace("\n", "<br />", $acc_content);
	$acc_content = str_replace("\r", "<br />", $acc_content);
	$acc_content = mb_convert_encoding($acc_content, "HTML-ENTITIES", "UTF-8");

	$acc_title = str_replace(array(
		"\"",
		"'",
		"<",
		">"), array(
		"&quot;",
		"&#039;",
		"&lt;",
		"&gt;"), $acc_title);
	$acc_title = str_replace("\r\n", "<br />", $acc_title);
	$acc_title = str_replace("\n", "<br />", $acc_title);
	$acc_title = str_replace("\r", "<br />", $acc_title);
	$acc_title = mb_convert_encoding($acc_title, "HTML-ENTITIES", "UTF-8");

	// 离线邀请 acc_title 和 acc_content
	$offwords = array();
	$offwords[0] = $cfg["name_jc"] . "邀请";
	$offwords[1] = "客服不在线，点击留言！";

	if (strpos($lang, "cn") === false)
	{
		$offwords[0] = $cfg["name_jc"] . " Invite!";
		$offwords[1] = "You can leave a message!";
	}
	if ($ivt_off_title == "")
	{
		$ivt_off_title = $offwords[0];
	}
	if ($ivt_off_content == "")
	{
		$ivt_off_content = $offwords[1];
	}

	$ivt_off_content = str_replace(array(
		"\"",
		"'",
		"<",
		">"), array(
		"&quot;",
		"&#039;",
		"&lt;",
		"&gt;"), $ivt_off_content);
	$ivt_off_content = str_replace("\r\n", "<br />", $ivt_off_content);
	$ivt_off_content = str_replace("\n", "<br />", $ivt_off_content);
	$ivt_off_content = str_replace("\r", "<br />", $ivt_off_content);
	$ivt_off_content = mb_convert_encoding($ivt_off_content, "HTML-ENTITIES", "UTF-8");

	$ivt_off_title = str_replace(array(
		"\"",
		"'",
		"<",
		">"), array(
		"&quot;",
		"&#039;",
		"&lt;",
		"&gt;"), $ivt_off_title);
	$ivt_off_title = str_replace("\r\n", "<br />", $ivt_off_title);
	$ivt_off_title = str_replace("\n", "<br />", $ivt_off_title);
	$ivt_off_title = str_replace("\r", "<br />", $ivt_off_title);
	$ivt_off_title = mb_convert_encoding($ivt_off_title, "HTML-ENTITIES", "UTF-8");
	///////////////////////////////////////////////////////////////////////////////////////////

	if ($isonline == 0)
	{
		$acc_title = $ivt_off_title;
	}


	if ($zdyivt == 1 && count($zdyivtarr) > 0)
	{
		if ($zdyurl != "")
			$openurl = $zdyurl;
		$zdyivtstr = "<div id='acc_title'";
		for ($zdy_i = 0; $zdy_i < count($zdyivtarr); $zdy_i++)
		{
			$c_value = explode("|", $zdyivtarr[$zdy_i]);
			$bak_data = get_div_str($c_value[1], $zdy_i);
			if ($zdy_i == 0)
			{
				$zdyivtstr .= " style='position:relative;overflow:hidden;" . $bak_data[0] . "'>";
				if ($prefix_border != "-")
				{
					$bak_data[2] = intval($bak_data[2]) + 2 * intval($prefix_border);
					$bak_data[3] = intval($bak_data[3]) + 2 * intval($prefix_border);
				}
				$zdyivt_width = $bak_data[2] . "px";
				$zdyivt_height = $bak_data[3] . "px";
			} else
			{
				if ($bak_data[3] != "" && $bak_data[3] != "-")
				{
					$zdyivtstr .= "<a href=\"" . $bak_data[3] . "\" target=\"" . $bak_data[4] . "\" style=\"cursor:pointer; text-decoration:none;\">";
				}
				$idname = "ivtzdy_53kf_" . $zdy_i;
				$zdyivtstr .= "<div style='overflow: hidden;position:absolute;" . $bak_data[0];
				if ($bak_data[2] == "chat")
				{
					$zdyivtstr .= "cursor:pointer;' onclick=';onliner_zdfq=2;window.open(\"talk_openurl\",\"_blank\",\"height=473,width=703,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable=$resize,scrollbars=no,location=no,titlebar=no\");hidden_ivt();'";
					$idname = "hz6d_53kf_invite_acc";
				} else
					if ($bak_data[2] == "close")
					{
						$zdyivtstr .= "cursor:pointer;' onclick=';onliner_zdfq=3;hidden_ivt();'";
						$idname = "hz6d_53kf_invite_hid";
					} else
						if ($bak_data[2] == "etel")
						{
							if ($bak_data[3] == "" || $bak_data[3] == "-")
							{
								$zdyivtstr .= "cursor:pointer;' onclick=';window.open(\"$http://" . $master_host . "/eht.php?company_id=" . $companyid . "&style_id=" . $style_real_id . "\",\"_blank\",\"height=400,width=300,top=100,left=200,status=yes,toolbar=no,menubar=no,resizable=no,scrollbars=no,location=no,titlebar=no\");'";
							}
						} else
						{
							$zdyivtstr .= "'";
						}
						$zdyivtstr .= " id='" . $idname . "'";
				$zdyivtstr .= ">";
				if ($bak_data[1] == "title")
				{
					$zdyivtstr .= $acc_title;
				} else
					if ($bak_data[1] == "content")
					{
						$zdyivtstr .= "<span id=\"hz6d_acc_content\">acc_content</span>";
					} else
						if ($bak_data[1] == "ip")
						{
							$zdyivtstr .= "acc_ip";
						} else
							if ($bak_data[1] != "-")
							{
								$wenzi = str_replace("&amp;douhao", ",", $bak_data[1]);
								$zdyivtstr .= $wenzi;
							}
				$zdyivtstr .= "</div>";
				if (($bak_data[3] != "" && $bak_data[3] != "-") || $bak_data[2] == "etel")
				{
					$zdyivtstr .= "</a>";
				}
			}
		}
		$zdyivtstr .= "</div>";
	}
	$ivtstr = "";
	if ($zdyivtstr != "" && $zdyivt == 1)
	{
		$zdyivtstr = str_replace("acc_ip", $ivt_ip, $zdyivtstr);
		$zdyivtstr = str_replace("\"", "\\\"", $zdyivtstr);
		$zdyivtstr = str_replace("'", "\'", $zdyivtstr);

		$ivtstr = mb_convert_encoding($zdyivtstr, "HTML-ENTITIES", "utf-8");
	} else
	{
		$ivtstr = get_ivt_str();
		$ivtstr = str_replace('"arial"', 'arial', $ivtstr);
		$ivtstr = str_replace('"', '\"', $ivtstr);
	}

	$openurl .= $tfrom;
	//new 自定义邀请框
	$is_autoyqk = 0;
	$height_new = 0;
	if($ivtstrs)
	{
		$is_autoyqk = 1;
		$ivtstr = htmlspecialchars_decode($ivtstrs, ENT_QUOTES);
		$ivtstr = str_replace('kflogo_box','acc_title',$ivtstr);
		$ivtstr = str_replace('欢迎来自xxx的朋友',$ivt_ip,$ivtstr);
		$ivtstr = preg_replace('/width: [\d]+px;*/',' ',$ivtstr,1);
		$ivtstr = preg_replace('/height: [\d]+px;*/',' ',$ivtstr,1);
		$ivtstr = str_replace('../', "$http://".$talk_host.'/', $ivtstr);
		$ivtstr = str_replace('"', '\"', $ivtstr);
		$pos1=strpos($ivtstrs,"height:");
		$newarray1=substr($ivtstrs,$pos1);
		$pos2=strpos($newarray,";");
		$newarray2=substr($newarray1,7,$pos2-7);
		$height_new=(int)$newarray2;
	}
	{
		$kf_time = time();
		
		      
		if (has_talk())
		{
			//echo "onliner_zdfq = 2;";
		}
		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		$is_right=  substr($talk_right,0,1);
                $is_top=  substr($talk_bottom,0,1);
                if($is_right=='l'||$is_right=='r'||$is_top=='b'||$is_top=='t')
                {
                $talk_right=substr($talk_right,1,  strlen($talk_right)-1);
                $talk_bottom=  substr($talk_bottom, 1,  strlen($talk_bottom)-1);
                }
                echo <<< HTML
			// 发送acc 
			var hz6d_filter_time = "$filter_time";
                        var is_right="$is_right";
                        var is_top="$is_top";
			function hz6d_sendACC(){
				if(hz6d_get_guest_id_over==0 && hz6d_get_guest_id_num>0){
					hz6d_get_guest_id_num--;
					setTimeout("hz6d_sendACC()",500);
					return;
				}
				
				if(!hz6d_block_trace_over){
					setTimeout("hz6d_sendACC()",10);
					return;
				}

				if(hz6d_block_trace_guest) return;

				var kh_status = 0;
				if(onliner_zdfq==3) { kh_status = 3; }
				if(hz6d_guest_id==0) { hz6d_guest_id = ""; }

				var ip = "$ip";
				if("" != ip){
					var com_id = "$companyid";
					var guest_ip_info = "$ipstr";
					var from_page = "$from_page";
                    var talk_page_tmp = window.location.href;
                    if(talk_page_tmp.indexOf('hz6d{') != -1) {
                        talk_page_tmp = talk_page_tmp.substring(0,talk_page_tmp.indexOf('hz6d{'));
                    }
                    var talk_page = window.encodeURIComponent(talk_page_tmp);
					var kf_time = "$kf_time";
					var time = new Date().getTime();
					var curSecond = Math.floor(time/1000);										
					var url = "$http://$acc_host/sendacc.jsp?cmd=ACC&did=0&sid=12&company_id="+com_id+"&guest_id="+hz6d_guest_id+"&status="+kh_status+"&guest_name=&guest_ip="+ip+"&guest_ip_info="+guest_ip_info+"&from_page="+from_page+"&talk_page="+talk_page+"&kf_time="+kf_time+"&bto_id6d=-99&time="+time + '&ucust_id=' + $53.getCookie('ucust_id') + '&style=' + $style_id + '&is_mobile=n&visitor_type='+$53.getCookie('visitor_type')+'&is_uv='+$53.data('is_uv');
					
					if(hz6d_filter_time!=""){
						if(hz6d_filter_time > 0){
							if(curSecond%hz6d_filter_time==0){
								$53.createScript("hz6d_send_acc", url);
							}
						}
					}else{
						$53.createScript("hz6d_send_acc", url);
					}
				}
				setTimeout("hz6d_sendACC()",20000);
			}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			var height_new = $height_new;
			// 邀请框处理 
			var acc_pop_page		 = "$acc_pop_page";
			var acc_pop_pagenum	= $acc_pop_pagenum;
			var acc_pop_total		= "$acc_pop_total";
			var acc_pop_totalnum = $acc_pop_totalnum;
			
			var nowpage					= window.location.href;
			nowpage = nowpage.replace('http://','').replace('https://','');
			nowpage = nowpage.split('?');
			nowpage = nowpage[0].replace(/\./g,'_').replace(/\//g,'_');

			var acc_lr					 = "$acc_lr";
			var acc_tb					 = "$acc_tb";
			var acc_middle			 = "$acc_middle";
			var how_float			 = "$how_float";
			var acc_left				 = $acc_left;
			var acc_top					= $acc_top;
			var acc_autotype		 = "$acc_autotype"; // 点击接受或拒绝不再弹出 

			var zdyivt						= "$zdyivt";
			var ivtstr						= "$ivtstr";
			var is_autoyqk				= "$is_autoyqk";
			var once_autoyqk            = 0;//邀请语开关
			var zdyivt_width			= "$zdyivt_width";
			var zdyivt_height		 = "$zdyivt_height";
			var acc_reinvite			= "$acc_reinvite";
			var acc_reauto				= "$acc_reauto";
			var acc_reauto_time	 = $acc_reauto_time;
			var acc_poptime			 = $acc_poptime;
			var acc_poptype			 = $acc_poptype;
			var acc_freeze				= "$acc_freeze";
			var acc_chattype			= $acc_chattype;
			var acc_from_kf			 = false;
			var hz6d_ivt_effect	 = "$ivt_effect";
			var hz6d_cname				= "$company_name";
			var font_color;
			hz6d_cname = hz6d_cname.replace(/\"/g, '&quot;').replace(/\'/g, '&#039;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
			var hz6d_ivt_tpl			= "$ivt_tpl";
			
			var acc_content = "$acc_content";
			var chatWindow;			//弹出新窗口
			var deteTime;
			if($isonline==0)
			{
				acc_content = "$ivt_off_content";
			}

			var ivt_timer = 0;
			var force_kf = "";
			var man_content = "";
			$53.creElm({
				'id':'kfiframe',
				'src':'',
				'style':'display:none;overflow:hidden;',
				'frameBorder':0,
				'scrolling': 'no'
			},'iframe');
			$53.creElm({
				'id':'kfivteffect',
				'style':'display:none;position:absolute;width:0px;height:0px;overflow:hidden;border:1px solid #1B88D0;background:#D6EEFD;z-index:10087;'
			},'div');
			$53.creElm({
				'id':'kfivtwin',
				'style': (is_autoyqk == 1) ? 'display:none;overflow:visible;' : 'display:none;overflow:hidden;',
				'innerHTML': (is_autoyqk == 1) ? ivt_seturl(ivtstr) : ivtstr
			},'div');
			
                                 
			$53.creElm({
            	id: 'hz6d_iframe_proxy',
            	name: 'hz6d_iframe_proxy',
            	style:'position:relative;height:0;width:0;border:0;display:none;',
            	frameBorder:0,
            	src:'$server_path/minkh/hz6d_iframe_proxy2.html?from{' + window.location.href.split('#6d')[0] + '}morf#hz6d{data:""}d6zh&ver=20121128002'
            }, "iframe");

            if($minchat_style == 1){
                // 强制对话小窗口HTML
                if($interface_color==2)
                {
                    font_color='#4aa1e4';
                }
                else
                {
                    font_color='#fff';
                }
                var tmp_innerHTML = '<div id="hz6d_cname_mini_div" style="font-size:16px;overflow:hidden;position:absolute;top:7px;left:10px;width:330px;height:20px;color:'+font_color+';text-indent:30px;background:url($server_path/style/chat/minichat2/img/minchat_ns_$interface_color.png) -79px 0 no-repeat;font-weight:bold;font-family:Arial;">' + hz6d_cname + '</div><div title="$mini_narrow" mini_narrow="$mini_narrow" mini_recover="$mini_recover" max_min="max" style="position:absolute;top:10px;right:46px;width:12px;height:12px;background:url($server_path/style/chat/minichat2/img/min.png?11) no-repeat; cursor:pointer;" onclick="max_min_company_mini(this);"></div><div title="$mini_maxto" style="position:absolute;top:10px;right:28px;width:12px;height:12px;background:url($server_path/style/chat/minichat2/img/maxto.gif) no-repeat; cursor:pointer;" onclick="max_from_company_mini(this);"></div><div title="$mini_close_title" style="position:absolute;top:10px;right:10px;width:12px;height:12px;background:url($server_path/style/chat/minichat2/img/minchat_ns_$interface_color.png) -18px 0 no-repeat;cursor:pointer;" onclick="close_company_mini();"></div><div id="mini_header_bg_div" style="position:static;width:400px;margin:0 2px;height:35px;background:url($server_path/style/chat/minichat2/img/header_bg_$interface_color.png?111) no-repeat;"></div><div id="iframe_company_mini_div" style="width:100%;height:100%;"><iframe id="iframe_company_mini" frameborder="0" width="100%" height="100%" ></iframe></div>';
                if($interface_color == 1){
                    tmp_innerHTML = '<div id="hz6d_cname_mini_div" style="font-size:16px;overflow:hidden;position:absolute;top:7px;left:10px;width:330px;height:20px;color:#fff;text-indent:30px;background:url($server_path/style/chat/minichat2/img/minchat_ns_$interface_color.png) -79px 0 no-repeat;font-weight:bold;font-family:Arial;">' + hz6d_cname + '</div><div title="$mini_narrow" mini_narrow="$mini_narrow" mini_recover="$mini_recover" max_min="max" style="position:absolute;top:10px;right:46px;width:12px;height:12px;background:url($server_path/style/chat/minichat2/img/min.png?11) no-repeat; cursor:pointer;" onclick="max_min_company_mini(this);"></div><div title="$mini_maxto" style="position:absolute;top:10px;right:28px;width:12px;height:12px;background:url($server_path/style/chat/minichat2/img/maxto.gif) no-repeat; cursor:pointer;" onclick="max_from_company_mini(this);"></div><div title="$mini_close_title" style="position:absolute;top:10px;right:10px;width:12px;height:12px;background:url($server_path/style/chat/minichat2/img/minchat_ns_$interface_color.png) -18px 0 no-repeat;cursor:pointer;" onclick="close_company_mini();"></div><div id="mini_header_bg_div" style="position:static;width:403px;height:35px;background:url($server_path/style/chat/minichat2/img/header_bg_$interface_color.png?111) no-repeat;"></div><div id="iframe_company_mini_div" style="width:100%;height:100%;"><iframe id="iframe_company_mini" frameborder="0" width="100%" height="100%" ></iframe></div>';
                }
                
                $53.creElm({
    				'id':'div_company_mini',
    				'style':'display:none;position:fixed;_position:absolute;right:0;bottom:0;width:403px;height:378px;overflow:hidden;z-index:10089;cursor:move;',
    				'innerHTML': tmp_innerHTML
		      	},'div');
            }
            
            if($minchat_style == 8){
                // 定制强制对话小窗口
                var tmp_innerHTML = '<div id="hz6d_cname_mini_div" style="font-size:15px;overflow:hidden;position:absolute;top:18px;left:30px;width:230px;height:18px;color:#fff;text-indent:25px;background:url($server_path/style/chat/minichat2/img/minchat_ns_dz$minchat_style.png) -79px 0 no-repeat;font-weight:bold;font-family:Arial;">' + hz6d_cname + '</div><div title="$mini_narrow" mini_narrow="$mini_narrow" mini_recover="$mini_recover" max_min="max" style="position:absolute;top:20px;right:46px;width:12px;height:12px;background:url($server_path/style/chat/minichat2/img/min.png?11) no-repeat; cursor:pointer;" onclick="max_min_company_mini(this);"></div><div title="$mini_maxto" style="position:absolute;top:20px;right:28px;width:12px;height:13px;background:url($server_path/style/chat/minichat2/img/maxto.png) no-repeat; cursor:pointer;" onclick="max_from_company_mini(this);"></div><div title="$mini_close_title" style="position:absolute;top:20px;right:10px;width:12px;height:12px;background:url($server_path/style/chat/minichat2/img/minchat_ns_dz$minchat_style.png) -18px 0 no-repeat;cursor:pointer;" onclick="close_company_mini();"></div><div id="mini_header_bg_div" style="position:static;width:320px;height:50px;background:url($server_path/style/chat/minichat2/img/header_bg_dz$minchat_style.png?111) no-repeat;"></div><div id="iframe_company_mini_div" style="width:100%;height:100%;"><iframe id="iframe_company_mini" frameborder="0" width="100%" height="100%" ></iframe></div>';
                
                $53.creElm({
    				'id':'div_company_mini',
    				'style':'display:none;position:fixed;_position:absolute;right:0;bottom:0;width:320px;height:393px;overflow:hidden;z-index:10089;cursor:move;',
    				'innerHTML': tmp_innerHTML
                },'div');
            }
            
            if($minchat_style == 9){
                // 定制强制对话小窗口
                var tmp_innerHTML = '<div id="hz6d_cname_mini_div" style="font-size:15px;overflow:hidden;position:absolute;top:8px;left:10px;width:230px;height:18px;color:#c9a67f;text-indent:2px;font-family:微软雅黑,arial">' + hz6d_cname + '</div><div title="$mini_narrow" mini_narrow="$mini_narrow" mini_recover="$mini_recover" max_min="max" style="position:absolute;top:12px;right:46px;width:12px;height:12px;background:url($server_path/style/chat/minichat2/img/min.png) no-repeat; cursor:pointer;" onclick="max_min_company_mini(this);"></div><div title="$mini_maxto" style="position:absolute;top:12px;right:28px;width:12px;height:13px;background:url($server_path/style/chat/minichat2/img/maxto.png) no-repeat; cursor:pointer;" onclick="max_from_company_mini(this);"></div><div title="$mini_close_title" style="position:absolute;top:12px;right:10px;width:12px;height:12px;background:url($server_path/style/chat/minichat2/img/close.png) no-repeat;cursor:pointer;" onclick="close_company_mini();"></div><div id="mini_header_bg_div" style="position:static;width:370px;height:35px;background:url($server_path/style/chat/minichat2/img/header_bg_dz$minchat_style.png) no-repeat; border-top-right-radius: 6px;"></div><div id="iframe_company_mini_div" style="width:100%;height:100%;"><iframe id="iframe_company_mini" frameborder="0" width="100%" height="100%" ></iframe></div>';
                
                $53.creElm({
    				'id':'div_company_mini',
    				'style':'display:none;position:fixed;_position:absolute;right:0;bottom:0;width:370px;height:393px;overflow:hidden;z-index:10089;cursor:move;',
    				'innerHTML': tmp_innerHTML
                },'div');
            }
			
            if($minchat_style == 10){
                // 定制强制对话小窗口
                var tmp_innerHTML = '<div id="hz6d_cname_mini_div" style="font-size:14px;  font-weight: bold;overflow:hidden;position:absolute;top:10px;left:20px;width:230px;height:18px;color:#525c63;text-indent:2px;font-family:微软雅黑,arial">' + hz6d_cname + '</div><div title="$mini_narrow" mini_narrow="$mini_narrow" mini_recover="$mini_recover" max_min="max" style="position:absolute;top:1px;right:76px;width:39px;height:29px;background:url($server_path/style/chat/minichat2/img/min_llt.png) no-repeat; cursor:pointer;" onclick="max_min_company_mini(this);"></div><div title="$mini_maxto" style="position:absolute;top:1px;right:39px;width:37px;height:29px;background:url($server_path/style/chat/minichat2/img/maxto_llt.png) no-repeat; cursor:pointer;" onclick="max_from_company_mini(this);"></div><div title="$mini_close_title" style="position:absolute;top:1px;right:8px;width:31px;height:29px;background:url($server_path/style/chat/minichat2/img/close_llt.png) no-repeat;cursor:pointer;" onclick="close_company_mini();"></div><div id="mini_header_bg_div" style="position:static;width:400px;height:41px;background:url($server_path/style/chat/minichat2/img/header_bg_dz$minchat_style.png) no-repeat; border-top-right-radius: 6px;"></div><div id="iframe_company_mini_div" style="width:100%;height:100%;"><iframe id="iframe_company_mini" frameborder="0" width="100%" height="100%" ></iframe></div>';
                
                $53.creElm({
    				'id':'div_company_mini',
    				'style':'display:none;position:fixed;_position:absolute;right:0;bottom:0;width:400px;height:423px;overflow:hidden;z-index:10089;cursor:move;',
    				'innerHTML': tmp_innerHTML
                },'div');
            }
            
            if($minchat_style == 11){
                // 定制强制对话小窗口
                var tmp_innerHTML = '<div id="hz6d_cname_mini_div" style="position:absolute;top:-43px;left:20px;width:100px;height:69px;background:url($server_path/style/chat/minichat2/img/3.png?1) no-repeat;"></div><div title="$mini_narrow" mini_narrow="$mini_narrow" mini_recover="$mini_recover" max_min="max" style="position:absolute;top:1px;right:85px;width:28px;height:18px;background:url($server_path/style/chat/minichat2/img/min_3.png?1) no-repeat; cursor:pointer;" onclick="max_min_company_mini(this);" onmouseover="this.style.background=\'url($server_path/style/chat/minichat2/img/min_3_3.png?1)\'" onmouseout="this.style.background=\'url($server_path/style/chat/minichat2/img/min_3.png?1)\'"></div><div title="$mini_maxto" style="position:absolute;top:1px;right:58px;width:27px;height:18px;background:url($server_path/style/chat/minichat2/img/maxto_2.png?1) no-repeat; cursor:pointer;" onclick="max_from_company_mini(this);" onmouseover="this.style.background=\'url($server_path/style/chat/minichat2/img/maxto_2_3.png?1)\'" onmouseout="this.style.background=\'url($server_path/style/chat/minichat2/img/maxto_2.png?1)\'"></div><div title="$mini_close_title" style="position:absolute;top:1px;right:14px;width:44px;height:18px;background:url($server_path/style/chat/minichat2/img/close_2.png) no-repeat;cursor:pointer;" onclick="close_company_mini();" onmouseover="this.style.background=\'url($server_path/style/chat/minichat2/img/close_2_3.png?2)\'" onmouseout="this.style.background=\'url($server_path/style/chat/minichat2/img/close_2.png?1)\'"></div><div id="mini_header_bg_div" style="position:static;width:450px;height:34px;background:url($server_path/style/chat/minichat2/img/header_bg_dz$minchat_style.png?1) no-repeat; border-top-right-radius: 4px;"></div><div id="iframe_company_mini_div" style="width:100%;height:100%;"><iframe id="iframe_company_mini" frameborder="0" width="100%" height="100%" ></iframe></div>';
                
                $53.creElm({
    				'id':'div_company_mini',
    				'style':'display:none;position:fixed;_position:absolute;right:0;bottom:0;width:450px;height:375px;z-index:10089;cursor:move;',
    				'innerHTML': tmp_innerHTML
                },'div');
            }
            

			//	mini悬浮对话窗口 转到正常聊天窗口 
			function max_from_company_mini(t)
			{
				var openurl = "$openurl"+force_kf;
				try{
					chatWindow = window.open(openurl,"_blank","height=$company_tpl_height,width=$company_tpl_width,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable=$resize,scrollbars=no,location=no,titlebar=no");
					if(chatWindow==null){
						location.href = openurl;
					}else{
						chatWindow.focus();
						chatWindow.opener = window;
					}
				}catch(e){
					location.href = openurl;	// 傲游 
				}
				close_company_mini();
				t.parentNode.parentNode.removeChild(t.parentNode);
			}
			//	mini悬浮对话窗口 缩小、放大 
			function max_min_company_mini(t)
			{
				if (t.getAttribute('max_min') == 'max')
				{
					$53("div_company_mini").style.height = "36px";
					$53("hz6d_cname_mini_div").style.width = "130px";
					$53("div_company_mini").style.width = "203px";
					$53("iframe_company_mini_div").style.display = "none";
					t.style.backgroundImage = "url('$server_path/style/chat/minichat2/img/max.png')";				
					t.setAttribute('max_min','min');
					t.title = t.getAttribute('mini_recover');
                    $53("div_company_mini").style.right = '0px';
			     	$53("div_company_mini").style.bottom = '0px';
                    if($minchat_style == 8) {
                        $53("mini_header_bg_div").style.backgroundImage = "url('$server_path/style/chat/minichat2/img/header_bg_dz82.png')"; 
						$53("hz6d_cname_mini_div").style.width = "140px";
						$53("hz6d_cname_mini_div").style.height = "18px";
						$53("hz6d_cname_mini_div").style.left="0px";
						$53("hz6d_cname_mini_div").style.top="11px";
						$53("hz6d_cname_mini_div").style.textIndent = "5px";
						t.style.top="13px";
						t.nextSibling.style.top="13px";
						t.nextSibling.nextSibling.style.top="13px";
                        return;       
                    }
                    
                    if($minchat_style == 9) {
                        $53("mini_header_bg_div").style.backgroundImage = "url('$server_path/style/chat/minichat2/img/header_bg2_5.png')";
						$53("mini_header_bg_div").style.borderTopLeftRadius = "5px";
                        $53("mini_header_bg_div").style.overflow = "hidden";
                        return;       
                    }
                    
                    if($minchat_style == 10) {
						$53("hz6d_cname_mini_div").style.left="10px";
                        $53("mini_header_bg_div").style.backgroundImage = "url('$server_path/style/chat/minichat2/img/header_bg_dz10.png')";
						$53("mini_header_bg_div").previousSibling.previousSibling.previousSibling.style.backgroundImage = "url('$server_path/style/chat/minichat2/img/max_llt.png')";
						$53("mini_header_bg_div").style.borderTopLeftRadius = "10px";
                        $53("hz6d_cname_mini_div").style.width = "80px";
                        $53("mini_header_bg_div").style.overflow = "hidden";
                        return;       
                    }
                    
                    if($minchat_style == 11) {
                        $53("div_company_mini").style.width = "233px";
                        $53("mini_header_bg_div").style.backgroundImage = "url('$server_path/style/chat/minichat2/img/header_bg_dz11.png')";
                        t.onmouseover = function() {
                            t.style.background='url($server_path/style/chat/minichat2/img/maxto_2_3-1.png?2)';
                        }
                        t.onmouseout = function() {
                            t.style.background='url($server_path/style/chat/minichat2/img/maxto_2-3.png?2)';
                        };
						t.style.backgroundImage = "url('$server_path/style/chat/minichat2/img/maxto_2-3.png')";
                        $53("mini_header_bg_div").style.width = "233px";
                        $53("mini_header_bg_div").style.overflow = "hidden";       
                        return;       
                    }
                    
                    $53("mini_header_bg_div").style.backgroundImage = "url('$server_path/style/chat/minichat2/img/header_bg2_$interface_color.png')";
				}
				else
				{	
					hz6d_re_flashing(HZ6D_CONFIGSNEW.com_id);
					$53("iframe_company_mini_div").style.display = "";
					$53("div_company_mini").style.height = "378px";
					$53("div_company_mini").style.width = "403px";
					$53("hz6d_cname_mini_div").style.width = "330px";
					t.style.backgroundImage = "url('$server_path/style/chat/minichat2/img/min.png')";
					t.setAttribute('max_min','max');
					t.title = t.getAttribute('mini_narrow');
                    if(is_right=='l'){
                        var wid=document.documentElement.clientWidth;
                        var right=parseInt($talk_right);
                        right=wid-right-403;
                        $53("div_company_mini").style.right = right + 'px';
                        
                        }else{
                  		    $53("div_company_mini").style.right = "$talk_right" + 'px';}
                            if(is_top=='t'){
                                var hei=document.documentElement.clientHeight;
                                var bottom=parseInt($talk_bottom);
                                bottom=hei-bottom-378;
                                $53("div_company_mini").style.bottom = bottom + 'px';
                            }else{
                                $53("div_company_mini").style.bottom = "$talk_bottom"+ 'px';
                            }
			       }
                   
                   if($minchat_style == 8) {
                        $53("div_company_mini").style.height = "393px";
                        $53("div_company_mini").style.width = "320px";  
                        $53("hz6d_cname_mini_div").style.width = "230px";
						$53("hz6d_cname_mini_div").style.height = "18px";
						$53("hz6d_cname_mini_div").style.left="30px";
						$53("hz6d_cname_mini_div").style.top="18px";
						$53("hz6d_cname_mini_div").style.textIndent = "20px";
                        $53("mini_header_bg_div").style.backgroundImage = "url('$server_path/style/chat/minichat2/img/header_bg_dz8.png?1111')";
						$53("hz6d_cname_mini_div").nextSibling.style.top="20px";
						$53("hz6d_cname_mini_div").nextSibling.nextSibling.style.top="20px";
						$53("hz6d_cname_mini_div").nextSibling.nextSibling.nextSibling.style.top="20px";
                        return;
                   }
                   
                   if($minchat_style == 9) {
                        $53("div_company_mini").style.height = "393px";
                        $53("div_company_mini").style.width = "370px";  
						$53("hz6d_cname_mini_div").style.left="10px";
						$53("hz6d_cname_mini_div").style.top="8px";
						$53("hz6d_cname_mini_div").style.textIndent = "2px";
                        $53("mini_header_bg_div").style.backgroundImage = "url('$server_path/style/chat/minichat2/img/header_bg_dz9.png')";
                        return;
                   }
                   
                   if($minchat_style == 10) {
                        $53("div_company_mini").style.height = "423px";
                        $53("div_company_mini").style.width = "400px";  
						$53("hz6d_cname_mini_div").style.left="20px";
						$53("hz6d_cname_mini_div").style.top="10px";
                        $53("hz6d_cname_mini_div").style.width = "230px";
						$53("hz6d_cname_mini_div").style.textIndent = "2px";
                        $53("mini_header_bg_div").style.backgroundImage = "url('$server_path/style/chat/minichat2/img/header_bg_dz10.png')";
						$53("mini_header_bg_div").previousSibling.previousSibling.previousSibling.style.backgroundImage = "url('$server_path/style/chat/minichat2/img/min_llt.png')";
                        return;
                   }
                   
                    if($minchat_style == 11) {
                        $53("hz6d_cname_mini_div").innerHTML="";
                        $53("div_company_mini").style.height = "375px";
                        $53("div_company_mini").style.width = "450px";               
                        $53("mini_header_bg_div").style.width = "450px";
                        $53("mini_header_bg_div").style.backgroundImage = "url('$server_path/style/chat/minichat2/img/header_bg_dz11.png?123')";
                        t.onmouseover = function() {
                            t.style.background='url($server_path/style/chat/minichat2/img/min_3_3.png?2)';
                        }
                        t.onmouseout = function() {
                            t.style.background='url($server_path/style/chat/minichat2/img/min_3.png?2)';
                        }
						t.style.backgroundImage = "url('$server_path/style/chat/minichat2/img/min_3.png?1')";
                        return;
                   }
                   
                   $53("mini_header_bg_div").style.backgroundImage = "url('$server_path/style/chat/minichat2/img/header_bg_$interface_color.png')";
                   
            }
			// 定时调用判断是否显示邀请框 
			function hz6d_checkIvt() { hz6d_showIvt(); }

			// 显示冻结层 
			function hz6d_showFreeze(){
				if(acc_freeze=="on"){
					var div = $53("hz6d_freeze_div");
					if(div==null){
						hz6d_createFreezeDiv();
					}else{
						div.style.display = "block";
					}
				}
			}

			// 创建冻结层 
			function hz6d_createFreezeDiv(){
				var div = document.createElement('DIV');
				div.id = 'hz6d_freeze_div';
				with(div.style){
					zIndex=6998;
					top='0px';
					left='0px';
					width='100%';
					height='100%';
					border='none';
					margin=padding=0;
					position='absolute';
					backgroundColor='#000';
					opacity='0.2';
					filter='alpha(opacity=20)';
					duration=1000;
				}
				document.body.insertBefore(div,document.body.firstChild);
				setInterval("hz6d_checkFreezeStyle()", 1);
			}
			
			var hz6d_maxPageWidth = 0;
			var hz6d_maxPageHeight = 0;
			// 定时调整冻结层大小 
			function hz6d_checkFreezeStyle(){
				try{
					var freeze = $53("hz6d_freeze_div");
					if(freeze!=null){
						var scroll = hz6d_getScrollPosition();
						var client = hz6d_getClientWindow();
						var w = client.width+scroll.sLeft;
						var h = client.height+scroll.sTop;
						if(w > hz6d_maxPageWidth){
							hz6d_maxPageWidth = w;
							freeze.style.width = hz6d_maxPageWidth+"px";
						}
						if(h > hz6d_maxPageHeight){
							hz6d_maxPageHeight = h;
							freeze.style.height = hz6d_maxPageHeight+"px";
						}
					}
				}catch(e){}
			}

			// 删除冻结层 
			function hz6d_destroyFreezeDiv(){
				try{
					var div = $53("hz6d_freeze_div");
					if(div!=null) { div.style.display = "none"; }
				}catch(e){}
			}

			// 显示邀请框 
			function hz6d_showIvt(){
				if(hz6d_isShowIvt()){
					if($53("kfivtwin").style.display=="none" && onliner_zdfq!=2 || acc_from_kf==true){
						acc_from_kf = false;
						get_ACCWindow();
						hz6d_setTotalNum();
						hz6d_setPageNum();
					}
				}
			}

			// 判断是否显示邀请框 
			function hz6d_isShowIvt(){
				if(acc_reinvite==1 && acc_from_kf==true) { return true; }
				if(acc_autotype==3){
					//点击接受或拒绝后不再弹出
					if(onliner_zdfq!=0){
						return false;
					}
				}
				if(!hz6d_overTotalNum()){
					if(hz6d_overPageNum()){
						return false;
					}
				}else{
					return false;
				}
				return true;
			}

			// 判断是否超过所有页面次数 
			function hz6d_overTotalNum(){
				if($53("kfivtwin").style.display!="none") return;
				if(acc_pop_total==1){
					var total_invite = $53.getCookie("invite_53kf_totalnum_$style_id");
					if(total_invite=="") { total_invite = 0; }
					if(total_invite>=acc_pop_totalnum) { return true; }
				}
				return false;
			}

			// 判断是否超过每个页面次数 
			function hz6d_overPageNum(){
				if($53("kfivtwin").style.display!="none") return;
				if(acc_pop_page==1){
					var page_invite = $53.getCookie(nowpage);
					if(page_invite=="") { page_invite = 0; }
					if(page_invite>=acc_pop_pagenum) { return true; }
				}
				return false;
			}

			// 设置所有页面弹出次数 
			function hz6d_setTotalNum()
			{
				var total_invite = $53.getCookie("invite_53kf_totalnum_$style_id");
				if(total_invite=="") { total_invite = 0; }
				total_invite++;
				document.cookie = "invite_53kf_totalnum_$style_id="+total_invite;
			}
			
			// 设置每个页面弹出次数 
			function hz6d_setPageNum()
			{
				var page_invite = $53.getCookie(nowpage);
				if(page_invite=="") { page_invite = 0; }
				page_invite++;
				document.cookie = nowpage+"="+page_invite;
			}
			
			// 隐藏邀请框 
			function hidden_ivt()
			{
				if(acc_poptype==1) {
					document.cookie = "onliner_zdfq{$companyid}="+onliner_zdfq;
					document.cookie = "my_acc_reauto_time=" + new Date().getTime() + ";path=/";
				} else {
					document.cookie = "my_acc_reauto_time=null;path=/";
				}
				try{ $53("kfiframe").style.display = "none"; }catch(e){}
				try{ hidden_ACCWindow(); }catch(e){}
				hz6d_destroyFreezeDiv();
				try{ force_kf = ""; }catch(e){}
			}
			
			function hz6d_haveMIn(){
				if('1' == $webclient_min && $53("hz6d_mnkh_content").style.display=="none" ){//&& onliner_zdfq!=2
						acc_from_kf=false;
						hz6d_showContent();
						force_kf = "";
						onliner_zdfq = 2;
						hidden_ivt();
						hz6d_setTotalNum();
						hz6d_setPageNum();
				}else if($53("div_company_mini").style.display=="none" ){//onliner_zdfq!=2
						acc_from_kf=false;
						get_location(acc_chattype);
						hz6d_setTotalNum();
						hz6d_setPageNum();
				}
			}
			
			function hz6d_showIvt3(){
				if(hz6d_isShowIvt()){
					var time=setInterval(function () {
						if('1' == $webclient_min && $53("hz6d_mnkh_content")){
							hz6d_haveMIn();
							clearInterval(time);
						}else if($53("div_company_mini")){
							hz6d_haveMIn();
							clearInterval(time);
						}
					},1000);
				}
			}
			
			function hz6d_deteWindow(){
				if(hz6d_isShowIvt()){
					if(chatWindow==null || chatWindow.closed==true){
						acc_from_kf=false;
						get_location(acc_chattype);
						hz6d_setTotalNum();
						hz6d_setPageNum();
					}
				}else{
					clearInterval(deteTime);
				}
			}
			
			function hz6d_showIvt2 () {
				deteTime = setInterval(function () {hz6d_deteWindow();},acc_reauto_time);
			}
			
			function hz6d_startReautoTimer2(acc_chattype){
				if(acc_chattype==3){
					hz6d_showIvt3();
				}
				if(acc_chattype==2){
					hz6d_showIvt2();
				}
				if(acc_chattype==1){
					if(hz6d_isShowIvt()){
						get_location(acc_chattype);
						hz6d_setTotalNum();
						hz6d_setPageNum();
					}
				}
			}
			
			// 加载后是否显示邀请框 
			function hz6d_LoadToShowIvt()
			{
				if(acc_poptype==1)
				{
					setTimeout("hz6d_checkIvt()", acc_poptime);
				}
				else if(acc_poptype==2)//&& onliner_zdfq!=2
				{	
					setTimeout(function () {hz6d_startReautoTimer2(acc_chattype);}, acc_poptime);
				}
			}
			//同一个域下处理cookie 改变延迟时间
			var my_acc_reauto_time_cookie = $53.getCookie('my_acc_reauto_time');
			if(my_acc_reauto_time_cookie) {
				acc_poptime = acc_reauto_time - (new Date().getTime() - my_acc_reauto_time_cookie);
			}
			//查询link表，判断是否已有客服在线，建立对话
			if($isonline==1 || "$ivt_off"=="on"){
				hz6d_sendACC();
				hz6d_LoadToShowIvt();
			}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			
			var hz6d_company_mini = null;
			// 强制对话 
			function get_location(type){
				// type:1 覆盖本窗口 2 新窗口 如果被拦截，则本窗口刷新 3 悬浮对话窗口 
				try{
					var openurl = "$openurl"+force_kf;
					if(type==1){
						location.href = openurl;
					}else if(type==2){
						try{
							chatWindow = window.open(openurl,"","height=$company_tpl_height,width=$company_tpl_width,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable=$resize,scrollbars=no,location=no,titlebar=no");
							if(chatWindow==null){
								location.href = openurl + '&timeStamp=' + new Date().getTime();
							}else{
								chatWindow.focus();
								chatWindow.opener = window;
							}
						}catch(e){
							location.href = openurl + '&timeStamp=' + new Date().getTime();	// 傲游 
						}
					}else{
						if('1' == $webclient_min){
						acpt_force_kf(force_kf);
							var timer=setInterval(function () {
								if($53("hz6d_mnkh_content")){
									hz6d_showContent();
									clearInterval(timer);
								}
							},100);
						}else{
							var openurl_mini = openurl;
							var tpl = "";
							if(openurl_mini.match(/&tpl=[^&]*/gim)!=null){
								openurl_mini = openurl_mini.replace(/&tpl=[^&]*/gim, "&tpl=minichat2");
							}else{
								tpl = "&tpl=minichat2";
							}
							$53("iframe_company_mini").src = openurl_mini + tpl + '&timeStamp=' + new Date().getTime()+'&interface_color=$interface_color&interface_theme=$interface_theme&minchat_style=$minchat_style';
							var div = $53("div_company_mini");
							hz6d_company_mini = new hz6d_div_scroll(div);
							hz6d_company_mini.start();
							div.style.display = "";
						}
					}
					force_kf = "";
					onliner_zdfq = 2;
					hidden_ivt();
				}catch(e){}
			}
			// 悬浮邀请框滚动 
			function hz6d_div_scroll(d){
				var self = this;
				this.div = d;
				this.right = 0;
				this.bottom = 0;
				this.timer = 0;
				this.posX=this.posY=this.posR=this.posB=0;
				this.scrollX=this.scrollY=false;

				this.start = function(){
					this.goPosition();
					this.timer = setInterval(this.scroll, 10);
					this.move();
				}
				this.stop = function(){
					if(this.timer!=0){ clearInterval(this.timer); }
				}
				this.goPosition = function(){
					this.right = $talk_right;
					this.bottom = $talk_bottom;
                                        if(is_right=='l')
                                        {
                                            var wid=document.documentElement.clientWidth;
                                            var right=parseInt(this.right);
                                            right=wid-right-403;
                                            this.div.style.right = right + "px";}
                                        else
                                        {
                                            this.div.style.right = this.right + "px";}
                                        if(is_top=='t')
                                        {
                                            var hei=document.documentElement.clientHeight; 
                                            var bottom=parseInt(this.bottom);
                                            bottom=hei-bottom-378;
                                            this.div.style.bottom = bottom + "px";}
                                        else
                                        {
                                            this.div.style.bottom = this.bottom + "px";}
				}
				this.scroll = function(){
				    
					var scroll = hz6d_getScrollPosition();
					var cur_right = -scroll.sLeft;
					var cur_bottom = -scroll.sTop;
				}
				this.move = function(){
					this.div.onmousedown = function(e){
						if(!e) e = window.event; //如果是IE 
						self.posX = e.clientX;
						self.posY = e.clientY;
						self.posR = parseInt(self.div.style.right);
						self.posB = parseInt(self.div.style.bottom);
						if(self.div.setCapture){
							self.div.setCapture();
						}else if(window.captureEvents){
							window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
						}
						var d = document;
						d.onmousemove = function(ev){
							if(!ev) ev = window.event; //如果是IE 
							self.div.style.right = (self.posR - (ev.clientX - self.posX)) + "px";
							self.div.style.bottom = (self.posB - (ev.clientY - self.posY)) + "px";
						}
						d.onmouseup = function(){
							if(self.div.releaseCapture){
								self.div.releaseCapture();
							}else if(window.captureEvents){
								window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
							}
							d.onmousemove = null;
							d.onmouseup = null;
						}
					}
				}
			}
			// 关闭悬浮框 
			function close_company_mini(){
				if(acc_autotype == 3) {document.cookie = "onliner_zdfq{$companyid}="+onliner_zdfq;}
				$53("div_company_mini").style.display = "none";
				$53("iframe_company_mini").src = "";
				hz6d_company_mini.stop();
				if(acc_reauto==1 && acc_poptype==2){
					setTimeout(function () {hz6d_showIvt3();},acc_reauto_time);
				}
				//添加cookie 实现整个域读取
				if(acc_reauto == 1) {
					document.cookie = "my_acc_reauto_time=" + new Date().getTime() + ";path=/";
				} else { //没有反复开启弹出窗口  删除cookie
					document.cookie = "my_acc_reauto_time=null;path=/";
				}
			}

			var ivt_top = 0;
			var ivt_left = 0;

			var ivt_width="$width_num";
			var ivt_height="$height_num";

			var hz6d_effect_time = 200;
			var hz6d_effect_timer = 10;
                        //获取邀请框的宽高
                        function get_wh(){
                            var ivt_obj=document.getElementById("acc_title").getElementsByTagName("div");
                            var ivt_width=0;
                            var ivt_height=0;
                            for(var i=0;i<ivt_obj.length;i++){
                                var width=parseInt((ivt_obj[i].style.width).replace(/px/ig,""));
                                var height=parseInt((ivt_obj[i].style.height).replace(/px/ig,""));
                                if(width>ivt_width) ivt_width=width;
                                if(height>ivt_height) ivt_height=height;
                            }
                            return {"width":ivt_width,"height":ivt_height};
                         }
			// 显示邀请框 
			function get_ACCWindow(){
				var ivtPosition = hz6d_getIvtPosition();

				if(zdyivt==1){
					ivt_height_init = zdyivt_height;
					ivt_width_init = zdyivt_width;
				}else{
					ivt_height_init = "$ivt_height";
					ivt_width_init = "$ivt_width";
				}
				$53("kfivtwin").style.height = ivt_height_init;
				$53("kfivtwin").style.width = ivt_width_init;

				try{
					$53("kfivtwin").style.zIndex = "10088";
					$53("kfivtwin").style.fontSize = "$ivt_fontsize";
					$53("kfivtwin").style.position = "absolute";
					if(how_float==1 && hasdoctype) $53("kfivtwin").style.position = "fixed";

					$53("kfiframe").style.width = $53("kfivtwin").clientWidth + $iframe_add_width + "px";
					$53("kfiframe").style.height = $53("kfivtwin").clientHeight + $iframe_add_height + "px";
					$53("kfiframe").style.position = "absolute";
					if(how_float==1 && hasdoctype) $53("kfiframe").style.position = "fixed";
					$53("kfiframe").style.filter = "alpha(opacity=1)";
					$53("kfiframe").style.display = "";
				}catch(e){}

				var openurl = "$openurl" + force_kf;
				if(is_autoyqk == 1){
					once_autoyqk = Number(once_autoyqk) + 1;
					if(once_autoyqk == 1){
						try{
							acc_content = $53("hz6d_acc_content").innerHTML;
						}catch(e){}
					}
					if(man_content!=""){
						try{
							$53("hz6d_acc_content").innerHTML = man_content.replace(/\"/g, '&quot;').replace(/\'/g, '&#039;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
						}catch(e){}
						man_content = "";
					}
					else{
						try{
							$53("hz6d_acc_content").innerHTML = acc_content;
						}catch(e){}
					}
				}
				else{
					if(man_content!=""){
						try{
							$53("hz6d_acc_content").innerHTML = man_content.replace(/\"/g, '&quot;').replace(/\'/g, '&#039;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
						}catch(e){}
						man_content = "";
					}else{
						try{
							$53("hz6d_acc_content").innerHTML = acc_content;
						}catch(e){}
					}
				}
				try{
					var isNew = hz6d_ivt_tpl.indexOf("new2011");
					if(zdyivt==1 || isNew>0){
						var zdyIds = document.getElementsByTagName("div");
						for(var i=0; i<zdyIds.length; i++){
							if(zdyIds[i].id=="hz6d_53kf_invite_acc"){
								zdyIds[i].onclick = function(){onliner_zdfq=2;window.open(openurl,"_blank","height=473,width=703,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable={$resize},scrollbars=no,location=no,titlebar=no");hidden_ivt();}
							}
						}
					}else{
						$53("hz6d_53kf_invite_acc").onclick = function(){onliner_zdfq=2;window.open(openurl,"_blank","height=473,width=703,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable={$resize},scrollbars=no,location=no,titlebar=no");hidden_ivt();}
					}
				}catch(e){}
				
				function hz6d_open_move(iconDivMain){
					var obj = $53("kfivtwin");
					obj.style.display = "block";
					var obj_height = obj.offsetHeight;
					var obj_width = obj.offsetWidth;
					obj.style.display = "none";

					var tb_top = parseInt(iconDivMain.style.top.replace("px",""));
					var tb_left = parseInt(iconDivMain.style.left.replace("px",""));
					var tb_width = parseInt(iconDivMain.style.width.replace("px",""));
					var tb_height = parseInt(iconDivMain.style.height.replace("px",""));

					obj = $53("kfivteffect");
					obj.style.top = tb_top + "px";
					obj.style.left = tb_left + "px";
					obj.style.height = tb_height + "px";
					obj.style.width = tb_width + "px";
					obj.style.display = "block";

					var moveHeight = tb_height;
					var moveWidth	= tb_width;
					var moveTop		= tb_top;
					var moveLeft	 = tb_left;

					var offTop		 = Math.abs(tb_top-ivtPosition.top);
					var offLeft		= Math.abs(tb_left-ivtPosition.left);

					var topStep		= offTop/(hz6d_effect_time/hz6d_effect_timer);
					var leftStep	 = offLeft/(hz6d_effect_time/hz6d_effect_timer);

					var heightStep = (obj_height-tb_height)/(hz6d_effect_time/hz6d_effect_timer);
					var widthStep	= (obj_width-tb_width)/(hz6d_effect_time/hz6d_effect_timer);

					var topD = 1;
					if(tb_top-ivtPosition.top>0) { topD=-1; }
					var leftD = 1;
					if(tb_left-ivtPosition.left>0) { leftD=-1; }

					function dmove(){
						moveHeight += heightStep;
						moveWidth	+= widthStep;
						moveTop		+= topD*topStep;
						moveLeft	 += leftD*leftStep;

						if(moveWidth>obj_width){
							obj.style.display = "none";
							clearInterval(iIntervalId);
							hz6d_showIvtWindow();
						}else{
							var ivtPosition_t = hz6d_getIvtPosition();
							obj.style.height = moveHeight + 'px';
							obj.style.width = moveWidth + 'px';
							obj.style.top = moveTop + (ivtPosition_t.top-ivtPosition.top) + 'px';
							obj.style.left = moveLeft + (ivtPosition_t.left-ivtPosition.left) + 'px';
						}
					}
					var iIntervalId = setInterval(dmove, hz6d_effect_timer);
					try{iconDivMain.style.display = "none";}catch(e){}
				}
				
				if(hz6d_ivt_effect==1 && hz6d_kf_type==2 && hz6d_pos_model==1 && hz6d_hidden==0){
					hz6d_checkIconDivMain();
				}else{
					hz6d_showIvtWindow();
				}

				function hz6d_showIvtWindow(){
					var ivtPosition_t = hz6d_getIvtPosition();
					if(how_float==1) var ivtPosition_t = hz6d_getIvtFixedPosition();
					hz6d_setIvtTop(ivtPosition_t.top);
					hz6d_setIvtLeft(ivtPosition_t.left);
					$53("kfivtwin").style.display = "block";
					hz6d_initScrollPosition();
					hz6d_showFreeze();
					hz6d_startScrollTimer();
				}
				function hz6d_setIvtTop(top){
					$53("kfivtwin").style.top = top + "px";
					$53("kfiframe").style.top = top + "px";
				}
				function hz6d_setIvtLeft(left){
					$53("kfivtwin").style.left = left + "px";
					$53("kfiframe").style.left = left + "px";
				}
				function hz6d_initScrollPosition(){
					var scrollPosition = hz6d_getScrollPosition();
					ivt_top = scrollPosition.sTop;
					ivt_left = scrollPosition.sLeft;
				}
				function hz6d_checkIconDivMain(){
					var iconDivMain = $53("iconDivMain"+kf_icon_id);
					if(iconDivMain!=null){
						if(hz6d_close_icon==0){
							hz6d_open_move(iconDivMain);
						}else{
							hz6d_showIvtWindow();
						}
					}else{
						setTimeout(hz6d_checkIconDivMain, 100);
					}
				}
				function hz6d_startScrollTimer(){
					if(ivt_timer==0 && how_float!=1){
						if(browser=="360" || browser=="TheWorld"){
							ivt_timer = window.setInterval("ivt_autoScroll()", 500);
						}else{
							ivt_timer = window.setInterval("ivt_autoScroll()", 10);
						}
					}
				}

				var posX;
				var posY;
				fdiv = $53("kfivtwin");
				$53("acc_title").onmousedown=function(e){
					if(!e) e = window.event;	 //如果是IE 
					posX = e.clientX - parseInt(fdiv.style.left);
					posY = e.clientY - parseInt(fdiv.style.top);
					document.onmousemove = mousemove;					
				}
				document.onmouseup = function(){
					document.onmousemove = null;
				}
				function mousemove(ev){
					if(ev==null) ev = window.event;//如果是IE 
					fdiv.style.left = (ev.clientX - posX) + "px";
					fdiv.style.top = (ev.clientY - posY) + "px";
					ivt_top = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
					ivt_left = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
					
					// if(ivt_top==0) { ivt_top = document.documentElement.scrollTop; }
					// if(ivt_left==0) { ivt_left = document.documentElement.scrollLeft; }
				}
			}

			function hidden_ACCWindow(){
				function hz6d_close_move(iconDivMain){
					var obj = $53("kfivtwin");
					var obj_height = obj.offsetHeight;
					var obj_width = obj.offsetWidth;
					var ivtPosition = {top:obj.offsetTop,left:obj.offsetLeft};
					if(how_float==1) var ivtPosition = hz6d_getIvtPosition();
					obj.style.display = "none";

					var tb_top = parseInt(iconDivMain.style.top.replace("px",""));
					var tb_left = parseInt(iconDivMain.style.left.replace("px",""));
					var tb_width = parseInt(iconDivMain.style.width.replace("px",""));
					var tb_height = parseInt(iconDivMain.style.height.replace("px",""));

					obj = $53("kfivteffect");
					obj.style.top = ivtPosition.top + "px";
					obj.style.left = ivtPosition.left + "px";
					obj.style.height = obj_height + "px";
					obj.style.width = obj_width + "px";
					obj.style.display = "block";

					var moveHeight = obj_height;
					var moveWidth	= obj_width;
					var moveTop		= ivtPosition.top;
					var moveLeft	 = ivtPosition.left;

					var offTop		 = Math.abs(tb_top-ivtPosition.top);
					var offLeft		= Math.abs(tb_left-ivtPosition.left);

					var topStep		= offTop/(hz6d_effect_time/hz6d_effect_timer);
					var leftStep	 = offLeft/(hz6d_effect_time/hz6d_effect_timer);

					var heightStep = (obj_height-tb_height)/(hz6d_effect_time/hz6d_effect_timer);
					var widthStep	= (obj_width-tb_width)/(hz6d_effect_time/hz6d_effect_timer);

					var topD = 1;
					if(tb_top-ivtPosition.top>0) { topD=-1; }
					var leftD = 1;
					if(tb_left-ivtPosition.left>0) { leftD=-1; }

					ivtPosition = hz6d_getIvtPosition();
					function dmove()
					{
						moveHeight -= heightStep;
						moveWidth	-= widthStep;
						moveTop		-= topD*topStep;
						moveLeft	 -= leftD*leftStep;

						if(moveWidth<tb_width){
							obj.style.display = "none";
							try{iconDivMain.style.display = "block";}catch(e){}
							clearInterval(iIntervalId);
							hz6d_startReautoTimer();
						}else{
							var ivtPosition_t = hz6d_getIvtPosition();
							obj.style.height = moveHeight + 'px';
							obj.style.width = moveWidth + 'px';
							obj.style.top = moveTop + (ivtPosition_t.top-ivtPosition.top) + 'px';
							obj.style.left = moveLeft + (ivtPosition_t.left-ivtPosition.left) + 'px';
						}
					}
					var iIntervalId = setInterval(dmove, hz6d_effect_timer);
				}
				if(hz6d_ivt_effect==1 && hz6d_kf_type==2 && hz6d_pos_model==1 && hz6d_hidden==0){
					var iconDivMain = $53("iconDivMain"+kf_icon_id);
					if(hz6d_close_icon==0){
						hz6d_close_move(iconDivMain);
					}else{
						$53("kfivtwin").style.display = "none";
						hz6d_startReautoTimer();
					}
				}else{
					$53("kfivtwin").style.display = "none";
					hz6d_startReautoTimer();
				}
			}

			function hz6d_startReautoTimer(){
				if(acc_reauto==1 && acc_poptype==1) { setTimeout("hz6d_checkIvt()", acc_reauto_time); }
			}

			// get ivt fixed position 
			function hz6d_getIvtFixedPosition(){
				var clientRect = hz6d_getClientWindow();

				if(ivt_height=="auto") { ivt_height="200"; }
				if(zdyivt==1){
					ivt_width = zdyivt_width.replace("px","");
					ivt_height = zdyivt_height.replace("px","");
				}
				if(acc_middle==1){
					acc_lr = 1;
					acc_tb = 1;
                                        var ivt_wh=get_wh();
					acc_left = (clientRect.width-ivt_wh.width)/2;
					acc_top = (clientRect.height-ivt_wh.height)/2-40;  
				}

				if(acc_lr==2){
					var ivt_left_init = clientRect.width - acc_left - ivt_width;
				}else{
					var ivt_left_init = acc_left;
				}
				if(acc_tb==2){
					var ivt_top_init = clientRect.height - acc_top - ivt_height;
				}else{
					var ivt_top_init = acc_top;
				}
				return {top:ivt_top_init, left:ivt_left_init};
			}

			// get ivt position 
			function hz6d_getIvtPosition(){
				var clientRect = hz6d_getClientWindow();
				
				if(ivt_height=="auto") {
					if(height_new == 0 || height_new == ''){
					ivt_height="200";	
					}else{
					ivt_height=height_new; 
					}
				}
				if(zdyivt==1){
					ivt_width = zdyivt_width.replace("px","");
					ivt_height = zdyivt_height.replace("px","");
				}
				if(acc_middle==1){
					acc_lr = 1;
					acc_tb = 1;
                                        var ivt_wh=get_wh();
					acc_left = (clientRect.width-ivt_wh.width)/2;
					acc_top = (clientRect.height-ivt_wh.height)/2-40;
				}

				var scrollPosition = hz6d_getScrollPosition();
				if(acc_lr==2){
					var ivt_left_init = scrollPosition.sLeft + clientRect.width - acc_left - ivt_width;
				}else{
					var ivt_left_init = acc_left + scrollPosition.sLeft;
				}
				if(acc_tb==2){
					var ivt_top_init = clientRect.height + scrollPosition.sTop - acc_top - ivt_height;
				}else{
					var ivt_top_init = acc_top + scrollPosition.sTop;
				}
				return {top:ivt_top_init, left:ivt_left_init};
			}
			
			// get scroll position 
			function hz6d_getScrollPosition(){
				var s_top = document.body.scrollTop;
				var s_left = document.body.scrollLeft;
				if(s_left==0) { s_left=document.documentElement.scrollLeft; }
				if(s_top==0) { s_top=document.documentElement.scrollTop; }
				return {sTop:s_top, sLeft:s_left};
			}

			// get client width height 
			function hz6d_getClientWindow(){
				var clientWidth = 0;
				var clientHeight = 0;
				if(document.documentElement && document.documentElement.scrollTop){ 
					clientWidth = document.documentElement.clientWidth; 
					clientHeight = document.documentElement.clientHeight; 
				}else if(document.body){
					clientWidth = document.body.clientWidth;
					clientHeight = document.body.clientHeight;
				}
				if(hasdoctype){
					clientHeight = document.documentElement.clientHeight;
					clientWidth = document.documentElement.clientWidth;
				}
				return {width:clientWidth, height:clientHeight};
			}
			
			// old client height width 
			var hz6d_oldClient = hz6d_getClientWindow();
			function ivt_autoScroll(){
				var scrollPosition = hz6d_getScrollPosition();
				// new client height width 
				var hz6d_newClient = hz6d_getClientWindow();

				var hz6d_kfivtwin = $53("kfivtwin");
				var hz6d_kfiframe = $53("kfiframe");
				
				// top change 
				if(scrollPosition.sTop!=ivt_top || hz6d_oldClient.height!=hz6d_newClient.height){
					if(scrollPosition.sTop!=ivt_top){
						if(browser=="360" || browser=="TheWorld"){
							ivt_top = scrollPosition.sTop;
						}else{
							ivt_top = smoothMove(ivt_top, scrollPosition.sTop);
						}
					}
					if(hz6d_oldClient.height!=hz6d_newClient.height){
						if(browser=="360" || browser=="TheWorld"){
							hz6d_oldClient.height = hz6d_newClient.height;
						}else{
							hz6d_oldClient.height = smoothMove(hz6d_oldClient.height, hz6d_newClient.height);
						}
					}
					var hz6d_ivt_top = 0;
					if(acc_tb==2){
						hz6d_ivt_top = hz6d_oldClient.height - acc_top - ivt_height + ivt_top;
					}else{
						hz6d_ivt_top = acc_top + ivt_top;
					}

					if(browser=="360" || browser=="TheWorld"){
						if(hz6d_kfivtwin.style.display=="none"){
							hz6d_recover = false;
						}else{
							hz6d_recover = true;
							hz6d_kfivtwin.style.display = "none";
							try{
								hz6d_kfiframe.style.display = "none";
							}catch(e){}
						}
						hz6d_kfivtwin.style.top = hz6d_ivt_top+"px";
						try{
							hz6d_kfiframe.style.top = hz6d_ivt_top+"px";
						}catch(e){}
						if(hz6d_recover==true){
							hz6d_kfivtwin.style.display = "block";
							try{
								hz6d_kfiframe.style.display = "block";
							}catch(e){}
						}
					}else{
						hz6d_kfivtwin.style.top = hz6d_ivt_top+"px";
						try{
							hz6d_kfiframe.style.top = hz6d_ivt_top+"px";
						}catch(e){}
					}
				}
				
				// left change 
				if(scrollPosition.sLeft!=ivt_left || hz6d_oldClient.width!=hz6d_newClient.width){
					if(scrollPosition.sLeft!=ivt_left){
						if(browser=="360" || browser=="TheWorld"){
							ivt_left = scrollPosition.sLeft;
						}else{
							ivt_left = smoothMove(ivt_left, scrollPosition.sLeft);
						}
					}
					if(hz6d_oldClient.width!=hz6d_newClient.width){
						if(browser=="360" || browser=="TheWorld"){
							hz6d_oldClient.width = hz6d_newClient.width;
						}else{
							hz6d_oldClient.width = smoothMove(hz6d_oldClient.width, hz6d_newClient.width);
						}
					}
					var hz6d_ivt_left = 0;
					if(acc_lr==2){
						hz6d_ivt_left = ivt_left + hz6d_oldClient.width - acc_left - ivt_width;
					}else{
						hz6d_ivt_left = acc_left + ivt_left;
					}
					
					if(browser=="360" || browser=="TheWorld"){
						if(hz6d_kfivtwin.style.display=="none"){
							hz6d_recover = false;
						}else{
							hz6d_recover = true;
							hz6d_kfivtwin.style.display = "none";
							try{
								hz6d_kfiframe.style.display = "none";
							}catch(e){}
						}
						hz6d_kfivtwin.style.left = hz6d_ivt_left+"px";
						try{
							hz6d_kfiframe.style.left = hz6d_ivt_left+"px";
						}catch(e){}
						if(hz6d_recover==true){
							hz6d_kfivtwin.style.display = "block";
							try{
								hz6d_kfiframe.style.display = "block";
							}catch(e){}
						}
					}else{
						hz6d_kfivtwin.style.left = hz6d_ivt_left+"px";
						try{
							hz6d_kfiframe.style.left = hz6d_ivt_left+"px";
						}catch(e){}
					}
				}
			}
			//替换连接 new
			function ivt_seturl(zdy_yqk)
			{
				var divs_str = zdy_yqk.replace(/operating="([^"]*)"/g,function(str){
					var vals = str.split('"');
					if(vals[1])
					{
						var click_str = '';
						var link_str ='';
						var target_str = '_blank';
						var hrs = '';
						var valst = vals[1].split("|");
						switch(valst[0])
						{
							case 'KF': 
								case 'KF': var click_open_url = 'window.open(\"$openurl\",\"_blank\",\"height=473,width=703,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable=$resize,scrollbars=no,location=no,titlebar=no\")';
								click_open_url = encodeURIComponent(click_open_url);
								click_str ='onliner_zdfq=2;hz6d_is_exist(\"'+click_open_url+'\");hidden_ivt();';break;
								//click_str ='onliner_zdfq=2;get_open_start();window.open(\"$openurl\",\"_blank\",\"height=473,width=703,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable=$resize,scrollbars=no,location=no,titlebar=no\");hidden_ivt();';break;
							case 'CLOSE': click_str = 'onliner_zdfq=3;hidden_ivt();'; break;
							case 'ETEL': click_str = 'window.open(\'$http://$master_host/eht.php?company_id=$companyid&style_id=$style_real_id\',\'_blank\',\'height=400,width=300,top=100,left=200,status=yes,toolbar=no,menubar=no,resizable=no,scrollbars=no,location=no,titlebar=no\')'; break;
							case 'QQ': 
								if(valst[1])
								{
									if(valst[1].toLowerCase().indexOf('biz') > -1)
									{
										var qq = valst[1].replace('biz','');
										link_str = '$http://$talk_host/bizqq.php?qq=' + qq + '&from=' + window.encodeURIComponent(window.location.href);
									}
									else
									{
										link_str = 'tencent://message/?uin=' + valst[1];
									}
									if(valst[1] == '97559766')
										link_str="http://www.53kf.com/?www.53rj.com";
								};
								break;
							case 'MSN': if (valst[1]) {link_str = 'msnim:chat?contact=' + valst[1]; if(valst[1].indexOf('fonlue') > -1) link_str='http://www.53kf.com/?www.53rj.com';} break;
							case 'WW': if (valst[1]) link_str = 'aliim://sendmsg?touid=cntaobao' + valst[1]; if(valst[1] == 'fonlue') link_str='http://www.53kf.com/?www.53rj.com'; break;
							case 'HYLINK': if (valst[1]) link_str = valst[1]; if(valst[2]) target_str = valst[2]; hrs = 1;break;
							default: click_str = '';link_str = '';
						}
						var onclick_str = '';
						if (link_str == '' && click_str != '') onclick_str = "onclick='" + click_str + ";'";
						else if (link_str != ''&& click_str != '') onclick_str = ' onclick="' + click_str + ';window.open(\'' + link_str +'\',\'' + target_str + '\');" ';
						else if (link_str != ''&& click_str == '' && !hrs) onclick_str = ' onclick="window.open(\'' + link_str +'\');" ';
						else if (link_str != ''&& click_str == '' && hrs) onclick_str = 'href="'+ link_str+'" target="'+ target_str +'"';
						return onclick_str;
					}
				});
				return divs_str;
			}
			if($isonline==0 && "$ivt_off"=="on" && acc_poptype==1){
				setTimeout("hz6d_checkIvt()", 500);
			}
			setTimeout(function(){
				var imgdragstart = function(){return false;};
				try {
					var hid_img = $53('kfivtwin').getElementsByTagName('img');
					for(i in hid_img)hid_img[i].ondragstart=imgdragstart;
					$53('acc_title').style.overflow = 'visible'; // 修正bug 
				} catch(e){}
			},2000);
HTML;
	}
}

// 接收$_GET参数
function get_value($get_name, $re = "")
{
	if (isset($_GET[$get_name]) && trim($_GET[$get_name]) != "")
	{
		$re = filterSQL(trim($_GET[$get_name]));
	}
	return $re;
}

// 获取特定风格值
function get_style_result($re, $style_id)
{
	$re2 = array();
	foreach ($re as $v)
	{
		if ($v["style_id"] == $style_id)
			$re2[] = $v;
	}
	return $re2;
}

// 获取设置值
function get_config_value($v_id, $v_value, $config_id, &$config_value)
{
	if ($v_id == $config_id)
	{
		if ($v_id == 'acc_content')
			$config_value = $v_value; //邀请语可以前后空格
		else
			$config_value = trim($v_value);
		return true;
	}
	return false;
}

// 设置是否风格锁定
function get_style_lock($stylename)
{
	global $agent_style_lock;
	foreach ($agent_style_lock as $vv)
	{
		if ($vv["stylename"] == $stylename)
			return true;
	}
	return false;
}

// 获取代理商的设置值
function get_agent_config_value($config_id, &$config_value)
{
	global $agent_config;
	foreach ($agent_config as $vv)
	{
		if ($vv["config_id"] == $config_id)
		{
			$config_value = trim($vv["config_value"]);
			return;
		}
	}
}

// 获取ip信息
function get_ip_info($ip)
{
	global $dblink;
	if ($dblink === false)
	{
		db_connect();
	}
	$oldip = $ip;

	$ip = parse_ip($ip);
	$c_name = str_replace("", ".", $ip);
	if (isset($_COOKIE[$c_name]) && $_COOKIE[$c_name] != "")
	{
		$c_value = explode(",", $_COOKIE[$c_name]);
		$r_value['area'] = $c_value[0];
		$r_value['isp'] = $c_value[1];
		return $r_value;
	}

	$res = ipinfo($oldip);
	if ($res === false)
	{
		return "";
	}
	setcookie($c_name, $res["area"] . "," . $res["isp"], time() + 3600 * 24, "/");
	return $res;
}

// 生成邀请框HTML
function get_ivt_str()
{
	global $cfg, $talk_host, $acc_title, $lang, $ivt_logo, $ivt_logo_com, $ivt_ip, $ivt_talk, $ivt_close, $resize, $http;

	$masterurl = "$http://" . $talk_host;
	$path = "$http://" . $talk_host;

	if (strpos($ivt_logo, "http://") === false)
	{
		$ivt_logo = "$http://" . $ivt_logo;
	}
	if (strpos($ivt_logo_com, "http://") === false)
	{
		$ivt_logo_com = "$http://" . $ivt_logo_com;
	}

	$acc_content = "acc_content";
	$openurl = "talk_openurl";

	eval("\$str=\"" . file_get_contents($cfg["ivt_tpl"]) . "\";");
	$str = str_replace("\r\n", "", $str);
	$str = str_replace("\r", "", $str);
	$str = str_replace("\n", "", $str);
	$str = mb_convert_encoding($str, "HTML-ENTITIES", "UTF-8");
	return $str;
}

// 生成自定义邀请框CSS
function get_div_str($csscontent, $zdyi)
{
	global $prefix_border;
	if ($csscontent == "")
	{
		return "";
	}
	$cssarr = explode(",", $csscontent);
	$cssstr = "";
	$charstr = "-";
	$css_element = "background-image: url(c_c),background-repeat: c_c,background-color: #c_c,-,font-size: c_cpx,color: #c_c,text-align:c_c,font-weight: c_c,font-style: c_c,text-decoration: c_c,width: c_cpx,height: c_cpx,left: c_cpx,top: c_cpx,z-index: c_c,border-style: c_c,border-width: c_cpx,border-color:#c_c,-,-,-,font-family:c_c";
	$re_data = array();
	$elementarr = explode(",", $css_element);
	for ($i = 0; $i < count($elementarr); $i++)
	{
		if ($i == 3 && $cssarr[$i] != '-')
		{
			$charstr = $cssarr[$i];
			$cssstr .= "line-height:120%;";
		} else
			if ($elementarr[$i] != "" && $elementarr[$i] != "-" && $cssarr[$i] != "" && $cssarr[$i] != '-')
			{
				if ($i == 0)
				{
					if (strpos($cssarr[$i], "http://") !== false)
					{
						$cssstr .= str_replace("c_c", $cssarr[$i], $elementarr[$i]) . ";";
					} else
					{
						$cssstr .= str_replace("c_c", "http://" . $_SERVER["HTTP_HOST"] . $cssarr[$i], $elementarr[$i]) . ";";
					}
				} else
				{
					$cssstr .= str_replace("c_c", $cssarr[$i], $elementarr[$i]) . ";";
				}
			}
		if (strpos($elementarr[$i], "border-width") !== false)
		{
			$prefix_border = $cssarr[$i];
			$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
			if (strpos($agent, 'firefox') !== false)
			{
				// do nothing
			} else
			{
				if ($cssarr[$i] != "-")
				{
					$cssstr .= "width:" . (intval($cssarr[10]) + 2 * intval($cssarr[$i])) . ";";
					$cssstr .= "height:" . (intval($cssarr[11]) + 2 * intval($cssarr[$i])) . ";";
				}
			}
		}
	}
	$re_data[0] = $cssstr;
	$re_data[1] = $charstr;
	$re_data[2] = $cssarr[18];
	$re_data[3] = $cssarr[19];
	$re_data[4] = $cssarr[20];
	if ($zdyi == 0)
	{
		$re_data[2] = $cssarr[10];
		$re_data[3] = $cssarr[11];
	}
	return $re_data;
}

// 是否已经开始对话
function has_talk()
{
	global $companyid;
	$has_talk = $_COOKIE['hz6d_open_talk_' . $companyid];

	if ($has_talk == "1")
	{
		return true;
	} else
	{
		return false;
	}
}

function get_module_value($module_id)
{

	return true;
}

?>
