/*
*******************************************************************************************************************************************************
Do not remove this notice. 

Copyright (c) since 2004 by Andreas Janda

See http://ww.andreas-janda.de for terms of use.
*******************************************************************************************************************************************************
*/


function aktuell()
  {
  fx=win('aktuell/', 'auffaelliges_paar', 680, 0, 30, 3);
  }

  
  
  
  
function zu()
  {
  if(f != null)
    if(!f.closed)
      f.close();
  }
  
  
  
  
  
function fenster_zu(fx, fy)
  {
  window.resizeTo(fx, fy);
  self.close();
  }
  

  
  
  
  
function win(p, name, ww, hh, z, fmt)
  {
  var h=hoehe(ww, hh, z, fmt);//alert(h);
  var w=breite(ww, hh, z, fmt);

/*  
if(navigator.appName=="Microsoft Internet Explorer")
  {
  var scrollweite=100;

  if(2*w==3*h)
    h=h+1;
  while(2*w!=3*h)
    {                                        document.write("Fenstergröße 2/3-optimieren"+"<br>");
    if(h>2*w/3)
	  {
	  h=2*w/3;
      f.resizeTo(w, h);
	  }
    else
	  {
	  w=3*h/2;
      f.resizeTo(w, h);
	  }
	  	                                        document.write(2*w+", "+3*h+"<br>");
    f.scrollTo(0, 0);
	var y=new Array(-1, 0);
	f.scrollBy(0, 1);//alert(w+", "+h);
	while((2*w==3*h)&&y[0]!=y[1]&&y[1]<screen.availHeight)
      {                                      document.write("while-schleife"+"<br>");
	                                          document.write(y[0]+", "+y[1]+"<br>");
      y[0]=y[1];
	  	                                          document.write(y[0]+", "+y[1]+"<br>");
      y[1]=f.document.body.scrollTop;
	  	                                          document.write(y[0]+", "+y[1]+"<br>");
      f.scrollBy(0, scrollweite);
	  y[0]=f.document.body.scrollTop;
	  	                                          document.write(y[0]+", "+y[1]+"<br>");
	  if(y[0]<scrollweite)
        {	                                          document.write(y[0]+", "+y[1]+"<br>");
	    h=h+y[0];
		y[1]=y[0];
//		w=3*h/2-1;
//		if(y[0]==0)
//		  {
//		  y[1]=y[0];
		  while(3*h>2*w||3*h<2*w)
		    {	                                          document.write("gemeinsamer nenner "+3*h+", "+2*w+"<br>");
            if(3*h<2*w)
			  h=h+1;
			else
			  w=w+1;
			  	                                          document.write(3*h+", "+2*w+"<br>");
			}
//          }
		}
	  else
        {
	    h=h+y[0];
	    w=3*h/2-1;
		y[1]=y[0];
		}
      }
	
	                                        document.write(h+", "+w+"<br>");											
    }
*/

  if(h>=screen.availHeight-30)
    {
	w=w+24;
    var f=window.open(p+name+'.htm', name, 'width='+w+', height='+h+', resizable=yes, scrollbars=yes');
	//MSIE misst die Innenmaße, daher Überstand nach unten
	}
  else
	w=w+24;
    var f=window.open(p+name+'.htm', name, 'width='+w+', height='+h+', resizable=yes');


/*  
// nach_oben_scrollen:
  var y1=y[1];
  while(y1>0)
    {
    f.scrollBy(0, -25);
    y1=y1-25;
    }
*/

  if(w%2==0)
    var l=(screen.availWidth-w)/2;
  else
    var l=(screen.availWidth-w-1)/2;
  if(l<0)l=0; 
  var s=screen.height-screen.availHeight;
  if(h<=screen.availHeight && h>=screen.height-2*s)
    var t=screen.availHeight-h;
  if(h<screen.height-2*s)
    {
    if(h%2==0)
      var t=(screen.height-h)/2;
    else
      var t=(screen.height-h-1)/2;
    }
	
  f.moveTo(l, t);	

  f.focus();

 
// }  // end if(nav.appName=="MSIE")
  }   // Ende function win


