// --------------------------------------------------------
// JavaScript-program
// for Internet Explorer and Netscape Comunicator
// called by: menue.htm (html-page works also without menue.js)
// according CSS: menue.css
//
// name: menue.js
// version: 4.0
// date: 30/09/2003
// author: Edwin Gross-Hardt (http://www.villa-seerose-ruegen.de)
//
// may be copied and altered,
// but the head must not be changed
// --------------------------------------------------------

// --------------------------------------------------------
// Global-Variabeln zum Ändern
// --------------------------------------------------------
// - Statuslinie (unten im Browser): window.defaultStatus
// - Abstände: ab1 - zusätzlicher Abstand vor einem Menuepunkt 1,
//             ab2 - Normaler Abstand nach einem Menuepunkt
// - Farbe der Markierung: farbe
// --------------------------------------------------------
window.defaultStatus = "Villa Seerose Rügen in Sassnitz";

var neu;
if (navigator.appName.indexOf("Microsoft") >= 0 || parseInt(navigator.appVersion)>=5) neu = 1;
else neu = 0;

var x1, x2;
var y;


// --------------------------------------------------------
// Function text_highlight
// Function text_normal
// Called by function sel, highlight, normal
// (1) Highlight actual menue point
// (2) Undo highlight actual menue point
// --------------------------------------------------------
function text_highlight(elem)
	{
	if (neu==1) elem.style.backgroundColor = '#ffffff';
	else elem.bgColor = '#ffffff';
	}

function text_normal(elem)
	{
	if (neu==1) elem.style.backgroundColor = '';
	else elem.bgColor = null;
	}

// --------------------------------------------------------
// Function enable
// Function disable
// Called by function sel
// (1) Make menue-points visible
// (2) Make menue-points invisible
// --------------------------------------------------------
function enable(elem)
	{
	if (neu==1) 
		{
		elem.style.visibility = 'visible';
		elem.style.display = '';
		elem.style.top = y;
		}
	else
		{
		elem.visibility = 'show';
		elem.pageY = y;
		}
	}

function disable(elem)
	{
	if (neu==1) 
		{
		elem.style.visibility = 'hidden';
		elem.style.display = 'none';
		}
	else elem.visibility = 'hide';
	}


// --------------------------------------------------------
// Function: mapid
// Called by function sel
// (1) Generate index for menue point
// (2) Return element-name
// --------------------------------------------------------
function mapid(l1,l2)
	{
	var index;
	if ( l2 == 0 ) index = 'vw' + l1 ;
	else index = 'vw' + l1 + '_' + l2 ;

	if (neu==1) return top.menue.document.getElementById(index);
	else  return top.menue.document.layers[index];
	}


// --------------------------------------------------------
// Main-function: sel 
// Called by event "onClick" or by function "init()"
// (1) Set global selection 
// (2) Get Element -> call mapid
// (3) enable/disable menue-points -> call enable/disable
// (4) text-emphasis -> call text_highlight/text_normal
// --------------------------------------------------------
function sel(l1,l2)
	{
// Wenn Frame menue nicht existiert, dann Weiterleitung an index.htm?framex.htm!
	if ( !parent.menue ) 
	  {
	  parent.location.replace("weiter.htm?" + location.pathname);
	  return true;
	  }
// set global selection
        x1=l1;
	x2=l2;
// set initial vertical position
	y =  0 ;
// enable/disable menue points
// check all possible menue-points (2 loops)
// break if menue-point doesn't exist
	for(i=1; i<15; i++)
		{
		for(j=0; j<15; j++)
			{
			var e1 = mapid(i,j);
			if ( !e1 ) break;
// all elements: undo highlight
			text_normal(e1);
// menue 1: always to be enabled
			if ( j == 0 ) 
				{
				y = y + 10;
				enable(e1);
				y = y + 20;
				}
// menue 2: enable, if according menue 1 is active, otherwise disable.
			else if ( l1 == i ) 
				{
				enable(e1);
				y = y + 20;
				}
			else disable(e1);
			}
		}
// actual menue-point: highlight
	text_highlight(mapid(l1,l2));
	}


// --------------------------------------------------------
// Function: init()
// Called by event "onLoad"
// makes initialization -> call sel(0,0)
// --------------------------------------------------------
function init()
	{
	sel(1,0);
	}

function mailsend(mail,p1,p2,p3) 
	{
	var ca;
	ca = "mailto:" + p2 + "\@" + p3 + "." + p1;
	mail.href = ca;
	return (1);
	}


// --------------------------------------------------------
// How to access properties with NS6/IE and with older NS:
// --------------------------------------------------------
// (1) Browser-Versions:
//   NS6:	navigator.appName = 'Netscape';
// 		navigator.appVersion = '5.0 (Windows; de-DE)';
//   IE5.5/Op:	navigator.appName = 'Microsoft Internet Explorer';
// 		navigator.appVersion = '4.0(compatible;MSIE5.5;Windows98;Win9x4.90)';
//   NS4.75:	navigator.appName = 'Netscape';
// 		navigator.appVersion = '4.75[de](Win95;U)';

// (2) Access Element div with id="vw1_1" (index) in Frame with name "Menue"
//   NS6/IE/Op:	obj = top.menue.document.getElementById('vw1_1');
//		obj = top.menue.document.getElementById(index);
//   NS:	obj = top.menue.document.vw1_1
//		obj = top.menue.document.layers[index];

// (3) Set Visibility
//   NS6/IE/Op:	obj.style.visibility = 'hidden';
//   		obj.style.visibility = '';
//   NS:	obj.visibility = 'hide';
// 		obj.visibility = 'show';

// (4) Set vertical position (y)
//   NS6/IE/Op:	obj.style.top = y;
//   NS:	obj.pageY = y;

// (5) Set Background-Color (white)
//   NS6/IE:	obj.style.backgroundColor = 'white';
//   NS:	obj.bgColor = 'white';
//   NS6/IE/Op:	obj.style.visibility = 'hidden';
//   		obj.style.visibility = '';
//   NS:	obj.visibility = 'hide';
// 		obj.visibility = 'show';

// (4) Set vertical position (y)
//   NS6/IE/Op:	obj.style.top = y;
//   NS:	obj.pageY = y;

// (5) Set Background-Color (white)
//   NS6/IE:	obj.style.backgroundColor = 'white';
//   NS:	obj.bgColor = 'white';


