function BuildHtml(){
	var host = location.hostname;
	var department,tel;
	if(host == "gj.jourserv.com" || host == "www.gjyxcq.cn" || host == "gjjy.cqshic.com" || host == "gjjy.cqshic.com.cn" || host == "gjjy.cqshic.cn"){
		department = "欢迎访问国际检验医学杂志网站";
		tel = "023—63616134";
	}else if(host == "cqyx.jourserv.com" || host == "cqyx.cqshic.com" || host == "cqyx.cqshic.com.cn" || host == "gjjy.cqshic.cn" ){
		department = "欢迎访问重庆医学杂志网站";
		tel = "023—63604477";
	}else if(host == "www.labmc.com.cn" || host == "jyyx.jourserv.com" || host == "jyyx.cqshic.com" || host == "jyyx.cqshic.com.cn" || host == "jyyx.cqshic.cn"){
		department = "欢迎访问检验医学与临床杂志";
		tel = "023—63613484";
	}else{
		tel = department = "域名无效";	
	}
	var html = "";
	html += "<div id='TonSuLive' style='background:transparent url(http:\/\/import.jourserv.com\/threeissue\/bg.gif); height:300px; width:170px;' onmousedown='mousedown.apply(this.parentNode,arguments);' onselectstart=\"return false;\">";
	html += "<div style='height:40px; overflow:hidden;cursor:move'>";
	html += "<input type='button' value='&nbsp;' style='margin-left:120px;cursor:pointer;border:0px;background:transparent url(http:\/\/import.jourserv.com\/threeissue\/close.gif) no-repeat top;width:42px; height:18px; overflow:hidden;' onmouseover='this.style.backgroundPosition=\"bottom\"' onmouseout='this.style.backgroundPosition=\"top\"' onclick='CloseTechnicalSupport()' />";
	html += "</div>";
	html += "<div style='width:150px; margin-left:10px; height:233px; overflow:hidden'>";
	html += "<div style='color:#0C4E7C; font-size:14px; line-height:140%'><span style='margin-left:28px;'></span>您好，" + department + "。</div>";
	html += "<div style='color:#0C4E7C; font-size:14px; line-height:120%;margin-top:10px;color:red'>编辑部热线：</div>";
	html += "<div style='color:#0C4E7C; font-size:14px; line-height:100%;margin-left:26px;'>" + tel + "</div>";
	html += "<div style='color:#0C4E7C; font-size:14px; line-height:120%;margin-top:5px;'>监督电话：</div>";
	html += "<div style='color:#0C4E7C; font-size:14px; line-height:100%;margin-left:26px;'>023-63623149</div>";
	html += "<div style='color:#0C4E7C; font-size:14px; line-height:100%;margin-left:26px;'>023-63635355</div>";
	html += "<div style='color:#0C4E7C; font-size:14px; line-height:120%;margin-top:5px;'>技术支持：</div>";
	html += "<div style='color:#0C4E7C; font-size:14px; line-height:100%;margin-left:26px;'>023-62647282</div>";
	html += "<div style='margin-left:26px; margin-top:2px;'>";
	html += "<a href='http:\/\/wpa.qq.com\/msgrd?V=1&amp;Uin=277307185&amp;Site=同数科技期刊OA系统&amp;Menu=yes' style='text-decoration:none' target='_blank'>";
	html += "<img src='http:\/\/wpa.qq.com\/pa?p=1:277307185:3' border='0' alt='技术支持' />";
	html += "</a>";
	html += "<div style='height:5px;overflow:hidden'></div>";
	html += "<a href='http:\/\/wpa.qq.com\/msgrd?V=1&amp;Uin=17505991&amp;Site=同数科技期刊OA系统&amp;Menu=yes' style='text-decoration:none' target='_blank'>";
	html += "<img src='http:\/\/wpa.qq.com\/pa?p=1:17505991:3' border='0' alt='技术支持' />";
	html += "</a>";
	html += "</div>";
	html += "</div>";
	html += "<div style='height:22px; overflow:hidden; width:160px; text-align:right;'>";
	html += "<input type='button' value='关闭窗口' onclick='CloseTechnicalSupport()' style='background:transparent url(http:\/\/import.jourserv.com\/threeissue\/btn.jpg); width:69px; height:21px; border:0px; cursor:pointer;font-size:13px; color:#0C4E7C' />";
	html += "</div>";
	html += "</div>";
	return html;
}
function BaseInit(){
    InitTechnicalSupport();
	initScroll();
	window.onscroll=scall; 
}
if(document.addEventListener){
    window.addEventListener('load',BaseInit,false);
}else{
    window.attachEvent('onload',BaseInit);
}
function InitTechnicalSupport(){
	var box = document.createElement("div");
    box.id = "TONSUTechBox"; 
	with(box.style){
		top = "0px";
		right = "20px";
		position = "absolute";
		width = "170px";
		height = "300px";
	}
	box.innerHTML = BuildHtml();
	document.body.appendChild(box);
	with(document.body.style){
		//width = "100%";
		height = "100%";
	}
}
function CloseTechnicalSupport(){
	document.getElementById("TONSUTechBox").style.display = "none";
	window.onscroll = function(){};
}

