    var d = document.all;
    var charlimit = 5000;
//-----------------------------------------------------------------------
    function fnCancel(url) {
      if(url!='') {
        window.location.href=url;
      } else {
        history.back();
      }
    } // fnCancel
//-----------------------------------------------------------------------
    function fnConfirmClearLoginHistory() {
      return confirm('Are you sure you want to clear the complete login history for this client?');
    } // fnConfirmClearLoginHistory
//-----------------------------------------------------------------------
    function fnConfirmDeactivate(o) {
        var obj = d[o];
        return confirm('Are you sure you want to deactivate \''+obj.options[obj.selectedIndex].text+'\'?')
    } // fnConfirmDeactivate
//-----------------------------------------------------------------------
    function fnConfirmFileDel() {
      return confirm('Are you sure you want to delete this file?');
    }  // fnConfirmFileDel
//-----------------------------------------------------------------------
    function fnFileDetails() {
      var features = 'toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=640,height=480,top=100,left=150';
      window.open('admin_files_details.asp','FileDetails',features);
    } // fnFileDetails
//-----------------------------------------------------------------------
    function fnOpenHorses(type) {
      d.idFormClients.action = 'admin_horses.asp?Action='+type+'s';
      d.idFormClients.submit();
    } // fnOpenHorses
//-----------------------------------------------------------------------
    function openPop(a,i) {
       var iMyWidth; var iMyHeight;
       if (a == 0) {
          iMyWidth = (window.screen.width/2) - (320 + 10); var iMyHeight = (window.screen.height/2) - (220 + 50);
          var iPop = window.open("media/horses/640wide/" + i, "iPop", "toolbars=1,location=0,directories=0,status=0,scrollbars=1,menubar=1,resizable=1,width=670,height=510,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + "");
       }
       else {
          iMyWidth = (window.screen.width/2) - (450 + 10); var iMyHeight = (window.screen.height/2) - (350 + 50);
          var iPop = window.open("media/horses/960wide/" + i, "iPop", "toolbars=1,location=0,directories=0,status=0,scrollbars=1,menubar=1,resizable=1,width=870,height=705,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + "");
       }
       iPop.focus();
    } // openPop
//-----------------------------------------------------------------------
    function fnToggleControls(obj,controlist) {
      var arrControls = controlist.split(',');
      if(d[obj].value!='') {
        for(var i=0;i<arrControls.length;i++) {
          d[arrControls[i]].disabled=false;
        }
      } else {
        for(var i=0;i<arrControls.length;i++) {
          d[arrControls[i]].disabled=true;
        }
      }
    } // fnToggleControls
      // from calling page
      // fnToggleControls('controlToWatch','commaDelimited,ControlsToToggle')
//-----------------------------------------------------------------------
    function fnUpdateChars(o) {
      if(o.value.length > charlimit) {
        o.value = o.value.substring(0,charlimit);
      } else {
        d.idChars.innerHTML = Number(charlimit - o.value.length);
      }
    } // fnUpdateChars
//-----------------------------------------------------------------------
    function fnValidateClientLogin() {
      // username
      if(d.idUsername.value=='') {
        alert('Please enter a username.');
        d.idUsername.focus();
        return false;
      }
      // password
      if(d.idPassword1.value=='') {
        alert('Please enter a password.');
        d.idPassword1.focus();
        return false;
      }
      // password mismatch
//      if(d.idPassword1.value!=d.idPassword2.value) {
//        alert('Passwords do not match!');
//        d.idPassword1.value='';
//        d.idPassword2.value=''
//        d.idPassword1.focus();
//        return false;
//      }
    } // fnValidateClientLogin
//-----------------------------------------------------------------------
    function fnValidateFiles() {
      if(document.formUpload.file1.value==''&&document.formUpload.file2.value==''&&document.formUpload.file3.value=='') {
        alert('Please use the \'Browse...\' button to locate a file on your computer.');
        return false;
      } else {
        document.formUpload.folder.value = document.formFolder1.folder1.value;
        return true;
      }
    } // fnValidateFiles
//-----------------------------------------------------------------------
    function fnValidateLogIn() {
      // username
      if(d.idUsername.value=='') {
        alert('Please enter your username.');
        d.idUsername.focus();
        return false;
      }
      // password
      if(d.idPassword.value=='') {
        alert('Please enter your password.');
        d.idPassword.focus();
        return false;
      }
    } // fnValidateLogIn
//-----------------------------------------------------------------------

