

var  ss =new Date().getTime() ;
var kf_openurl_float="http://chat.5251.net/client.jsp?companyId=12243&style=26656&username=&locate=cn" +"&refer="+ escape(window.location.href);
var companyId = 12243;
//路径
var route = escape(window.location.href);
var kdocTitle = document.title;//标题 
if(kdocTitle == null){ 
    var t_titles = document.getElementByTagName("title") 
    if(t_titles && t_titles.length >0) 
    { 
       kdocTitle = t_titles[0]; 
    }else{ 
       kdocTitle = ""; 
    } 
} 

function setCookie(name, value, path, domain) {
  var oCookie = name + "=" + escape(value) +
      "; expires=Thu, 6 Jan 2100 12:01:01 UTC" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "");
  document.cookie = oCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return "";
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


var  now___  =  new  Date();  
var  kf_ss  =  now___.getTime() 

var temp_d = parseInt(Math.random() *10000);
var user_str = "" + kf_ss + "_" + temp_d;

var userid = getCookie("kf51_userid");
if(userid == "" || userid == null)
{
	
	setCookie("kf51_userid",user_str);
	userid = user_str ;	
}

var ref = document.referrer; 
var local_host = document.domain;
if(ref.indexOf(local_host) < 0)
{
	setCookie("kf51_referrer",ref);
}
kf_openurl_float += "&keyword="+escape(getCookie("kf51_referrer"))+ "&userid="+userid;

var showStr = "<iframe   style='position:absolute;z-index:8001;width:expression(this.nextSibling.offsetWidth);height:expression(this.nextSibling.offsetHeight);top:expression(this.nextSibling.offsetTop);left:expression(this.nextSibling.offsetLeft);' frameborder='0' ></iframe><div id=\"kf_5251\" style=\"z-index:8001;position:absolute;width:auto;height:auto;top:10px;left:10px;margin:0 0 0\" >";

	showStr = "<div id=\"kf_5251\" style=\"z-index:8001;position:absolute;width:auto;MARGIN:0px;height:auto;top:10px;left:10px;margin:0 0 0\" >";
	


showStr += "<table onmousedown='startDrag(this)' onmouseup='stopDrag(this)' onmousemove='drag(this)' width=\"auto\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";

  showStr += "<tr>";
    showStr += "<td height=\"17\">";
	showStr += "<div id=\"kf_5251_head\" style=\"width:auto;MARGIN:0px;height:15px; border:#006699 1px solid;border-bottom:none;background:url(http://img.5251.net/etel/image/bj04.jpg); line-height:16px;\">";
	   showStr += "<div style=\"width:17px; height:16px; MARGIN:0px;cursor:move; margin-left:5px; float:left;\"><img src=\"http://img.5251.net/etel/image/image1.jpg\" width=\"17\" height=\"16\" /></div>";
	   showStr += "<div style=\"width:64px; height:14px; MARGIN:0px;float:left; cursor:move; line-height:14px;\"><img src=\"http://img.5251.net/etel/image/image2.jpg\" width=\"64\" height=\"13\" /></div>";
	   	
	showStr += "</td></tr></table>";



showStr += "<div  style=\"width:auto; height:auto;MARGIN:0px; border:#006699 1px solid; background:#B4DCEF;\">";
     showStr += "<div style=\"width:auto; height:auto;MARGIN:0px; border:#FFFFFF 2px solid; background:url(http://img.5251.net/etel/image/bj03.jpg) repeat-y; margin:1px;\">";
	    showStr += "<div style=\"width:auto; height:auto;MARGIN:0px; background:url(http://img.5251.net/etel/image/bj03.jpg) repeat-y; margin:4px;\" align=\"center\">";

		   showStr += "<table  id=\"kf_5251_body\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" noWrap=\"1\">";
		   

					  showStr += "<tr><td height=\"17\" colspan=\"3\"align=\"center\" valign=\"middle\" background=\"http://img.5251.net/etel/image/bj02.jpg\"><span class=\"STYLE_51kf_12b\">&#x9500;&#x552e;&#x90e8;</span></td></tr>";
					  
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(13194)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">&#x5c0f;&#x52c7; </span></td><td><span class=\"STYLE_51kf_1O\"><img src=\"http://img.5251.net/etel/image/icon04b.jpg\" width=\"14\" height=\"15\" /></td><td nowrap style=\"cursor: pointer;\" onclick=\"open_chat_person(13194)\"><span class=\"STYLE_51kf_12\">&#x4ea4;&#x6d41;</span></span></td> </tr>";
					
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(13195)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">&#x5c0f;&#x5cf0; </span></td><td><span class=\"STYLE_51kf_1O\"><img src=\"http://img.5251.net/etel/image/icon04b.jpg\" width=\"14\" height=\"15\" /></td><td nowrap style=\"cursor: pointer;\" onclick=\"open_chat_person(13195)\"><span class=\"STYLE_51kf_12\">&#x4ea4;&#x6d41;</span></span></td> </tr>";
					
	showStr += "<tr><td height=\"34\"  colspan=\"3\" style=\"cursor: pointer;\" onclick=\"open_chat()\" align=\"center\" valign=\"middle\"><img src=\"http://img.5251.net/etel/image/icon06.gif\" width=\"88\" height=\"24\" /></td> </tr>";



  showStr += "<tr>  <td height=\"9\"  colspan=\"3\" align=\"center\" valign=\"bottom\"><img src=\"http://img.5251.net/etel/image/image0.jpg\" width=\"65\" height=\"9\" /></td> </tr>";
