Index: extensions/AStat/astat.css
===================================================================
--- extensions/AStat/astat.css	(revision 16009)
+++ extensions/AStat/astat.css	(revision 16009)
@@ -0,0 +1,53 @@
+.AStatBar1, .AStatBar2, .AStatBar3, .AStatBar4, .AStatBarX {
+  border:0px;
+  height:8px;
+  display: block;
+  margin:0px;
+  padding:0px;
+  left:0;
+  position:relative;
+}
+.MiniSquare1, .MiniSquare2, .MiniSquare3, .MiniSquare4 {
+  border:0px;
+  height:8px;
+  width:8px;
+  margin:0px;
+  padding:0px;
+}
+.AStatBar1 { top:5px;  }
+.AStatBar2 { top:-3px; }
+.AStatBar3 { top:-3px;}
+.AStatBar4 { top:-3px;}
+.AStatBarX { background-color:transparent; top:-3px; height:1px; }
+
+.formtable, .formtable P { text-align:left; display:block; }
+.formtable tr { vertical-align:top; }
+.window_thumb {
+  position:absolute;
+  border: none;
+  background: none;
+  left:0;
+  top:0;
+  margin:0px;
+  padding:0px;
+  z-index:100;
+  overflow:hidden;
+  visibility:hidden;
+}
+.img_thumb {
+  border: solid 3px #ffffff;
+  background: #000000;
+  margin:0px;
+  padding:0px;
+}
+.time_request {
+  font-size:83%;
+  text-align:right;
+}
+.invisible { visibility:hidden; display:none; }
+.littlefont { font-size:90%; }
+table.littlefont th { padding:3px; }
+table.littlefont td { padding:0px;padding-left:3px;padding-right:3px; }
+#iplist { visibility:hidden; position:absolute; width:200px; z-index:1000; }
+.iipsellistitem { float:right; }
+#iipsellist { width:100%; font-family:monospace; }
Index: extensions/AStat/astat_aim.class.inc.php
===================================================================
--- extensions/AStat/astat_aim.class.inc.php	(revision 15342)
+++ extensions/AStat/astat_aim.class.inc.php	(revision 16009)
@@ -17,11 +17,8 @@
 
 include_once('astat_root.class.inc.php');
