public static function includeClass($classname, $loadscheme='Web2All', $package='', $set_includedir=false) {
    // $path will be the relative path to the classfile by exploding the namespace
    $path = '';
    $filename = $classname;
    // support namespaces
    if(strpos($classname,'\\')){
      // ok, contains namespace
      $path_parts = explode('\\',$classname);
      $part_count=count($path_parts);
      $filename = $path_parts[$part_count-1];
      $classname_without_namespaces = $filename;
      for ($i=0;($i<$part_count-1);$i++) {
        $path.=$path_parts[$i].DIRECTORY_SEPARATOR;
      }
    }else{
      $classname_without_namespaces = $classname;
    }
    
    if ($loadscheme!='PLAIN')
    {
      $path_parts = explode("_",$classname_without_namespaces);
      $part_count=count($path_parts);
      $filename = $path_parts[$part_count-1];
      for ($i=0;($i<$part_count-1);$i++) {
        $path.=$path_parts[$i].DIRECTORY_SEPARATOR;
      }
    }
    
    // depending on the scheme, select the suffix
    // PEAR class files do not have the .class in the name.
    // The Web2All scheme historically used ".class.php", but for 
    // better compatibility we now also support the plain ".php".
    $classfilesuffixes=array('.class.php','.php');
    switch($loadscheme){
      case 'PEAR':
      case 'PLAIN':
        $classfilesuffixes=array('.php');
        break;
      case 'INC':
        $classfilesuffixes=array('.inc.php');
        break;
    }
    
    foreach(self::$frameworkRoots as $include_path){
      if ($package) {
        $include_path.=$package.DIRECTORY_SEPARATOR;
      }
      foreach($classfilesuffixes as $classfilesuffix){
        if(is_readable($include_path.$path.$filename.$classfilesuffix)){
          // if set_includedir is true, then we have the include path of the package to
          // the PHP environment include path
          if ($set_includedir) {
            $pathArray = explode( PATH_SEPARATOR, get_include_path() );
            // only add the path if its not already in the include path
            if (!in_array($include_path,$pathArray)) {
              $pathArray[]=$include_path;
              set_include_path(implode(PATH_SEPARATOR,$pathArray));
            }
          }
          include_once($include_path.$path.$filename.$classfilesuffix);
          // ok once we found a file, we are done
          return;
        }
      }
    }
  }