var eyeballWidth=77;
var eyeballHeight=77;
var irisWidth=35;
var irisHeight=35;
var centerX=0;
var centerY=0;
var height=1000;

function initImagesBig() {
	var backLogoImg=document.getElementById("bigBackLogo");	
	
	var logoImg=document.getElementById("bigLogo");
	logoImg.src=backLogoImg.src;	
	initEyesBig();

	document.onmousemove=moveHandlerBig;
	window.onresize=initEyesBig;
}

function initEyesBig(){
setCenterBig();
animateEyesBig(100,100);
}

function setCenterBig(){
	var img=document.getElementById("bigLogo");	
	var parentLocation= new Array(2);
	parentLocation[0]=0;
	parentLocation[1]=0;
	parentLocation=findPosBig(img);	//determine the coordinates of the logo
	centerX=parentLocation[0]+82;			
	centerY=parentLocation[1]+53;	
}

function moveHandlerBig(evt) {
	if (!evt) {
		evt=window.event;
	}
	animateEyesBig(evt.clientX, evt.clientY);
}

function animateEyesBig(xPos, yPos) {
	var irisImg=document.getElementById("bigIris").style;		
	var deltaX=((xPos-centerX)/Math.sqrt((xPos-centerX)*(xPos-centerX)+(yPos-centerY)*(yPos-centerY)+height*height))*eyeballWidth/2;
	var deltaY=((yPos-centerY)/Math.sqrt((xPos-centerX)*(xPos-centerX)+(yPos-centerY)*(yPos-centerY)+height*height))*eyeballHeight/2;
	var maxDeltaR=(eyeballWidth-irisWidth)/2-7;
	var deltaR=Math.sqrt(deltaX*deltaX+deltaY*deltaY);
	if (deltaR>maxDeltaR){
		deltaX=deltaX/deltaR*maxDeltaR;
		deltaY=deltaY/deltaR*maxDeltaR;
	}
		
	irisImg.left=(centerX+deltaX-irisWidth/2)+"px";
	
	irisImg.top=(centerY+deltaY-irisHeight/2+1)+"px";

}

//THANKS to www.quirksmode.org for generously providing this free function below (findPos)
function findPosBig(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

window.onload=initImagesBig;






	