showStr += "</table>";
showStr += "</div></div></div></div>";

showStr += "<style type=\"text/css\">";
showStr += "<!--\n";
showStr += ".STYLE_51kf_1O {font-family: \"宋体\";font-size: 10px;}\n";
showStr += ".STYLE_51kf_11 {font-size: 11px}\n";
showStr += ".STYLE_51kf_12 {font-size: 12px;color: #000066; }\n";
showStr += ".STYLE_51kf_12b {font-family: \"宋体\"; font-size: 12px; color: #000066; font-weight: bold; }\n";
showStr += "-->\n</style>";



var alignx_float = 1;
var alignW_float =1;
var alignH_float =130;
var old_alignW = alignW_float;

var screen_width =  window.screen.availWidth;
var screen_hight = window.screen.availHeight;

alignLeft = alignW_float;

var re = "top:"+ alignH_float +"px;left:"+alignLeft+"px;"
//top:10px;left:10px;
if(alignx_float == 2)
{
	re = "top:"+ alignH_float +"px;left:" + (screen_width - alignLeft - 110) +"px;"
}
showStr = showStr.replace("top:10px;left:10px;",re);
//alert(showStr);
document.write(showStr);
document.getElementById("kf_5251_head").style.width = document.getElementById("kf_5251").offsetWidth+"px";

var ofloatip = document.getElementById("kf_5251");
var onload_float_Interval = window.setInterval(showKf,500);
var scrollChang = false;
var x0=0,y0=0,x1=0,y1=0,w0=0,h0=0,w1=0,h1=0;
var offx=6,offy=6,offw=6,offh=6;
var moveable=false,sizeable=false;
var hover='orange',normal='#EFF5FF',normalBorder='#79A7E2';//color;'#336699'
var index=10000;//z-index;

var count = 0
function showKf()
{
	if(moveable)
	return;

	var body_width = document.getElementById('kf_5251_body').offsetWidth ;

	var body_left = document.getElementById('kf_5251_body').offsetLeft ;

	var head_width = document.getElementById('kf_5251_head').style.width ;
	//document.getElementById('kf_5251_head').style.width = 
	if(body_width +16 < 115)
		document.getElementById('kf_5251_head').style.width =115;
	else
		document.getElementById('kf_5251_head').style.width =body_width +16;

		
		
		var diffY = document.documentElement.scrollTop;	
		var diffX = document.documentElement.scrollLeft ;
			
		if(diffY==0)
		{		
			diffY = document.body.scrollTop;
		}
		
		if(diffX==0)
		{		
			diffX = document.body.scrollLeft;
		}


		if (self.innerHeight) { // all except Explorer 
		screen_width = self.innerWidth; 
		screen_hight = self.innerHeight; 
		} 
		else if (document.documentElement && document.documentElement.clientHeight) { 
		// Explorer 6 Strict Mode 
		screen_width = document.documentElement.clientWidth; 
		screen_hight = document.documentElement.clientHeight; 
		} else if (document.body) { // other Explorers 
		screen_width = document.body.clientWidth; 
		screen_hight = document.body.clientHeight; 
		} 


	
	ofloatip.style.top = diffY + alignH_float + "px" ;
	

	try{
	
		if(document.getElementById("aotu").style.display == "" || document.getElementById("aotu").style.display == "block" )
		{
		
			var auto_top = document.getElementById("aotu").style.top
			var auto_width = document.getElementById("aotu").offsetWidth
			var auto_hight = document.getElementById("aotu").offsetHight
			if(typeof(auto_hight)=="undefined")
			auto_hight = 125;
			
			document.getElementById("aotu").style.top =(diffY + ( screen_hight  ) / 2 - (auto_hight)/2)+"px" ;

			if (document.all) 
			document.getElementById("aotu").style.left =   screen_width/2  - auto_width/2;

			
		}
	}
	catch(e){};
	

	if(ofloatip.style.display == "none")
	ofloatip.style.display = "";

	
	scrollChang = false;
	count++;

	
}
function open_chat()
{
	var chat_win= window.open(kf_openurl_float,'chat_12243','height=473,width=703,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable=no,scrollbars=no,location=no,titlebar=no');
	chat_win.focus();
	try{sendAndRecieve("/js/recieve.jsp?state=3&companyId="+companyId+"&sessionId="+userid);}catch(e){}	
}

