<!--
/*************
调用例子:
<script type="text/javascript">var bar_url='http://www.yourname.com',bar_adcallno='9001001000',bar_sit='0',bar_show='1',bar_title='%E5%85%8D%E8%B4%B9%E7%94%B5%E8%AF%9D',bar_adcallno2='9001001000/9001001011',bar_400='4006789789',bar_pos='0',bar_css='6',bar_top='100',call_title='%E6%AC%A2%E8%BF%8E%E4%BD%BF%E7%94%A8%E5%85%8D%E8%B4%B9%E7%94%B5%E8%AF%9D%E5%92%A8%E8%AF%A2',call_content='%E6%AC%A2%E8%BF%8E%E4%BD%BF%E7%94%A8%E7%94%9F%E6%84%8F%E6%9D%A5%E7%94%B5%E5%AE%9D',call_sms='XX%E5%85%AC%E5%8F%B8',call_phone='XX%E5%85%AC%E5%8F%B8',invite_show='2000',invite_title='%E6%AC%A2%E8%BF%8E%E4%BD%BF%E7%94%A8%E5%85%8D%E8%B4%B9%E7%94%B5%E8%AF%9D%E5%92%A8%E8%AF%A2',bar_text='%E4%BA%A7%E5%93%81%E5%92%A8%E8%AF%A2/%E6%B8%A0%E9%81%93%E4%BB%A3%E7%90%86';</script><script type="text/javascript" src="http://code.adcall.com.cn/service/float_6.js" id="adcallfloat" charset="gb2312"></script>
*******************/

//init
var host;
if(typeof(host) == "undefined" || host=="" || host==null)
	host = "http://code.adcall.com.cn";
//host = "http://192.168.1.23:10054";
var bar_url,bar_adcallno,bar_sit,bar_show,bar_title,bar_adcallno2,bar_400,bar_pos,bar_css,bar_top,call_title,call_content,call_sms,call_phone,invite_show,invite_title,bar_text,bar_branch,kf_id,kf_code,kf_title,kf_host;


bar_url = decodeURI(bar_url);
bar_adcallno = decodeURI(bar_adcallno);
bar_sit = decodeURI(bar_sit);
bar_show =parseInt(decodeURI(bar_show));
bar_title = decodeURI(bar_title);
bar_branch = decodeURI(bar_branch);
bar_adcallno2 = decodeURI(bar_adcallno2);bar_400 = decodeURI(bar_400);bar_pos = decodeURI(bar_pos);bar_css = decodeURI(bar_css);bar_top = decodeURI(bar_top);call_title = decodeURI(call_title);
call_content = decodeURI(call_content);
call_sms = decodeURI(call_sms);call_phone = decodeURI(call_phone);invite_show = parseInt(decodeURI(invite_show));invite_title = decodeURI(invite_title);bar_text = decodeURI(bar_text);
kf_id =kf_id;
kf_code = decodeURI(kf_code);
kf_title = decodeURI(kf_title);

if(typeof(kf_host) != "undefined" && kf_host !=null && kf_host!="")
	kf_host = decodeURI(kf_host);

var adcall_img = host + "/images/6";
var bar_adcallno_400 = bar_adcallno.substring(6,10);

if(bar_adcallno2 != "")
{
	bar_adcallno2=bar_adcallno2.split("/");
}
if(bar_text != "")
{
	bar_text=bar_text.split("/");
}

if(kf_code != "")
{
	kf_code=kf_code.split("/");
}

if(kf_title != "")
{
	kf_title=kf_title.split("/");
}

if(parseInt(bar_pos)==1){
	bar_pos = "right:5px;"
}else{
	bar_pos = "left:5px;"
}
if(bar_branch=='undefined' )
	bar_branch='';

var lib = {
	loadCss: function (url) {
		var css = document.createElement('link');
		css.setAttribute('rel', 'stylesheet');
		css.setAttribute('type', 'text/css');
		css.setAttribute('href', url);
		document.getElementsByTagName('head')[0].appendChild(css);
	},
	
	getElement: function (id) {
		return document.getElementById(id);
	}
}

