var sizeIdentifier
var baseX, baseY, baseWidth, baseHeight
function showLogo(){
	var docWidth, docHeight, imageWidth, menuHeight, contentWidth, topBarHeight, h1FontSize;
	if (self.innerHeight) {// all except Explorer
		docWidth = self.innerWidth;
		docHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		docWidth = document.documentElement.clientWidth;
		docHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		docWidth = document.body.clientWidth;
		docHeight = document.body.clientHeight;
	}
	


	if (docHeight < 452) {
		sizeIdentifier = 800;
		
		imageSource = "images/logo800.gif";
		imageWidth = 216;
		topBarHeight = 30;
		h1FontSize = 20;
		
		baseX = docWidth - 95;
		baseY = 154;
		baseWidth = 30;
		baseHeight = 6;
		
	} else if (docHeight < 612) {
		
		sizeIdentifier = 1024;
		
		imageSource = "images/logo1024.gif";
		imageWidth = 293;
		topBarHeight = 32;
		h1FontSize = 22;
		
		baseX = docWidth - 127;
		baseY = 204;
		baseWidth = 42;
		baseHeight = 10;
		
	} else if (docHeight < 703) {
		imageSource = "images/logo1152.gif";
		imageWidth = 335;
		topBarHeight = 45;
		h1FontSize = 28;
		
		baseX = docWidth - 145; 
		baseY = 233;
		baseWidth = 48;
		baseHeight = 11;
		sizeIdentifier = 1152;
	} else if (docHeight < 856) {

		sizeIdentifier = 1280;
		
		imageSource = "images/logo1280.gif";
		imageWidth = 408;
		topBarHeight = 50;
		h1FontSize = 35;
		
		baseX = docWidth - 177; 
		baseY = 280;
		baseWidth = 59;
		baseHeight = 15;
		
		
	} else if (docHeight < 1032) {
		
		sizeIdentifier = 1600;
		
		imageSource = "images/logo1600.gif";
		imageWidth = 489;
		topBarHeight = 60;
		h1FontSize = 35;
		
		baseX = docWidth - 213; 
		baseY = 333;
		baseWidth = 71;
		baseHeight = 16;
		
	} else if (docHeight < 1213) {
		
		sizeIdentifier = 2000;
		
		imageSource = "images/logo2000.gif";
		imageWidth = 579;
		topBarHeight = 70;
		h1FontSize = 40;
		
		baseX = docWidth - 254; 
		baseY = 393;
		baseWidth = 87;
		baseHeight = 21;
		
	} else {

		sizeIdentifier = 2400;

		imageSource = "images/logo2400.gif";
		imageWidth = 670;
		topBarHeight = 80;
		h1FontSize = 45;
		
		baseX = docWidth - 292; 
		baseY = 453;
		baseWidth = 98;
		baseHeight = 25;
	}
	//alert(sizeIdentifier)
	
	menuHeight = returnObjectById("menu").height = "100%" // reset the menu height to snug fit
	menuHeight = returnObjectById("menu").clientHeight;
	
	returnObjectById("logo").style.clip = "rect(0px " + imageWidth + "px " + (docHeight - 10) + "px 0px)"
	returnObjectById("logoImage").style.clip = "rect(0px " + imageWidth + "px " + (docHeight - 10) + "px 0px)"
	
	contentWidth = docWidth - 150 - imageWidth - 21 // 7 padding left of text, 14 to the right
	
	returnObjectById("logoImage").src = imageSource
	
	scrollHeight = document.getElementById("content").scrollHeight
	
//	window.status = "menuHeight = " + menuHeight + "/docHeight = " + docHeight + "/scrollHeight = " + scrollHeight
	if (menuHeight <= docHeight) {
		if (docHeight < scrollHeight) {
			returnObjectById("menu").style.height = scrollHeight + "px";
		} else {
			returnObjectById("menu").style.height = docHeight + "px";
		}
		returnObjectById("logo").style.right = "0px"
		returnObjectById("content").style.width = contentWidth
	} else if (menuHeight > docHeight) { // scrollbars!
		if (menuHeight < scrollHeight) {
			returnObjectById("menu").style.height = scrollHeight + "px";
		}
		returnObjectById("logo").style.right = "0px"
		returnObjectById("content").style.width = (contentWidth - 0) + "px"
	}
	returnObjectById("content").style.visibility = "visible"
	
	returnObjectById("topBar").style.height = topBarHeight + "px"
	returnObjectById("topBar").style.fontSize = h1FontSize + "px"
	returnObjectById("topBar").style.visibility = "visible"
	
	returnObjectById("eyeImage").style.left = (baseX + baseWidth / 5) + "px";
	returnObjectById("eyeImage").style.top = (baseY + baseHeight / 8) + "px";
	returnObjectById("eyeImage").src = "images/eye" + sizeIdentifier + ".gif";
	//window.status = sizeIdentifier
}

