function init(bilder_vorladen) {
	if (bilder_vorladen == 1) {
		lade_bilder('images/dilink_h.gif','images/spotbg_h.gif');
	}
}

function lade_bilder() {
    document.vorladen = new Array();
    if(document.images) {
        for (var i = 0; i < lade_bilder.arguments.length; i++) {
            document.vorladen[i] = new Image();
            document.vorladen[i].src = lade_bilder.arguments[i];
        }
    }
}

function swap_spotbg(zeile) {
	document.getElementById("spot_"+zeile).style.backgroundImage = 'url(images/spotbg_h.gif)';
	document.getElementById("spothead_"+zeile).style.color = '#fbf6f1';
}
function swap_spotbg_back(zeile) {
	document.getElementById("spot_"+zeile).style.backgroundImage = 'url(images/trenner.png)';
	document.getElementById("spothead_"+zeile).style.color = '#d49b58';
}



var pageNumber = 0;
function setPageNumber( number ){
	pageNumber = number;
}

function getText( element ){
	for( var m=element.firstChild; m!=null; m = m.nextSibling ){
		if( m.nodeType == Node.TEXT_NODE ){
			return m.data;
		}
	}

	return '';
}


function initDirectorLinks(){
	var links = document.getElementsByTagName( 'a' );
	for( var i=0; i<links.length; i++ ){
		var link = links[i];
		if( link.className == 'movie_director' ){
			registerEventLevel0( link, 'click', stopEvent );
		}
	}
}

/**
Positioniert das Popup vertikal in der Mitte des Viewports und horizontal (etwas verschoben)
über der Mitte des Dokuments.
*/
function playMovie( file, width, height ){
	/*
	if( !Geometry.loaded ){
		Geometry.load();
	}
if( window.screenLeft ){
	alert( window.screenLeft );
}
	var left = Geometry.getWindowX();
	var top = Geometry.getWindowY();*/

	if( !Geometry.loaded ){
		Geometry.load();
	}

	var top, left, correction_x, correction_y;
	if( window.screenLeft ){	// IE and others
		correction_x = 58;	// Verschiebt das Popup von der Mitte nach links.
		correction_y = 0;	// Verschiebt das Popup von der Mitte nach unten.
		left = window.screenLeft;
		top = window.screenTop;

		var offset_x = Math.round( (Geometry.getDocumentWidth() - width) / 2 );
		left += offset_x + correction_x;

		var offset_y = Math.round( (Geometry.getViewportHeight() - height) / 2 );
		offset_y = (offset_y<0) ? 0 : offset_y;
		top += offset_y + correction_y;

	}else if( window.screenX ){	// Firefox and others
		correction_x = 58;	// Verschiebt das Popup von der Mitte nach links.
		correction_y = 130;	// Verschiebt das Popup von der Mitte nach unten.


		//if( window.screenX != 0 ){ correction_x += 2; };

		left = window.screenX + Math.round( (Geometry.getDocumentWidth() - width) / 2 );
		left += correction_x;
		top = Math.round( (Geometry.getViewportHeight() - height) / 2 );
		top += window.screenY + correction_y;


		//left = window.screenX;
		//top = window.screenY;
	}else{
		// Nehmen wir einfach mal an, wir haben den ganzen Bildschirm für uns.
		correction_x = 58;	// Verschiebt das Popup von der Mitte nach links.
		correction_y = 100;	// Verschiebt das Popup von der Mitte nach unten.
		left = Math.round( (Geometry.getDocumentWidth() - width) / 2 );
		left += correction_x;
		top = Math.round( (Geometry.getViewportHeight() - height) / 2 );
		top += correction_y;
	}

	var topleft = ',top=' + top + ',left=' + left;

	var win = window.open('player.php?spot=' + file,'pop','scrollbars=no,width=' + width + ',height=' + height + topleft );
}

