
  var popwin;

  function popopen(title,width,height,content) {

    if ( !popwin || popwin.closed ) {
      popwin=window.open('','pophelp','width=' + width +',height=' +height + ',resizable=yes,scrollbars=yes,top=50,left=10');
    }

    popwin.document.clear();
    popwin.document.writeln('<html>  <head>    <title>' + title + '</title>');
    popwin.document.writeln('    <link rel="stylesheet" type="text/css" href="alegio.css">');
    popwin.document.writeln('    <script>');
    popwin.document.writeln('      function check_required(form) {');
    popwin.document.writeln('        var inputs = document.getElementsByTagName("input");');
    popwin.document.writeln('        for (var i=0; i<inputs.length; i++) {');
    popwin.document.writeln('          if ((inputs[i].className=="required") && (! inputs[i].value)) {');
    popwin.document.writeln('            alert("A value for \\""+inputs[i].getAttribute("name")+"\\" is required.");');
    popwin.document.writeln('            return false;');
    popwin.document.writeln('          }');
    popwin.document.writeln('        }');
    popwin.document.writeln('        return true; ');
    popwin.document.writeln('      }');
    popwin.document.writeln('    </script>');

    popwin.document.writeln('  </head>');
    popwin.document.writeln('  <body style="padding: 20px; color: #7E8080; background: #333333;">');

    popwin.document.writeln('    <br><br><br><p class="center">Tell a Friend</p><p class="center">Please enter your name and email address as well as<br>those of your friend, with an optional message.</p>');
    popwin.document.writeln('    <br><br><br>');
    popwin.document.writeln('    <form name="tell" action="cgi-bin/alegiotell.cgi" method="POST" onSubmit="return check_required(this)">');
    popwin.document.writeln('      <input type="hidden" name="from" value="' + content + '">');

    popwin.document.writeln('      <table id="tell">');
    popwin.document.writeln('        <tr><td>Your name:</td><td><input type="text" name="yourname" class="required"></td></tr>');
    popwin.document.writeln('        <tr><td>Your email:</td><td><input type="text" name="youremail" class="required"></td></tr>');
    popwin.document.writeln('        <tr><td>Friend\'s name:</td><td><input type="text" name="friendname" class="required"></td></tr>');
    popwin.document.writeln('        <tr><td>Friend\'s email:</td><td><input type="text" name="friendemail" class="required"></td></tr>');
    popwin.document.writeln('        <tr><td>&nbsp;</td><td>&nbsp;</td></tr>');
    popwin.document.writeln('        <tr><td>Your message:</td><td><textarea name="comments" rows="3" cols="20"></textarea></td></tr>');
    popwin.document.writeln('        <tr><td>&nbsp;</td><td>&nbsp;</td></tr>');
    popwin.document.writeln('        <tr><td></td><td><input type="submit" value="send" style="float: right;"></td></tr>');
    popwin.document.writeln('      </table>');

    popwin.document.writeln('    </form>');

    popwin.document.writeln('  </body></html>');
    popwin.document.close();
    popwin.focus();
  }

  function popclose() {
    if (popwin && !popwin.closed) {
      popwin.close();
    }
  }
  function ph(area,pre,suf) {
    document.write('(' + area + ") " + pre + "-" + suf);
  }

  function em(acct,dom,tld) {
    document.write('<a href="mailto:' + acct + "@" + dom + "." + tld + '">' + acct + "@" + dom + "." + tld + '</a>');
  }

  function check_required(form) {
    var inputs = document.getElementsByTagName("input");
    for (var i=0; i<inputs.length; i++) {
      if ((inputs[i].className=="required") && (! inputs[i].value)) {
        alert("A value for \""+inputs[i].getAttribute("name")+"\" is required.");
        return false;
      }
    }
    return true; 
  }

  function fixflash(containerID){
    var msie = ((navigator.appVersion.indexOf("MSIE") != -1) && !window.opera) ? true : false; 
    if (msie) {
      var flashContainer = document.getElementById(containerID);
      var flashMovie = document.createElement("div");
      flashMovie.innerHTML = flashContainer.innerHTML.replace(/</g, "<").replace(/>/g, ">");
      flashContainer.parentNode.insertBefore(flashMovie, flashContainer);
      flashContainer.parentNode.removeChild(flashContainer);
      flashMovie.setAttribute("id",containerID);
    }
  }

