window.defaultStatus = "insel-langeoog.de";

function fResize()
{
	window.location.reload();
}

// Bannerslide ------------------------------------------------------------------------------------
// style="overflow-x:hidden" to the opening BODY tag

img_places = 5;
data = new Array();
data[0] = new Array( "ref11_small.jpg",	 "seite2a11.htm",	"_self", "");
data[1] = new Array( "ref12_small.jpg",	 "seite2a12.htm",	"_self", "");
data[2] = new Array( "ref13_small.jpg",	 "seite2a13.htm",	"_self", "");
data[3] = new Array( "ref1_small.jpg",	 "seite2b.htm",		"_self", "");
data[4] = new Array( "ref2_small.jpg",	 "seite2b2.htm",	"_self", "");
data[5] = new Array( "ref3_small.jpg",	 "seite2b3.htm",	"_self", "");
data[6] = new Array( "ref4_small.jpg",	 "seite2b4.htm",	"_self", "");
data[7] = new Array( "ref5_small.jpg",	 "seite2b5.htm",	"_self", "");
data[8] = new Array( "ref6_small.jpg",	 "seite2b6.htm",	"_self", "");
data[9] = new Array( "ref7_small.jpg",	 "seite2b7.htm",	"_self", "");
data[10] = new Array( "ref8_small.jpg",	 "seite2b8.htm",	"_self", "");
data[11] = new Array( "ref9_small.jpg",	 "seite2b9.htm",	"_self", "");
data[12] = new Array("ref10_small.jpg",	"seite2b10.htm",	"_self", "");
data[13] = new Array("ref14_small.jpg",	"seite2b11.htm",	"_self", "");
data[14] = new Array("ref15_small.jpg",	"seite2b12.htm",	"_self", "");
data[15] = new Array("ref16_small.jpg",	"seite2b13.htm",	"_self", "");
data[16] = new Array("ref17_small.jpg",	"seite2b14.htm",	"_self", "");
data[17] = new Array("ref18_small.jpg",	"seite2b15.htm",	"_self", "");

// random permutation of indices
var index, store;
indices = new Array(data.length);
for (var i = 0; i < data.length; i++) {
	indices[i] = i;
}
//for (var i = data.length; i>0 ; i--) {
//	index = Math.floor(i * Math.random());
//	store = indices[index];
//	indices [index] = indices[i-1];
//	indices[i-1] = store;
//}
//alert(indices);

speed_play =  1;
speed_fast = 10;

img_width =  116;		// Breite eines Bildes
img_height = 80;		// Höhe eines Bildes
img_spacer =   4;		// Zwischenraum der Bilder

display_top =  0;		// Position oben
display_left = 0;		// Position links

time_fast = 10;			// Laufsteuerung
time_play = 18;
time_pause = 0;

moveFlag = 0;			// Laufsteuerung
moveFlag_catch = 0;
moveFlag_end = 0;
moveFlag_fastStop = 0;	

display_border = 0;
border_type = "solid";
border_colour = "#ffffff";
space_color = "#ffffff";

display_width = (img_places * img_width) + (img_places * img_spacer);
nowdivpos = new Array();
next_right = "";
nextpic = 0;

function BsControl(aSignal)
{
	switch (aSignal)
	{
		case "on":
			document.getElementById('btnStop').style.display		= "block";
			document.getElementById('btnStart').style.display		= "none";
			//document.getElementById('btnInactiv').style.display	= "none";
			start_play();
			break;

		case "off":
			document.getElementById('btnStop').style.display		= "none";
			document.getElementById('btnStart').style.display		= "none";
			//document.getElementById('btnInactiv').style.display	= "block";
			moveFlag_fastStop = 1;
			break;

		case "next":
			document.getElementById('btnStop').style.display		= "none";
			document.getElementById('btnStart').style.display		= "none";
			//document.getElementById('btnInactiv').style.display	= "block";
			stop_move();
			move_right();
			moveFlag_fastStop=1;
			break;

		case "reset":
			document.getElementById('btnStop').style.display		= "none";
			document.getElementById('btnStart').style.display		= "block";
			//document.getElementById('btnInactiv').style.display	= "none";
			break;
	}
}


