Index: ezjscore/classes/ezjscpacker.php
===================================================================
--- ezjscore/classes/ezjscpacker.php	(revision 191)
+++ ezjscore/classes/ezjscpacker.php	(working copy)
@@ -69,13 +69,13 @@
      * @param bool $wwwInCacheHash To add www path in cache hash or not
      * @return string Html with generated tags
      */
-    static function buildJavascriptTag( $scriptFiles, $type = 'text/javascript', $lang = '', $charset = 'utf-8', $packLevel = 2, $wwwInCacheHash = true )
+    static function buildJavascriptTag( $scriptFiles, $type = 'text/javascript', $lang = '', $charset = 'utf-8', $packLevel = 2, $indexDirInCacheHash = true )
     {
         $ret = '';
         $lang = $lang ? ' language="' . $lang . '"' : '';
         $http = eZHTTPTool::instance();
         $useFullUrl = ( isset( $http->UseFullUrl ) && $http->UseFullUrl );
-        $packedFiles = ezjscPacker::packFiles( $scriptFiles, 'javascript/', '.js', $packLevel, $wwwInCacheHash );
+        $packedFiles = ezjscPacker::packFiles( $scriptFiles, 'javascript/', '.js', $packLevel, $indexDirInCacheHash );
         if ( $charset )
             $charset = " charset=\"$charset\"";
         foreach ( $packedFiles as $packedFile )
@@ -108,10 +108,10 @@
      * @param bool $wwwInCacheHash To add www path in cache hash or not
      * @return string Html with generated tags
      */
-    static function buildStylesheetTag( $cssFiles, $media = 'all', $type = 'text/css', $rel = 'stylesheet', $packLevel = 3, $wwwInCacheHash = true )
+    static function buildStylesheetTag( $cssFiles, $media = 'all', $type = 'text/css', $rel = 'stylesheet', $packLevel = 3, $indexDirInCacheHash = true )
     {
         $ret = '';
-        $packedFiles = ezjscPacker::packFiles( $cssFiles, 'stylesheets/', '_' . $media . '.css', $packLevel, $wwwInCacheHash );
+        $packedFiles = ezjscPacker::packFiles( $cssFiles, 'stylesheets/', '_' . $media . '.css', $packLevel, $indexDirInCacheHash );
         $http = eZHTTPTool::instance();
         $useFullUrl = ( isset( $http->UseFullUrl ) && $http->UseFullUrl );
         $media = $media && $media !== 'all' ? ' media="' . $media . '"' : '';
@@ -142,9 +142,9 @@
      * @param bool $wwwInCacheHash To add www path in cahce hash or not
      * @return array List of javascript files
      */
-    static function buildJavascriptFiles( $scriptFiles, $packLevel = 2, $wwwInCacheHash = true )
+    static function buildJavascriptFiles( $scriptFiles, $packLevel = 2, $indexDirInCacheHash = true )
     {
-        return ezjscPacker::packFiles( $scriptFiles, 'javascript/', '.js', $packLevel, $wwwInCacheHash );
+        return ezjscPacker::packFiles( $scriptFiles, 'javascript/', '.js', $packLevel, $indexDirInCacheHash );
     }
 
     /**
@@ -155,31 +155,40 @@
      * @param bool $wwwInCacheHash To add www path in cahce hash or not
      * @return array List of css files
      */
-    static function buildStylesheetFiles( $cssFiles, $packLevel = 3, $wwwInCacheHash = true )
+    static function buildStylesheetFiles( $cssFiles, $packLevel = 3, $indexDirInCacheHash = true )
     {
-        return ezjscPacker::packFiles( $cssFiles, 'stylesheets/', '_all.css', $packLevel, $wwwInCacheHash );
+        return ezjscPacker::packFiles( $cssFiles, 'stylesheets/', '_all.css', $packLevel, $indexDirInCacheHash );
     }
 
     // static :: gets the cache dir
-    static function getCacheDir()
+    protected static function getCacheDir()
     {
         static $cacheDir = null;
         if ( $cacheDir === null )
         {
-            $sys = eZSys::instance();
-            $cacheDir = $sys->cacheDirectory() . '/public/';
+            $cacheDir = eZSys::cacheDirectory() . '/public/';
         }
         return $cacheDir;
     }
 
     // static :: gets the www dir
-    static function getWwwDir()
+    protected static function getWwwDir()
+    {
+        static $wwwDir = null;
+        if ( $wwwDir === null )
+        {
+            $wwwDir = eZSys::wwwDir() . '/';
+        }
+        return $wwwDir;
+    }
+
+    // static :: gets the index dir (including index.php and siteaccess anme if that is part of url)
+    protected static function getIndexDir()
     {
         static $wwwDir = null;
         if ( $wwwDir === null )
         {
-            $sys = eZSys::instance();
-            $wwwDir = $sys->wwwDir() . '/';
+            $wwwDir = eZSys::indexDir() . '/';
         }
         return $wwwDir;
     }
@@ -199,7 +208,7 @@
      * @param bool $wwwInCacheHash To add www path in cahce hash or not
      * @return array List of css files
      */
-    static function packFiles( $fileArray, $subPath = '', $fileExtension = '.js', $packLevel = 2, $wwwInCacheHash = false )
+    static function packFiles( $fileArray, $subPath = '', $fileExtension = '.js', $packLevel = 2, $indexDirInCacheHash = false )
     {
         if ( !$fileArray )
         {
@@ -243,13 +252,14 @@
             'sub_path' => $subPath,
             'cache_dir' => self::getCacheDir(),
             'www_dir' => self::getWwwDir(),
+            'index_dir' => self::getIndexDir(),
             'custom_host' => (isset( $customHosts[$fileExtension] ) ? $customHosts[$fileExtension] : ''),
         );
 
         // needed for image includes to work on ezp installs with mixed access methods (virtualhost + url based setup)
-        if ( $wwwInCacheHash )
+        if ( $indexDirInCacheHash )
         {
-            $cacheName = $packerInfo['www_dir'];
+            $cacheName = $packerInfo['index_dir'];
         }
 
         while ( count( $fileArray ) > 0 )
