// loadsheet 0.1 - load stylesheet - optionally use a different sheet for Netscape
// developed by Stuart Udall stu@cyberdelix.net
// note: to use the same sheet for all browsers, set the file to the same name
function loadsheet() {
 if (navigator.appName=="Netscape") { 
  sheet="global.css";
 } else {
  sheet="global.css";
 }
 document.write('<link rel="stylesheet" href="' + sheet + '" type="text/css">');
}

// loadframe 0.2 - load page into frame
// developed by Stuart Udall stu@cyberdelix.net
function loadframe(framenum,filename) {
 parent.frames[framenum].location.href = filename;
}

// 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 = "index.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 + ">");
}

// playflash 0.2 - play a flash movie
// developed by Stuart Udall stu@cyberdelix.net
function playflash(moviename, width, height, align) {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="' + width + '" height="' + height + '" align="' + align + '">');
  document.write('<param name=movie value="' + moviename + '">');
  document.write('<param name=quality value=high>');
  document.write('<param name=menu value=false>');
  document.write('<embed src="' + moviename + '" menu=false quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" align="' + align + '">');
  document.write('</embed>');
  document.write('</object>');
}

// makenavcell 0.1 - generate nav table cell, highlighting current item
// developed by Stuart Udall stu@cyberdelix.net
function makenavcell(contentURL, extras) {
 if (parent.content.location.href.indexOf(contentURL) != -1) {
  classstring="navcellhigh";
 } else {
  classstring="navcell";
 }
 document.write("<td class=" + classstring + " " + extras + ">");
}

// writeimgdata 0.1 - write imagehold data into formfields (for use by imghold)
// ensure to call with the parameters populated - there's no error checking! :)
// developed by Stuart Udall stu@cyberdelix.net
function writeimgdata(contentURL, width, height, title, caption, status) {
 document.imghold.contentURL.value=contentURL;
 document.imghold.title.value=title;
 document.imghold.caption.value=caption;
 document.imghold.status.value=status;
 window.open('imghold.htm','','width=' + width + ',height=' + height);
}

