function del_confirm(itm, qs, tbl) {//v1
  if (confirm("Are you sure you want to delete " + itm + " from " + tbl)) window.location.href = window.location.pathname+"?"+qs;
}

function textareaLimiter(field, maxlimit) {
  if (field.value.length > maxlimit) field.value = field.value.substring(0, maxlimit);
}

//find the checked radio button and return the checked value.
function getSelectedRadio(radiogroup) {
  if (radiogroup.length) {
    for (i=0; i<radiogroup.length; i++) {
      if (radiogroup[i].checked) return radiogroup[i].value;
    }
  } else if (radiogroup.value) {
      return radiogroup.value;
  }
  return 0;
}

function getStrArrayVal(str, i) {
  var arr = str.split('~');
  return arr[i];
}

function setContainerHeight(offset, container) {
  if (window.innerHeight) document.getElementById(container).style.height = (window.innerHeight - offset) + 'px';
  else if (document.documentElement.clientHeight) document.getElementById(container).style.height = (document.documentElement.clientHeight - offset) + 'px';
}

//Escapes apostrophes.
function fixQuotes(strText) {
  strText = strText.replace("'", "\\'")
  return(strText);
}