lib.loadCss(host + '/css/6.css');


//getPageSize function
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 = yScroll;    
    } else {    
        pageHeight = windowHeight;    
    }    
   
    if(xScroll < windowWidth){    
        pageWidth = xScroll;    
    } else {    
        pageWidth = windowWidth;    
    }    
   
    arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)    
    return arrayPageSize;    
} 

//move function
var adcall_drag_=false;
var adcall_D=new Function('obj','return document.getElementById(obj);');
var adcall_IE=new Function('','if(navigator.appName.indexOf("Explorer")>=0)return 1;if(navigator.appName.indexOf("Netscape")>=0)return 2');
function adcall_move_bar(obj){
	adcall_D(obj).onmousedown=function(e){
		adcall_drag_=true
		with(this){
			style.position="absolute";temp1=offsetLeft;temp2=offsetTop;
		    if(adcall_IE()==1){
			  adcall_x=event.clientX;adcall_y=event.clientY
			  document.onmousemove=function(e){
			   if(adcall_drag_==false)return false 
				 with(this){style.left=temp1+event.clientX-adcall_x+"px";style.top=temp2+event.clientY-adcall_y+"px"} 
				 }
		  } 
		  if(adcall_IE()==2){adcall_x=e.pageX;adcall_y=e.pageY;
			  document.onmousemove=function(e){ 
					if(adcall_drag_==false)return false 
				 with(this){style.left=temp1+e.pageX-adcall_x+"px";style.top=temp2+e.pageY-adcall_y+"px"} 
				 }
		  }
	}
	document.onmouseup=new Function("adcall_drag_=false") 
	}
}

// float functon
var adcall_lastScrollY_1=0;
var adcall_lastScrollY_2=0;
var adcall_lastScrollY_3=0;
function adcall_floatbar(floaObj,floaType){
 var diffY;
 if (document.documentElement && document.documentElement.scrollTop) {
  diffY = document.documentElement.scrollTop;
 } else if (document.body) {
  diffY = document.body.scrollTop;
 } else {/*Netscape stuff*/}
 if(floaType == 0){
     percent = 0.2*(diffY-adcall_lastScrollY_1);
 }else if(floaType == 1){
     percent = 0.2*(diffY-adcall_lastScrollY_2);
 }else{
	 percent = 0.2*(diffY-adcall_lastScrollY_3); 
 }

	if(percent>0) {
	    percent=Math.ceil(percent);
	} else {
	    percent=Math.floor(percent);
	}
	if(document.getElementById(floaObj)){
	    document.getElementById(floaObj).style.top=parseInt(document.getElementById(floaObj).style.top)+percent+"px";
	}

	if(floaType==0){
	    adcall_lastScrollY_1=adcall_lastScrollY_1+percent;
	}else if(floaType==1){
	    adcall_lastScrollY_2=adcall_lastScrollY_2+percent;
	}else{
	    adcall_lastScrollY_3=adcall_lastScrollY_3+percent;
	}

}

