<!--

var limit, next;

function checkField(field, message) {
  if (field.value == "" && field.name == "ms_doc_attr_title") {
    alert(message);
    field.focus();
  }
}

function confirm_delete(ref)
{
  if (confirm("Please, confirm delete"))
    window.location.href=ref;
}

function confirm_action(message, ref) {
  if (confirm(unescape(message)))
    window.location.href=ref;
}

function openChooser(chooser,form,field) {
  window.open(chooser+'/form='+form+'/field='+field, 'chooser', 'resizable=yes, scrollbars=yes, toolbar=no, menubar=no, location=no, top=10px, left=10px, height=600px, width=850px');
}

function makeChoice(form,field,value) {
  var code = 'window.opener.document.'+form+'.'+field+'.value="'+value+'"';
  eval(code);
  window.close();
}

function submitForm(action) {
  if (action == null )
    return false;
  var workForm = document.forms[0];
  if (workForm == null)
    return false;
  workForm.action=action;
//  for(i = 0; i < workForm.elements.length; i++) {
//    var element = workForm.elements[i];
//    var el_type = elementType(element);
//    if (el_type != null && (el_type == 'textarea' || el_type == 'text')) {
//      element.value = escape(element.value);
//    }
//  }
  workForm.submit();
  return true;
}

function checkForm(action, field, message) {
  if (action == null )
    return false;
  var workForm = document.forms[0];
  if (workForm == null)
    return false;
  workForm.action=action;
  if (field.value == "") {
    alert(message);
    field.focus();
    return false;
  } else {
    workForm.submit();
//    for(i = 0; i < workForm.elements.length; i++) {
//      var element = workForm.elements[i];
//      var el_type = elementType(element);
//      if (el_type != null && el_type == 'textarea') {
//        element.value = escape(element.value);
//      }
//    }
    return true;
  }
}


function elementType(element) {
  if (null == element)
    return null;
  if (null != element.type)
    return element.type;
  else if (null != element.length)
    return (element[0]).type;
  else
    return null;
}

// -->
