function check_frameset()
{
	if( parent.frames.length == 0 )
	{
		window.location.href = "../index.php";
	};
	
	if( parent.frames.length >= 6 )
	{
		parent.LaufHandyFrame.location.href = '../shop/laufleiste_handy.php';
	};
};

var scroll_to_left = false;

function scroll_left()
{
	scroll_to_left = false;
};

function scroll_right()
{
	scroll_to_left = true;
};

function init() 
{ 
	// Die Hoehe des inneren Fensters
	$height = window.innerHeight;
	if($height == undefined)
	{
		$height = screen.height;
	};

	// Die Hoehe des DIV-Tags ( Layer)
	$div_height = 150;
	
	$max = $height / $div_height;
	
	for( $i = 0; $i <= $max; $i++ )
	{
		$bild = 'bild' + $i;
		document.getElementById($bild).src = bilder[$i];
		scrolli( $i * $div_height, $i );
	};
}

function scrolli($x, $c) 
{ 
	// DIV-Tag-Name für JavaScript
	$div_tag_name = 't' + $c;
	// Die Hoehe des inneren Fensters
	$height = window.innerHeight;
	if($height == undefined)
	{
		$height = screen.height;
	};
	// Die Hoehe des DIV-Tags ( Layer)
	$div_height = 150;
	
	document.getElementById($div_tag_name).style.top = $x + 'px';
	
	if( scroll_to_left )
	{
		if( $x >= (-1) * $div_height )
		{
			$div_tag_name = 'scrolli(' + ($x-1) + ',' + $c + ')';
			window.setTimeout( $div_tag_name , 30 );
		}
	
		if( $x == $height - $div_height )
		{
			$c++;
	
			if( $c >= bilder.length )
			{
				$c = 0;
				$x = $height;
			}
			
			$x = $height;
			$div_tag_name = 'bild' + $c;
			document.getElementById($div_tag_name).src=bilder[$c];
			$div_tag_name = 'scrolli(' + ($x-1) + ',' + $c + ')';
			window.setTimeout( $div_tag_name , 30 );
		}
	}
	else
	{
		if( $x <= $height )
		{
			$div_tag_name = 'scrolli(' + ($x+1) + ',' + $c + ')';
			window.setTimeout( $div_tag_name , 30 );
		}
	
		if( $x == 0 )
		{
			$c--;

			if( $c < 0 )
			{
				$c = bilder.length - 1;
				$x = (-1) * $div_height;
			}

			$x = (-1) * $div_height;
			$div_tag_name = 'bild' + $c;
			document.getElementById($div_tag_name).src=bilder[$c];
			$div_tag_name = 'scrolli(' + ($x+1) + ',' + $c + ')';
			window.setTimeout( $div_tag_name , 30 );
		}
	}
}