var hj5107ext = {};
hj5107ext.baseUrl = 'http://cs.5107.cn/';
hj5107ext.company = 123132;
hj5107ext.schemeId = 2;
hj5107ext.jsonRequest=function(url, f){
	var u=url+'&t='+(new Date()).getTime();	
	var h=document.getElementsByTagName("head")[0];	
	var c=document.createElement("script");	
	c.setAttribute("type","text/javascript");
	h.appendChild(c);
	c.setAttribute("src",u);
	c.onreadystatechange =function(){
		if(c.readyState=='loaded'){
			f();
			this.parentNode.removeChild(this);
		}
	};
	c.onload=function(){
		f();
		this.parentNode.removeChild(this);
	};
};
hj5107ext.openChat=function(u) {
	var sChatUrl=hj5107ext.baseUrl+"vt/chat/chat.php?c="+hj5107ext.company
					+"&s="+hj5107ext.schemeId
					+"&pageUrl="+encodeURIComponent(document.location)
					+"&pageName="+encodeURIComponent(document.title.substring(0, 30)).replace(/\'/g, "%27") 
					+"&referedUrl="+encodeURIComponent(document.referrer) 
					//+"&searchEngine="+hj5107ext.monitor.iSeNo 
					//+"&keyWord="+encodeURIComponent(hj5107ext.monitor.sSeKeyword)
					+"&ie="+encodeURIComponent(navigator.appName);
	if (typeof(u)!="undefined") sChatUrl+=u;
	
	var oW=window.open(sChatUrl, 'hj5107ext', 'toolbar=no,location=no,directories=no,scrollbars=no,menubar=no,width=600,height=520,resizable=no,left=0,top=0,status=no');
	if (typeof(oW)!="undefined") oW.focus;
};
hj5107ext.statusUrl='http://cs.5107.cn/code5/code5_checkStatus.php?c='+hj5107ext.company;
hj5107ext.jsonRequest(hj5107ext.statusUrl, function(){
		var hj5107_status=_hj5107Status.c;
		//alert(hj5107_status);
		//for(var key in hj5107_status) {
			//if (document.getElementById("hj5107img_"+key)) {
				if (hj5107_status==1){
					//document.getElementById(key).className="link_online";
					//document.getElementById(key).innerHTML = '在线';
					document.getElementById("hj5107img").src = 'http://www.kaien.net.cn/images/home/online_services_ct.jpg';
				}else{
					//document.getElementById(key).className="link_offline";
					//document.getElementById(key).innerHTML = '留言';
					document.getElementById("hj5107img").src = 'http://www.kaien.net.cn/images/home/online_services_ct1.jpg';
				}
			//}
		//}
	});