// panning bars mouseover
function rollover(imgObj, imgId, imgId2) {
	if (document.images) {
		imgSrc = "/images/map/" + imgId + "h.jpg";
		imgObj.src = imgSrc;
		if (imgId2) {
			id = "nav" + imgId2.toUpperCase();
			imgObj = document.getElementById(id);
			imgSrc = "/images/map/" + imgId2 + "h.jpg";
			imgObj.src = imgSrc;
		}
	}
}
function rollout(imgObj, imgId, imgId2) {
	if (document.getElementById) {
		imgSrc = "/images/map/" + imgId + ".jpg";
		imgObj.src = imgSrc;
		if (imgId2) {
			id = "nav" + imgId2.toUpperCase();
			imgObj = document.getElementById(id);
			imgSrc = "/images/map/" + imgId2 + ".jpg";
			imgObj.src = imgSrc;
		}
	}
}

// next 4 functions copyright 'free' from quirksmode.org. required for aerial photo overlay
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function getVertScroll() {
	var y;
	if (self.pageYOffset) // all except Explorer
	{
		y = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		y = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		y = document.body.scrollTop;
	}
	return y;
}

function getHorizScroll() {
	var x;
	if (self.pageYOffset) // all except Explorer
	{
		x = self.pageXOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		x = document.documentElement.scrollLeft;
	}
	else if (document.body) // all other Explorers
	{
		x = document.body.scrollLeft;
	}
	return x;
}

// overlay map into aerial photo
function displayMap(pageX, pageY, clientX, clientY, width, height) {
	if (document.getElementById) {
		var overlay = document.getElementById('overDiv');
		var mapWidth = (width=='')?500:width;
		var mapHeight = (height=='')?300:height;
		var clipWidth = Math.round(mapWidth / 2);
		var clipHeight = Math.round(mapHeight / 2);
		
		var posx = 0;
		var posy = 0;
		
		if (pageX || pageY)
		{
			posx = pageX;
			posy = pageY;
		}
		else if (clientX || clientY)
		{
			posx = clientX + getHorizScroll();
			posy = clientY + getVertScroll();
		}
		
		var clipTop = posy - findPosY(overlay) - Math.round(clipHeight/2);
		var clipLeft = posx - findPosX(overlay) - Math.round(clipWidth/2);		
		var clipBot = clipTop + clipHeight;
		var clipRight = clipLeft + clipWidth;
		var defClip = "rect(" + clipTop +"px "+ clipRight +"px "+ clipBot +"px "+ clipLeft +"px)";

		overlay.style.visibility = "visible";
		overlay.style.display = "block";		
		overlay.style.clip = defClip;
	}
}