function InitBannerslide()
{
	nextpic = 0;
	//document.write("<div id=\"btnStop\" style=\"position:absolute; display:block; right:525px; top:61px; height:15px; border:solid 0px #fff; background-color:#4897E8; color:#fff; font-size:10px; font-family:verdana; line-height:13px; padding:0px 1px 1px 1px;\"><a href=\"javascript:BsControl('off');\" onFocus=\"if (this.blur) this.blur();\">&nbsp;stop&nbsp;</a></div>");
	//document.write("<div id=\"btnStart\" style=\"position:absolute; display:none; right:525px; top:61px; height:15px; border:solid 0px #fff; background-color:#4897E8; color:#fff; font-size:10px; font-family:verdana; line-height:13px; padding:0px 1px 1px 1px;\"><a href=\"javascript:BsControl('on');\" onFocus=\"if (this.blur) this.blur();\">&nbsp;start&nbsp;</a></div>");
	//document.write("<div id=\"btnNext\" style=\"position:absolute; display:block; right:560px; top:61px; height:15px; border:solid 0px #fff; background-color:#4897E8; color:#fff; font-size:10px; font-family:verdana; line-height:13px; padding:0px 1px 1px 1px; font-weight:bold;\"><a href=\"javascript:BsControl('next');\" title=\"Einzelbildschaltung\" onFocus=\"if (this.blur) this.blur();\">&nbsp;&nbsp;<<&nbsp;&nbsp;</a></div>");
	
	document.write("<div id=\"display\" style=\"overflow:hidden; position:relative; left:" + display_left + "px; top:" + display_top + "px; width:"+(display_width+display_border*2)+"px; height:"+(img_height+display_border*2)+"px; border:"+display_border+"px "+border_type+" "+border_colour+"; background-color:"+space_color+"\">");
	document.write("<div id=\"center_div\" style=\"position:absolute; left:0px; top:0px; width:"+display_width+"px; height:"+img_height+"px; clip:rect(0," + display_width + "," + img_height + ",0)\" onmouseover=\"if (moveFlag_fastStop==0) stop_move();\" onmouseout=\"start_play();\">"); //if start-stop button is used: onmouseout=\"if (document.getElementById('btnStop').style.display=='block') start_play();\"
	for (i=0; i<img_places + 1; i++)
	{
		document.write("<div id=\"div_"+[i]+"\" style=\"position:absolute\">");
		document.write("<a class='Standard' id=\"loc"+[i]+"\" href=\"#\" onclick=\"if (this.target == '_blank') newwin(this.location); else parent.Hauptframe.location = this.location; return false\"><img src=\"\" id=\"pic_"+[i]+"\" width="+img_width+" height="+img_height+" alt=\"\" border=\"0\"></a></div>");
	}
	document.write("</div>");
	document.write("</div>");

	el_center = document.getElementById("center_div");
	el_pos = -document.getElementById("pic_0").width - img_spacer; 
	for (i=0; i < img_places+1; i++)
	{
		el_pos += document.getElementById("pic_0").width + img_spacer;
		document.getElementById("div_" + [i]).style.left = el_pos;
		document.getElementById("loc" + [i]).location = data[indices[nextpic]][1];
		document.getElementById("loc" + [i]).target = data[indices[nextpic]][2];
		document.getElementById("pic_" + [i]).alt = data[indices[nextpic]][3];
		document.getElementById("pic_" + [i]).src = data[indices[nextpic++]][0];
	}
	speed = speed_play;
	next_right = setTimeout("move_right()", time_pause);
}



function move_right()
{
	if (moveFlag_end == 0 || moveFlag_fastStop == 0) 
	{	
		moveFlag = 1;
		moveFlag_end = 0;
		for (i = 0; i < img_places+1; i++)
		{
			nowdivpos[i] = parseInt(document.getElementById("div_" + [i]).style.left);
			nowdivpos[i] -= speed;
			
			var dist_left = nowdivpos[i] + document.getElementById("pic_0").width + img_spacer; 	
			if (dist_left <= 0)
			{
				moveFlag_catch = 0;
				moveFlag_end = 1;
				document.getElementById("div_"+[i]).style.left = parseInt(el_center.style.width);  
				if (nextpic > data.length-1) 
				{
					nextpic = 0;
				}
				document.getElementById("loc" + [i]).location = data[indices[nextpic]][1];
				document.getElementById("loc" + [i]).target = data[indices[nextpic]][2];
				document.getElementById("pic_" + [i]).src = data[indices[nextpic]][0];
				document.getElementById("pic_" + [i]).alt = data[indices[nextpic++]][3];
			}
			else
			{
				if(dist_left < speed_fast) moveFlag_catch = 1;
				document.getElementById("div_"+[i]).style.left = nowdivpos[i];
			}
		}
		moveFlag = moveFlag + moveFlag_catch + 2*moveFlag_end + 3*moveFlag_fastStop;	// key
		//key-values: 1 play, 2 play_catch, 3 pause, 4 fast, 5 fast_catch, 6 stop
		
		switch (moveFlag)
		{
			case 3:
				next_right = setTimeout("move_right()", time_pause);
				break;
			case 4:
				speed = speed_fast;
				next_right = setTimeout("move_right()", time_fast);
				break;
			case 5:
				speed = speed_play;
				next_right = setTimeout("move_right()", time_play);
				break;
			case 6:
				clearTimeout(next_right);
				moveFlag = 0;
				moveFlag_fastStop = 0;
				BsControl("reset")	//reset start-button
				break;
			default:
				next_right = setTimeout("move_right()", time_play);
				break;
		}
	}
	else 
	{
		moveFlag = 0;
		moveFlag_fastStop = 0;
		BsControl("reset");
	}
}

function start_play()
{
	if (moveFlag == 0 && moveFlag_fastStop == 0) 
	{
		clearTimeout(next_right);
		speed = speed_play;
		move_right();
	}
}

function stop_move()
{
	if (moveFlag != 0)
	{
		clearTimeout(next_right);
		moveFlag = 0;
		moveFlag_fastStop = 0;
	}
}

function BsMoveToEnd()
{
	switch (moveFlag)
	{
		case 0:
			break;
		case 3:
			stop_move();
			BsControl("reset");
			break;
		default:
			BsControl("next");
			break;
	}
}

function newwin(loc)
{
	if (loc == "") 
	{
		return;
	}
	window.open(loc);
}
// Bannerslide ------------------------------------------------------------------------------------
