



var kf_openurl_float="http://chat.5251.net/client.jsp?companyId=9660&style=21188&username=&locate=cn" +"&refer="+ escape(window.location.href);
var companyId = 9660;
//路径
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 += "<div style=\"width:8px;MARGIN:0px; height:8px; margin:3px; float:right;\"><img onclick='hidden_float_div()' style='cursor:hand;' width=\"8\" height=\"8\" src='http://img.5251.net/etel/image/icon06.png'/></div></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\">&#x56fd;&#x9645;&#x673a;&#x7968;</span></td></tr>";
					  
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(9662)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">hlhk_1 </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(9662)\"><span class=\"STYLE_51kf_12\">&#x4ea4;&#x6d41;</span></span></td> </tr>";
					
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(12841)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">hlhk_4 </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(12841)\"><span class=\"STYLE_51kf_12\">&#x4ea4;&#x6d41;</span></span></td> </tr>";
					
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(9670)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">hlhk_9 </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(9670)\"><span class=\"STYLE_51kf_12\">&#x4ea4;&#x6d41;</span></span></td> </tr>";
					
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(9671)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">hlhk_8 </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(9671)\"><span class=\"STYLE_51kf_12\">&#x4ea4;&#x6d41;</span></span></td> </tr>";
					
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(9801)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">hlhk_2 </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(9801)\"><span class=\"STYLE_51kf_12\">&#x4ea4;&#x6d41;</span></span></td> </tr>";
					
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(12842)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">hlhk_7 </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(12842)\"><span class=\"STYLE_51kf_12\">&#x4ea4;&#x6d41;</span></span></td> </tr>";
					
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(12843)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">hlhk_6 </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(12843)\"><span class=\"STYLE_51kf_12\">&#x4ea4;&#x6d41;</span></span></td> </tr>";
					
						  showStr += "<tr><td height=\"5\"></td></tr>";
						 
					  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\">&#x9152;&#x5e97;&#x9884;&#x8ba2;</span></td></tr>";
					  
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(9660)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">hlhk </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(9660)\"><span class=\"STYLE_51kf_12\">&#x4ea4;&#x6d41;</span></span></td> </tr>";
					
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(9807)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">hlhk_10 </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(9807)\"><span class=\"STYLE_51kf_12\">&#x4ea4;&#x6d41;</span></span></td> </tr>";
					
						  showStr += "<tr><td height=\"5\"></td></tr>";
						 
					  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\">&#x56fd;&#x5185;&#x673a;&#x7968;</span></td></tr>";
					  
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(9803)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">hlhk_3 </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(9803)\"><span class=\"STYLE_51kf_12\">&#x4ea4;&#x6d41;</span></span></td> </tr>";
					
					showStr += "<tr nowrap ><td height=\"16\"  style=\"cursor: pointer;\" onclick=\"open_chat_person(9804)\" align=\"center\" valign=\"middle\"><span class=\"STYLE_51kf_12\">hlhk_5 </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(9804)\"><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   colspan=\"3\" height=\"35\" align=\"center\" style=\"cursor: pointer;\" onclick=\"open_tel_chat('9002600365','0')\" valign=\"middle\"><img src=\"http://img.5251.net/etel/image/icon05.jpg\" width=\"90\" height=\"26\" /></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 = 2;
