function offerService(delay){
	var to;

	var cookies = getCookie("OfferService");
	if(!cookies)	//第一次打开网站,写入cookies,打开在线客服
		setTimeout(function(){create();},delay);

	function create(){
		var tag = document.getElementById("OfferService");
		if(!tag){
			tag = document.createElement("DIV");
			tag.id = "OfferService";
			tag.style.display = "none";
			tag.style.width = "402px";
			tag.innerHTML = html();
			document.body.appendChild(tag);
		}
		tableCNTR("el:OfferService; title:<span class='offer_service_title'></span>; color:serviceblue; div:#000000 30%; move:yes;");

		var topMoveDiv = document.getElementById("tableCNTR_Head_OfferService").childNodes[0];
		var bottomMoveDiv = document.getElementById("tableCNTR_Bottom_OfferService").childNodes[0];
		var delDiv = topMoveDiv.childNodes[0].childNodes[0].getElementsByTagName("SAMP")[1];
		var borderLeft = document.getElementById("tableCNTR_Head_OfferService").childNodes[1];
		var borderRight = document.getElementById("tableCNTR_Head_OfferService").childNodes[2];
		topMoveDiv.style.height = "28px";
		delDiv.style.marginTop = "8px";
		borderLeft.style.height = "201px";
		borderRight.style.width = (parseInt(borderRight.style.width) - 4) + "px";
		borderRight.style.height = "201px";
		borderRight.style.marginLeft = "5px";
		if(document.all){
			topMoveDiv.attachEvent("onmousedown",offerService_Clear);
			topMoveDiv.attachEvent("onmouseup",function(){offerService_Move(tag,null,null)});
			bottomMoveDiv.attachEvent("onmousedown",offerService_Clear);
			bottomMoveDiv.attachEvent("onmouseup",function(){offerService_Move(tag,null,null)});
			delDiv.attachEvent("onclick",setTips);
		}else{
			topMoveDiv.addEventListener("mousedown",offerService_Clear,false);
			topMoveDiv.addEventListener("mouseup",function(){offerService_Move(tag,null,null)},false);
			bottomMoveDiv.addEventListener("mousedown",offerService_Clear,false);
			bottomMoveDiv.addEventListener("mouseup",function(){offerService_Move(tag,null,null)},false);
			delDiv.addEventListener("click",setTips,false);
		}

		var operEM = document.getElementById("offer_service_oper").getElementsByTagName("EM");
		operEM[0].onclick = function(){setNoTips(7); delTableCNTR("OfferService");}
		operEM[1].onclick = function(){setNoTips(30); delTableCNTR("OfferService");}
		operEM[2].onclick = function(){setNoTips(365); delTableCNTR("OfferService");}
		var operSPAN = document.getElementById("offer_service_oper").getElementsByTagName("SPAN")[0];
		operSPAN.onclick = function(){addFav("http://www.ecenco.com","宇讯网络科技");}

		var OfferServiceUrl = document.getElementsByName("OfferServiceUrl");
		for(var i = 0; i < OfferServiceUrl.length; i++){
			OfferServiceUrl[i].onclick = function(){
				setTips();
				//open({W:630,H:452,TB:'no',MB:'no'});
				delTableCNTR("OfferService");
			}
		}

		offerService_Move(tag,null,null);
	}

	function html(){
		var alpahaLink = (document.all) ? "filter:alpha(opacity=0);" : "-moz-opacity:0;opacity:0;";
		var str = "";
		str += "<div class=\"offer_service_main\">";
		str += "	<div class=\"offer_service_input\">";
		str += "		<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"272\" height=\"143\" style=\"z-index:-1;\">";
		str += "			<param name=\"wmode\" value=\"Opaque\">";
		str += "			<param name=\"movie\" value=\"" + MainServer + "/api/offerservice/style/re.swf\">";
		str += "			<param name=\"quality\" value=\"high\">";
		str += "			<param name=\"wmode\" value=\"transparent\">";
		str += "			<embed src=\"" + MainServer + "/api/offerservice/style/re.swf\" wmode=\"opaque\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"272\" height=\"143\">";
		str += "		</object>";
		str += "		<a name=\"OfferServiceUrl\" href=\"http://www.ecenco.com/support/\" target=\"_blank\" class=\"offer_service_flash_url\" style=\"" + alpahaLink + "\"></a>";
		str += "	</div>";
		str += "	<a name=\"OfferServiceUrl\" href=\"http://www.ecenco.com/support/\" target=\"_blank\"><div class=\"offer_service_women\"></div></a>";
		str += "	<a name=\"OfferServiceUrl\" href=\"http://www.ecenco.com/support/\" target=\"_blank\" class=\"offer_service_send\"></a>";
		str += "	<div class=\"offer_service_clear\"></div>";
		str += "	<div class=\"offer_service_bottom\">";
		str += "		<span class=\"offer_service_content\">";
		str += "			<strong>服务热线</strong>：400-600-3198、0760-88877527　<strong>QQ</strong>：75093988";
		str += "		</span>";
		str += "		<span id=\"offer_service_oper\">";
		str += "			<em><input type=\"radio\" name=\"NoTips\">一周内不再提醒</em>";
		str += "			<em><input type=\"radio\" name=\"NoTips\">一月内不再提醒</em>";
		str += "			<em><input type=\"radio\" name=\"NoTips\">永久不再提醒</em>";
		str += "			<span></span>";
		str += "		</span>";
		str += "	</div>";
		str += "</div>";
		return str;
	}

	var offerService_Move = function(id,_top,_left){
		var me = id.charAt ? document.getElementById(id) : id;
		var d1 = document.body;
		var d2 = document.documentElement;
		if(_top == null){
			_top = parseInt(me.style.top) - ((d2) ? d2.scrollTop : d1.scrollTop);
		}

		me.style.position = "absolute";
		to = setInterval(
			function (){
				me.style.top = parseInt(me.style.top) + (Math.max(d1.scrollTop,d2.scrollTop) + _top - parseInt(me.style.top)) * 0.1 + "px";
			}
		,10 + parseInt(Math.random() * 20));
		return arguments.callee;
	}

	var offerService_Clear = function(){
		clearTimeout(to);
	}

	function getCookie(name){
		var arg = name + "=";
		var alen = arg.length;
		var clen = document.cookie.length;
		var i = 0;
		while (i < clen){
			var j = i + alen;
			if(document.cookie.substring(i, j) == arg)
				return getCookieVal(j);
			i = document.cookie.indexOf(" ", i) + 1;
			if(i == 0) break;
		}
		return null;
	}

	function setCookie(name,value){
		var argv = setCookie.arguments;
		var argc = setCookie.arguments.length;
		var expires = (argc > 2) ? argv[2] : null;
		var path = (argc > 3) ? argv[3] : null;
		var domain = (argc > 4) ? argv[4] : null;
		var secure = (argc > 5) ? argv[5] : false;
		document.cookie = name + "=" + escape (value) +
		((expires == null) ? "" : ("; expires=" + expires.toUTCString())) +
		((path == null) ? "" : ("; path=" + path)) +
		((domain == null) ? "" : ("; domain=" + domain)) +
		((secure == true) ? "; secure" : "");
	}

	function getCookieVal(offset){
		var endstr = document.cookie.indexOf (";", offset); 
		if (endstr == -1) 
			endstr = document.cookie.length; 
		return unescape(document.cookie.substring(offset, endstr)); 
	}

	var setTips = function(){
		setCookie("OfferService","NextTips",null,"/");
	}

	function setNoTips(day){
		setCookie("OfferService","NoTips",dateAdd("n",day,new Date()),"/");
	}

	function dateAdd(interval,number,d){
		var k={'y':'FullYear', 'q':'Month', 'm':'Month', 'w':'Date', 'd':'Date', 'h':'Hours', 'n':'Minutes', 's':'Seconds', 'ms':'MilliSeconds'};
		var n={'q':3, 'w':7}; 
		eval('d.set'+k[interval]+'(d.get'+k[interval]+'()+'+((n[interval]||1)*number)+')');
		return d;
	}

	function addFav(url, title){
		url = url ? url : location.href;
		title = title ? title : document.title;
		if(document.all){
			window.external.addFavorite(url, title);
		}else if(window.sidebar){
			window.sidebar.addPanel(title, url, "");
		}
	}

	function open(parameter){
		var url = "http://www.ecenco.com/support/online/";
		var ary = new Array();
		(parameter.W) ? ary.push("width=" + parameter.W) : o.W = 500;
		(parameter.H) ? ary.push("height=" + parameter.H) : o.H = 400;
		ary.push("left=" + ((screen.width-parameter.W) / 2));
		ary.push("top=" + ((screen.height-parameter.H) / 2));
		(parameter.TB) ? ary.push("toolbar=" + parameter.TB) : '';//是否显示工具栏
		(parameter.MB) ? ary.push("menubar=" + parameter.MB) : '';//是否显示菜单栏
		(parameter.SB) ? ary.push("scrollbars=" + parameter.SB) : '';
		(parameter.S) ? ary.push("status=" + parameter.S) : '';//是否显示状态栏内的信息
		var win = window.open(url,"",ary.join(","));
	}
}