function zentriere(w, h)
  {
  //var w=self.width;
  //var h=self.height;
  if(w%2==0)
    var l=(screen.availWidth-w)/2;
  else
    var l=(screen.availWidth-w-1)/2;
  if(l<0)l=0; 
  var s=screen.height-screen.availHeight;
  if(h<=screen.availHeight && h>=screen.height-2*s)
    var t=screen.availHeight-h;
  if(h<screen.height-2*s)
    {
    if(h%2==0)
      var t=(screen.height-h)/2;
    else
      var t=(screen.height-h-1)/2;
    }	
  moveTo(l, t);
  focus();
  }
  
function fktTop()
  {   
  var s=screen.height-screen.availHeight;
  if(h<=screen.availHeight && h>=screen.height-2*s)
    var t=screen.availHeight-h;
  if(h<screen.height-2*s)
    {
    if(h%2==0)
      var t=(screen.height-h)/2;
    else
      var t=(screen.height-h-1)/2;
    }
  alert(t);
  return t;
  }



 
  
  
  
function hoehe(w, h, z, fmt)
  {
    switch(fmt)
    {
    case 1:     // Text neben dem Bild (raspi, mall)
      w=w+300;
      h=h+144; 
      break;
    case 2:     // Text unter dem Bild (spbg, bgf, raspi, mall)
      h=h+144;  
      if(navigator.appName=='Microsoft Internet Explorer')
        w=w+56;  
      else
        w=w+43;
      //if(scrollbars.visible==true)		
	    //w=w+18;
      break; 
    case 3:     // nur Text, kein Bild bzw. B[px] * H[z] (Begriffs-Erkl.-Dateien und große)
      h=h+114;
      break;
    case 4:     // frei skalierbar (px * px) mit Text und Bild (Lettner (Neustädter))
      break;
    case 5:     // wie 2, nur schmale Rahmen (neust)
      w=w+50;
      h=h+144;
      break;
    case 6:     // wie 1, nur schmale Rahmen (neust)
      w=w+300;
      h=h+126;
      break;
    default:    // kein Text, nur Bild (Alter Markt usw., canv, spbgf)
      w=w+50;
      h=h+114;
    }
  if(z==0)
    var n=0;
  else if(z>0)
    var n=38+(z-1)*23;//alert('n='+n+'    h='+h);
  h=h+n;
  // f_overflow:
  if(h>=screen.availHeight)
    {
    h=screen.availHeight;
	if(navigator.appName=='Opera')
	  h=h-50;
    w=w+18;
    }
  return h;
  }
  
  


function breite(w, h, z, fmt)
  {
    switch(fmt)
    {
    case 1:     // Text neben dem Bild (raspi, mall)
      w=w+300;
      h=h+144; 
      break;
    case 2:     // Text unter dem Bild (spbg, bgf, raspi, mall)
      h=h+144;
	  w=w+56;
      /*if(navigator.appName=='Microsoft Internet Explorer')
        w=w+56;  
      else
        w=w+43; */
      break; 
    case 3:     // nur Text, kein Bild bzw. B[px] * H[z] (Begriffs-Erkl.-Dateien und große)
      h=h+114;
      break;
    case 4:     // frei skalierbar (px * px) mit Text und Bild (Lettner (Neustädter))
      break;
    case 5:     // wie 2, nur schmale Rahmen (neust)
      w=w+50;
      h=h+144;
      break;
    case 6:     // wie 1, nur schmale Rahmen (neust)
      w=w+300;
      h=h+126;
      break;
    default:    // kein Text, nur Bild (Alter Markt usw., canv, spbgf)
      w=w+50;
      h=h+114;
    }
  if(z==0)
    var n=0;
  else if(z>0)
    var n=38+(z-1)*23;
  h=h+n;
  // f_overflow:
  if(w>screen.availWidth)
    w=screen.availWidth;
  return w;
  }