function open_chat_person(workerid)
{
	var chat_win = window.open(kf_openurl_float+'&workId='+workerid+'&flag=3','chat_12243','height=473,width=703,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable=no,scrollbars=no,location=no,titlebar=no');

	chat_win.focus();
	try{sendAndRecieve("/js/recieve.jsp?state=4&companyId="+companyId+"&sessionId="+userid);}catch(e){}
}

function open_tel_chat(wiseid,seat)
{
    var etel_url = "http://etel.5251.net/etel/dial.jsp?wiseid=" + wiseid + "&seat=" + seat +"&com_name=%E4%BD%B0%E5%AE%9D%E7%BD%91%E7%BB%9C";
;
	var win = window.open(etel_url,'e_tel_chat','height=473,width=703,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable=no,scrollbars=no,location=no,titlebar=no');
	win.focus();
	
}

function hidden_float_div()
{	
	document.getElementById("kf_5251").style.display="none";
	try{clearInterval(onload_float_Interval);}catch(e){}
}


//开始拖动;
function startDrag(obj)
{
  if(event.button==1)
  {
    //锁定标题栏;
    obj.setCapture();
    //定义对象;
    var win = obj.parentNode;
   // var sha = eval("bg"+win.id);//win.nextSibling;
    //记录鼠标和层位置;
    x0 = event.clientX;
    y0 = event.clientY;
    x1 = parseInt(win.style.left);
    y1 = parseInt(win.style.top);
    //记录颜色;
    normal = obj.style.backgroundColor;
    //改变风格;
    obj.style.backgroundColor = '#FFEED3';//hover; 
    win.style.borderColor = hover;
    moveable = true;
  }
}
//拖动;
function drag(obj)
{
  if(moveable)
  {
    var win = obj.parentNode;
	change(win,y1 + event.clientY - y0,x1 + event.clientX - x0,0,0);
	
	
  }
}
//停止拖动;
function stopDrag(obj)
{
  if(moveable)
  {
    var win = obj.parentNode;
   // var sha = eval("bg"+win.id);//win.nextSibling;

    var msg = obj.nextSibling;
    win.style.borderColor     = "#79A7E2";//normal;
    obj.style.backgroundColor = normal;
    msg.style.color           = "#000000"//normal;

	obj.releaseCapture();
	//layout(obj);
    moveable = false;

	var diffY = document.body.scrollTop;	
	var diffX = document.body.scrollLeft; 
	if(diffY==0)
	{
		diffY = document.documentElement.scrollTop;	
		diffX = document.documentElement.scrollLeft;
	}

	alignH_float = ofloatip.offsetTop - diffY;
	alignW_float = ofloatip.offsetLeft - diffX
	//alert(diffX);
	//alert(alignW);
  }
}


function change(obj,top,left,width,height){
	//var sha = eval("bg"+obj.id);//obj.nextSibling;
	if (width!=0){
		obj.style.width=width;
		sha.style.width=width+6;

		var tmptitle=eval("idtitle"+obj.id);
		tmptitle.style.width=width-2*1;
		var tmptitlespan=eval("idspan"+obj.id);

		tmptitlespan.style.width=width-2*12-10;
		var tmpcon=eval("idcon"+obj.id);
		tmpcon.style.width=width-2*1;
	}
	if(height!=0){
		obj.style.height=height;
		//sha.style.height=height+6;

		var tmpcon=eval("idcon"+obj.id);
		tmpcon.style.height=height-20;
	}
	if(top!=0){
		obj.style.top=top;
		//sha.style.top=top-3;	
	}
	if(left!=0){
		obj.style.left=left;
		//sha.style.left=left-3;			
	}
	if (width!=0)
	{

		//改变信息宽度
		var tpmCou=parseInt((width-15)/fontWith)+1;
		//alert(tpmCou);
		var tmpA = obj.getElementsByTagName("A");
		var strttmpAs="";

		for (var i=0;i<tmpA.length;i++)
		{
			strttmpAs=tmpA[i].title;
			if (strttmpAs!="")
			{
				//alert(tpmCou);
				tmpA[i].innerText=strttmpAs.substr(0,tpmCou);
			}
			
	}
	}
}

