var InitFlag;
var ButtonStatus;
ButtonNames = new Array("home","werft","bootsbau","liegeplaetze","kontakt");
var bCount=ButtonNames.length;
Buttons = new Array(bCount);
BrowserName = navigator.appName;

if(BrowserName == "Netscape" ) ok=0; else ok=1;

function init()
{ if (ok) {
	for (i=0; i < bCount; i++)
	{
		Buttons[i] = new Array(3);
		for (j=0; j < 2; j++)
		{
			Buttons[i][j]=new Image(); 
			Buttons[i][j].src="buttons/"+ButtonNames[i]+"_"+j+".gif";
		}
		for (k=0; k < document.images.length; k++)
			if(document.images[k].src==Buttons[i][0].src) Buttons[i][2]=k;
	}
	document.images[Buttons[0][2]].src=Buttons[0][1].src;
	InitFlag=true;
	toframe();
}
}

function toframe(){
if (ok) {
	if (this.document == top.document){
		window.location.href = "index.htm";
	}else{
		if(top.Select.InitFlag){
			x=top.Content.location.href;
						i=x.lastIndexOf("/")+1;
			x=x.substr(i,x.length-i-4); /* anzahl der zeichen der dateiendung inkl. punkt (-4 = .htm)*/
			if(isNaN(x.substr(x.length-1,1))) {}else{x=x.substr(0,x.length-1);}
			top.Select.ChangeButton(x);
		}
	}
}
}

function NewWin(URL,NAME,w,h)
{
if(h<screen.availHeight && w<screen.availWidth){
options="status=no,location=no,menubar=no,directories=no,scrollbars=no,height="+h+",width="+w;
}else{
options="status=no,location=no,menubar=no,directories=no,scrollbars=yes,height="+h+",width="+w;}
window.open(URL,NAME,options);
}

var ImgPath="../buttons/";

function setbtn(buttonname,mod){
for(i=0;i<document.images.length;i++)
	if(document.images[i].name==buttonname) 
	document.images[i].src=ImgPath+buttonname+"_"+mod+".gif";
}


function ShowButton(btn,evt)
{ if (ok) {
if(InitFlag){
	if(evt==0)
	{
		for(i=0; i < bCount; i++)
		if (btn==ButtonNames[i])
		{
			if(ButtonStatus==i)
			{
				document.images[Buttons[i][2]].src=Buttons[i][1].src;
			}
			else
			{
				document.images[Buttons[i][2]].src=Buttons[i][0].src;
			}
		}
	}
	else
	{
		for(i=0;i<bCount;i++)
		if (btn==ButtonNames[i])
		{
			document.images[Buttons[i][2]].src=Buttons[i][1].src;
		}
	}
}
}
}

function ChangeButton(btn)
{ if (ok) {
	btnFound=false;
	for(i=0;i<bCount;i++)
	if(btn==ButtonNames[i])
	{
		btnFound=true;
		j=i;
	}
	if(btnFound)
	{
		for(i=0;i<bCount;i++) document.images[Buttons[i][2]].src=Buttons[i][0].src;
		document.images[Buttons[j][2]].src=Buttons[j][1].src;
		ButtonStatus=j;
	}
}
}

function changeMenu(menuID)
{
	parent.headline.setMenu(menuID);
}