
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

  var checkflag = "false";

  function check(field) {
     if (checkflag == "false") {
       for (i = 0; i < field.length; i++) {
         field[i].checked = true;
       }
     checkflag = "true";
     return "Uncheck All";
     } else {
       for (i = 0; i < field.length; i++) {
         field[i].checked = false;
       }
     checkflag = "false";
     return "Check All";
     }
   }

function dl_verify(download_form) {
 var downloadcount = download_form.download.length;
 var downloadchecked = 0;
  for(i = 0; i < downloadcount; i++) {
    if (download_form.download[i].checked) {
      downloadchecked++;
    }
  }

  if (downloadchecked == 0) {
     alert("Oops! You did not check any documents to download!")
     return (false);
  }
}

function outputE(ex,d,usr,sub) {
  var t = '.';
  var n = '?';
  var e = usr + '@' + d + t + ex;
  var s1 = n + 'sub';
  var s2 = 'ject=' + sub;
  var l1 = '<a href="ma';
  var l2 = 'ilto:' + e;
  var l3 = s1 + s2 + '"><u>' + e;
  var l4 = '</u></a>';
  document.writeln(l1+l2+l3+l4);
}

  function open_window(url,width,height,name,scroll,winl,wint) {
   if (winl == "") { var winl = (screen.width - width) / 2; }
   if (wint == "") { var wint = (screen.height - height) / 2; }
       mywin = window.open(url,name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+scroll+',resizable=1,width='+width+',height='+height+',left='+winl+',top='+wint+',dependent=1');
     if (parseInt(navigator.appVersion) >= 4) { mywin.window.focus(); }
  }


  function submitEmail(theForm) {
     var agency = "";
     var certification = "";
     var script = "cgi-bin/EMS_post_list.cgi?";
     if (document.theForm.other_agency) {
       if (document.theForm.other_agency.value != "") {
          agency = document.theForm.other_agency.value;
       } else {
          agency = document.theForm.agency.value;
       }
     } else {
       if (document.theForm.agency.value != "") {
          agency = document.theForm.agency.value;
       }
     }

     if (document.theForm.other_certification) {
       if (document.theForm.other_certification.value != "") {
          certification = document.theForm.other_certification.value;
       } else {
          certification = document.theForm.certification.value;
       }
     } else {
       if (document.theForm.certification.value != "") {
          certification = document.theForm.certification.value;
       }
     }
     var str = "name=" + document.theForm.name.value + "&email=" + document.theForm.email.value + "&password=" + document.theForm.password.value + "&agency=" + agency + "&certification=" + certification;
     var url = script + str;
     open_window(url,250,220,'',0,'','');
  }

  var other_agency = "";
  var other_agency2 = "";

  function choseOther1(theForm) {
     if (document.theForm.agency.value == "Other") {
        other_agency =  "<br>Other Agency (please enter below):<br><input type='text' name='other_agency' style='width:140px; height:20px; font-family:arial; font-size:12; color:#000000; background-color:#FFFFFF; border: inset 1px #4B7E21;'>";
        document.getElementById("other_ag").innerHTML = other_agency;
     } else {
        document.getElementById("other_ag").innerHTML = "";
     }
  }
  function choseOther2(theForm) {
     if (document.theForm.certification.value == "Other") {
        var other_agency2 =  "<br>Other Certification: (please enter below):<br><input type='text' name='other_certification' style='width:140px; height:20px; font-family:arial; font-size:12; color:#000000; background-color:#FFFFFF; border: inset 1px #4B7E21;'>";
        document.getElementById("other_cert").innerHTML = other_agency2;
     } else {
        document.getElementById("other_cert").innerHTML = "";
     }
  }