//show bar function
function show_adcall_bar()
{
	//来电宝
	var t_temp ='';
	//客服通
	var kf_temp='';
	if(typeof(kf_id) != "undefined" && kf_id !=null && kf_id!="")
	{
		kf_temp +='<div id="ADCC_F_BOX_KF" style="display:;">';
		if(typeof(kf_code) != "undefined" && kf_code!="" && kf_code!=null)
		{
			for(var aai = 0; aai < kf_code.length;aai++ )
			{
				if(kf_code[aai].length==0)
				  	break;
				if(typeof(kf_title[aai])=="undefined")
				{
					kf_temp +=getKftState(bar_adcallno2[aai],kf_code[aai],'',-1);
					/*
					fn="在线咨询";
					for(i=0;i<OperatorArray.length;i++)
					{
						if(OperatorArray[i].name==kf_code[aai])
						{
							fn=unescape(OperatorArray[i].friendname);
							break;
						}
					}
					kf_temp += "<span onClick=\"window.open('http://kft.zoosnet.net/LR/Chatpre.aspx?id="+kf_id+"&oname="+unescape(kf_code[aai].replace(/\+/g,'%20'))+"')\" title=\"点击与[ "+fn+" ]在线交流\"  style=\"display:block;width:100%;cursor:pointer;text-align:center;padding-top:3px;padding-bottom:3px;\">"+fn+"<br>【在线洽谈】</span>";
					*/
				}
				else
				{
					kf_temp +=getKftState(bar_adcallno2[aai],kf_code[aai],kf_title[aai],-1);
					//kf_temp += "<span onClick=\"window.open('http://kft.zoosnet.net/LR/Chatpre.aspx?id="+kf_id+"&oname="+kf_code[aai]+"')\" title=\"点击与[ "+kf_title[aai]+" ]在线交流\"  style=\"display:block;width:100%;cursor:pointer;text-align:center;padding-top:3px;padding-bottom:3px;\">"+kf_title[aai]+"<br>【在线洽谈】</span>";
				}
			}
			
		}
		else if(typeof(OperatorArray) != 'undefined')
		{
			for(i=0;i<OperatorArray.length;i++)
			{
				kf_temp +=getKftState(bar_adcallno2[i],OperatorArray[i].name,OperatorArray[i].friendname,OperatorArray[i].state);
				//var fn = unescape(OperatorArray[i].friendname);
				//kf_temp += "<span onClick=\"window.open('http://kft.zoosnet.net/LR/Chatpre.aspx?id="+kf_id+"&oname="+OperatorArray[i].name+"')\" title=\"点击与[ "+fn+" ]在线交流\"  style=\"display:block;width:100%;cursor:pointer;text-align:center;padding-top:3px;padding-bottom:3px;\">"+fn+"<br>【在线洽谈】</span>";
				
			}
		}
		kf_temp +='</div>';
		
	}
	else if(bar_adcallno2.length > 1)//来电宝
	{
		t_temp +='<div id="ADCC_F_BOX_MESSAGE" style="display:;">'
		for(i=0;i<bar_adcallno2.length;i++)
		{
			if(typeof(bar_text[i])=='undefined')
				txt='免费咨询';
			else
				txt=bar_text[i];
			t_temp +=  '<a href="javascript:void(0);" title="'+txt+'"  onclick="adcall_openDiv('+bar_adcallno2[i]+')">'+txt+'</a>';
		}
		t_temp +='</div>';
	}

	//浮动条
	var adcall_show_bar_code ="";
	var w=114;
	if(bar_sit==1)
	{
		adcall_show_bar_code = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="186" height="92"><param name="movie" value="'+host+'/flash/f_ico.swf"><param name="menu" value="false"><param name="quality" value="high"><param name="wmode" value="transparent"><embed src="'+host+'/flash/f_ico.swf" width="186" height="92" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"><\/embed></object>' +
		"<div title='' style='position:absolute; left:0px; top:0px; width:186px; height:92px; background-color:#ffffff;filter:alpha(opacity=0);opacity:0;cursor:hand;'><a href='javascript:void(0);' title='免费咨询' onclick=\"adcall_openDiv('"+bar_adcallno+"')\" style='z-index:0;display:block;width:186px;height:92px;position:absolute; left:0px; top:0px;'></a></div>";
		w=186;
	}
	else
	{
		adcall_show_bar_code =	'<div id="ADCC_F_BOX" style="z-index:9999;">' +
	  '<h1 id="ADCC_F_BOX_TITLE"><span onmouseover="adcall_move_bar(\'adcall_show_bar\')">'+bar_title+'</span><a href="javascript:void(0);" id="ADCC_F_BOX_CLOSE" class="close" onclick="adcall_closeDiv(\'adcall_show_bar\')"></a></h1>' +
	  '<div id="ADCC_F_BOX_CONTENT">' +
		'<div id="ADCC_F_BOX_ICON" title="点击免费通话" onclick="adcall_openDiv(\''+bar_adcallno+'\')"></div>' +
		t_temp +
		kf_temp +
	  '</div>' +
	  '<div id="ADCC_F_BOX_BOTTOM" style="display:;"><center><b>'+bar_400+'</b></center>';
	 	if(bar_branch!='undefined' && bar_branch.length>0)
	  		adcall_show_bar_code +=	'<span>转 <b>'+bar_branch+'</b></span>';
		adcall_show_bar_code +=	'</div></div>';
	}

	var bar_div ;
	if(document.getElementById('adcall_show_bar')!=null)
	{
		bar_div = document.getElementById("adcall_show_bar");
	}
	else
		bar_div = document.createElement("div");
	bar_div.id = "adcall_show_bar";
	bar_div.style.cssText = "position:absolute; top:"+bar_top+"px;"+bar_pos+"width:"+w+"px;overflow:hidden;z-index:9999;";
	bar_div.innerHTML = adcall_show_bar_code;
	
	document.body.appendChild(bar_div);
	window.setInterval("adcall_floatbar('adcall_show_bar',0)",1);	
		
}
//请修改下面的代码里的文本内容，如 "在线" "繁忙" "发送给" "的留言" 等
function getKftState(adcall,name,friendname,state)
{
	if(typeof(adcall)=="undefined")
	   adcall=bar_adcallno;
	if(typeof(OperatorArray) != 'undefined' && state==-1)
	{
		for(i=0;i<OperatorArray.length;i++)
		{
			if(OperatorArray[i].name==name)
			{
				state=OperatorArray[i].state;
				if(friendname=='')
					friendname=OperatorArray[i].friendname;
				break;
			}
		}
	}

	if(state>=3)
	{
		return '<span style="display:block;width:100%;cursor:pointer;text-align:center;padding-top:3px;padding-bottom:3px;" ><b>'+unescape(friendname.replace(/\+/g,'%20'))+'</b><br><a href="javascript:openZoosWindow_olist(\'chatwin\',\'&oname='+name+'\')" target="_self"><font style="FONT-SIZE: 13px;COLOR: red;">【在线洽谈】</font></a></span>';
	}
	else if(state==2)
	{
		var e=escape('发送给'+unescape(name.replace(/\+/g,'%20'))+'的留言');
		return '<span style="display:block;width:100%;cursor:pointer;text-align:center;padding-top:3px;padding-bottom:3px;" ><b>'+unescape(friendname.replace(/\+/g,'%20'))+'<br><a href="#"  onclick="return false;" target="_self"><font style="FONT-SIZE: 13px;COLOR: purple;" onclick=openZoosWindow_olist(\'sendnote\',\'&e='+name+'\')>【繁忙】</font></a></span>';
	}
	else if(state==1)
	{
		var e=escape('发送给'+unescape(name.replace(/\+/g,'%20'))+'的留言');
		return '<span style="display:block;width:100%;cursor:pointer;text-align:center;padding-top:3px;padding-bottom:3px;" ><b>'+unescape(friendname.replace(/\+/g,'%20'))+'<br><a href="#"  onclick="return false;" target="_self"><font style="FONT-SIZE: 13px;COLOR: blue;" onclick=openZoosWindow_olist(\'sendnote\',\'&e='+name+'\')>【离开】</font></a></span>';
	}
	else if(state==0)
	{
		var e=escape('与'+unescape(name.replace(/\+/g,'%20'))+'免费通话');
		//return '<span style="display:block;width:100%;cursor:pointer;text-align:center;padding-top:3px;padding-bottom:3px;" ><b>'+unescape(friendname.replace(/\+/g,'%20'))+'</b><br><a href="http://manage.adcall.com.cn/WebCall/WebCall.jsp?wid='+adcall+'&surl='+bar_url+'"  target="_blank"><font style="FONT-SIZE: 13px;COLOR: red;">【免费电话】</font></a></span>';
		return '<span style="display:block;width:100%;cursor:pointer;text-align:center;padding-top:3px;padding-bottom:3px;"  onclick="adcall_openDiv(\''+adcall+'\')"><b>'+unescape(friendname.replace(/\+/g,'%20'))+'</b><br><a><font style="FONT-SIZE: 13px;COLOR: red;">【免费电话】</font></a></span>';
	}
	else
		return '';
}




