function onerr() 
{
	return true;
}

window.onError=onerr();

function preloadImages() 
{
	var d=document; 
	if ( d.images ) 
	{ 
		if ( !d.p ) d.p = new Array();
		var i,j=d.p.length,a=preloadImages.arguments; 
		for ( i=0; i<a.length; i++)
		{
			if ( a[i].indexOf("#") != 0 )
			{
				d.p[j]=new Image; d.p[j++].src=a[i];
			}
		}
	}
}

function change_pic(picname,pic_object)
{
	if ( ( picname != menu_act ) || ( pic_object == act01 ) || ( pic_object == act02 ) )
	{
		window.document[picname].src = pic_object.src;
	}	
	return;
}

function change_back(picname,pic_object)
{
	if ( picname != menu_act )
	{
		window.document[picname].src = pic_object.src;
	}
	return;
}

function open_win(url_name,win_name,win_options)
{
	if ( ( window_open == true ) && ( new_window.closed == false ) ) 
	{
		new_window.close();
	}
	new_window = window.open(url_name,win_name,win_options);
	window_open = true;
}

function open_starcut(name)
{
	url_name = "starcut/starcut_" + name + ".html";
	open_win(url_name,'contentwin','width=318,height=369,status=no,resizable=no,scrollbars=no,menubar=no,toolbar=no,locationbar=no,screenX=300,screenY=100');
}

function goto_soundlab()
{
	clearTimeout(scrolling);
	window.location.href = "soundlab.html";
}

function layer_visibility(layername,zustand) { //changes state of visibility of layer
	// modified by flooo, for firefox, 260706
	document.all[layername].style.visibility = zustand;
}

function layer_blink(layername,repeat)
{
	layern = layername;

	if ( repeat != 0 )
	{
		if ( ( repeat/2 ) == ( Math.ceil(repeat/2 ) ) ) //gerade...
		{
			vis_stat = "hidden";
		} else vis_stat = "visible"; //oder ungerade zahl?
		
		layer_visibility(layern,vis_stat);
		
		repeat = repeat - 1;
		rep = repeat;
		
		blinkstat = setTimeout("layer_blink(layern,rep)",200);
	} else clearTimeout(blinkstat);
}

function move_layer(layername,xpos_new)
{
	// modified by flooo, for firefox, 260706
	document.all[layername].style.left = xpos_new;
}

function move_left(layername,menu_x)
{
	menu_h = menu_x;
	if (x > menu_x) {
		rest = ( x - menu_x );
		if ( rest <= 50 ) {
			schrittweite = 8;
			if ( rest <= 11 ) {
				schrittweite = 1;
			}
		}	
		x = x - schrittweite;
		move_layer(layername,x);
		layern = layername;
		
		scrolling = setTimeout("move_left(layern,menu_h)",zeitsprung);
		
		if ( ( layername == "content" ) || ( layername == "imgscroll" ) ) check_visibility(menu_h); //reached a menu ??
		
	} else 
	{
		schrittweite = schritt_max;
	}
 }

function move_right(layername,menu_x)
{
	menu_h = menu_x;
	if (x < menu_x) {
		rest = ( menu_x - x );
		if ( rest <= 50 ) {
			schrittweite = 8;
			if ( rest <= 11 ) {
				schrittweite = 1;
			}
		}	
     	x = x + schrittweite;
		move_layer(layername,x);
		layern = layername;
		
		scrolling = setTimeout("move_right(layern,menu_h)",zeitsprung);
		
		if ( ( layername == "content" ) || ( layername == "imgscroll" ) ) check_visibility(menu_h); //reached a menu ??
		
	} else 
	{
		schrittweite = schritt_max;
		if ( layername == "body" ) goto_soundlab();
	}
}

function check_menu(menu_x,layername) //check the direction
{
	if ( x > menu_x ) 
	{
		if ( layername == "content" ) move_left('content',menu_x);
		if ( layername == "imgscroll" ) move_left('imgscroll',menu_x);
	}
	if ( x < menu_x ) 
	{
		if ( layername == "content" ) move_right('content',menu_x);
		if ( layername == "imgscroll" ) move_right('imgscroll',menu_x);
	}
}

function check_approach() 	//if there is an approach to one of the x-coordinates of the menues
							//scroll to the relevant point
{
	for ( i=0; i < menu.length; ++i )
	{
		tol_left = menu[i] - 150;
		tol_right = menu[i] + 150;
		
		if ( ( x >= tol_left ) && ( x <= tol_right ) )
		{
			schrittweite = 15;
			check_menu(menu[i],'content');
		}		
	}	
}

function stop_layer()
{
	clearTimeout(scrolling);
	check_approach();
	schrittweite = schritt_max; //reset schrittweite
}