/*----------------------------------------------------------------------*/
/*  redirect.js: neue Seite laden...                                    */
/*  Copyright by Antritter-Informatik, August 2003 - April 2006         */ 
/*----------------------------------------------------------------------*/


/*- Konstruktor: -------------------------------------------------------*/

function Redirect( adress, attributes )
   {
   if( attributes == null ) attributes = "";

   // Daten:
   this.adress     = adress;
   this.width      = ( ( attributes.indexOf("width:")!=(-1) )? parseInt(attributes.slice(attributes.indexOf("width:")+6)) : 640 );
   this.height     = ( ( attributes.indexOf("height:")!=(-1) )? parseInt(attributes.slice(attributes.indexOf("height:")+7)) : 480 );
   this.fixedSize  = ( ( attributes.indexOf("fixedSize")!=(-1) )? 1 : 0 );
   this.scrollbars = ( ( attributes.indexOf("noScrollbars")!=(-1) )? 0 : 1 );
   this.blank      = ( ( attributes.indexOf("_blank")!=(-1) )? true : false );
   var posKennung = attributes.indexOf("kennung:");
   if( posKennung != -1 )
      {
      var attributesAbKennung = attributes.slice(posKennung+8);
      this.kennung = attributesAbKennung.slice(0,attributesAbKennung.indexOf(";"));
      }
   else
      {
      this.kennung = "";
      }

   // Methoden:
   this.doItNow = REDIRECT_doItNow;
   }



/*----------------------------------------------------------------------*/

var REDIRECT_OkFuerLink = 0;
function REDIRECT_spezifiziereOkFuerLink( funcRef )
   {
   REDIRECT_OkFuerLink = funcRef;
   }



function REDIRECT_doItNow()
   {
   if( REDIRECT_OkFuerLink )
      {
      // prüfe, ob man dem Link jetzt folgen darf
      if( !REDIRECT_OkFuerLink(this.kennung) )
         return;
      }

   if( this.blank )
      {
      window.open( this.adress, "NEWWINDOW",
                   "width="      + this.width +
                   ",height="    + this.height +
                   ",resizable=" + ((this.fixedSize)?"no":"yes") +
                   ",scrollbars=" + ((this.scrollbars)?"yes":"no")
                 );
      }
   else
      {
      window.location.href = this.adress;
      }
   }



/*- end of file --------------------------------------------------------*/