var ad_pagesize = getPageSize();
var f_w_t = parseInt(ad_pagesize[3]/2 - 100);
var f_w_l = parseInt(ad_pagesize[0]/2 - 200);
//show win function
function show_adcall_win()
{

	
	var adcall_show_win_code = 	'<div height=26 style="height:26px;background:transparent url('+host+'/images/6/ac_cw_title.png) no-repeat; padding:10px 5px 0 10px;margin:0;behavior: url("'+host+'/css/iepngfix.htc");" onmouseover="adcall_move_bar(\'adcall_show_win\')"><div id="flow_icon"></div><span style="font-size:16px; font-weight:bold; color:#3E78AC; float:left;">'+invite_title+'</span><a href="javascript:void(0);" style="height:12px; width:15px; overflow:hidden; float:right;background:url('+host+'/images/6/ac_close_btn.png) top left no-repeat; display:inline-block; margin:3px 7px 0 0;" onclick="adcall_closeDiv(\'adcall_show_win\');"></a></div><iframe width="447px" height="190px" frameborder="0" scrolling="no" marginheight="0" allowTransparency="true" id=adcall_win_frame name=adcall_win_frame></iframe>';

	var bar_div ;
	if(document.getElementById('adcall_show_win')!=null)
	{
		bar_div = document.getElementById("adcall_show_win");
	}
	else
		bar_div = document.createElement("div");
	bar_div.id = "adcall_show_win";
	bar_div.style.cssText = "position:absolute;top:"+f_w_t+"px;left:"+f_w_l+"px;width:447px;height:210px;overflow:hidden;z-index:9999;cursor:move;";
	bar_div.innerHTML = adcall_show_win_code;

	document.body.appendChild(bar_div);
	document.getElementById('adcall_win_frame').src=host+'/url.php?action=invite&uid='+bar_adcallno+"&url="+bar_url+'&no400='+bar_400+'&branch'+bar_branch;
	window.setInterval("adcall_floatbar('adcall_show_win',1)",1);
}


