var href = parent.document.location.href;
var ndx  = href.lastIndexOf("/");

if(href.substr(0,4)=="file") {
  if(href.substr(ndx+1,9) != "index.htm")
     parent.document.location.href=parent.document.location.href.substr(0,ndx+1)+"index.htm";
} else if(ndx+1 != href.length)
  parent.document.location=parent.document.location.href.substr(0,ndx)+"/";

