// NECST BEE - free for noncommercial use. http://www.necst.net, gfx@necst.net
// requires layer capable browser (usually version4 and above)

var userAgent=navigator.appName + " " + navigator.appVersion;
var agentInfo=userAgent.substring(0, 12);

var Mozilla=0, VER=0; if (navigator.appName == "Netscape") Mozilla=1; if (parseInt(navigator.appVersion) > 3) VER=1; var NECSTBeeX=0, NECSTBeeY=0;

function MoveIt(evnt) 
	{
	if (Mozilla) { Xpos = evnt.pageX;Ypos = evnt.pageY; }
	else { Xpos = event.x; Ypos = event.y; }
	}

function NecstBee() {
	
	if (Mozilla) {
		NECSTBeeX = window.innerWidth/4; NECSTBeeY = window.innerHeight/14;				
	} else {
		NECSTBeeX = document.all.beebase.offsetWidth/4; NECSTBeeY = document.all.beebase.offsetHeight/14;
	}
	
	x = Math.sin((20*Math.sin(currStep/20)))*NECSTBeeX*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep)/10);
	y = Math.cos((20*Math.sin(currStep/20)))*NECSTBeeY*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep)/10);	

	if (Mozilla) {
		if (Xpos > window.innerWidth-400) Xpos = window.innerWidth-400;
		if (Xpos < 150) Xpos = 150;
		
		document.layers["a"].left = Xpos + x;
		document.layers["a"].top = Ypos + y;		
		
	// prevent MSIE flickering with offset -300
	} else {
		if (Xpos > document.all.beebase.offsetWidth-300) Xpos = document.all.beebase.offsetWidth-300;
		if (Xpos < 200) Xpos = 200;

		document.all["a"].style.left = Xpos + x;
		document.all["a"].style.top = Ypos + y;		
		
	}
	
	currStep += step;
	setTimeout("NecstBee()", delay) ;
}

if (VER) {		// version 4 or above?
	
	var delay = 5;
	var yAmpl = 10;
	var yMax = 40;
	var step = .2;
	var ystep = .5;
	var currStep = 1;
	var tAmpl=1;
	var Xpos, Ypos;
	
	if (Mozilla) {
		Xpos = window.innerWidth/2;
		Ypos = window.innerHeight/2;
	} else {
		Xpos = document.all.beebase.offsetWidth/2;
		Ypos = document.all.beebase.offsetHeight/2;		
	}	

	if (Mozilla) {	// set things up for netscape
	
		document.write('<layer name=a width=10 height=10 visibility=show><A HREF="http://www.necst.net"><img border=0 ALT="www.necst.net" src="necstbee.gif"></A></layer>');
	
		// catch mousemove event
		window.onMouseMove = MoveIt;
		window.captureEvents(Event.MOUSEMOVE);
	
	} else {	// do it for msie as well

		document.write('<DIV ID="a" style="position:relative; left:10; top:10; visibility:visible;"><A HREF="http://www.necst.net"><img border=0 ALT="www.necst.net" src="necstbee.gif"></A></DIV>');
	
		// catch mousemove event
		document.onmousemove = MoveIt;
	}
				
	NecstBee()
}