var f_c_t = parseInt(ad_pagesize[3]/2 - 200);
var f_c_l = parseInt(ad_pagesize[0]/2 - 200);
function show_adcall_call(id)
{


	var adcall_show_call_code = '<div height=26 style="height:26px;background:transparent url('+host+'/images/6/ac_cw_title.png) no-repeat; padding:10px 5px 0 10px;margin:0;behavior: url("'+host+'/css/iepngfix.htc");" onmouseover="adcall_move_bar(\'adcall_show_call\')"><div id="flow_icon"></div><span style="font-size:16px; font-weight:bold; color:#3E78AC; float:left;">'+invite_title+'</span><a href="javascript:void(0);" style="height:12px; width:15px; overflow:hidden; float:right;background:url('+host+'/images/6/ac_close_btn.png) top left no-repeat; display:inline-block; margin:3px 7px 0 0;" onclick="adcall_closeDiv(\'adcall_show_call\');"></a></div><iframe width=443 height=360 frameborder="0" scrolling="no" marginheight="0" allowTransparency="true" style="width:443px; min-height:360px;background:url('+host+'/images/6/ac_cw_bg.png) top repeat-x #ebf7fd; border-left:1px solid #8fb9d0;border-right:1px solid #8fb9d0;" name=adcall_call_frame id=adcall_call_frame></iframe><div style="height:28px;background:url('+host+'/images/6/ac_cw_bot.png) repeat-x #ebf7fd; width:447px;"></div>';
	var bar_div ;
	if(document.getElementById('adcall_show_call')!=null)
	{
		bar_div = document.getElementById("adcall_show_call");
	}
	else
		bar_div = document.createElement("div");
	bar_div.id = "adcall_show_call";
	bar_div.style.cssText = "position:absolute;top:"+f_c_t+"px;left:"+f_c_l+"px;width:448px;height:480px;overflow:hidden;z-index:9999;cursor:move;";
	bar_div.innerHTML = adcall_show_call_code;
	document.body.appendChild(bar_div);
	document.getElementById('adcall_call_frame').src=host+'/url.php?action=callform&uid='+id+"&url="+bar_url+'&no400='+bar_400+'&branch'+bar_branch+'&intro='+call_content;
	window.setInterval("adcall_floatbar('adcall_show_call',2)",1);

}