-include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php');
 
 class AStat_AIM extends AStat_root
 {
-  protected $css = null;
-
-  function __construct($prefixeTable, $filelocation)
+  public function __construct($prefixeTable, $filelocation)
   {
     parent::__construct($prefixeTable, $filelocation);
@@ -31,6 +28,7 @@
     initialize events call for the plugin
   */
-  function initEvents()
+  public function initEvents()
   {
+    parent::initEvents();
     add_event_handler('get_admin_plugin_menu_links', array(&$this, 'pluginAdminMenu') );
   }
Index: extensions/AStat/astat_aip.class.inc.php
===================================================================
--- extensions/AStat/astat_aip.class.inc.php	(revision 15342)
+++ extensions/AStat/astat_aip.class.inc.php	(revision 16009)
@@ -60,22 +60,8 @@
   }
 
-  /*
-    initialize events call for the plugin
-  */
-  function initEvents()
-  {
-    add_event_handler('loc_end_page_header', array(&$this, 'applyCSS'));
-  }
-
-
 
   /* ---------------------------------------------------------------------------
   Public classe functions
   --------------------------------------------------------------------------- */
-
-  public function applyCSS()
-  {
-    GPCCore::addHeaderCSS(basename(dirname($this->getPluginNameFiles())), PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'css/'.$this->getPluginNameFiles().".css");
-  }
 
 
Index: extensions/AStat/astat_root.class.inc.php
===================================================================
--- extensions/AStat/astat_root.class.inc.php	(revision 15342)
+++ extensions/AStat/astat_root.class.inc.php	(revision 16009)
@@ -17,11 +17,7 @@
 
 include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/CommonPlugin.class.inc.php');
-include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCCss.class.inc.php');
-
 
 class AStat_root extends CommonPlugin
 {
-  protected $css;   //the css object
-
   public function __construct($prefixeTable, $filelocation)
   {
@@ -31,11 +27,4 @@
     $this->setPluginNameFiles("astat");
     parent::__construct($prefixeTable, $filelocation);
-    $this->css = new GPCCss(PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'css/'.$this->getPluginNameFiles().".css");
-  }
-
-  public function __destruct()
-  {
-    unset($this->css);
-    parent::__destruct();
   }
 
@@ -70,91 +59,23 @@
   }
 
-  /*
-    surchage of CommonPlugin->saveConfig function
-  */
-  function loadConfig()
+  public function loadCSS()
   {
-    parent::loadConfig();
-    if(!$this->css->fileExists())
-    {
-      $this->css->makeCSS($this->generate_CSS());
-    }
-  }
+    parent::loadCSS();
+    GPCCore::addHeaderCSS('astat.css', 'plugins/'.$this->getDirectory().'/'.$this->getPluginNameFiles().".css");
+    GPCCore::addHeaderContent('css',
+"
+.AStatBar1 { background-color:#".$this->config['AStat_BarColor_Pages']."; }
+.AStatBar2 { background-color:#".$this->config['AStat_BarColor_Img']."; }
+.AStatBar3 { background-color:#".$this->config['AStat_BarColor_IP']."; }
+.AStatBar4 { background-color:#".$this->config['AStat_BarColor_Cat']."; }
 
-  /*
-    surchage of CommonPlugin->saveConfig function
-  */
-  function saveConfig()
-  {
-    if(parent::saveConfig())
-    {
-      $this->css->makeCSS($this->generate_CSS());
-      return(true);
-    }
-    return(false);
-  }
+.MiniSquare1 { color:#".$this->config['AStat_BarColor_Pages'].";   }
+.MiniSquare2 { color:#".$this->config['AStat_BarColor_Img'].";  }
+.MiniSquare3 { color:#".$this->config['AStat_BarColor_IP']."; }
+.MiniSquare4 { color:#".$this->config['AStat_BarColor_Cat']."; }
 
-  /*
-    generate the css code
-  */
-  function generate_CSS()
-  {
-    $text = ".AStatBar1, .AStatBar2, .AStatBar3, .AStatBar4, .AStatBarX {
-      border:0px;
-      height:8px;
-      display: block;
-      margin:0px;
-      padding:0px;
-      left:0;
-      position:relative;
-      }
-       .MiniSquare1, .MiniSquare2, .MiniSquare3, .MiniSquare4 {
-      border:0px;
-      height:8px;
-      width:8px;
-      margin:0px;
-      padding:0px;
-      }
-       .AStatBar1 { background-color:#".$this->config['AStat_BarColor_Pages']."; top:5px;  }
-       .AStatBar2 { background-color:#".$this->config['AStat_BarColor_Img']."; top:-3px; }
-       .AStatBar3 { background-color:#".$this->config['AStat_BarColor_IP']."; top:-3px;}
-       .AStatBar4 { background-color:#".$this->config['AStat_BarColor_Cat']."; top:-3px;}
-       .AStatBarX { background-color:transparent; top:-3px; height:1px; }
-       .MiniSquare1 { color:#".$this->config['AStat_BarColor_Pages'].";   }
-       .MiniSquare2 { color:#".$this->config['AStat_BarColor_Img'].";  }
-       .MiniSquare3 { color:#".$this->config['AStat_BarColor_IP']."; }
-       .MiniSquare4 { color:#".$this->config['AStat_BarColor_Cat']."; }
-       .StatTableRow:hover { background-color:#".$this->config['AStat_MouseOverColor']."; }
-       .formtable, .formtable P { text-align:left; display:block; }
-       .formtable tr { vertical-align:top; }
-       .window_thumb {
-      position:absolute;
-      border: none;
-      background: none;
-      left:0;
-      top:0;
-      margin:0px;
-      padding:0px;
-      z-index:100;
-      overflow:hidden;
-      visibility:hidden; }
-        .img_thumb {
-      border: solid 3px #ffffff;
-      background: #000000;
-      margin:0px;
-      padding:0px; }
-        .time_request {
-      font-size:83%;
-      text-align:right; }
-        .invisible { visibility:hidden; display:none; }
-      .littlefont { font-size:90%; }
-      table.littlefont th { padding:3px; }
-      table.littlefont td { padding:0px;padding-left:3px;padding-right:3px; }
-      #iplist { visibility:hidden; position:absolute; width:200px; z-index:1000; }
-      .iipsellistitem { float:right; }
-      #iipsellist { width:100%; font-family:monospace; }
-    ";
-
-    return($text);
+.StatTableRow:hover { background-color:#".$this->config['AStat_MouseOverColor']."; }
+"
+    );
   }
 
Index: extensions/AStat/main.inc.php
===================================================================
--- extensions/AStat/main.inc.php	(revision 15342)
+++ extensions/AStat/main.inc.php	(revision 16009)
@@ -100,5 +100,5 @@
 
 //AStat loaded and active only if in admin page
-if(basename($_SERVER["PHP_SELF"])=='admin.php')
+if(defined('IN_ADMIN') && !defined('AJAX_CALL'))
 {
   include_once("astat_aim.class.inc.php");
