//
// Version 1.0--27-Jan-2000--JackL/KoenC
// Version 1.1--01-Jul-2000--JackL
//

//
// Default matrix is BLOSUM62.
//

def_matrix = 0;

//
// Fill the matrix array (structure).
//

function Matrix (matrix, gaps, pref) {
  this.matrix = matrix;
  this.gaps = gaps;
  this.pref = pref;
}


matrix = new Array()

gaps = new Array("10 / 1", "11 / 1", "12 / 1", "7 / 2", "8 / 2")
matrix[0] = new Matrix("BLOSUM62", gaps, 1)

gaps = new Array("7 / 2", "6 / 2", "11 / 1", "10 / 1", "9 / 1")
matrix[1] = new Matrix("BLOSUM80", gaps, 4)

gaps = new Array("12 / 3", "11 / 3", "10 / 3", "15 / 2", "14 / 2",
  "13 / 2", "12 / 2", "19 / 1", "18 / 1", "17 / 1", "16 / 1")
matrix[2] = new Matrix("BLOSUM45", gaps, 5)

gaps = new Array("6 / 2", "5 / 2", "10 / 1", "9 / 1", "8 / 1")
matrix[3] = new Matrix("PAM30", gaps, 4)

gaps = new Array("7 / 2", "6 / 2", "11 / 1", "10 / 1", "9 / 1")
matrix[4] = new Matrix("PAM70", gaps, 4)

//
// Generate a list of selectable PAM/BLOSUM matrices.
//

function make_matrix_list () {
  for ( i = 0; i <= 4; i++ )
    document.blast.matrix.options[i] = new Option(matrix[i].matrix)

  document.blast.matrix.options[def_matrix].selected = true
}

//
// Generate the list of gap-pairs for the current scoring matrix;
// set the focus on the default (preferred) value pair.
//

function show_gap_list (id) {
  for ( i = 0; i < 12; i++ )
    document.blast.gaps.options[i] = null

  for ( i = 0; i < 12; i++ ) {
    if ( matrix[id].gaps[i] != null )
      document.blast.gaps.options[i] = new Option(matrix[id].gaps[i])
    else
      document.blast.gaps.options[i] = null
  }
  document.blast.gaps.options[matrix[id].pref].selected = true
}

//
// Generate the lists; set focus on default values.
//

function set_defaults () {
  make_matrix_list ()
  show_gap_list (def_matrix)
}