function imFrame(a, b, c)
  {//alert("imFrame    "+top.frames.length);
  if(top.frames.length==0)
    {
    var x='';
    for(var i=1; i<=a; i++)
      x=x+'../';
    a=x;
    if(b!='')
      {
      x=b;
      b=b+'_links.htm';
      if(dateiname(location.href)!=b)
        {
        b=x+'/'+x+'_frame.htm?';
        if(c!='')
          {
          if(c.indexOf('?')!=c.length-1)
            c=c+'/';
          else
            c=ordnernamen(x)+'/'+c;
          }
        else
          {
          if(location.href.indexOf('termine')!=-1)
            c='veranstaltungskalender.htm?termine/'+ordnername(location.href)+'/';
		  else if(location.href.indexOf('automuseum')!=-1)
		    {
		    switch(ordnername(location.href))
		      {
			  case 'lkw':
			    c='nutzfahrzeuge.htm?lkw/';
              break;	 
              case 'pkw':
                c='oldtimer.htm?pkw/';
		      break;	 
              case 'yng':
                c='youngtimer.htm?yng/';
			  break;	 
              case 'us':
                c='us_cars.htm?us/';
              break;
              default:
                c='';				   
			  }
			  c='automuseum/'+c;
		    }
          else
            {
            c=ordnernamen(x);
            if(c!='')
              c=c+'/';
            }
          }  
        b=b+c+dateiname(location.href);
        }
      else
        b=x+'/'+x+'_frame.htm';
      }
    if(b=='')
      var address=a+'index.htm';
    else
      var address=a+'index.htm?freizeit/'+b;
    if(document.images)
      top.location.replace(address);
    else
      top.location.href=address;
	}
  }



function ordnernamen(x)
  {
  var a=new String(location.href);
  var b=location.href.length;
  var c=location.href.indexOf(x);
  for(var i=b-1; i>=0; i=i-1)
    {
    d=new String(location.href.charAt(i));
    if(d=='/')
      {
      a=a.slice(c+x.length+1, i);
      i=-1;
      }
    }
    return a;
  }









/*function imFrame(a, b)
  {
  if(top.frames.length==0)
    {
    address=a+'index.htm?freizeit/'+b;
    if(document.images)
      top.location.replace(address);
    else
      top.location.href=address;
    }
  } */









  
function FImFrame(a, b)
 {
  if(top.location==self.location)
    {
    if(document.images)
      location.replace(a+'index.htm?freizeit/'+b+'/'+dateiname(location.href));
    else
      location.href=a+'index.htm?freizeit/'+b+'/'+dateiname(location.href);
    }
  }

    
  


function FImFrame2(a, b)
  {
  if(top.location==self.location)
    {
    if(document.images)          location.replace(a+'../../index.htm?freizeit/'+b+'.htm?'+ordnername(location.href)+'/'+dateiname(location.href));
    else
      location.href=a+'../../index.htm?freizeit/'+b+'.htm?'+ordnername(location.href)+'/'+dateiname(location.href);
    }
  }




function imFrameWin(a, c0, c1, c2, c3, c4, c5, d)
/*
a = Pfad der Datei vor der das Fenster geöffnet werden soll mit Anker des Links
c0 = ./ (JS-Parameter für diese Funktion)
c1 = Name der Datei, die im Fenster geöffnet werden soll
c2 = Breite des Fensters (Pixel)
c3 = Höhe des Fensters (Pixel; nicht erforderlich = 0)
c4 = Zeilen
c5 = Format
d = window.opener nicht schließen = 0, schließen = 1, nicht mehr erforderlich, s.u.
*/
  {
  if(window.opener!=null && window.opener.location.href==self.location.href)
	{
	var y=0;
	y=y+1;
	}
  else if(window.opener==null || window.opener.location.href.indexOf('sitemap')!=-1)
    {
	if(self.location.href.indexOf('sitemap_info')==-1 || (self.location.href.indexOf('sitemap_info')!=-1 && window.opener==null))
	  {
       /*address=a+b;//alert(address);+'index.htm?freizeit/'
	  if(self.top.location.href!=address)
        self.top.location.replace(address);//alert(self.top.location.href);
      win(c0, c1, c2, c3, c4, c5);*/
      var address=a;//+'index.htm?freizeit/'+b;
	  win(c0, c1, c2, c3, c4, c5);
	  if(top.location.href!=address)
        {//alert(top.location.href);
        if(document.images){
	      top.location.replace(address);}//alert(top.location.href);
		else
          top.location.href=address;
		}//alert(top.location.href);
      }
    }
  if(window.opener!=null && window.opener.location.href!=self.location.href)
	{
    if(pfad(self.location.href)==pfad(window.opener.location.href))
	  window.opener.close();
	}
  }
  
  
  
  