function y_gVal(iz)
{var endstr=document.cookie.indexOf(";",iz);if(endstr==-1) endstr=document.cookie.length;return document.cookie.substring(iz,endstr);}
function y_g(name)
{var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;var j;while(i<clen) {j=i+alen;if(document.cookie.substring(i,j)==arg) return y_gVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0) break;}return null;}
function cc_k()
{var y_e=new Date();var y_t=31104000000;var yesvisitor=1000*36000;var yesctime=y_e.getTime();y_e.setTime(y_e.getTime()+y_t);var yesiz=document.cookie.indexOf("cck_lasttime");if(yesiz==-1){document.cookie="cck_lasttime="+yesctime+"; expires=" + y_e.toGMTString() +  "; path=/";document.cookie="cck_count=0; expires=" + y_e.toGMTString() +  "; path=/";return 0;}else{var y_c1=y_g("cck_lasttime");var y_c2=y_g("cck_count");y_c1=parseInt(y_c1);y_c2=parseInt(y_c2);y_c3=yesctime-y_c1;if(y_c3>yesvisitor){y_c2=y_c2+1;document.cookie="cck_lasttime="+yesctime+"; expires="+y_e.toGMTString()+"; path=/";document.cookie="cck_count="+y_c2+"; expires="+y_e.toGMTString()+"; path=/";}return y_c2;}}
var yesdata;
yesdata='companyId=12243&userid='+userid+'&refe='+escape(document.referrer)+'&location='+escape(document.location)+'&color='+screen.colorDepth+'x&resolution='+screen.width+'x'+screen.height+'&returning='+cc_k()+'&language='+navigator.systemLanguage+'&ua='+escape(navigator.userAgent)+'&ip=';
var host_stat = document.domain;
var refe_stat = document.referrer;
if(refe_stat == null)refe_stat= "";
var pos = refe_stat.indexOf(host_stat);

