// script for rotating stars

window.onerror=null;

var _browser;
_browser = navigator.appName.substr(0,5);

if (_browser == "Netsc") {
	_ie = false;
	_ns = true;
} else {
	_ie = true;
	_ns = false;
}

var toplocation = new Array( 0,30,57,80,101,125,80,80,101,125,80 );
var temptoplocation = new Array( 50,100,100,150,150,200,200,100,150,150,200,200 );
var leftlocation = new Array( 0,292,318,181,181,217,263,318,181,181,217,263 );
var templeftlocation = new Array( 0,0,260,390,420,550,680,390,420,550,680 );

var difftop = new Array( 0,0,0,0,0,0,0,0,0,0,0 );
var diffleft = new Array( 0,0,0,0,0,0,0,0,0,0,0 );

var _tn;

if (_ns) {
	window.captureEvents(Event.MOUSEMOVE);
	window.onmousemove = MoveHandler; 
	var windowWidth = window.innerWidth;
	var windowHeight = window.innerHeight;
} else if (_ie) {
	document.onmousemove=MoveHandler;
	windowWidth=600;
	windowHeight=400;
}

   var Ypos2 = 72;
   var Xpos2 = 72;

function MoveHandler(e) {
	Xpos2 = (_ns)?e.pageX:event.x
  	Ypos2 = (_ns)?e.pageY:event.y
	Xorigin = Xpos2;
	Yorigin = Ypos2; 
	if (Ypos2 > windowHeight/2) {
		if (Xpos2 > windowWidth/2) { direction = 1;} 
		else { direction = -1;}
	} else {
		if (Xpos2 > windowWidth/2) { direction = -1;} 
		else { direction = 1;}
	}
}

function setup() {
	if (_ie) {
		windowWidth=document.body.clientWidth;
		windowHeight=document.body.clientHeight;
	}
	Xorigin = 204;
	Yorigin = 147; 
	spin();
	run();
}


var OrbitSize = 200;
delay=100; direction = -1;
Count = new Array ( 0, .63, 1.26, 1.89, 2.52, 3.15, 3.78, 4.41, 5.04, 5.67 );
Xpoint = new Array ( 0, .63, 1.26, 1.89, 2.52, 3.15, 3.78, 4.41, 5.04, 5.67 );
Ypoint = new Array ( 0, .63, 1.26, 1.89, 2.52, 3.15, 3.78, 4.41, 5.04, 5.67 );
if (_ie) {
	var speed = -0.06;
} else {
	var speed = -0.15;
}
var offset = 1;

function spin() {
	for ( j = 0 ; j <= 9 ; j++ ) {
		Count[j] = Count[j] + (speed*direction);	
		Xpoint[j] = Xorigin + ((OrbitSize*Math.sin(Count[j])*offset));	
		Ypoint[j] = Yorigin + (OrbitSize*Math.cos(Count[j]));
	}
	setTimeout('spin()',3);
}

function run() {
	for ( j = 0 ; j <= 9 ; j++ ) {
		difftop[j]  = Ypoint[j] -  temptoplocation[j];
		diffleft[j] = Xpoint[j] - templeftlocation[j];
		diff = 30;
		temptoplocation[j] = temptoplocation[j] + difftop[j]/diff;
		templeftlocation[j] = templeftlocation[j] + diffleft[j]/diff;
		_tn = document.getElementById("a"+j);
		_tn.style.top = temptoplocation[j];
		_tn.style.left = templeftlocation[j];
	}
	setTimeout('run()', 25);
}
