


var companyId = 8830;
var kf_openurl="http://chat.5251.net/client.jsp?flag=1&companyId=8830&style=19487&locate=cn" +"&refer="+ escape(window.location.href)+"&username="+encodeURIComponent("")+"&conn_word="+encodeURIComponent("");

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  ss  =  now.getTime() 

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

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

//alert("userid is-->" + getCookie("kf51_userid"));
var ref = document.referrer; 
var local_host = document.domain;
if(ref.indexOf(local_host) < 0)
{
	setCookie("kf51_referrer",ref);
}
kf_openurl += "&keyword="+escape(getCookie("kf51_referrer"));
kf_openurl += "&userid="+userid;
function open_pic_chat()
{
	var chat_win= window.open(kf_openurl,'chat_8830','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="+8830+"&sessionId="+userid);}catch(e){}
}
function open_chat_person(workerid)
{
	var chat_win = window.open(kf_openurl+'&workId='+workerid+'&flag=3','chat_8830','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){}
}
var is_kf_online = 0;
var kf_workids = "";
var workids = "";
var judge_kf_isonline = function(workerid){
	if(kf_workids.indexOf(","+workerid+",")>-1)return true;
	else return false;
}

		var closeButton = false;var closeIMG ="http://img.5251.net/images/close.gif";

		function get_close_str()
		{
			if (closeButton) return "<img onclick='hidden_div()' style='position:absolute; right:7px; top:7px; cursor:hand;' src='" + closeIMG + "'/>"; 
			return "";
		}

		function hidden_div()
		{	
			document.getElementById("float_img_div").style.display="none";
			try{
			clearInterval(interval);
			}catch(e){}
		}

		function addEvent(obj,evtType,func,cap){ 
				cap=cap||false; 
			if(obj.addEventListener){ 
				 obj.addEventListener(evtType,func,cap); 
			   return true; 
			}else if(obj.attachEvent){ 
					if(cap){ 
					 obj.setCapture(); 
					 return true; 
				 }else{ 
				  return obj.attachEvent("on" + evtType,func); 
			   } 
			}else{ 
			   return false; 
				} 
			} 
			function getPageScroll(){ 
				var xScroll,yScroll; 
			if (self.pageXOffset) { 
			   xScroll = self.pageXOffset; 
			} else if (document.documentElement && document.documentElement.scrollLeft){ 
			   xScroll = document.documentElement.scrollLeft; 
			} else if (document.body) { 
			   xScroll = document.body.scrollLeft; 
			} 
			if (self.pageYOffset) { 
			   yScroll = self.pageYOffset; 
			} else if (document.documentElement && document.documentElement.scrollTop){ 
			   yScroll = document.documentElement.scrollTop; 
			} else if (document.body) { 
			   yScroll = document.body.scrollTop; 
			} 
			arrayPageScroll = new Array(xScroll,yScroll); 
			return arrayPageScroll; 
			} 
			function GetPageSize(){ 
				var xScroll, yScroll; 
				if (window.innerHeight && window.scrollMaxY) {  
					xScroll = document.body.scrollWidth; 
					yScroll = window.innerHeight + window.scrollMaxY; 
				} else if (document.body.scrollHeight > document.body.offsetHeight){ 
					xScroll = document.body.scrollWidth; 
					yScroll = document.body.scrollHeight; 
				} else { 
					xScroll = document.body.offsetWidth; 
					yScroll = document.body.offsetHeight; 
				} 
				var windowWidth, windowHeight; 
				if (self.innerHeight) { 
					windowWidth = self.innerWidth; 
					windowHeight = self.innerHeight; 
				} else if (document.documentElement && document.documentElement.clientHeight) { 
					windowWidth = document.documentElement.clientWidth; 
					windowHeight = document.documentElement.clientHeight; 
				} else if (document.body) { 
					windowWidth = document.body.clientWidth; 
					windowHeight = document.body.clientHeight; 
				}  
				if(yScroll < windowHeight){ 
					pageHeight = windowHeight; 
				} else {  
					pageHeight = yScroll; 
				} 
				if(xScroll < windowWidth){  
					pageWidth = windowWidth; 
				} else { 
					pageWidth = xScroll; 
				} 
				arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)  
				return arrayPageSize; 
			} 

			var AdMoveConfig=new Object(); 
			AdMoveConfig.IsInitialized=false; 
			AdMoveConfig.ScrollX=0; 
			AdMoveConfig.ScrollY=0; 
			AdMoveConfig.MoveWidth=0; 
			AdMoveConfig.MoveHeight=0; 
			AdMoveConfig.Resize=function(){ 
				var winsize=GetPageSize(); 
				AdMoveConfig.MoveWidth=winsize[2]; 
				AdMoveConfig.MoveHeight=winsize[3]; 
				AdMoveConfig.Scroll(); 
			} 
			AdMoveConfig.Scroll=function(){ 
				var winscroll=getPageScroll(); 
				AdMoveConfig.ScrollX=winscroll[0]; 
				AdMoveConfig.ScrollY=winscroll[1]; 
			} 
			addEvent(window,"resize",AdMoveConfig.Resize); 
			addEvent(window,"scroll",AdMoveConfig.Scroll); 
			function AdMove(id){ 
				if(!AdMoveConfig.IsInitialized){ 
					AdMoveConfig.Resize(); 
					AdMoveConfig.IsInitialized=true; 
				} 
				var obj=document.getElementById(id); 
				obj.style.position="absolute"; 
				var W=AdMoveConfig.MoveWidth-obj.offsetWidth; 
				var H=AdMoveConfig.MoveHeight-obj.offsetHeight; 
				var x = W*Math.random(),y = H*Math.random(); 
				var rad=(Math.random()+1)*Math.PI/6; 
				var kx=Math.sin(rad),ky=Math.cos(rad); 
				var dirx = (Math.random()<0.5?1:-1), diry = (Math.random()<0.5?1:-1); 
				var step = 1; 
				var interval; 
				this.SetLocation=function(vx,vy){x=vx;y=vy;} 
				this.SetDirection=function(vx,vy){dirx=vx;diry=vy;} 
				obj.CustomMethod=function(){ 
					obj.style.left = (x + AdMoveConfig.ScrollX) + "px"; 
					obj.style.top = (y + AdMoveConfig.ScrollY) + "px"; 
					rad=(Math.random()+1)*Math.PI/6; 
					W=AdMoveConfig.MoveWidth-obj.offsetWidth; 
					H=AdMoveConfig.MoveHeight-obj.offsetHeight; 
					x = x + step*kx*dirx; 
					if (x < 0){dirx = 1;x = 0;kx=Math.sin(rad);ky=Math.cos(rad);}  
					if (x > W){dirx = -1;x = W;kx=Math.sin(rad);ky=Math.cos(rad);} 
					y = y + step*ky*diry; 
					if (y < 0){diry = 1;y = 0;kx=Math.sin(rad);ky=Math.cos(rad);}  
					if (y > H){diry = -1;y = H;kx=Math.sin(rad);ky=Math.cos(rad);} 
				} 
				this.Run=function(){ 
					var delay = 30; 
					interval=setInterval(obj.CustomMethod,delay); 
					obj.onmouseover=function(){clearInterval(interval);} 
					obj.onmouseout=function(){interval=setInterval(obj.CustomMethod, delay);} 
				} 
			}

		

		document.write('<div id="float_img_div" >');
		document.write(' <img src="http://img.5251.net/upload/2008-09-11/108841759409.gif"  style="cursor: pointer;" onclick="open_pic_chat()" /> ');
		document.write(get_close_str());
		document.write("</div>");	

		
		
		function getImageProperty()
		{ 
			
			
			var theDoc = document;
			var img_float_div = null;
			if (theDoc.getElementById){img_float_div = theDoc.getElementById("float_img_div");}
			else if (document.all)
			{img_float_div =  theDoc.all("float_img_div");}
			
			if(img_float_div == null ){
				setTimeout('getImageProperty()',100);
				return;
			}
			 var ad1=new AdMove("float_img_div"); 
			 ad1.Run(); 
		}

		getImageProperty();

	var onloadInterval_fixed = window.setInterval(show_fixed_kf,500);
	function show_fixed_kf()
	{

		try{showKFDiv()}catch(e){};
	}
	

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=8830&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);
}






