function showAllData()
{
  document.getElementById('differfields').style.display = 'inline';
  document.getElementById('allfields').style.display = 'none';

  var rows = document.getElementById('items').rows;
  for (var j=0; j < rows.length; j++)
  {
    if (rows[j].className == 'same-hidden')
      rows[j].className = 'same'
  }  
}

function showDifferentData()
{
  document.getElementById('differfields').style.display = 'none';
  document.getElementById('allfields').style.display = 'inline';
  
  var rows = document.getElementById('items').rows;
  for (var j=0; j < rows.length; j++)
  {
    if (rows[j].className == 'same')
      rows[j].className = 'same-hidden'
  }
  
}

function doCompare()
{
  var form = document.getElementById('ccard_compare');
  //calculate number of selected checkboxes
  var num =0;
  var el=null;
  
  for (var j=0; j < form.elements.length; j++)
  {
    el = form.elements[j];
    if (el.type == 'checkbox' && el.checked)
      num++;
  }
  
  if (num < 2)
  {
    alert('Please select at least 2 cards to compare. 5 Max');
    return;
  }
  
  if (num > 5)
  {
    alert('Please select no more than 5 cards to compare.');
    return;
  }
  
  form.submit();
}

function trOnMouseOver(tr)
{
  tr.style.backgroundColor = '#99CCFF';
}

function trOnMouseOut(tr)
{
  if (tr.className == 'difference')
    tr.style.backgroundColor = 'beige';
  else
    tr.style.backgroundColor = 'white';
  
}