/* Function that pops a new window */
var winOpts = 'resizeable=no,scrollbars=no,menubar=no,toolbar=yes,width=525,height=450';
function popUp(pPage) {
	popUpWin = window.open(pPage,'popWin',winOpts);
	if(popUp.opener==null) popUp.opener=window;
}

/* Function that pops a new window */
function detailWin(pPage,x,xx,xxx) {
	var winOpts2 = 'resize=yes,status=yes,scrollbars=yes,menubar=no,toolbar=yes,width=400,height=450';
	popUpWin = window.open(pPage,'popWin',winOpts2);
	if(popUp.opener==null) popUp.opener=window;
}

/* Function that pops a new window */
function detailWin_urb(pPage,name,height,width) {
	var winOpts2 = 'resize=yes,status=yes,scrollbars=yes,menubar=no,toolbar=no,width='+width+',height='+height;
	popUpWin = window.open(pPage,name,winOpts2);
	if(popUp.opener==null) popUp.opener=window;
}

/* Function that displays status bar messages. */
function dm(msgStr) {
    window.status = msgStr;
    document.MM_returnValue = true;
}

/* Function that swaps images. */
function di20(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}

/* Functions that track and set toggle group button states. */
function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}
function validateDate(myField)  {
     dateStr = myField.value;
     a = dateStr.split("/");
     if (a.length != 3)
        {
 
        alert('Check that the date is in the proper format.');
        myField.focus();
        return false;
        }
        else
        {
           if (isNaN(a[0]) || a[0] > 12)
              {
              alert('Check that the date is in the proper format.');
              myField.focus();
              return false;
              }
            if (isNaN(a[1]) || a[1] > 31)
	      {
               alert('Check that the date is in the proper format.');
               myField.focus();
               return false;
              }
            if (isNaN(a[2]) || a[2] < 1900)
	      {
              alert('Check that the date is in the proper format.');
              myField.focus();
              return false;
              }
       }  // end if-else
    return true;
} 
function validateEmail(eMail)  {
		emailStr = eMail.value;
		a = emailStr.split("@");
		if (a.length !=2) {
			alert('Email invalid.');
			eMail.focus();
			return false;
		} else {
			b = a[1].split(".");
			if (b.length < 2) {
				alert ('Email invalid.');
				eMail.focus();
				return false;
			}
		}
		return true;
}
function validateNumber(myField) {
      numberStr == myField.value;
      if ((numberStr != "") && (isNaN(numberStr)))
       {
          alert('Quantity must be a number.');
      myField.focus();
       return false;
       }
      if (numberStr == 0)
       {
          alert('Quantity can not be zero.');
      myField.focus();
       return false;
       }
    return true;
}