/**
 * fw_menu 24OCT2000 Version 4.0
 * John Ahlquist, October 2000
 * Copyright (c) 2000 Macromedia, Inc.
 *
 * based on menu.js
 * by gary smith, July 1997
 * Copyright (c) 1997-1999 Netscape Communications Corp.
 *
 * Netscape grants you a royalty free license to use or modify this
 * software provided that this copyright notice appears on all copies.
 * This software is provided "AS IS," without a warranty of any kind.
 */
 
function openWin(url, name) {
  popupWin = window.open(url, name, "resizable,width=500,height=350,left=0,top=0");
  windowIsOpen = "true";
  popupWin.focus()
}

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];}
}

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() { //v3.0
 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_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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 modifyDate() {
var months = new Array();
months[1] = "January";
months[2] = "February";
months[3] = "March";
months[4] = "April";
months[5] = "May";
months[6] = "June";
months[7] = "July";
months[8] = "August";
months[9] = "September";
months[10] = "October";
months[11] = "November";
months[12] = "December";

dateObj = new Date(document.lastModified);
lmonth = months[dateObj.getMonth() + 1];
date = dateObj.getDate();
year = dateObj.getYear();
if (year < 1000) year += 1900;

pagemod = document.write ("&nbsp;&nbsp;Last updated:" + " " + lmonth + " " + date + ", " + year);

return pagemod;
}

function checkEmail(myForm) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(feedback.email.value)) 
		{
		return (true)
		}
	alert("Invalid e-mail address! Please re-enter.")
	return (false)
	}

function protectAddress( name, account, domain )	{
	var tag1 = "mai"
	var tag2 = "lto:" 
	document.write("<a h" + "ref=" + tag1 + tag2 + account + "@" + domain + ">"+name +"</a>");
	}

function DoIt() {
   with (document.forms[0]) {
      if (QueryType.value == "BROWSE") {
         return true
      }

      if (spn_code.value != "" &&
          spn_code.value != null &&
          spn_code.value.length != 4) {
         alert("Invalid Sponsor Code")
         spn_code.focus()
         return false
      }

      if (spn_code.value != "" && spn_code.value != null) {
         QueryType.value = "CODE"
         return true
      }

    if ((spn_code.value == "" || spn_code.value == null) && 
          (spn_name.value == "" || spn_name.value == null) &&
          (update_date.value == "" || update_date.value == null) &&
          category.options[category.selectedIndex].value == "all" &&
          foreign.options[foreign.selectedIndex].value == "include") {
         alert("Please enter at least one search criteria")
         return false
      }

     // if (spn_name.value != "" && spn_name.value != null) {
     //    if (spn_name.value.indexOf("*") == -1) {
     //       spn_name.value = "*" + spn_name.value + "*"
     //    }
     // }

      QueryType.value = "QUERY"
   }

	return true
}

function BrowseRecord(n) {
   document.forms[0].QueryType.value = "BROWSE"
   if (n == "MISC" || n == "VOID") {
      document.forms[0].Browse.value = "-" + n
   } else {
      document.forms[0].Browse.value = n
   }
   document.forms[0].submit()
}

function CheckDate() {
   with (document.forms[0]) {
     if (update_date.value == "" || update_date.value == null) {
         return true
      }

	if (update_date.value.indexOf("/") == -1) {
         alert("You must include the separator (/)")
         update_date.focus()
         return false
      }
   }
}
