function showPopup (popupId)
{
	if (document.getElementById)
	{
		var o = document.getElementById('overlay');
		o.style.display = 'block';

		var p = document.getElementById(popupId);
		p.style.display = 'block';
		var pw = p.offsetWidth;
		var ph = p.offsetHeight;

	  	p.style.left = Math.floor(parseInt(o.offsetWidth - pw) / 2) + "px";
	  	p.style.top = Math.floor(parseInt(o.offsetHeight - ph) / 2) + "px";
	  	return false;
	}
	return true;
}

function hidePopups ()
{
	document.getElementById('overlay').style.display = 'none';
	document.getElementById('contact-popup').style.display = 'none';
	document.getElementById('wallerstein-popup').style.display = 'none';
	document.getElementById('baldern-popup').style.display = 'none';
	document.getElementById('harburg-popup').style.display = 'none';
	document.getElementById('beer-popup').style.display = 'none';
}

function initDHTML ()
{
	return;
	document.getElementById('scroller').style.overflow = 'hidden';
	document.getElementById('scroller').style.height = "248px";
	if (document.getElementById('left'))
	{
		document.getElementById('left').style.display = 'block';
		document.getElementById('right').style.display = 'block';
	}

	// duplicate content
	//var org = document.getElementById('scroller').innerHTML;
	//var	cpy = org.replace(/id="/g, 'id="c');
	//document.getElementById('scroller').innerHTML += cpy;
}

var animationStep = 10;
var animationID = null;
var animationObj = null;
var animationCpy = null;
var animationStart = null;
var animationEnd = null;

function moveTo (domId)
{
	stopBackward();
	stopForward();
	clearInterval(animationID);
	if (document.getElementById)
	{
		var c = document.getElementById('content');
		var t = document.getElementById(domId);
		animationObj = c;
		//animationCpy = document.getElementById('ccontent');
		animationStart = parseInt(c.offsetLeft);
		animationEnd = -parseInt(t.offsetLeft);
		animationID = setInterval('animate()', 40);
		return false;
	}
	return true;
}

function animate ()
{
	if (Math.abs(animationObj.offsetLeft - animationEnd) > .5)
	{
		animationObj.style.left = Math.floor((parseInt(animationObj.offsetLeft)
			+ (animationEnd - parseInt(animationObj.offsetLeft)) / 3))
			+ "px";
	}
	else
	{
		animationObj.style.left = animationEnd + "px";
		clearInterval(animationID);
	}
	//animationCpy.style.left = (animationObj.offsetLeft + animationObj.offsetWidth) + "px";
}

// FORWARD
function moveForward ()
{
	clearInterval(animationID);
	if (document.getElementById)
	{
		animationID = setInterval('forward()', 40);
		return false;
	}
	return true;
}

function stopForward ()
{
	clearInterval(animationID);
}

function forward ()
{
	var c = document.getElementById('content');
	//var cc = document.getElementById('ccontent');
	var s = document.getElementById('scroller');
	if (c.offsetLeft <= (s.offsetWidth - (c.offsetWidth)))
	{
		c.style.left = (s.offsetWidth - (c.offsetWidth)) + "px";
		//cc.style.left = (c.offsetLeft + c.offsetWidth) + "px";
		clearInterval(animationID);
		return false;
	}

	c.style.left = (parseInt(c.offsetLeft) - animationStep) + "px";
	//cc.style.left = (c.offsetLeft + c.offsetWidth) + "px";
	return false;
}

// BACKWARD
function moveBackward ()
{
	clearInterval(animationID);
	if (document.getElementById)
	{
		animationID = setInterval('backward()', 40);
		return false;
	}
	return true;
}

function stopBackward ()
{
	clearInterval(animationID);
}

function backward ()
{
	var c = document.getElementById('content');
	//var cc = document.getElementById('ccontent');
	if (c.offsetLeft >= 0)
	{
		c.style.left = "0px";
		//cc.style.left = (c.offsetLeft + c.offsetWidth) + "px";
		clearInterval(animationID);
		return false;
	}

	c.style.left = (parseInt(c.offsetLeft) + animationStep) + "px";
	//cc.style.left = (c.offsetLeft + c.offsetWidth) + "px";
	return false;
}


function getSize() {
	var myWidth = 0, myHeight = 0;

	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return [ myWidth, myHeight ];
}


function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;

	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}