if( refe_stat == "" || pos == -1 )
{
	js_src = "http://etel.5251.net/stat.jsp?" +yesdata;
	var script=document.createElement("script");
	script.type='text/javascript';
	script.language='javascript';
	script.src=js_src;
	document.getElementsByTagName("head")[0].appendChild(script);
}
	





		var work_id=0;



			
		var kf_openurl_auto="http://chat.5251.net/client.jsp?companyId=12243&style=26656&username=&locate=cn" +"&refer="+ escape(window.location.href);
		
		function set51KfCookie(name, value) 
		{
			var date =new Date();
			date.setTime(date.getTime()+1*3600*1000*24);
			var oCookie = name + "=" + escape(value) + ";expires="+date.toGMTString();
			document.cookie = oCookie;
		}
		function getTime()
		{
			 var dd=new Date();
			 return Math.floor(dd.getTime()/1000);
		}
		var starttime = getTime();
		var auto_has_show = false;
		//kf_openurl_auto += "&keyword="+escape(getCookie("kf51_referrer"));
		kf_openurl_auto += "&keyword="+escape(getCookie("kf51_referrer"))+ "&userid="+userid;

		var auto_invite_type = "2"; 
		var is_auto_again = "1"; 
		var isonline=1;

		if(getCookie("auto_invite_type") == null || getCookie("auto_invite_type") == "")
		{
			set51KfCookie("auto_invite_type","0");
		}
		if(getCookie("is_auto_again") == null || getCookie("is_auto_again")	== "")
		{
			set51KfCookie("is_auto_again","1");
		}	
		if(  getCookie("auto_invite_type") !=  auto_invite_type  )
		{
			set51KfCookie("is_auto_again","1");
			set51KfCookie("auto_invite_type",auto_invite_type);
		}
		is_auto_again = (getCookie("is_auto_again") == "")?"1":getCookie("is_auto_again");

		var time_to_show = 2000;
	
	
		var auto_agent = window.navigator.userAgent.toLowerCase();   
        var client_kf = {
			 isQuirks:	document.compatMode == 'BackCompat',   
			 isOpera:   auto_agent.indexOf('opera') > -1,   
			 isIE:		auto_agent.indexOf('msie') > -1,   
			 isIE6:      auto_agent.indexOf('msie 6') > -1,    
			 isIE7:		auto_agent.indexOf('msie 7') > -1,  
			 isIE8:      auto_agent.indexOf('msie 8') > -1,   
			 is360:		false
         }; 
		var isIE =	client_kf.isIE;
		var isIE6 =  client_kf.isIE6;
		var img_host = "http://img.5251.net";
		
	var kf_online_content = '&#x5728;&#x7ebf;&#x5ba2;&#x670d;&#x6b22;&#x8fce;&#x60a8; <p>&#x5ba2;&#x670d;&#x5728;&#x7ebf;,&#x5982;&#x6709;&#x4ec0;&#x4e48;&#x7591;&#x95ee;&#x8bf7;&#x70b9;&#x51fb;&#x54a8;&#x8be2;.';
	var kf_offline_content = '&#x5728;&#x7ebf;&#x5ba2;&#x670d;&#x6b22;&#x8fce;&#x60a8; <p>&#x5ba2;&#x670d;&#x4e0d;&#x5728;&#x7ebf;,&#x5982;&#x6709;&#x4ec0;&#x4e48;&#x7591;&#x95ee;&#x8bf7;&#x70b9;&#x51fb;&#x7559;&#x8a00;.';

	var client_source = '&#x60a8;&#x597d;,&#x6765;&#x81ea;:<br>&nbsp;&nbsp;&nbsp;&#x7f8e;&#x56fd; &#x534e;&#x76db;&#x987f;&#x54e5;&#x4f26;&#x6bd4;&#x4e9a;&#x7279;&#x533a;Cog&#x7684;&#x670b;&#x53cb;.';

	function getScreenProperty()
	{
		var kf_screen_p=new Array();
		if(window.innerHeight) { // all except Explorer 
			kf_screen_p.h=window.innerHeight;
			kf_screen_p.w=window.innerWidth;
		} 
		else if (document.documentElement && document.documentElement.clientHeight) { 
		// Explorer 6 Strict Mode 
			kf_screen_p.w = document.documentElement.clientWidth; 
			kf_screen_p.h = document.documentElement.clientHeight; 
		} else if (document.body) { // other Explorers 
			kf_screen_p.w = document.body.clientWidth; 
			kf_screen_p.h = document.body.clientHeight; 
		}
		return kf_screen_p;
	}
	function AutoClass(){
					this.property=new Array();
					this.content='';
					this.top = 0;
					this.left=0;
					this.invite_bj='';
					this.show="none"; 
					this.scrollTimer=null;	
					this.autoTimer=null;
					this.configTimer = null;
					this.show_delay = 0;
					this.get_auto_str = getAutoStr;
					this.floatHtml= '';
					this.autoCssHtml = '';
					this.autoScroll = autoAutoScroll;
					this.start=auto_start;
					this.imgsInit=autoImagesInit;
					this.parsInit=autoParsInit;
					this.sizeConfiger = resizeAutoFrame;
					this.otherConfiger = autoConfiger;
		}
var lastDiffY = 0;
var kf_auto = new AutoClass();
if(is_auto_again == "1" )
{
	kf_auto.start();
	kf_auto.autoTimer = window.setTimeout("kf_auto.sizeConfiger()",kf_auto.show_delay);
	if(typeof(KF_Drag)=="function"){
		kf_auto.scrollTimer =new KF_Drag("aotu_kf","{}","{Able:true,Lock:false,KeepX:50,KeepY:50}");
	}else{
		if(! client_kf.is360 )kf_auto.scrollTimer = window.setInterval("kf_auto.autoScroll()", 3);
	}
	kf_auto.configTimer = window.setTimeout("kf_auto.otherConfiger()",kf_auto.show_delay+1000);
}
function auto_start()
{
	this.imgsInit();
	this.parsInit();
	var kFiframeStr = '<div id=\'aotu_kf\' style=\'z-index:9999;left:'+this.left+'px;top:'+this.top+'px;display:'+this.show+'; ';
	var hcss = 'position:absolute;\' onmousedown="dragPanel(this,event, 1)" onmouseup="dragPanel(this,event, 3)" onmousemove="dragPanel(this,event, 2)" >';
	if(typeof(KF_Drag)=="function"){hcss = 'position:absolute;\'>';}
	if(client_kf.is360)	 hcss = 'position:fixed;* position:absolute; *top:expression( ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )+'+this.top+'+"px" );\'>';
	kFiframeStr += hcss + '</div>\n';
	document.write(this.autoCssHtml + kFiframeStr );
}
function getAutoStr()
{
	var auto_str ='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="480" height="180" id="kf_flash" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+this.invite_bj+'" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="'+this.invite_bj+'" quality="high" wmode="transparent" bgcolor="#ffffff" width="480" height="180" name="kf_flash" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/></object>\n';
	auto_str += '<div id="kf_title"><div class="kf_title_body">'+client_source+'</div>';
	
	auto_str += '</div><div id="kf_content"><div class="kf_content_body">'+this.content;
	
	auto_str += '</div></div><div id="kf_button"><div class="kf_button_img"><img src="'+this.property["img_action"]+'"  border="0" onclick="javascript:open_win_chat();"><img src="'+this.property["img_refuse"]+'" border="0" onclick="javascript:hidden_auto();"></div></div>';
	

	if(client_kf.is360)auto_str = '<TABLE cellSpacing="0" cellPadding="0" width="100%" bgColor="#666666" border="0" ><TBODY><TR><TD height="1"><TABLE cellSpacing="1" cellPadding="0" width="400" border="0"><TBODY><TR><TD ><TABLE cellSpacing="0" cellPadding="0" width="100%" border="0"><TBODY><TR><TD > '+ auto_str+ '</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY>';

	this.floatHtml = auto_str;
}

