var currContact = null;
var sHeight = 0;
var upInt = null, downInt = null;

function getElem(id)
{
	var obj = new Object();
	obj.elem = null;
	obj.style = null;
	
	if (document.getElementById)
	{
		obj.elem = document.getElementById(id);
		obj.style = obj.elem.style;
	}
	else if (document.all)
	{
		obj.elem = document.all[id];
		obj.style = obj.elem.style;
	}
	else if (document.layers)
		obj.style = obj.elem = document.layers["container"].layers[id];
	return obj;
}

function initContacts()
{
	if (document.location.href.indexOf("locations") != -1)
	{
		loadContact("default");
		var upArrow = null, downArrow = null;
		if (document.layers)
		{
			upArrow = getElem("upArrow");
			downArrow = getElem("downArrow");
			
			upArrow.elem.left = 290 - upArrow.elem.clip.width;
			downArrow.elem.left = upArrow.elem.left;
			downArrow.elem.top = 176 - downArrow.elem.clip.height;
			upArrow.elem.zIndex = 1000;
			downArrow.elem.zIndex = 1000;
			
			upArrow.elem.hidden = false;
			downArrow.elem.hidden = false;
		}
	}
}

function loadContact(id)
{
	if (currContact) 
	{
		currContact.style.visibility = "hidden";
		currContact.style.top = (document.layers) ? 0 : "0px";
		currContact.style.height = (document.layers) ? sHeight : sHeight + "px";
	}
	
	currContact = getElem(id);
	if (document.layers)
		sHeight = currContact.style.clip.height;
	else if (currContact.style.overflow == null)
	{
		sHeight = currContact.elem.offsetHeight;
		currContact.elem.offsetParent.style.height = sHeight + "px";
	}
	
	if (!document.layers)
		currContact.style.height = "168px";
	else
		currContact.style.clip.height = 178;
	currContact.style.visibility = "visible";
}

function scrollUp()
{
	if (parseInt(currContact.style.top) < 0)
	{
		if (document.layers)
		{
			currContact.style.top += 5;
			currContact.style.clip.height -= 5;
		}
	}
}

function scrollDown()
{
	if (parseInt(currContact.style.top) > -sHeight)
	{
		if (document.layers)
		{
			currContact.style.top -= 5;
			currContact.style.clip.height += 5;
		}
	}
}