function getResizedImageInfos(width,height,maxWidth,maxHeight)
{
  maxHeight -= 100;
  this.width = width;
  this.height = height;
  faktor = this.width/this.height;
  if(this.width > maxWidth)
  {
    while(this.width > maxWidth)
    {
      this.width = this.width * 0.95;
    }
    this.height = this.width/faktor;
    //z.B. bei Ausgang: 480 x 640
    if(this.height > maxHeight)
    {
      while(this.height > maxHeight)
      {
        this.height = this.height * 0.95;
      }
      this.width = this.height*faktor;
    }
    else//z.B. bei Ausgang: 640 x 480
    {
    }
  }
  else
  {
    //z.B. bei Ausgang: 50 x 150
    this.height = this.width/faktor;
    if(this.height > maxHeight)
    {
      while(this.height > maxHeight)
      {
        this.height = this.height * 0.95;
      }
      this.width = this.height*faktor;
    }
    else//z.B. bei Ausgang: 50 x 50
    {
    }
  }
}

function oeffnen(url, width, height)
{
  var scroll = "no";
  if(width >= screen.width || height >= screen.height)
  {
    if(width > screen.width || height > screen.height)
    {
      scroll = "auto";
    }
    var infos = new getResizedImageInfos(width, height, screen.width, screen.height);
    width = infos.width;
    height = infos.height;
  }
  var left = Math.round((screen.width - width)/2);
  var top = Math.round((screen.height - height)/2);
  window.open(url + "&width=" + width + "&height=" + height + "&scroll=" + scroll,"","toolbar=no,location=no,resizable=no,status=yes,left=" + left + ",top=" + top + ",width=" + width + ",height=" + height);
}

function maximize()
{
  if(width>height)
  {
    var faktor = width/height;

    if(status == 0)
    {
      width = screen.width;
      status = 1;
    }
    else
    {
      width = old_width;
      status = 0;
    }

    height = width/faktor;

  }
  else
  {
    var faktor = height/width;

    if(status == 0)
    {
      height = screen.height;
      status = 1;
    }
    else
    {
      height = old_height;
      status = 0;
    }

    width = height/faktor;
  }

  width = (width * 0.95);
  height = (height * 0.95);
  window.resizeTo(width+12-5,height+51-5);
  window.moveTo(Math.round((screen.width - (width+12-5))/2),Math.round((screen.height - (height+51-5))/2));
  document.getElementById("bild").style.width = width;
  document.getElementById("bild").style.height = height;
}

function forward()
{
	window.location.href="index2.php";
}

// preload images (arguments [imageUrl]
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 trabi_werbung_animation()
{
	current_position=current_position-10;
	document.getElementById('trabi_werbung').style.left = current_position + 'px';
	
	if(current_position < -1545)
	{
		current_position = 0;
	}
}

var current_position = 0;
