<?php

    $imp_configured         = false;
$imp_configured         = file_exists( './config/defaults.php3' );
$imp_lib_configured     = (file_exists( '../lib/horde.lib' ) &&
			   (file_exists( './lib/imp.lib' )));
$imp_configurable       = (is_readable( './setup.php3') &&
			   is_writeable( './config/defaults.php3'));


if ($imp_configured && $imp_lib_configured && ! $imp_configurable) {
   /* Bring in the horde library for the WebClient class */
   if (!defined("HORDE_LIB")) include ('../lib/horde.lib');
   
   /* Detect that browser */
   $this_client = new WebClient;

   if ($this_client->frames && ! $this_client->lynx) {
      
      /* Frames mode */
      echo( '<html>' );
      echo( '<head>' );
      echo( '<title>IMP</title>' );
      include( './templates/index/frames_mode.inc' );
      echo( '</html>' );
      
      /* } else if ( $this_client->tables ) { */
      /* Table mode? Per User Request = Lynx Mode ?*/
   } else if ( $this_client->lynx ) {
      
      /* Lynx Mode */
      include( './login.php3' );
      /* include( './templates/index/lynx_mode.inc' ); */
      
   } else {
      
      /* Ooo what browser is this? */
      include( './templates/index/unknown_browser.inc' );
      
   }
   
} else if ( $imp_configurable ) {
   /* IMP is web congigurable */
   include( './templates/index/imp_configurable.inc' );
   
} else if ( ! $imp_configured ) {
   
   /* IMP Isn't configured */
   include( './templates/index/imp_notconfigured.inc' );
   
} else if ( ! $imp_lib_configured ) {
   
   /* IMP's libraries are not present */
   include( './templates/index/imp_lib_notconfigured.inc' );
   
}

?>
