home *** CD-ROM | disk | FTP | other *** search
- function getFilePath() {
- var fromPos, toPos, filePath;
-
- //find the index of the first colon in the string
- a = location.href.search(":");
-
- //alert(a);
-
- if (a == 2) {
- fromPos = 14; //prefix = mk:@MSITStore:
- } else if (a == 6) {
- fromPos = 7; //prefix = ms-its:
- } else {
- return(''); //no a CHM - return an empty string
- }
-
- //find last back slash
- toPos = location.href.lastIndexOf("\\") + 1;
- if (fromPos > toPos) {
- //fromPos = toPos;
- }
-
- filePath = location.href.substring(fromPos, toPos);
-
- //UnEscape path - EG. Replace %20 with spaces
- filePath = unescape(filePath);
-
- //alert(fromPos + "*" + filePath + "*" + toPos);
-
- return filePath
- }
-
- function openExtFile(fileName) {
- var filePath, link;
-
- filePath = getFilePath();
-
- if (filePath != "") {
- link = "file:///" + filePath;
- } else {
- link = "";
- }
-
- link += fileName;
-
- location.href = link;
-
- return false;
- }
-