function popup(url)
{
   newPopup = window.open(url,"","width=700,height=500,top=50,left=50,location=yes,menubar=yes,toolbar=yes,status=yes,scrollbars=yes,resizable=yes");
}

/*
 * Diese Popup-Funktion erzeugt ein neues Fenster
 * mit definierter Groesse;
 */
function popupFirmSize(url,width,height)
{
   if(null == width)
   {
      var width = 700;
   }
   if(null == height)
   {
      var height = 500;
   }
   newPopup = window.open(url,"","width=" + width + ",height="+ height +",top=50,left=50,location=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=yes");
}

/*
 * @param string  container   Die CSS-ID des zu pruefenden Containers
 * @param int     padTop      das "padding-top" des zu pruefenden Containers
 * @param int     padBot      das "padding-bottom" des zu pruefenden Containers
 *
 **/
function applyPositioningFix(container,padTop,padBot)
{
   var containerHeight = xHeight(container);
   if(containerHeight%2 != 0)
   {
      var newHeight = containerHeight - padTop - padBot + 1;
      document.getElementById(container).style.height = newHeight;
   }
}

// -------------- dieses Script passt die Hoehe von "rechteSpalte" automatisch an ----------------
function adjustLayout()
{
   // Ermitteln der Hoehe von "linkeSpalte" und  "content"
   var linkeSpalteHeight = xHeight("linkeSpalte");
   var rechteSpalteHeight = xHeight("rechteSpalte");
   var contentHeight = xHeight("content") + xHeight("breadcrumbs");
   var contentStartseiteHeight = xHeight("contentStartseite") + xHeight("breadcrumbs");

   // Ermitteln der groessten Hoehe
   var maxHeight = Math.max(linkeSpalteHeight,rechteSpalteHeight,contentHeight,contentStartseiteHeight);
   // Copyright mit einschliessen
   if(rechteSpalteHeight > contentHeight)
   {
      maxHeight = maxHeight + 40;
   }

   // Zuweisen der groessten Hoehe
   xHeight("linkeSpalte",maxHeight);
   xHeight("rechteSpalte",maxHeight);
   xHeight("content",maxHeight);
   xHeight("contentStartseite",maxHeight);

   applyPositioningFix("content",0,0);
   applyPositioningFix("contentStartseite",0,0);
   applyPositioningFix("linkeSpalte",0,0);
   applyPositioningFix("rechteSpalte",0,0);

   // Footer positionieren
   var footerStartPos = maxHeight - 23;
   document.getElementById("contentFt").style.top = footerStartPos + "px";
}

window.onload = function()
{
   xAddEventListener(window,"resize",adjustLayout,false);
   adjustLayout();
}

// dateCheck Funktion
// Diese Funktion generiert bei einer Datumseingabe per Select Box, die Select Box fuer die Tage, nach der Auswahl des Monates bzw Jahres automatisch
function dateCheck(tag_id, monat_id, jahr_id)
{
   var tag = tag_id.value;
   var monat = monat_id.value;
   var jahr = jahr_id.value;

   // Ausgewähltes Jahr ein Schaltjahr?
   var schaltjahr = false;
   var schaltjahr_string = new String(jahr / 4);
   if (-1 == schaltjahr_string.indexOf("."))
   {
      schaltjahr = true;
   }

   if(4 == monat || 6 == monat || 9 == monat || 11 == monat) // Monat mit 30 Tagen
   {
      // Loescht Tag 31 und fügt 29 und 30 neu ein
      tag_id.options[31] = null;
      tag_id.options[30] = new Option("30", "30", false, false);
      tag_id.options[29] = new Option("29", "29", false, false);
      if(tag <= 30 && tag >= 1) { tag_id.options[tag] = new Option(tag, tag, false, true); } // Selected einen vorher ausgewählten Tag innerhalb der neuen Tages"Range"
   }
   else if(02 == monat) // Februar mit 28 bzw 29 Tagen
   {
      // Je nach Schaltjahr 29 oder 28 Tage
      if( schaltjahr )
      {
         // Fuegt Tag 29 ein und loescht 30 und 31
         tag_id.options[31] = null;
         tag_id.options[30] = null;
         tag_id.options[29] = new Option("29", "29", false, false);
         if(tag <= 29 && tag >= 1) { tag_id.options[tag] = new Option(tag, tag, false, true); } // Selected einen vorher ausgewählten Tag innerhalb der neuen Tages"Range"
      }
      else
      {
         // Loescht Tag 29,30 und 31
         tag_id.options[31] = null;
         tag_id.options[30] = null;
         tag_id.options[29] = null;
         if(tag <= 28 && tag >= 1) { tag_id.options[tag] = new Option(tag, tag, false, true); } // Selected einen vorher ausgewählten Tag innerhalb der neuen Tages"Range"
      }
   }
   else  // Monat mit 31 Tagen
   {
      tag_id.options[31] = new Option("31", "31", false, false);
      tag_id.options[30] = new Option("30", "30", false, false);
      tag_id.options[29] = new Option("29", "29", false, false);
      if(tag <= 31 && tag >= 1) { tag_id.options[tag] = new Option(tag, tag, false, true); } // Selected einen vorher ausgewählten Tag innerhalb der neuen Tages"Range"
   }
}

function paypalTimedRedirect()
{
   var secs = parseInt($('#seconds').html());
   if(secs <= 0)
   {
      return $('#paypalForm').submit();
   }
   $('#seconds').html((secs -1));
   window.setTimeout("paypalTimedRedirect()", 1000);
}
