function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// Anfahrtskizze
	var bildPfad2 = '/img/anfahrt/';

	maps = new Array();
	 
	// Bilder vorladen und ggf. richtige 3rd Level Navigation einschalten
	function preloadMap()
	{
		 if (document.images) 
		 {
	 		for (i =1; i<=4;i++)
			{
	 			maps[i] = new Image();
				maps[i].src = bildPfad2 + 'skizze_anfahrt_' + i + '.gif';
	 		}
	 	}
	 }
	 
	 mapZoom=1;
	 
	function swapMap(which)
	{
		selectedAreaOld=selectedArea;
		selectedArea='zoom' +which;
		darken(selectedAreaOld);
		mapZoom = which;
		document.images.map.src=maps[mapZoom].src;
	}

//Neue Navigation 
	var which='';
	var which2 ='';
	var last='';
	var wait=false;
	var newNav = 0;
	
	
function navigate(which)
{
	newNav = 1;
	if (last =='' || last == which)
	{
		if(document.layers && document.layers[which]) document.layers[which].visibility="show";
		if((!document.all)&&(document.getElementById)) document.getElementById(which).style.visibility="visible";
		//if(document.all) document.all[which].style.visibility="visible";
		if((document.all)&&(document.all[which]))document.all[which].style.visibility="visible";
		last = which;
	}
	else
	{
		navigateout(last);
		if(document.layers && document.layers[which]) document.layers[which].visibility="show";
		if((!document.all)&&(document.getElementById)) document.getElementById(which).style.visibility="visible";
		if((document.all)&&(document.all[which])) document.all[which].style.visibility="visible";
		last = which;
	}
	
}	


function colorOn(which)
{
	newColor="#6F9EC0";
	if(document.layers) document.layers[which].color=newColor;
	if((!document.all)&&(document.getElementById)) document.getElementById(which).style.backgroundColor = newColor;
	if(document.all)document.all[which].style.background=newColor;
}

function colorOff(which)
{
	defaultColor="#235E88";
	if(document.layers) document.layers[which].color=defaultColor;
	if((!document.all)&&(document.getElementById)) document.getElementById(which).style.backgroundColor = defaultColor;
	if(document.all) document.all[which].style.background=defaultColor;
}


function navigateout(which)
{
	if(document.layers  && document.layers[which]) document.layers[which].visibility="hide"
	if((!document.all)&&(document.getElementById)) document.getElementById(which).style.visibility="hidden";
	if(document.all) document.all[which].style.visibility="hidden";
}

//Browser ueberpruefen 
function check_browser(){

if (navigator.appName.indexOf("Microsoft") != -1){
                if (navigator.userAgent.indexOf("3.") != -1 ) return 1 ;
                if (navigator.userAgent.indexOf("4.") != -1 ) return 5 ;
                if (navigator.userAgent.indexOf("5.") != -1 ) return 6 ;
        }
        else if (navigator.appName == "Netscape"){
                if (navigator.userAgent.indexOf("2.") != -1 ) return 2 ;
                if (navigator.userAgent.indexOf("3.") != -1 ) return 3 ;
                if (navigator.userAgent.indexOf("4.") != -1 ) return 4 ;
        }
    alert(navigator.appName);
                return 0;
 }


var bildPfad = '../../images/buttons/';

buttonOn = new Array();
buttonOff = new Array();
 
// Bilder vorladen und ggf. richtige 3rd Level Navigation einschalten
function preloadImages()
{
	 if (document.images) 
	 {
 		for (i =0; i<document.images.length;i++)
		{
 			if (document.images[i].name.indexOf('_button')!=-1)
			{
				stopPoint = document.images[i].name.indexOf('_button');
				bildName =document.images[i].name.substring(0,stopPoint);
		
				buttonOn[document.images[i].name] = new Image();
				buttonOn[document.images[i].name].src = bildPfad + bildName + '_on.gif';
				buttonOff[document.images[i].name] = new Image();
 				buttonOff[document.images[i].name].src = bildPfad + bildName + '_off.gif';
 			}
 		}
 	}
 }
 
 selectedArea="";

//onMouseOver -> einschalten
function lightup(which)
{
	if (document.images)
	{
		whichButton = which +"_button";
		newButton =  buttonOn[whichButton];
 		if(buttonOn[whichButton]) document.images[whichButton].src=buttonOn[whichButton].src;
		return true;
		selectedArea=which;
 	}
 	else return false;
	
}

//onMouseOut  -> ausschalten
function darken(which)
{
	if (document.images && selectedArea!=which)
	{
		whichButton = which +"_button";
		newButton = buttonOff[whichButton];
		if(buttonOff[whichButton]) document.images[whichButton].src=buttonOff[whichButton].src;
		return true;
	}
	else return false;
}

// Pop_up Fenster
function pop_up(which, title, width, height, scrollbars)
{
	my_pop_up= window.open(which, title,'width='+ width +',height=' + height + ',scrollbars=' + scrollbars + ',resizable=yes');
    if (my_pop_up != null) 
	{
    	if (my_pop_up.opener == null) 
		{
      		my_pop_up.opener = self
   		} 
		my_pop_up.window.focus();
	}
}

function openNewWindow(URLtoOpen, windowName, windowFeatures, myHeight, myWidth) { 
  		var myLeft = (screen.width-myWidth)/2;
  		var myTop = (screen.height-myHeight)/2;
  			windowFeatures+=',left='+myLeft+',top='+myTop+',height='+myHeight+',width='+myWidth;

  			NewWindow=window.open(URLtoOpen, windowName, windowFeatures);

  			NewWindow.focus();
	}	

