//////////////////////////////////////////////////////////////////////
// This code is (c) 2000 by kci:dnd / ZPiDER.
// kci - design & development / Marcel Bricman aka ZPiDER
//////////////////////////////////////////////////////////////////////

if (runCount == null)
{
	var runCount = 0;
}
runCount++;

// get base & local Path

if (basePath == null)
{
	var basePath = '';
	if (document.images["imgPathPtr"])
	{
		basePath = document.images["imgPathPtr"].src;
		basePath = unescape (basePath.substring (0, basePath.indexOf ('img/white.gif')));
	} else {
		basePath = '../../';
	}
}

if (localPath == null)
{
	var localPath = '';
	if (document.images["localImgPathPtr"])
	{
		localPath = document.images["localImgPathPtr"].src;
		localPath = unescape (localPath.substring (0, localPath.indexOf ('i/white.gif')));
	} else {
		localPath = '';
	}
}

function nicePath (p)
{
	if (p.indexOf ('/html/') == -1) return p;
	return p.substring (0, p.indexOf ('/html/') + 6) +
		escape (p.substring (p.indexOf ('/html/') + 6, p.length));
}

// create a single Button for the Button - Bar

function createBarButtonUrl (area, url)
{
	if (url == null) {
		url = basePath + 'html/' + escape(area) + '/index.htm';
	}
	res = '';
	res += '<TD CLASS="mainBarB';
	if (area == areaName)
	{
		res += 'A';
	}
	res += '" onMouseOver="menuMouseOver(\'' + area + '\', ' + runCount + ')" ' +
		   'onMouseOut="menuMouseOut(\'' + area + '\', ' + runCount + ')">';
	res += '<A HREF="' + url + '">' +
		'<IMG SRC="' + basePath + 'img/i_' + escape(area) + '.gif" WIDTH=17 HEIGHT=17 HSPACE=1 VSPACE=1 BORDER=0 ALIGN=LEFT><SPAN CLASS="mmtext">'+area+'</SPAN></A></TD>';
	return res;
}

function createBarButton (area)
{
	return createBarButtonUrl(area, null);
}

function menuMouseOver (area, run)
{
/*	var text = '<A>' + area + ' besuchen</A>';
	if (run == 1)
	{
		titleDIV1.innerHTML = text;
	} else {
		titleDIV2.innerHTML = text;
	}*/
}

function menuMouseOut (area, run)
{
/*	var text = barTitle;
	if (run == 1)
	{
		titleDIV1.innerHTML = text;
	} else {
		titleDIV2.innerHTML = text;
	}*/
}

var title = this.location.href;
title = unescape (title);
var pathBarText = title.substring (title.lastIndexOf('/html/')+6, title.length);
if (pathBarText.indexOf ('.htm') > -1)
{ pathBarText = pathBarText.substring (0, pathBarText.indexOf ('.htm')); }
if (pathBarText.indexOf ('.php') > -1)
{ pathBarText = pathBarText.substring (0, pathBarText.indexOf ('.php')); }
if (pathBarText.indexOf ('/index') > -1)
{ pathBarText = pathBarText.substring (0, pathBarText.indexOf ('/index')); }


var menuTitle = pathBarText;
menuTitle = menuTitle.substring (menuTitle.lastIndexOf('/')+1, menuTitle.length);
//if (menuTitle.indexOf ('.htm') > -1)
//{ menuTitle = menuTitle.substring (0, menuTitle.indexOf ('.htm')); }
//if (menuTitle.indexOf ('/index') > -1)
//if (menuTitle.indexOf ('/') > -1)
//{ menuTitle = menuTitle.substring (0, menuTitle.indexOf ('/')); }

if (title.indexOf ('.htm') > -1)
{ title = title.substring (0, title.indexOf ('.htm')); }
if (title.indexOf ('/index') > -1)
{ title = title.substring (0, title.indexOf ('/index')); }
title = title.substring (title.lastIndexOf('/')+1, title.length);

var barTitle = areaName;
if (title != areaName) { barTitle += ': ' + title; }

var mainBar =
		'<A NAME="top"></A>' +
		'<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%><TR><TD CLASS="mainBarO">' +
		'<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%><TR>' +
		'<TD CLASS="mainBar" WIDTH=10>&nbsp;</TD>' +
		createBarButton ('News') +
		createBarButton ('Pfarre') +
		createBarButton ('Kinder & Jugend') +
		createBarButton ('Kindergarten') +
		createBarButton ('SJWDB') +
		createBarButton ('DB Familie') +
		createBarButtonUrl ('Don Bosco - Kirche', 'http://www.donboscokirche-klagenfurt.at/') +
		createBarButton ('Franz von Sales') +
		createBarButton ('Archiv') +
		'<TD CLASS="mainBar"><TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%><TR><TD><NOBR></NOBR></TD>'+
		'<TD ALIGN=RIGHT><NOBR CLASS="Pfarre"><A HREF="' + basePath + 'index.htm">Pfarre St. Josef</A></NOBR></TD></TR></TABLE></TD>' +
		'</TR></TABLE>'+
		'</TD></TR></TABLE>';

document.write (mainBar);

if (runCount == 1)
{
	document.write ('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100% BGCOLOR="#999999">');
	document.write ('<TR>');
	document.write ('<TD CLASS="headerLeft"><IMG SRC="' + nicePath(localPath) + 'i/headerLeft.jpg"></TD>');
	document.write ('<TD CLASS="headerMiddle" BACKGROUND="' + nicePath(localPath) + 'i/headerMiddle.jpg" WIDTH=100%>&nbsp;</TD>');
	document.write ('<TD CLASS="headerRight"><IMG SRC="' + nicePath(localPath) + 'i/headerRight.jpg"></TD>');
	document.write ('</TR>');
	document.write ('</TABLE>');

//	if (pathBarText.indexOf ('/') != pathBarText.lastIndexOf ('/'))
	{
		var mainBar =
		'<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%><TR><TD CLASS="mainBarO">' +
		'<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH=100%><TR>' +
		'<TD CLASS="mainBar"><DIV CLASS="pathBar">' + pathBarText + '&nbsp;&nbsp;</DIV></TD>' +
		'</TR></TABLE>'+
		'</TD></TR></TABLE>';

		document.write (mainBar);
	}

	if (navigator.appName.indexOf("Netscape") > -1)
	{
		document.write ('<LINK REL=STYLESHEET TYPE="text/css" HREF="' + basePath + 'styles/netscape.css">');
	}
}
