    <script type="text/javascript" src="../lib/javascript/AutoComplete.js"></script>
    <script type="text/javascript" src="../lib/javascript/XmlHttp.js"></script>

    <h1><?php print _("Storage Setup") ?></h1>

    <p>
      <?php printf(_("Gallery needs to store data in a directory on your server. It will use this directory to store your images as well as other important data. For security, we suggest that you place this directory <b>outside</b> of your web site so that it cannot be browse directly via the web. This is necessary if you wish to have your images accessible only via Gallery [%s]. Note that the default path provided below is inside the webserver area. This is because we are unable to reliably guess a directory outside of your web site. You should update it with a secure location, such as a path under your user home directory, if possible. If you access your site via FTP, you might not have this option."), '<b><a href="#footnote_firewall">*</a></b>'); ?>
    </p>

    <?php if (isset($templateData['isMultisite']) && $templateData['isMultisite']): ?>
    <p class="warning">
      <?php print _("This is a multisite installation. Remember that each multisite requires its own storage directory."); ?>
    </p>
    <?php endif; ?>

    <p>
      <?php print _("If you're using a modern browser, we'll try to autocomplete any path you enter here.  So if you're having trouble finding the right path to your g2data directory, try experimenting with paths in the text box below and see what completions it provides for you."); ?>
    </p>

    <form method="post" action="">
      <table>
	<tr>
	  <td class="label">
	    <?php print _('Directory path:') ?>
	  </td>

	  <td>
	    <input id="dir" name="dir" type="text" size="50"
	     value="<?php print $templateData['dir'] ?>" autocomplete="off"/>
	    <input type="hidden" name="action" value="save" />
	    <script type="text/javascript">
	      // <![CDATA[
	      autoCompleteAttach('dir', '<?php printf('%s?step=%s', INDEX_PHP,
		  $currentStep->getStepNumber()) ?>&doAutoComplete=1&path=__VALUE__');
	      // ]]>
	    </script>
	  </td>
	</tr>

	<?php if (isset($templateData['error'])): ?>
	<tr>
	  <td colspan="2" class="error">
	    <?php if (isset($templateData['error']['missing_value'])): ?>
	    <?php print _('You must enter a directory'); ?>
	    <?php endif; ?>
	    <?php if (isset($templateData['error']['missing_dir'])): ?>
	    <?php print _('The directory you entered does not exist'); ?>
	    <?php endif; ?>
	    <?php if (isset($templateData['error']['inaccessible_dir'])): ?>
	    <?php print _('The directory you entered is not accessible.  Change the permissions so that the webserver can read this directory.'); ?>
	    <?php endif; ?>
	    <?php if (isset($templateData['error']['readonly_dir'])): ?>
	    <?php print _('The directory you entered is read only'); ?>
	    <?php endif; ?>
	    <?php if (isset($templateData['error']['creation_error'])): ?>
	    <?php print _('There was an error creating the directory structure within the storage directory.'); ?>
	    <?php endif; ?>
	  </td>
	</tr>
	<?php endif; ?>
      </table>
    </form>

    <?php if (isset($templateData['error']['missing_dir'])): ?>
    <p>
      <?php print _('In some web hosting environments, the paths that you see in the shell or via FTP are not the same paths that PHP sees.  In order to find out the real path to your data directory, you can try creating a PHP script called <b>dir.php</b> containing the following code in it and put it into your data directory.') ?>
    </p>
    <div class="example">
      <pre> &lt;?php print system("pwd"); ?&gt; </pre>
    </div>
    <p>
      <?php printf(_('then figure out the URL to dir.php and open it in your web browser (eg, %s).  This will tell you the exact path to enter here.'), '<b>http://your.server.com/g2data/dir.php</b>'); ?>
    </p>
    <p>
      <?php print _('<b>Note</b>: This requires that your data directory is web accessible, which we don\'t recommend because it circumvents our image firewall.  Once you figure out the path this way, we recommend that you move your data directory outside of your web accessible area and then update the path here accordingly.'); ?>
    </p>
    <p>
      <?php print _('<b>Note</b>: Don\'t forget to delete dir.php when you\'re done!'); ?>
    </p>
    <?php else: ?>
    <p>
      <?php print _("Your webserver needs to be able to write to this directory. Permission systems vary from host to host. You can set a very relaxed set of permissions on this directory to get Gallery working, but if you're concerned about security you should consult your system adminstrator to figure out how to make this as secure as possible. To get it working, you can follow these examples.") ?>
      <br/>
      <i>
	<?php print _("Note: these are only examples!  You may find that they don't work quite right on your system.") ?>
      </i>
    </p>

    <?php if ($templateData['OS'] == 'unix'): ?>
    <div class="example">
      <h2> <?php print _("Unix (with shell access)"); ?> </h2>
      <pre> $ <b> <?php printf(_("mkdir %s"), $templateData['dir']) ?> </b> <br/> $ <b> <?php printf(_("chmod 777 %s"), $templateData['dir']) ?> </b> </pre>
    </div>

    <div class="example">
      <h2> <?php print _("Unix (with ftp access)"); ?> </h2>
      <i> <?php print _("Note that ftp servers and clients vary so these instructions may not work for you. Consult the manual for your FTP client or talk to a system administrator for help with this if you have problems") ?> </i> <br/>
      <pre> ftp> <b> <?php printf(_("cd %s"), dirname($templateData['dir'])) ?></b><br/> ftp> <b> <?php printf(_("mkdir %s"), basename($templateData['dir'])) ?> </b> <br/> ftp> <b> <?php printf(_("chmod 777 %s"), basename($templateData['dir'])) ?> </b> </pre>
    </div>

    <?php else: ?>

    <div class="example">
      <h2> Windows </h2>
      <pre> C:\> <b> <?php printf(_("mkdir %s"), $templateData['dir']) ?></b></pre>
    </div>

    <?php endif; ?>
    <?php endif; ?>

    <div class="go">
      <span class="goToNext">
	<a href="javascript:document.forms[0].submit()"><?php print _('Save') ?></a>
      </span>
    </div>

    <hr/>

    <p style="text-align: left;">
      <strong><a name="footnote_firewall">*</a></strong> <?php print _("This is sometimes known as an <b>image firewall</b>.") ?>
    </p>