var ft;
function initScroll(){
	ft=parseInt(document.documentElement.scrollTop+(document.documentElement.clientHeight-document.getElementById("TONSUTechBox").offsetHeight)/2);
	document.getElementById("TONSUTechBox").style.top=ft;
}
var flag=0;
var speed=5;
var acc=100;
function move(){
	var t=document.getElementById("TONSUTechBox").style.top;
	var top=parseInt(t);
	var myhigh=parseInt(document.documentElement.scrollTop+(document.documentElement.clientHeight-document.getElementById("TONSUTechBox").offsetHeight)/2);
	if(top<myhigh-speed){
		document.getElementById("TONSUTechBox").style.top=top+speed;
	}else if(top>myhigh+speed){
		document.getElementById("TONSUTechBox").style.top=top-speed;
	}
	setTimeout("move()",10);
}
function scall(){ 
	if(flag==0){
		move();
		flag=1;
	}
} 

function mousedown()
{
	var e=arguments[0]||event;
	var me=this;
	var dy=e.clientY-parseInt(me.style.top);
	var dx=e.clientX-parseInt(me.style.left);
	startdrag(
		document.body,
		function(e){
			e=e||event;
			me.style.top=e.clientY-dy;
			me.style.left=e.clientX-dx;
		},
		function(e){
		}
	);
}
function startdrag(parent,onmove,onfinish,area)
{
	var up,out,over;
	var divarea=document.createElement("div");
	if(!area)area={
		"top":"0px",
		"left":"0px",
		"width":"100%",
		"height":"100%"
	}
	divarea.style.position="absolute";
	divarea.style.top=area.top;
	divarea.style.left=area.left;
	divarea.style.width=area.width;
	divarea.style.height=area.height;
	divarea.style.overflow="hidden";
	divarea.style.zIndex="10000";
	divarea.className="dragArea";
	parent.appendChild(divarea);

	if(divarea.attachEvent)
	{
		divarea.attachEvent("onmousemove",onmove)
		document.attachEvent("onmouseup",up=function(){
			divarea.detachEvent("onmousemove",onmove);
			document.detachEvent("onmouseup",up);
			divarea.detachEvent("onmouseout",out);
			parent.removeChild(divarea);
			onfinish(event||arguments[0]);
		});
		divarea.attachEvent("onmouseout",out=function(){
			divarea.detachEvent("onmousemove",onmove);
			document.detachEvent("onmouseup",up);
			divarea.detachEvent("onmouseout",out);
			parent.removeChild(divarea);
			onfinish(event||arguments[0]);
			});
		}

	else if(divarea.addEventListener)
	{
		divarea.addEventListener("mousemove",onmove,true);
		document.addEventListener("mouseup",up=function(){
			divarea.removeEventListener("mousemove",onmove,true);
			document.removeEventListener("mouseup",up,true);
			divarea.removeEventListener("mouseout",out,true);
			parent.removeChild(divarea);
			onfinish(event||arguments[0]);
		},true);
		divarea.addEventListener("mouseout",out=function(){
			divarea.removeEventListener("mousemove",onmove,true);
			document.removeEventListener("mouseup",up,true);
			divarea.removeEventListener("mouseout",out,true);
			parent.removeChild(divarea);
			onfinish(event||arguments[0]);
		},true);
	}
}