/*<![CDATA[*/
/**
 * functions.js - Bibliothek mit uebergreifenden JavaScript Funktionen
 *
 * Copyright (c) 2007    die.interaktiven GmbH & Co. KG
 *                       Agentur für digitale Medien
 *                       Eisenmarkt 1
 *                       35578 Wetzlar
 *                       Germany
 *
 *                       Fon: +49 (0)64 41 / 39 86 19 - 0
 *                       Fax: +49 (0)64 41 / 39 86 19 - 9
 *                       Web: www.die-interaktiven.de
 *
 * Alle Rechte vorbehalten. Unberechtigte Kopie und Weiter-
 * verwendung nicht gestattet.
 *
 */

function doStart()
{
	if(window.location.search.indexOf('druck') != -1)
	{
		setStyle('druck');
	}
	
	setPagePosition();
	
	setStatus('die.interaktiven - kreativagentur für digitale medien');
}

function gotoPage(strURL)
{
	if(strURL)
	{
		location.href = strURL;
	}
}

function setStatus(sText)
{
	if(!sText) sText = '';
	window.status = sText;
	return true;
}

function setPagePosition()
{
	//var iPaddingTop = ((getWindowHeight() - 605) / 2);
	var iPaddingTop = ((getWindowHeight() - 555) / 2);
	
	iPaddingTop = iPaddingTop > 0 ? iPaddingTop : 0;
	
	$('page').style.paddingTop = iPaddingTop+'px';
}

function showPopup(sUrl, sName, iBreite, iHoehe, sFeatures, iPosx, iPosy)
{
	var oWin = window.open(sUrl, sName,"width=" + iBreite + ",height=" + iHoehe + "," + sFeatures + "");
	
	if(oWin)
	{
		if(!iPosx)
		{
			x = (screen.width-iBreite)/2;
		}
		else
		{
			x = iPosx;
		}
		
		if(!iPosy)
		{
			y=(screen.height-iHoehe)/2;
		}
		else
		{
			y = iPosy;
		}
		
		oWin.moveTo(x,y);
		
		oWin.focus();
	}
}

function getWindowHeight()
{
	var iHeight = 0;
	
	if( typeof( window.innerWidth ) == 'number' )
	{
	    //Non-IE
		iHeight = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	{
		//IE 6+ in 'standards compliant mode'
		iHeight = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
		//IE 4 compatible
		iHeight = document.body.clientHeight;
	}

	return iHeight;
}

Event.observe(window, 'load', doStart);
Event.observe(window, 'resize', setPagePosition);
/*]]>*/