/*
*** (C) 2008 UCMai.com ***

Subj: 异步获取客服QQ列表
Auth: lingq
Date: 2008
*/
function getServiceQQ(tagid){
	//$$("serviceqq").innerHTML = "&nbsp;正在加载...";
	var xmlhttp=CreatXml();
	xmlhttp.open("get","/shop/getServiceQQ.asp?tagid="+tagid,true);
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4 && xmlhttp.status==200){
			var html=[];
			var ServiceQQStr = unescape(xmlhttp.responseText);
			var tmpServiceQQ,ServiceQQItem,ServiceQQC,tmpC,tmpCC,ServiceStatus;
			if (ServiceQQStr.indexOf("$$") != -1)
			{
				tmpServiceQQ = ServiceQQStr.split("$$");
				var len = tmpServiceQQ.length;
				for (var i=1;i<len;i++)
				{
					if (tmpServiceQQ[i].indexOf("$"))
					{
						ServiceQQItem = tmpServiceQQ[i].split("$");
						html.push("&nbsp;");
						switch(ServiceQQItem[0]){
							case '1':
								html.push("<span style='color:#FF6600;'>销售客服</span>");
								break;
							case '4':
								html.push("<span style='color:#FF6600;'>账号交易客服</span>");
								break;
							case '5':
								html.push("<span style='color:#FF6600;'>代客下单</span>");
								break;
							case '6':
								html.push("<span style='color:#FF6600;'>服务投诉</span>");
								break;
						}
						ServiceQQC = ServiceQQItem[1];
						if(ServiceQQC.indexOf("|") != -1){
							tmpC = ServiceQQC.split("|");
							for(var j=0;j<tmpC.length;j++){
								tmpCC = tmpC[j].split(",");
								ServiceStatus = tmpCC[1] == "忙"?"<span style='color:#ff0000;'>(忙)</span>":"(闲)";
								html.push("<br /><img  style=\"CURSOR: pointer\" onclick=\"javascript:window.open('http://bizapp.qq.com/webc.htm?new=0&sid="+tmpCC[0]+"&o=www.ucmai.com&q=7', '_blank', 'height=544, width=644,toolbar=no,scrollbars=no,menubar=no,status=no');\"  border=\"0\" SRC=\"http://im.bizapp.qq.com:8000/zx.gif\">");
							}
						}else{
							tmpCC = ServiceQQC.split(",");
							ServiceStatus = tmpCC[1] == "忙"?"<span style='color:#ff0000;'>(忙)</span>":"(闲)";
							html.push("<br /><img  style=\"CURSOR: pointer\" onclick=\"javascript:window.open('http://bizapp.qq.com/webc.htm?new=0&sid="+tmpCC[0]+"&o=www.ucmai.com&q=7', '_blank', 'height=544, width=644,toolbar=no,scrollbars=no,menubar=no,status=no');\"  border=\"0\" SRC=\"http://im.bizapp.qq.com:8000/zx.gif\">");
						}
						html.push("<br />");
					}
				}
			}
			html.push("<span style='color:#FF6600;'>&nbsp;客服电话</span><br />&nbsp;&nbsp;电话：0578-2082268");
			$$("serviceqq").innerHTML = html.join("");
		}
	};
	xmlhttp.send(null);
}

function reServiceQQ(tagid){
	setInterval(function(){getServiceQQ(tagid);},60000);
}

function qqaction(str){
var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey='+str;
var oldscript=document.getElementById('testJs');
var newscript=document.createElement('script');
newscript.setAttribute('type','text/javascript'); 
newscript.setAttribute('id', 'testJs');
newscript.setAttribute('src',tempSrc);
if(oldscript == null){
	document.body.appendChild(newscript);
}
else{oldscript.parentNode.replaceChild(newscript, oldscript);}

return false;
}
