﻿//取出COOKIE name=变量名
function fGetCookie(name) {
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0) { 
    offset = document.cookie.indexOf(search);
    if (offset != -1) { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end));
    }
  }
  return cookieValue;
}

//设置COOKIE 变量名,内容,时间(小时)
function fSetCookie(name, value, hours) {
  var expire = "";
  var domain = "; domain=aothink.com; path=/";
  if(hours != "") {
    expire = new Date((new Date()).getTime() + hours * 60 * 60 * 1000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + domain;
}

//获取URL参数
function Request_URL()
{
	var strHref = top.document.referrer;
	if (strHref=="")
	{
		strHref=this.location.href;
	}
	strHref=strHref.replace("http://","");
	var arrTmp = strHref.split("/");
	if (arrTmp[1]=="28")
	{
		return "28";
	}
	else
	{
		var arrTmp = strHref.split(".");
		return arrTmp[1];
	}
}

come_from=fGetCookie("come_from"); //取出值
if (come_from=="")
{
	come_from=Request_URL();
	fSetCookie("come_from",come_from,1);
}

//=====================

var asw_xinming=new Array();
var asw_qq=new Array();
var sort_array=new Array();

asw_xinming[0]="黄小姐";
asw_qq[0]="103171839";

var sort_array=[0];
var show_xinming,show_qq,qq_list="";
sort_array.sort(function(){return Math.random()>0.5?-1:1;});

for (i=0;i<=0;i++) 
{
	show_xinming=asw_xinming[sort_array[i]];
	show_qq=asw_qq[sort_array[i]];
	qq_list+="<a href='http://wpa.qq.com/msgrd?V=1&Uin="+show_qq+"&Site="+come_from+"_"+show_xinming+"&Menu=yes' target='blank'><img SRC='http://wpa.qq.com/pa?p=1:"+show_qq+":10' alt='QQ服务' border='0'> "+show_xinming+"</a><BR>";
}

var showbody="<table width='128' border='0' cellspacing='0' cellpadding='0'><tr><td colspan='3'><img src='/web/etech/qq/qq_top.gif'></td></tr><tr><td width='6' rowspan='2' background='/web/etech/qq/qq_life.gif'></td><td align='center' bgcolor='#FFFFFF'><table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr><td width='27%' height='25' align='center'><img src='/web/etech/qq/qq_ico.gif'></td><td width='73%'>客户服务</td></tr></table></td><td width='7' rowspan='2' background='/web/etech/qq/qq_right.gif'></td></tr><tr id='qqstab1'><td width='115' align='center' bgcolor='#FFFFFF'>"+qq_list+"</td></tr><tr><td colspan='3'><img src='/web/etech/qq/qq_logo.gif'></td></tr></table>";

	var delta=0.15
	var collection;
	var closeB=false;
	function floaters() {
		this.items	= [];
		this.addItem	= function(id,x,y,content)
				  {
					document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute;  width:80px; height:60px;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()
		{
			if(screen.width<=648 || closeB)
			{
				for(var i=0;i<collection.length;i++)
				{
					collection[i].object.style.display	= 'none';
				}
				return;
			}
			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.body.scrollTop+followObj_y)) {
					var dy=(document.body.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	= '';
			}
		}	
		function closeBanner()
		{
			closeB=true;
			return;
		}
		function qqstabBanner()
		{
			if(document.all.qqstab1.style.display=='none')
			{
			   document.all.qqstab1.style.display=''
			}
			else 
			{
				document.all.qqstab1.style.display='none'
		    }
		}
		
	var theFloaters = new floaters();
	theFloaters.addItem('followDiv2',6,30,showbody);
	//theFloaters.addItem('followDiv1','document.body.clientWidth-130',50,showbody);
	theFloaters.play();