/* Back to parent directory button -
If the current file is either "index.*" or the default file in a directory,
then this link points to the parent directory.
If the current file is anything else, it points to the default file
(typically index.htm) in the current directory
*/
// Get URL and convert to lower case
var DocumentURL=location.href.toLowerCase();
// Get everything after the final /
var DocumentShortName = (DocumentURL.substring( DocumentURL.lastIndexOf("/")+1));
// Get everything before the .
DocumentShortName = DocumentShortName.substring(0,DocumentShortName.lastIndexOf("."))
// Decide whether to use the current or the parent directory as a suitable link
var LinkBackURL;
if ((DocumentShortName == "index") || (DocumentShortName == ""))
{
LinkBackURL = "../";
}
else
{
LinkBackURL = "./";
}
// Display HTML to implement this link
document.writeln ('<p> <a href="' + LinkBackURL + '"> Back to index</a> ');
// See it work by clicking the link below