
function initScroll()
{
  if ( navigator.userAgent.indexOf("Opera") != -1 )
  {
  	return;
  }
  if ( navigator.userAgent.indexOf("Firefox") != -1 )
  {
  	return;
  }

	window.onresize = function()
	{
		var oDiv = document.getElementById('Content');

		if ( navigator.appName == "Microsoft Internet Explorer" ) 
		{
			// Sobald das Format zu eng ist, den inneren Scrollteil expanden,
			// damit es keine doppelten Scrollbalken gibt !
			if ( document.body.clientWidth < 965 || document.body.clientHeight < 600 )
			{
				// oDiv.style.overflow = 'visible';
				oDiv.style.cssText="overflow:visible;overflow-x:hidden;fx-overflow:hidden";
			}
			else
			{
				// oDiv.style.overflow = 'scroll';
				oDiv.style.cssText="overflow:scroll;overflow-x:hidden;fx-overflow:hidden";
			}
			return;
		}

		// *** Resizing Funktion für Firefox etc. ***

		var oCopy = document.getElementById('CopyrightBox');

		var bottomHeight = document.body.scrollHeight - oCopy.offsetParent.offsetTop;
		var nHeight = document.body.clientHeight - oDiv.offsetParent.offsetTop - bottomHeight;
		
		if ( navigator.userAgent.indexOf("Firefox") != -1 )
		{
		  oDiv.style.height = nHeight - 22;
		  document.body.style.overflow = "hidden";
	  	// oDiv.style.overflow = "visible";
		}
		else if(navigator.userAgent.indexOf("Netscape") != -1)
		{
			oDiv.style.height = nHeight - 22;  // <-- wtf?
		}
		else if ( navigator.userAgent.indexOf("Mozilla") != -1 )
		{
			oDiv.style.overflow = "hidden";
			// document.body.style.overflow = "hidden";
		}
	}
	window.onresize();
}


function updScroll()
{
	var speed = 0.25;
	var ypos = document.all.Content.scrollTop - document.all.Content.scrollTop * speed;

	document.all.Content.scrollTop = Math.round(ypos);

	if ( ypos > 3 )	setTimeout( "updScroll()", 10 );

}

function scrollToTop()
{
	// content:
	if ( navigator.appName.indexOf('Internet Explorer') != -1 && !(document.body.clientWidth < 965 || document.body.clientHeight < 600) )
	{
		updScroll();
	}
	else 
	{
		location.href = "#topmark";
	}

}


// *** VIDEO PLAYER ***

var win_detail = null;

function dgl_showpopup( url, target, w, h ) {

	var x = (screen.width - w) * 0.5;
	var y = (screen.height - h) * 0.5;

   	win_detail = window.open( url, target, "dependant=yes,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=" + w + ",height=" + h + ",top=" + y + ",left=" + x)
	win_detail.focus();

	return win_detail;

}

function showVideo()
{
	dgl_showpopup("video/", "_video", 488, 300);
}




// Ensure that a call to document.getElementById is always meaningful
if( !document.getElementById ) {

	if( document.all ) {

		document.getElementById = function( id ) {
	
			return document.all[ id ];

		}

	} else {

		document.getElementById = function() {

			return null;

		}

	}
	
}


// *** GENERIC styles code ***

// Retrieves the value of the given style property from an element
function getStyle( e, p ) {

	if( e && e.style && ( 'undefined' != typeof e.style[ p ]))
	return e.style[ p ];
	
}


// Set the specified style property for an element
function setStyle( e, p, v ) {

	if( e && e.style && ( 'undefined' != typeof e.style[ p ]))
		e.style[ p ] = v;
		
}


String.prototype.trim = function() 
{
	return this.replace(/^\s*/,"").replace(/\s*$/,"");
} 


function setCookie(name, value, expires, path, domain, secure) {
   var curCookie = name + "=" + escape(value) +
     ((expires) ? "; expires=" + expires.toGMTString() : "") +
     ((path) ? "; path=" + path : "") +
     ((domain) ? "; domain=" + domain : "") +
     ((secure) ? "; secure" : "");
   document.cookie = curCookie;
 }
 
 function getCookie(name) {
   var dc = document.cookie;
   var prefix = name + "=";
   var begin = dc.indexOf("; " + prefix);
   if (begin == -1) {
     begin = dc.indexOf(prefix);
     if (begin != 0) return null;
   } else {begin += 2;}
   var end = document.cookie.indexOf(";", begin);
   if (end == -1) {end = dc.length;}
   return unescape(dc.substring(begin + prefix.length, end));
 }


// resolution check

function checkRes()
{
	var v = getCookie( "cookie_rescheck" );

	if ( screen.width < 1024 && v != "done" )
	{
		alert( 'Dear Visitor! This site requires a modern browser and at least 1024x768 screen resolution. - Please update your settings!' );
		
		var now = new Date();
		var future = new Date( now.getTime() + 1000*60*60 );
	
		setCookie( "cookie_rescheck", "done", future );
	}
}





