//init cookie
function setCookie() 
{ 
  var FromUrl=window.location.toString();
      FromUrl=FromUrl.replace("http://","");
	  FromUrl=FromUrl.replace("www.","");
	  FromUrl=FromUrl.substring(0,FromUrl.indexOf("/"));
  var now=new Date();
//set cookie  expires date 1000ms*60*60
  now.setTime( now.getTime() + 1000 * 60 * 60 );
  var the_cookie = "FromUrl="+FromUrl+";expires="+now.toGMTString()+";path=/";
  document.cookie = the_cookie;//write Cookie
} 
function readCookie()
{ var the_cookie = document.cookie; 
  return the_cookie;
}
setCookie();
//end of init cookie
var brOK=false;
var mie=false;
var vmin=2;
var vmax=5;
var vr=3;
var timer1;
var nowads;
var ad_width=0;
var ad_height=0;
// <a href="http://www.now.net.cn">Domain Hosting email </a>    <a href="http://www.todayisp.com">Domain Hosting email</a>
function movechip(chipname)
{
	if(brOK)
	{
		eval("chip="+chipname);
		if(!mie)
		{
			pageX=window.pageXOffset;
			pageW=window.innerWidth;
			pageY=window.pageYOffset;
			pageH=window.innerHeight;
		} 
		else
		{
			pageX=window.document.body.scrollLeft;
			pageW=window.document.body.offsetWidth-8;
			pageY=window.document.body.scrollTop;
			pageH=window.document.body.offsetHeight;
		}
		chip.xx=chip.xx+chip.vx;
		chip.yy=chip.yy+chip.vy;
		chip.vx+=vr*(Math.random()-0.5);
		chip.vy+=vr*(Math.random()-0.5);
		if(chip.vx>(vmax+vmin))  chip.vx=(vmax+vmin)*2-chip.vx;
		if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx;
		if(chip.vy>(vmax+vmin))  chip.vy=(vmax+vmin)*2-chip.vy;
		if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy;
		if(chip.xx<=pageX)
		{
			chip.xx=pageX;
			chip.vx=vmin+vmax*Math.random();
		}
		if(chip.xx>=pageX+pageW-chip.w)
		{
			chip.xx=pageX+pageW-chip.w;
			chip.vx=-vmin-vmax*Math.random();
		}
		if(chip.xx>=pageW-ad_width)
		{
			chip.xx=chip.xx-20;
			chip.vx=-vmin-vmax*Math.random();
		}
		if(chip.yy<=pageY)
		{
			chip.yy=pageY;
			chip.vy=vmin+vmax*Math.random();
		}
		if(chip.yy>=pageY+pageH-ad_height)
		{
			chip.yy=pageY+pageH-ad_height;
			chip.vy=-vmin-vmax*Math.random();
		}
		if(!mie)
		{
			eval('document.'+chip.named+'.top ='+chip.yy);
			eval('document.'+chip.named+'.left='+chip.xx);
		}
		else
		{
			eval('document.all.'+chip.named+'.style.pixelLeft='+chip.xx);
			eval('document.all.'+chip.named+'.style.pixelTop ='+chip.yy);
		}
		chip.timer1=setTimeout("movechip('"+chip.named+"')",80);
	}
}

function stopme(chipname)
{
	if(brOK)
	{
		eval("chip="+chipname);
		if(chip.timer1!=null)
		{
			clearTimeout(chip.timer1)
		}
	}
}

function nowads()
{
	if(navigator.appName.indexOf("Internet Explorer")!=-1)
	{
		if(parseInt(navigator.appVersion.substring(0,1))>=4) brOK=navigator.javaEnabled();mie=true;
	}
	if(navigator.appName.indexOf("Netscape")!=-1)
	{
		if(parseInt(navigator.appVersion.substring(0,1))>=4) brOK=navigator.javaEnabled();
	}
	nowads.named="nowads";
	nowads.vx=vmin+vmax*Math.random();
	nowads.vy=vmin+vmax*Math.random();
	nowads.w=1;
	nowads.h=1;
	nowads.xx=0;
	nowads.yy=0;
	ad_width=nowads_img.width;
	ad_height=nowads_img.height;
	//alert(ad_height);
	nowads.timer1=null;
	movechip("nowads");
}

function getClientSize()
{
    pageW=window.document.body.offsetWidth-8;
    pageH=window.document.body.offsetHeight;
    
}

document.write('<div id="nowads" style="height:110px;left:178px;position:absolute;top:1237px;width:80px; z-index:100000">');
document.write('<a href="http://www.51y.net" target="_blank" onmouseover=stopme("nowads"); onmouseout=movechip("nowads");>');
document.write('<img id="nowads_img" src="http://www.51y.net/ad/fly.gif" border="0"></a></div>');
nowads();
window.onresize=getClientSize;