function imFrameWinNeu(a, b, c0, c1, c2, c3, c4, c5, d)
  {
  if(window.opener!=null)
    {
	if(window.opener.location.href.indexOf('sitemap')==-1 && self.location.href.indexOf(c1)==-1)
	  {alert('fall');win(c0, c1, c2, c3, c4, c5);}
	else
	  {
      address=a+'index.htm?freizeit/'+b;
	  if(self.location.href!=address)
	    {
	    self.location.replace(address);
	    win(c0, c1, c2, c3, c4, c5);
	    }
	  }
	}
  
  }



function imFrameWinAlt(a, b, c0, c1, c2, c3, c4, c5, d)
  {  
  if(window.opener==null)
    {
    address=a+'index.htm?freizeit/'+b;
    if(document.images)
      top.location.replace(address);
    else top.location.href=address;
    win(c0, c1, c2, c3, c4, c5);
    }
  else if(d==1)
    {
    window.opener.close();
    }
  }




  
 
function pfad(x)
  {
  var a=new String(x);
  var b=a.length;
  var c=a.charAt(b-1);
  var d=new String('');
  var e=new String('');
  for(var i=b-1; i>=0; i=i-1)
    {
    c=a.charAt(i);
	d=('');
    if(c=='/')
      {
      var j=i-1;
	  var f=a.charAt(j);
      while(f!='/' && f!='?' && j>=0)
	    {
        d=f+d;
		j=j-1;
		f=a.charAt(j);
	    i=j+1;
		if(f=='?')
		  j=-1;
		}
	  if(d=='freizeit')
        i=-1;
      else		
	    e=e+d;
      }
    }
    return e;
  }  


  
  


function jump2()
  {var y=0; y=y+1;
  if(top.hauptseite.location.search!="")
    {
    var size2=top.hauptseite.location.search.length;

    if(top.hauptseite.location.hash=="")
      var address2=top.hauptseite.location.search.substring(1, size2);
    else
      var address2=top.hauptseite.location.search.substring(1, size2)+top.hauptseite.location.hash;

    if(document.images)
      top.hauptseite.mitte.location.replace(address2);
    else
      top.hauptseite.mitte.location.href=address2;
    }
  }






function jump3()
  {var y=0; y=y+1;
/*  if(top.hauptseite.mitte.location.search!="")
    {
    var size3=top.hauptseite.mitte.location.search.length;

    if(top.hauptseite.mitte.location.hash=="")
      var address3=top.hauptseite.mitte.location.search.substring(1, size3);
    else
      var address3=top.hauptseite.mitte.location.search.substring(1, size3)+top.hauptseite.mitte.location.hash;

    if(document.images)
      top.hauptseite.mitte.oben.location.replace(address3);
    else
      top.hauptseite.mitte.oben.location.href=address3;
    }*/
  }






function jump3evb()
  {
  if(top.hauptseite.mitte.location.search!="")
    {
    var size3=top.hauptseite.mitte.location.search.length;

    if(top.hauptseite.mitte.location.hash=="")
      var address3=top.hauptseite.mitte.location.search.substring(1, size3);
    else
      var address3=top.hauptseite.mitte.location.search.substring(1, size3)+top.hauptseite.mitte.location.hash;

    if(document.images)
      top.hauptseite.mitte.eventbox.location.replace(address3);
    else
      top.hauptseite.mitte.eventbox.location.href=address3;
    }
  }
  
  
  
  
  
  
  
