// checkframe 0.4 - make sure we're inside our frameset
// developed by Stuart Udall - stu@cyberdelix.net
// future work: the number of subdirs defined by the value of subflag
// to use: 1. set defaultpage - this is the page which builds your frameset
//         2. call this script onload from each page requiring deeplinking support
//         3. add handler to defaultpage
// call with 1 as a parameter to indicate you're inside a subdirectory
function checkframe(subflag) {
 var defaultpage = "home.htm"
 if (parent.frames.length == 0) {
    myURL = location.href.split("/");
    if (subflag) { 
       if (navigator.userAgent.indexOf("Opera") != -1) { // exclude Opera >:(
          top.location.replace('../' + defaultpage);
       } else {
          targetURL = '../' + defaultpage + '?page='+ myURL[myURL.length-2] + "/";
       }
    } else {
       targetURL = defaultpage + '?page='
    }
    top.location.replace(targetURL + myURL[myURL.length-1]);
 }
}

// poptofront 0.1 - pop this window to front
// developed by Stuart Udall stu@cyberdelix.net
function poptofront() {
 window.focus();
}

// safemailto 0.2 - generate email address - antispam measure
// developed by Stuart Udall stu@cyberdelix.net (based on source from authors unknown)
function safemailto(email1, email2) {
 document.write("<a h" + "ref=" + "mail" + "to:" + email1 + "@" + email2 + ">" + email1 + "@" + email2 + "</a>");
}

// safeformto 0.1 - generate recipient line for formmail - antispam measure
// developed by Stuart Udall stu@cyberdelix.net (based on source from authors unknown)
function safeformto(email1, email2) {
 document.write("<INPUT type=hidden NAME=recipient VALUE=" + email1 + "@" + email2 + ">");
}

// checkform 0.2 - get confirmation before submitting, with custom and default confirmation message
// developed by Stuart Udall stu@cyberdelix.net
function checkform(msg) {
 if (msg == '') {
    msg="Continue?";
 }
 if (confirm(msg)) {
    return true;
 } else {
    alert("Your form has not been sent.");
    return false;
 }
}