function autoParsInit()
{
	this.show_delay = time_to_show;
	this.content = (isonline)?kf_online_content:kf_offline_content;
	this.property["auto_width"] = 480;
	this.property["auto_height"] = 180;
	this.property["hor_rate"] = 50/100;
	this.property["ver_rate"] = 50/100;

	var kf_screen_p=getScreenProperty();
	
	this.left  = parseInt((kf_screen_p.w - this.property["auto_width"])*this.property["hor_rate"]);
	this.top  = parseInt( (kf_screen_p.h - this.property["auto_height"])*this.property["ver_rate"]);

	var auto_cssStr = '<style type="text/css">\n<!--\n';
	if(companyId == 9344 )	auto_cssStr+= '#aotu_kf *{margin:0;padding:0;font-size:15px;color:#1a6789; font-weight:bold ;BACKGROUND-COLOR:transparent}\n';
	else	auto_cssStr+= '#aotu_kf *{margin:0;padding:0;font-size:12px;color:#1a6789;BACKGROUND-COLOR:transparent}\n';
	auto_cssStr+= '#aotu_kf{width:480px;	height:180px; cursor:move;BACKGROUND-COLOR:transparent}\n';
	auto_cssStr+= '#kf_flash{position:absolute;z-index:9999;left:0px;top: 0px;BACKGROUND-COLOR:transparent}\n';

	auto_cssStr+= '#kf_title{position:absolute;z-index:9999;	left: 0px;top: 0px;	width: 100%;	height: 30%;BACKGROUND-COLOR:transparent;	}\n';
	auto_cssStr+= '#kf_content{position:absolute;z-index:9999;	left: 0px;top: 30%;width: 100%;	height: 45%;BACKGROUND-COLOR:transparent;}\n';
	auto_cssStr+= '#kf_button{position:absolute;	z-index:9999;left: 0px;top: 75%;height:25%;width: 100%;BACKGROUND-COLOR:transparent}\n';
	auto_cssStr+= '#kf_button IMG{display:inline;border:0;cursor:pointer;margin:0 20px 0 30px;BACKGROUND-COLOR:transparent}\n';

	auto_cssStr+=  '#kf_title .kf_title_body{float:right;height:40px;margin:auto;margin-top:15px; margin-right:90px; line-height:20px;width:49%;word-spacing:2px;overflow:hidden;text-align:left;BACKGROUND-COLOR:transparent}\n';
	if(isIE6)auto_cssStr+= '#kf_title .kf_title_body{margin-right:55px;BACKGROUND-COLOR:transparent}\n';
	if(client_kf.is360)auto_cssStr+= '#kf_title .kf_title_body{margin-left:151px;BACKGROUND-COLOR:transparent}\n';
	auto_cssStr+= '#kf_title .kf_close_pic{position:absolute;z-index:9999;right:12px;top:20px;width: 11px;height:11px;cursor:pointer}\n';
	if(client_kf.is360)
	auto_cssStr+= '#kf_content .kf_content_body{float:right;height:60px;margin:10px;margin-right:0px;line-height:20px;	width:59%;word-spacing:2px;overflow:hidden;text-align:left;BACKGROUND-COLOR:transparent}\n';
	else
	auto_cssStr+= '#kf_content .kf_content_body{float:right;height:60px;margin:10px;margin-right:18px;line-height:20px;	width:59%;word-spacing:2px;overflow:hidden;text-align:left;BACKGROUND-COLOR:transparent}\n';
	auto_cssStr+= '#kf_content p{margin:8px 0;line-height:16px;BACKGROUND-COLOR:transparent}\n';


	auto_cssStr+= '#kf_button .kf_button_img{float:right;width:80%;height:30px;BACKGROUND-COLOR:transparent;text-align:';
	if(client_kf.is360)	auto_cssStr +='right;}\n';else auto_cssStr +='center;}\n';

	auto_cssStr+= '-->\n</style>';
	this.autoCssHtml = auto_cssStr;
}