var isIE = document.all ? true : false;
if (!isIE) document.captureEvents(Event.MOUSEMOVE);

document.onmousemove = trackMouse;
function trackMouse(e) {
	var xPosition, yPosition;
	if (!isIE) {
		xPosition = e.pageX;
		yPosition = e.pageY;
	} else if (isIE) {
		xPosition = event.clientX + document.body.scrollLeft;
		yPosition = event.clientY + document.body.scrollTop;
	}
	//window.status = xPosition + "/" + yPosition
	
	var eyeX, eyeY
	var overruleEyeX = false
	
	if (xPosition < baseX) {
		overruleEyeX = true // moving closer towards the eye from the left, the eye will move a little
		if (xPosition / baseX < 0.3) {
			xPosition = baseX
		} else if (xPosition / baseX < 0.5) {
			xPosition = baseX + 1
		} else if (xPosition / baseX < 0.66) {
			xPosition = baseX + 2
		} else if (xPosition / baseX < 0.8) {
			xPosition = baseX + 3
		} else if (xPosition / baseX < 0.9) {
			xPosition = baseX + 4
		} else {
			xPosition = baseX + 5
		}
	} else if (xPosition > baseX + baseWidth) {
		overruleEyeX = true // moving closer away from the eye to the right, the eye will move a little
		if (xPosition / (baseX + baseWidth) > 1.06) {
			xPosition = baseX + baseWidth
		} else if (xPosition / (baseX + baseWidth) > 1.03) {
			xPosition = baseX + baseWidth -1
		} else {
			xPosition = baseX + baseWidth - 2
		}
	}

	eyeX = xPosition - baseX
	if (!overruleEyeX) { // if eyeX is set based on the approach, then don't interfere. Otherwise, set to leftmost or right most boundaries.
		if (eyeX < 6) {
			eyeX = 6
		} else if (eyeX > baseWidth - 3) {
			eyeX = baseWidth - 3
		}
	}
	eyeX += baseX
		
	eyeY = yPosition - (baseY + baseHeight);
	if (eyeY < 0) { // set eyeY to topmost or bottom most boundaries.
		eyeY = 0
	} else if (eyeY > baseHeight) {
		eyeY = baseHeight
	}
	eyeY += baseY

	if (((eyeX >= baseX) && (eyeX < baseX + baseWidth / 20)) || ((eyeX <= baseX + baseWidth) && (eyeX > (baseX + baseWidth - baseWidth / 20)))) {
		// in the first few pixels of the eye, eyeY should be lower (or higher, depending on whether you're above or below the eye) to allow for the arching of the eye
		if (eyeY <= baseY + baseHeight / 3) {
			eyeY = parseInt(baseY + baseHeight / 3)
		} else if (eyeY >= baseY + baseHeight - baseHeight / 3) {
			eyeY = parseInt(baseY + baseHeight - baseHeight / 3)
		}
	} else if (((eyeX >= baseX) && (eyeX < baseX + baseWidth / 15)) || ((eyeX <= baseX + baseWidth) && (eyeX > (baseX + baseWidth - baseWidth / 15)))) {
		// in the next few pixels of the eye, eyeY should be lower (or higher, depending on whether you're above or below the eye) to allow for the arching of the eye
		if (eyeY <= baseY + baseHeight / 6) {
			eyeY = parseInt(baseY + baseHeight / 6)
		} else if (eyeY >= baseY + baseHeight - baseHeight / 6) {
			eyeY = parseInt(baseY + baseHeight - baseHeight / 6)
		}
	} else 	if (((eyeX >= baseX) && (eyeX < baseX + baseWidth / 10)) || ((eyeX <= baseX + baseWidth) && (eyeX > (baseX + baseWidth - baseWidth / 10)))) {
		// The same for the next few pixels of the eye, except less so
		if (eyeY <= baseY + baseHeight / 12) {
			eyeY = parseInt(baseY + baseHeight / 12)
		} else if (eyeY >= baseY + baseHeight - baseHeight / 12) {
			eyeY = parseInt(baseY + baseHeight - baseHeight / 12)
		}
	} 


	eyeObject = returnObjectById("eyeImage")

	if (!isNaN(eyeX) && !isNaN(eyeY)) {
		eyeObject.style.left = eyeX + "px";
		eyeObject.style.top = eyeY + "px";
	} 
	

	return true;
}