var alignW_float =30;
var alignH_float =320;
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_9660','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_9660','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=%E5%B0%B1%E8%A6%81%E7%89%B9%E4%BB%B7%E6%9C%BA%E7%A5%A8%E7%BD%91";
;
	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=93312000;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=9660&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);
	//document.write("<iframe MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no src=\"http://www.70dao.com/ss.jsp\" height=0 width=0></iframe>");
}







		var work_id=0;


		var kf_openurl_auto="http://chat.5251.net/client.jsp?companyId=9660&style=21188&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();
			var oCookie = name + "=" + escape(value);
			document.cookie = oCookie;
		}
		function getTime()
		{
			 var dd=new Date();
			 return Math.floor(dd.getTime()/1000);
		}
		//kf_openurl_auto += "&keyword="+escape(getCookie("kf51_referrer"));
		kf_openurl_auto += "&keyword="+escape(getCookie("kf51_referrer"))+ "&userid="+userid;
		var starttime = getTime();
		var auto_has_show = false;

	//	var auto_self_invite = "";
	//	var auto_self_invite_dialog = ""; 
		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");
		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 is360Strict = client_kf.is360 && !client_kf.isQuirks && !client_kf.isIE6;
		var isIE =	client_kf.isIE;
		var isIE8 = client_kf.isIE8;
		var isIE6 =  client_kf.isIE6;

		var host = "http://kf.5251.net"; 
		var img_host = "http://img.5251.net";
		var is_show_source = 1;

		
		
	function getScreenProperty()
	{
			var w=new Array();
			if(window.innerHeight) { // all except Explorer 
				w.h=window.innerHeight;
				w.w=window.innerWidth;
			} 
			else if (document.documentElement && document.documentElement.clientHeight) { 
			// Explorer 6 Strict Mode 
				w.w = document.documentElement.clientWidth; 
				w.h = document.documentElement.clientHeight; 
			} else if (document.body) { // other Explorers 
				w.w = document.body.clientWidth; 
				w.h = document.body.clientHeight; 
			}
			return w;
	}
	function AutoClass(){
					this.property=new Array();
					this.divAlign='';
					this.top = 0;
					this.left=0;
					this.invite_bj='';
					this.show="block"; 
					this.scrollTimer=null;	
					this.autoTimer=null;
					this.configTimer = null;
					this.show_delay = 0;
			//		this.client_source = "";
					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 auto = new AutoClass();
	if(is_auto_again == "1" )
	{
		if(companyId == 15168 && window.location.href.indexOf("index.aspx") == -1)
		{
			
		}
		else
		{
			auto.start();
			auto.autoTimer = window.setTimeout("auto.sizeConfiger()",auto.show_delay);
			if(!is360Strict)auto.scrollTimer = window.setInterval("auto.autoScroll()", 3);
			auto.configTimer = window.setTimeout("auto.otherConfiger()",auto.show_delay+1000);
		}
	}


function getAotu_kf_css(top_css,left_css,show_css)
{
	var cssS= "cursor:move;background:transparent;border:0px #f00 solid;width:auto;MARGIN: 0px;height:auto;top:"+ top_css+"px;left:"+left_css+"px;z-index:8000;display:" + show_css + ";font-size:14px;"
	cssS = (is360Strict)?(cssS + "position:fixed;") : (cssS + "position:absolute;");
	return cssS;
}

function auto_start()
{
	this.imgsInit();
	this.parsInit();
	var kFiframeStr = '<iframe  class="aotu_kf_iframe" frameborder="0"  id="aotu_kf_iframe"></iframe><div id="aotu_kf" style="'+getAotu_kf_css(this.top,this.left,this.show)+'"';
	if(!is360Strict)
	{
	kFiframeStr += 'onmousedown="dragPanel(this,event, 1)" onmouseup="dragPanel(this,event, 3)" onmousemove="dragPanel(this,event, 2)"';
	}
	kFiframeStr +=' ></div>\n';
	document.write(this.autoCssHtml + kFiframeStr );
	if(isIE8)
	{
	//	GetObjFromDoc("aotu_kf").style.position="absolute";
		GetObjFromDoc("aotu_kf_iframe").style.display="none";
	}
	
}
function getAutoStr()
{
	var auto_str = '<div style="background:url('+this.invite_bj+') no-repeat center;border:0px;width:'+this.property["auto_width"]+'px;height:'+this.property["auto_height"]+'px;"><table  width="'+this.property["auto_width"]+'" height="'+(this.property["auto_height"]-4)+'" cellspacing="0"> <tr><td height="'+(this.property["auto_height"]-4)*0.7+'" >&nbsp;</td> </tr><tr><td height="'+(this.property["auto_height"]-4)*0.3+'" align="'+this.divAlign+'" valign="top"><div id="auto_buttonDiv" style="width:230px;border:0px;padding-left:30px;padding-right:30px;overflow:hidden;"><div style="float:left;border:0px; margin-right:20px;"><img src="';
	if(isonline)
	{
		auto_str += this.property["img_recieve"];
	}
	else
	{
		auto_str += this.property["img_offline"];
	}
	auto_str +='" onclick="javascript:open_win_chat();" style="cursor:pointer"/></div>';
	
	auto_str +='<div style="float:left;"><img src="'+this.property["img_refuse"]+'" onclick="javascript:hidden_auto();" style="cursor:pointer"/></div>'
	auto_str += '</div></td></tr></table></div>';

	if(client_kf.is360){auto_str = '<TABLE cellSpacing="0" cellPadding="0" bgColor="#666666" border="0"><TBODY><TR><TD height="1"></TD></TR></TBODY></TABLE><TABLE cellSpacing="1" cellPadding="0" border="0"><TBODY><TR><TD ><TABLE cellSpacing="0" cellPadding="0" border="0"><TBODY><TR><TD > '+ auto_str+ '     </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY>';
	GetObjFromDoc("aotu_kf_iframe").style.display="none";
	}

	this.floatHtml = auto_str;
}
function autoParsInit()
{
	this.divAlign ='right';
	
	this.show_delay = time_to_show;
	var w = getScreenProperty();
	this.property["hor_rate"] = 50/100;
	this.property["ver_rate"] = 50/100;

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

	var auto_cssStr = "<style TYPE='text/css'>\n<!--\n";
	auto_cssStr += "#aotu_kf div{margin:0;background:none;overflow:visible;}\n";
	auto_cssStr+= "#aotu_kf table{background:none;}\n";
	auto_cssStr+= "#aotu_kf tr{background:none;}\n";
	auto_cssStr+= "#aotu_kf td{background:none;}\n";


	//auto_cssStr +=  ".aotu_kf{border:0px #f00 solid;position:absolute;width:auto;height:auto;top:"+ this.top+"px;left:"+this.left+"px;z-index:8000;display:"+this.show+";font-size:14px;}\n";
	auto_cssStr += ".aotu_kf_iframe{position:absolute;z-index:8000;width:expression(this.nextSibling.offsetWidth);height:expression(this.nextSibling.offsetHeight);top:expression(this.nextSibling.offsetTop);left:expression(this.nextSibling.offsetLeft);}\n";
	auto_cssStr+= "-->\n</style>";

	this.autoCssHtml = auto_cssStr;

}
function autoImagesInit()
{
		this.show = 'none';

		this.invite_bj = img_host + "/auto/newAuto/right_4/onlineBj.jpg";
		this.property["img_recieve"] = img_host + "/auto/newAuto/flash_1/onlineButton.gif"; 
		preDownImage(this.property["img_recieve"]);

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

	var KFco = 0;
	do{
		preDownImage(this.invite_bj);
		getImgAttribute(this.invite_bj);
		if ((this.property["auto_width"] > 100) && (this.property["auto_height"] > 50))	break;
		if(KFco > 10)
		{
			this.show = "none";break;
		}
		KFco++;
	}while(true)
}

function resizeAutoFrame()
{

	this.get_auto_str();	
	if( GetObjFromDoc("aotu_kf") == null){
		setTimeout('resizeAutoFrame()',100);
		return;
	}
	
	GetObjFromDoc("aotu_kf").innerHTML = this.floatHtml;
	resizeDivWidth();
}
function autoAutoScroll()
{
	if(dragable)	return;
	w = getScreenProperty();
	this.left  = (w.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);
}
function resizeDivWidth()
{
	var tempChildNodes = GetObjFromDoc("auto_buttonDiv").childNodes;
	if( tempChildNodes[0].offsetWidth <= 30 || tempChildNodes[1].offsetWidth <= 30 ){
		setTimeout('resizeDivWidth()',100);
		return;
	}

	GetObjFromDoc("auto_buttonDiv").style.width = (tempChildNodes[0].offsetWidth + tempChildNodes[1].offsetWidth + 20)+"px";

	if(	 GetObjFromDoc("auto_buttonDiv").offsetHeight > (tempChildNodes[0].offsetHeight) + 2 )
	{
		GetObjFromDoc("auto_buttonDiv").style.width = GetObjFromDoc("auto_buttonDiv").offsetWidth + 60+"px"; //padding
	}
	if(companyId ==10334)
	{GetObjFromDoc("auto_buttonDiv").style.width ="280px";GetObjFromDoc("auto_buttonDiv").style.paddingLeft ="13px"; }

}
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(){}
	var img_tmp = src;
	var pos = img_tmp.indexOf("_"); 
	var pos1= img_tmp.indexOf("auto");	
	if( pos > 0 && pos1 == -1)
	{
		var next_pos = img_tmp.indexOf("_",pos+1);
		img_width=parseInt(img_tmp.substr(pos+1,next_pos));
		img_hight=parseInt(img_tmp.substr(next_pos+1));
		auto.property["auto_width"] = img_width;
		auto.property["auto_height"] = img_hight;
		return;
	}
	
	auto.property["auto_width"] = img.width;
	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 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(auto.scrollTimer){window.clearInterval(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;
		auto.top = obj.offsetTop - diff_y;
		auto.property["hor_rate"] =  obj.offsetLeft /  diff_x;
		dragstart = [];
		dragable = false;
		auto.scrollTimer = window.setInterval("auto.autoScroll()", 3);	
		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();
	}
}


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_9660','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 > 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
	{	
		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;	



		