function autoImagesInit()
{
		this.show = 'none';
		//this.invite_bj = img_host+'/auto/newAuto/ly2.swf';
		
		this.invite_bj = img_host+'/auto/newAuto/ly2.swf';
		
 
		this.property["img_action"] = img_host + "/auto/newAuto/flash_1/onlineButton.gif"; 

		this.property["img_refuse"] = img_host + "/auto/newAuto/flash_1/cancelButton.gif";
		preDownImage(this.property["img_action"]);
		preDownImage(this.property["img_refuse"]);
}
function resizeAutoFrame()
{

	this.get_auto_str();	
	if( GetObjFromDoc("aotu_kf") == null)
	{
		setTimeout('resizeAutoFrame()',100);
		return;
	}
	GetObjFromDoc("aotu_kf").innerHTML = this.floatHtml;
}
function autoAutoScroll()
{
	if(dragable)	return;
	var kf_screen_p = getScreenProperty();
	this.left  = (kf_screen_p.w-this.property["auto_width"])*this.property["hor_rate"];
	try{
		var diffY = document.documentElement.scrollTop;	
		var diffX = document.documentElement.scrollLeft ;
		if(diffY==0)	diffY = document.body.scrollTop;
		if(diffX==0)	diffX = document.body.scrollLeft;
		var percent=0.1*(diffY-lastDiffY); 
		if(percent>0)percent=Math.ceil(percent); 
		else percent=Math.floor(percent); 
		lastDiffY = lastDiffY+percent; 

		GetObjFromDoc("aotu_kf").style.top = parseInt(percent + GetObjFromDoc("aotu_kf").offsetTop) + "px" ;
		if( GetObjFromDoc("aotu_kf").offsetTop <= 0){
			GetObjFromDoc("aotu_kf").style.top = parseInt(diffY + this.top) + "px" ;
		}
		GetObjFromDoc("aotu_kf").style.left = parseInt(diffX + this.left) + "px";
	}catch(e){};
}
function autoConfiger()
{
	auto_has_show = true;
	if( auto_invite_type == "1" && (getCookie("href") == window.location.href))
	{
		set51KfCookie("is_auto_again","0");
	}
	set51KfCookie("auto_invite_type",auto_invite_type);
	set51KfCookie("href",window.location.href);
}
var dragstart = new Array();
var dragable = false;

function dragPanel(obj,e, op) {
	if(op == 1) {
		dragstart = isIE ? [event.clientX, event.clientY] : [e.clientX, e.clientY];
		dragstart[2] = parseInt(obj.offsetLeft);
		dragstart[3] = parseInt(obj.offsetTop);
	    dragable = true;
		if(kf_auto.scrollTimer){window.clearInterval(kf_auto.scrollTimer);}
		doane(e);
	} else if(op == 2 && dragstart[0] && dragable) {
		var dragnow = isIE ? [event.clientX, event.clientY] : [e.clientX, e.clientY];
		obj.style.left = (dragstart[2] + dragnow[0] - dragstart[0]) + 'px';
		obj.style.top = (dragstart[3] + dragnow[1] - dragstart[1]) + 'px';
		doane(e);
	} else if(op == 3 && dragable) {
		var diff_y = document.documentElement.scrollTop;	
		var diff_x = document.documentElement.scrollLeft ;
		if(diff_y==0)diff_y = document.body.scrollTop;
		if(diff_x==0)diff_x = document.body.scrollLeft;
		kf_auto.top = obj.offsetTop - diff_y;
		kf_auto.property["hor_rate"] =  obj.offsetLeft /  diff_x;
		dragstart = [];
		dragable = false;
		kf_auto.scrollTimer = window.setInterval("kf_auto.autoScroll()", 2);	
		doane(e);
	}
}
function doane(event) {
	e = event ? event : window.event;
	if(isIE) {
		e.returnValue = false;
		e.cancelBubble = true;
	} else if(e) {
		e.stopPropagation();
		e.preventDefault();
	}
}