function adcall_closeDiv(Divobj){   
	adcall_D(Divobj).style.display = "none";   //删除
}
function adcall_openDiv(id){   
	show_adcall_call(id);
}
function clear_num(i)
{
	if(i.value=="请输入您自己的电话号码")
		i.value="";
	i.style.color="#cb3c2d";
}
//check form
function adcall_checkCB()
{
	if (document.cb.cb_num.value==""){alert("请输入您的电话号码");return false;}
	if (isNaN(document.cb.cb_num.value) && document.cb.cb_num.value.indexOf("-")==-1){alert("电话号码只能输入数字");return false;}
	setTimeout("document.cb.cb_sub.disabled=false;",8000);
	setTimeout("document.cb.cb_num.disabled=false;",8000);
}

function adcall_init()
{
	if(typeof(bar_show)!="undefined" && bar_show !='' && bar_show > 0){
		 window.setTimeout("show_adcall_bar();",bar_show);
	}
	if(typeof(invite_show)!="undefined" && invite_show !='' && invite_show > 0){
		 window.setTimeout("show_adcall_win();",invite_show);
	}
}

//页面加载完后再执行
document.onreadystatechange = function(){   
	if(document.readyState=="complete")   
    {   
        //alert('加载完毕'); 
		adcall_init();
    }
}

//页面尺寸更改

window.onresize = function(){
	if(document.getElementById('adcall_show_win')!=null && adcall_D("adcall_show_win").style.display != "none")
	{
		
		ad_pagesize = getPageSize();
	
		f_w_t = parseInt(ad_pagesize[3]/2 -100);
		f_w_l = parseInt(ad_pagesize[0]/2 -200);
		
		show_adcall_win();
	}

}
function setCookie(name,value){ 
	var Days = 60; //cookie 将被保存两个月 
	var exp = new Date(); //获得当前时间 
	exp.setTime(exp.getTime() + Days*24*60*60*1000); //换成毫秒 
	document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); 
} 

function getCookie(name){ 
	var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); 
	if(arr != null) 
	return unescape(arr[2]); 
	return null; 

} 

function delCookie(name){ 
	var exp = new Date(); //当前时间 
	exp.setTime(exp.getTime() - 1); 
	var cval=getCookie(name); 
	if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString(); 
}
if(typeof(kf_id) != "undefined" && kf_id !=null && kf_id!="")
{
	if(typeof(kf_host) != "undefined" && kf_host !=null && kf_host!="")
		document.write('<scr'+'ipt language="javascript" src="http://'+kf_host+'/JS/LsJS.aspx?siteid='+kf_id+'&lng=cn"></scr'+'ipt>');
	else
		document.write('<scr'+'ipt language="javascript" src="http://kft.zoosnet.net/JS/LsJS.aspx?siteid='+kf_id+'&lng=cn"></scr'+'ipt>');
}

-->
