﻿var delta=0.15 ;
var collection;
function floaters() {  
	this.items = [];  
	this.addItem = function(id,x,y,content) {  
		document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute;top:140px; width:88px; height:203px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>'); 
		var newItem = {};  
		newItem.object = document.getElementById(id);  
		newItem.x = x;  
		newItem.y = y; 
		this.items[this.items.length] = newItem;  
		}  
	this.play = function()  
	{  
		collection = this.items  
		setInterval('play()',10);  
	}  
}  
function play()  
{ 
	for(var i=0;i<collection.length;i++)  
{  
var followObj = collection[i].object;  
var followObj_x = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);  
var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y); 
if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {  
var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;  
dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));  
followObj.style.left=followObj.offsetLeft+dx;  
} 
if(followObj.offsetTop!=(document.documentElement.scrollTop+followObj_y)) {  
var dy=(document.documentElement.scrollTop+followObj_y-followObj.offsetTop)*delta;  
dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));  
followObj.style.top=followObj.offsetTop+dy;  
}  
followObj.style.display = '';  
}  
}  
var theFloater1 = new floaters();  
theFloater1.addItem('lovexin','1',210,"<a href=\"tencent:\/\/message\/?uin=138200169&Site=福州东南妇幼医院&Menu=yes\"><img src=\"http:\/\/www.hzzdyy.com/\qq.gif\" border=\"0\"><\/a>"); 
theFloater1.play();


//右侧广告

document.writeln("<div class=\"QQbox\" id=\"divQQbox\" style='right:2px;POSITION:absolute;Z-INDEX: 10000;TOP:200px;'>");
document.writeln("<div class='Qlist' id='divOnline'>");
//document.writeln("<div onclick='OnlineOut();' style='cursor: pointer;'><span class='quit'>关闭</span></div>");
document.writeln("<div class=\"con\">");
document.writeln("<a href=http://lr.zoosnet.net/LR/Chatpre.aspx?id=LEF98035188&amp;e=点击咨询专家 target=_blank><img src=http://www.hzzdyy.com/template/images/swtyc_01.gif /></a><br /><a href=tencent://message/?uin=138200169&Site=东南妇幼医院&Menu=yes><img src=http://www.hzzdyy.com/template/images/swtyc_02.gif /></a><br><a href=http://www.hzzdyy.com/hzzdyy.html target=_blank><img src=http://www.hzzdyy.com/template/images/swtyc_03.gif /></a>");
document.writeln("<\/div>");
document.writeln("<\/div>");
document.write("<div id='divMenu' onmouseover='OnlineOver();' style='display : none;right:2px; width: 27px; POSITION:absolute;'></div>");

document.writeln("<\/div>");

//<![CDATA[
var tips; var theTop = 160/*这是默认高度,越大越往下*/; var old = theTop;
function initFloatTips() {
  tips = document.getElementById('divQQbox');
  moveTips();
};
function moveTips() {
  var tt=50;
  if (window.innerHeight) {
    pos = window.pageYOffset
  }
  else if (document.documentElement && document.documentElement.scrollTop) {
    pos = document.documentElement.scrollTop
  }
  else if (document.body) {
    pos = document.body.scrollTop;
  }
  pos=pos-tips.offsetTop+theTop;
  pos=tips.offsetTop+pos/10;

  if (pos < theTop) pos = theTop;
  if (pos != old) {
    tips.style.top = pos+"px";
    tt=10;
  //alert(tips.style.top);
  }

  old = pos;
  setTimeout(moveTips,tt);
}
//!]]>
initFloatTips();



function OnlineOver(){
	document.getElementById("divMenu").style.display = "none";
	document.getElementById("divOnline").style.display = "block";
	document.getElementById("divQQbox").style.width = "145px";
}

function OnlineOut(){
	document.getElementById("divMenu").style.display = "block";
	document.getElementById("divOnline").style.display = "none";
}

function hideMsgBox(theEvent){  //theEvent用来传入事件，Firefox的方式
	if (theEvent){
		var browser=navigator.userAgent;   //取得浏览器属性
		if (browser.indexOf("Firefox")>0){  //如果是Firefox
			if (document.getElementById('divOnline').contains(theEvent.relatedTarget)) {  //如果是子元素
				return;   //结束函式
			} 
		} 
		if (browser.indexOf("MSIE")>0){  //如果是IE
	 		if (document.getElementById('divOnline').contains(event.toElement)) {  //如果是子元素
				return;  //结束函式
	  		}
	}
}
/*要执行的操作*/
	document.getElementById("divMenu").style.display = "block";
	document.getElementById("divOnline").style.display = "none";
}