function jump3otb()
  {
  if(top.hauptseite.mitte.location.search!="")
    {
    var size3=top.hauptseite.mitte.location.search.length;

    if(top.hauptseite.mitte.location.hash=="")
      var address3=top.hauptseite.mitte.location.search.substring(1, size3);
    else
      var address3=top.hauptseite.mitte.location.search.substring(1, size3)+top.hauptseite.mitte.location.hash;

    if(document.images)
      top.hauptseite.mitte.oldtimerbox.location.replace(address3);
    else
      top.hauptseite.mitte.oldtimerbox.location.href=address3;
    }
  }  
  
  
  
  
  
  
  
function linkshome() // nur für Dateien in liste.htm
  {
  if(top.location!=self.location)
    {
    var strig=top.hauptseite.links.location.href;
    if(strig.slice(strig.length-14, strig.length)!='home_links.htm')
      {
      if(document.images)
	    top.location.replace(self.location)
      else
        top.location.href=self.location
      }
    }
  }

  






function nachladenInEvb() // nur für dateien im ordner kultur/termine/
  {
  if(top.hauptseite.mitte.location.search!="")
    {
    var size3=top.hauptseite.mitte.location.search.length;

    if(top.hauptseite.mitte.location.hash=="")
      var address3=top.hauptseite.mitte.location.search.substring(9, size3);
    else
      var address3=top.hauptseite.mitte.location.search.substring(9, size3)+top.hauptseite.mitte.location.hash;

    if(document.images)
      top.hauptseite.mitte.eventbox.location.replace(address3);
    else
      top.hauptseite.mitte.eventbox.location.href=address3;
    }
  }
  
  
  
  
  
  
  
  
function nachladenInOtb() // nur für dateien im ordner kultur/automuseum/
  {
  if(top.hauptseite.mitte.location.search!="")
    {
    var size3=top.hauptseite.mitte.location.search.length;

    if(top.hauptseite.mitte.location.hash=="")
      var address3=top.hauptseite.mitte.location.search.substring(1, size3);
    else
      var address3=top.hauptseite.mitte.location.search.substring(1, size3)+top.hauptseite.mitte.location.hash;
	  
    if(document.images)
      top.hauptseite.mitte.oldtimerbox.location.replace(address3);
    else
      top.hauptseite.mitte.oldtimerbox.location.href=address3;
    }
  }  








function text(tx)
  {
  window.defaultStatus=tx;
  }





function textop(tx)
  {
  if(window.opener!=null&&window.opener.location.href.indexOf('sitemap')==-1)
  window.opener.defaultStatus=tx;
  }
  
  
  
  
  
function opfoc()  
  {
  if(window.opener.location.href.indexOf('sitemap')==-1&&window.opener!=null)window.opener.focus();
  }



  
  
  




function dateiname(name)
  {
   var a=new String(name);
   var b=a.length;
   var c=a.charAt(b-1);
   for(var i=b-1; i>=0; i=i-1)
     {
     c=a.charAt(i);
     if(c=='/')
       {
       a=a.slice(i+1, b);
       i=-1
       }
     }
   return a;
  }





function ordnername(name)
  {
   var a=new String(name);
   var b=a.length;
   var c=a.charAt(b-1);
   for(var i=b-1; i>=0; i=i-1)
     {
     c=a.charAt(i);
     if(c=='/')
       {
       name=name.slice(0, i);
       a=dateiname(name);
       i=-1;
       }
     }
   return a;
  }





var bild;

function bild_over(a)
  {
  bild.src=a;
  }

function bild_out(a)
  {
  bild.src=a;
  }



function druckversion()
  {
  var a=new String(top.hauptseite.mitte.eventbox.location.href);
  var monate=new Array('januar', 'februar', 'maerz', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'dezember');
  for(var i=0; i<12; i++)
    {
    if(dateiname(a)==monate[i]+'.htm')
      {
      win('drucken/', 'frame', 640, 570, 100, 2, 0, 4, 1);
      i=11;
      }

    else if(i==11)
        //win('', 'keindruck', 200, 150, 150, 150, 4, 3, 1);
        alert('Eine Druckversion steht nur für die Kalender zur Verfügung.');
    }
  }