function GetObjFromDoc(id,theDoc)
{
	if(!theDoc){theDoc = document;}
	if (theDoc.getElementById){return theDoc.getElementById(id);}
	else if (document.all)
	{return theDoc.all(id);}
}
function getImgAttribute(src)
{
	var img = new Image();
	img.src = src;
	img.onerror=function(){}
	kf_auto.property["auto_width"] = img.width;
	kf_auto.property["auto_height"] = img.height;
}
function preDownImage(src)
{
	var imgs = new Image();
	imgs.src = src;
	imgs.onerror=function(){}
	if(!imgs.complete)
	{
		setTimeout("preDownImage('"+src+"')",500);
		return;
	}
}
function isImage(src)
{
	var imgs = new Image();
	imgs.src = src;
	if(imgs.complete)
	{
		return (imgs.height > 0 || imgs.width > 0)?true:false;
	}
	return false;
}
var kfwin_has_show = false;
 var onloadInterval = window.setInterval(checkIfShow,10000);

function sendAndRecieve(js_src)
{
	if(auto_invite_type == "3")
	{
		set51KfCookie("is_auto_again","0");
	}
	else
	{
		if(isonline)
		{
			js_src = "http://kf.5251.net" +js_src;
			var script=document.createElement("script");
			script.type='text/javascript';
			script.language='javascript';
			script.src=js_src;
			document.getElementsByTagName("head")[0].appendChild(script);
		}
	}
}
function hidden_auto()
{
	if( auto_invite_type =="2" || auto_invite_type =="3" || auto_invite_type =="4")
	{
		set51KfCookie("is_auto_again","0");
	}
	auto_has_show = false;
	var aotu=GetObjFromDoc("aotu_kf");
	aotu.style.display="none";		
	
	sendAndRecieve("/js/recieve.jsp?state=3&companyId="+companyId+"&sessionId="+userid);	
}
function open_win_chat()
{
	kf_openurl_auto = kf_openurl_auto+"&workId="+work_id;
	var chat_win= window.open(kf_openurl_auto,'chat_12243','height=473,width=703,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable=no,scrollbars=no,location=no,titlebar=no');
	chat_win.focus();

	try
	{
		if(auto_invite_type == "2" || auto_invite_type == "3")
		{
			set51KfCookie("is_auto_again","0");
		}
		kfwin_has_show = true;
		//window.clearInterval(onloadInterval);
		var aotu=GetObjFromDoc("aotu_kf");
		aotu.style.display="none";
		sendAndRecieve("/js/recieve.jsp?state=4&companyId="+companyId+"&sessionId="+userid);
	}catch(e){}
}


var counttimes = 0;
function checkIfShow()
{	
	
	if(companyId == 14991)
	{
		if(kfwin_has_show) return;
	}
	/*
	var now_time = getTime();
	if(now_time - starttime > 600)
	{
		
			window.clearInterval(onloadInterval);
			return;
		
	}
	*/
	counttimes++;

	if(counttimes > 30)
	{
		if(counttimes % 2 ==1)return;
	}
	
	//if(counttimes > 1)
	{
		sendAndRecieve("/js/autoShow.jsp?t="+counttimes+"&companyId="+companyId+"&sessionId="+userid);
	}
}

function show_kf_auto(workid){
    // nextAccept();
	work_id = workid;
	var aotu= GetObjFromDoc("aotu_kf");
	if(aotu)
	{
		aotu.style.display="block";
	}
	else
	{	
		kf_auto.sizeConfiger();
	}
	auto_has_show = true;
}
function show_51kf_dialog(workid)
{
	work_id = workid;
	try
	{
		kfwin_has_show = true;
		//window.clearInterval(onloadInterval);
		sendAndRecieve("/js/recieve.jsp?state=4&companyId="+companyId+"&sessionId="+userid);	
		//window.open(kf_openurl_auto,"chat"+companyId,"height=473,width=703,top=200,left=200,status=yes,toolbar=no,menubar=no,resizable=no,scrollbars=no,location=no,titlebar=no");
		kf_openurl_auto = kf_openurl_auto+"&workId="+work_id;
		location.href=kf_openurl_auto;

		window.focus();
	}catch(e){}
}
var returning = 0;
try{returning=cc_k()}catch(e){}
sendAndRecieve("/js/autoShow.jsp?t=0&returning="+returning+"&companyId="+companyId+"&sessionId="+userid+"&route="+route+"&keyword="+escape(getCookie("kf51_referrer"))+"&page_title="+escape(kdocTitle));


//if(1)return;	
//auto
			