function UnCryptMailto( s )
    {
        var n = 0;
        var r = "";
        for( var i = 0; i < s.length; i++)
        {
            n = s.charCodeAt( i );
            if( n >= 8364 )
            {
                n = 128;
            }
            r += String.fromCharCode( n - 1 );
        }
        return r;
    }

    function linkTo_UnCryptMailto( s )
    {
        location.href=UnCryptMailto( s );
    }
    // --> 


function get_object(o) {
  if(document.all) {
    return document.all[o];
  } else if (document.getElementById) {
    return document.getElementById(o);
  }
}

function sort (selectbox, limit, rubriken_id) {
  // limit = Tabellenspalten-Name, nach der die Anzeige begrenzt werden soll, z.B. Kunde
  // selectbox = Name der Selectbox
  // formular = Name des Formulars
  wert = document.getElementById(selectbox).value;
  window.location.href="?list_contrubriken_id="+rubriken_id+"&limit="+limit+"&limit_wert="+wert;
}

function inactive (table, field, id, rubriken_id, limit, limit_wert) {
  //alert (Tabelle:'+table+', Feld:'+field+', ID:'+id+', rubriken_id:'+rubriken_id+', Limit:'+limit+', Limit_wert:'+limit_wert);
  //alert ('Tabelle:'+table+', Feld:'+field+', ID:'+id);
  //alert (Tabelle:'+table);
  // id = ID des Datensatzes, der aktiv/inaktiv geschaltet werden soll
  // field = Name des Feldes, das auf den Status 0 oder 1 gesetzt werdem soll
  // table = Name der Datenbanktabelle, in der sich der Datensatz befindet
  if (document.getElementById(field+id).checked == true) {
	status_checkbox = "0";
	//limit = field;
	//limit_wert = '0';
  } else {
    status_checkbox = "1";
	//limit = field;
	//limit_wert = '1';
  }
  window.location.href="?list_contrubriken_id="+rubriken_id+"&table_active="+table+"&id_active="+id+"&status_active="+status_checkbox+"&field_active="+field+"&limit="+limit+"&limit_wert="+limit_wert;
}

function toggle_text(o) {
  o2=get_object(o);
  if(o2.style.display=="block") {
    o2.style.display="none";
  } else {
    o2.style.display="block";
  }
}


// Funktion für Bildergalerie

/* Auto center window script- Eric King (http://redrival.com/eak/index.shtml) */
      var win = null;
      function NewWindow(mypage,myname,w,h,scroll,text){
        LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
        TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
        settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable'
        win = window.open("","NewWindow",settings);
        win = window.open("","NewWindow",settings);
        win.document.write ("<HTML><HEAD><TITLE>.");
        win.document.write ("</TITLE></HEAD>");
        win.document.write ("<BODY BGCOLOR='#FFFFFF'>");
        win.document.write (" ");
        win.document.write (" ");
        win.document.write (" ");
        win.document.write ("<CENTER><IMG SRC='");
        win.document.write (mypage);
        win.document.write ("' BORDER=0></CENTER>");
        win.document.write (" ");
        win.document.write (" ");
        win.document.write (" ");
        win.document.write ("<br><CENTER><font face='Arial' size='2' color='#000000'>");

        win.document.write ("</font></center>");
        win.document.write ("</BODY></HTML>");
        win.document.close();
        win.document.bgColor="#FFFFFF"
        if(win.window.focus)
          {win.window.focus();}
      }

   function winOpen(url, breite, hoehe) {
      // Errechnet Koordinaten, um das Popup zentriert zu platzieren
      links = (screen.width/2)-(breite/2);
      oben = (screen.height/2)-(hoehe/2);
      window.open(url,"popup","height="+hoehe+",width="+breite+",status = no,toolbar = no,menubar = no,location = no,resizable = no,titlebar = no,scrollbars = no,fullscreen = no,top ="+oben+",left ="+links);
   } 

function styleedit(datei) {
 window.open("styleeditor.php?datei="+datei, "", "fullscreen=1, scrollbars=yes");
}