// Objekt finden
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=d.getElementById(n); return x;
}

// Text Scrolen
var s_next;
var s_top = 0;
var s_max;
var s_min = -3;
if( navigator.platform.indexOf("Mac") != -1 )
	s_min = 0;
function Scroll( schritt )
{
	var text  = MM_findObj("copyText");
	var maske = MM_findObj("copyMaske");
	
	if( !s_max ){
		if( document.layers ) // Netscape 4.x
			s_max = maske.clip.height - text.clip.height;
		else // Netscape 6 / MSIE
			s_max = maske.offsetHeight - text.offsetHeight;
		s_max-=1;
	}
	
	s_top += schritt;
	if( s_top < s_max )
		s_top = s_max;
	if( s_top > s_min )
		s_top = s_min;

	if( document.layers )
		text.top = s_top;
	else
		text.style.top = s_top;

	if( s_next )
		clearTimeout( s_next );
	if( schritt != 0 )
		s_next = window.setTimeout("Scroll(" + schritt + ");",40);
}



var scrollGraphik = ''
	+ '<a href="#" onmouseover="Scroll(3)" onmouseout="Scroll(0)" onmousedown="Scroll(9)" onmouseup="Scroll(3)" onclick="if(document.all)this.blur();return false"><img src="images/pfeiloben.gif" name="scrollgif1"  width="27" height="22" alt="" border="0"></a><br>'
	+ '<img src="images/space.gif" name="scrollgif2" width="13" height="180" alt="" border="0"><br>'
	+ '<a href="#" onmouseover="Scroll(-3)" onmouseout="Scroll(0)" onmousedown="Scroll(-9)" onmouseup="Scroll(-3)" onclick="if(document.all)this.blur();return false"><img src="images/pfeilunten.gif" name="scrollgif3" width="27" height="22" alt="" border="0"></a>'

function init() {

	var text  = MM_findObj("copyText");
	var maske = MM_findObj("copyMaske");
	
	if( document.layers ) // Netscape 4.x
		s_max = maske.clip.height - text.clip.height;
	else // Netscape 6 / MSIE
		s_max = maske.offsetHeight - text.offsetHeight;
	
	if( s_max < 0 ) // Scrollbars nur anzeigen wenn gescrollt werden kann
		Write( "scroller", scrollGraphik );




	Scroll( 0 );
}

function Write( objName, text ) {
	obj = MM_findObj(objName);
	if( obj )
	if( document.layers ){
		obj.document.open();
		obj.document.write(text);
		obj.document.close();
	}
	else
		obj.innerHTML=text;
}
