function checkChoice(field, i) {
  if (field[i].checked == true) {
    for (j = 0; j < field.length; j++) 
      if (i != j) { field[j].checked = false;
    }
  } else {
    field[i].checked = true;
  }
}

function confirmSend(that) {
  var prompt="You are about to send a COOP ALERT notification, are you sure you want to do this?";
  val=validate(that);
  if (val==false) return val;  
  return confirmDeleteSub(null,prompt);
}

function confirmDelete(that) {
  var prompt="Are you sure you want to delete this record?";
  return confirmDeleteSub(that,prompt);
}

function DoubleConfirmDelete(that) {
  if (confirmDelete(that)==false) return false;
  var promptx="Type the word CONFIRM to delete this person.";
  agree=(prompt(promptx,""));

  if (agree=='CONFIRM')
  {
    return true;
  } else {
    return false;
  } 
}

function confirmDeleteSub(that,prompt) {
  agree=confirm(prompt);
  if (that != null) that.form.onsubmit="";
  if (agree==true)
  {
    return true;
  } else {
    return false;
  } 
}

function check_proected(element,val){
  if (element.value == val) {
      element.checked = true;
  }
}

function one2two(m1,m2) {
    m1len = m1.length ;
    for ( i=0; i<m1len ; i++){
        if (m1.options[i].selected == true ) {
            m2len = m2.length;
            m2.options[m2len]= new Option(m1.options[i].text);
            m2.options[m2len].value = m1.options[i].value;
        }
    }

    for ( i = (m1len -1); i>=0; i--){
        if (m1.options[i].selected == true ) {
            m1.options[i] = null;
        }
    }
}

function one2twoAll(m1,m2) {
    m1len = m1.length ;
    for ( i=0; i<m1len ; i++){
            m2len = m2.length;
            m2.options[m2len]= new Option(m1.options[i].text);
            m2.options[m2len].value = m1.options[i].value;
     }

    for ( i = (m1len -1); i>=0; i--){
            m1.options[i] = null;
        }
}

function two2one(m1,m2) {
    m2len = m2.length ;
        for ( i=0; i<m2len ; i++){
            if (m2.options[i].selected == true ) {
                m1len = m1.length;
                m1.options[m1len] = new Option(m2.options[i].text);
                m1.options[m1len].value = m2.options[i].value;				
            }
        }
        for ( i=(m2len-1); i>=0; i--) {
            if (m2.options[i].selected == true ) {
                m2.options[i] = null;
            }
        }
}

function finish(m1) {
for (i=0; i<m1.length; i++) { 
  m1.options[i].selected = true;
  }
}

function two2oneAll(m1,m2) {
    m2len = m2.length;
        for ( i=0; i<m2len ; i++){
                m1len = m1.length;
                m1.options[m1len]= new Option(m2.options[i].text);
                m1.options[m1len].value= m2.options[i].value;				
        }
        for ( i=(m2len-1); i>=0; i--) {
                m2.options[i] = null;
        }
}
