function verifyFileName(inputName,type1,type2,type3,type4)
{
   var strExt;
   var fldFile = inputName.value;
   var flgSubmit = false;
   var extArray = new Array(type1,type2,type3,type4);
   var extArrayEXT = new Array;
   if (fldFile.length) {
      strExt = fldFile.substring(fldFile.lastIndexOf('.') + 1,fldFile.length);
      for (var i = 0; i < extArray.length; i++) {
         if ( extArray[i].charAt(0) != "!" ) {
            if (extArray[i].toLowerCase() == strExt.toLowerCase()) {
               flgSubmit = true;
            }
            if (extArray[i] !='') {
				   extArrayEXT[i] = " "+extArray[i].toLowerCase();
            }
         } else {
            var excludedType = extArray[i].substring(extArray[i].lastIndexOf("!")+1);
            if ( excludedType.toLowerCase() != strExt.toLowerCase() ) {
               flgSubmit = true;
            } else {
               flgSubmit = false;
               alert("File type of extension " + excludedType.toUpperCase() + " is not allowed.");
               inputName.value='';
               return;
            }
         }
      }
      if (flgSubmit == false) {
         alert("File type of extension " + strExt.toUpperCase() + " is not supported.  Please select a supported file type. \r\rSupported file extension(s):" + extArrayEXT );
         inputName.value = "";
         if (inputName.value != "") {
				inputName.reset();
			}
         return false;
      }
      return true;
    }
    return true;
}

function popupWindow(url, target, X, Y) {
   var width, height, scr_height, winy;
   width = X;
   height = Y;
   if (width == "") {
      width = 430;
   }
   if (height == "") {
      height = 200;
   }
   scr_height = Math.round((window.screen.availHeight - height) / 2);
   scr_width = Math.round((window.screen.width - width) / 2);
   var openCommand = "window.open(\"" + url + "\", \"" + target + "\",\"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,screenX=" + scr_width + ",screenY=" + scr_height + ",top=" + scr_height + ",left=" + scr_width + ",width=" + width + ",height=" + height + "\");";
   popup2 = eval(openCommand);
   popup2.focus();
   if (!popup2.opener) {
      popup2.opener = this.window;
   }
}

