      function item_select(id_no, type, cat)
      {                          
        var myform = document.getElementById("it" + id_no);

        if(type == 'N' || type == 'Z' || type == 'P' || type == 'Q' || type == 'H')
        {
          document.getElementById("it" + id_no).sell_by.value = type;
          if(type == 'Z')
          {
            document.getElementById("sel" + id_no + "n").style.backgroundColor = 'transparent';
            document.getElementById("sel" + id_no + "z").style.backgroundColor = '#636e63';
            myform.prod_id.value = 'ZZ' + id_no + myform.color.value;
            myform.fract.disabled = true;
            myform.lbl.value = 'pcs';
          }
          else if(type == 'N')
          {
            document.getElementById("sel" + id_no + "z").style.backgroundColor = 'transparent';
            document.getElementById("sel" + id_no + "n").style.backgroundColor = '#636e63';
            myform.prod_id.value = cat + id_no + myform.color.value;
            myform.fract.disabled = false;
            myform.lbl.value = 'lbs';
          }
          else if(type == 'P')
          {
            document.getElementById("sel" + id_no + "p").style.backgroundColor = '#636e63';
            document.getElementById("sel" + id_no + "q").style.backgroundColor = 'transparent';
            document.getElementById("sel" + id_no + "h").style.backgroundColor = 'transparent';
            myform.prod_id.value = cat + id_no + 'P';
            myform.lbl.value = 'pints';
          }
          else if(type == 'Q')
          {
            document.getElementById("sel" + id_no + "p").style.backgroundColor = 'transparent';
            document.getElementById("sel" + id_no + "q").style.backgroundColor = '#636e63';
            document.getElementById("sel" + id_no + "h").style.backgroundColor = 'transparent';
            myform.prod_id.value = cat + id_no + 'Q';
            myform.lbl.value = 'quarts';
          }
          else
          {
            document.getElementById("sel" + id_no + "p").style.backgroundColor = 'transparent';
            document.getElementById("sel" + id_no + "q").style.backgroundColor = 'transparent';
            document.getElementById("sel" + id_no + "h").style.backgroundColor = '#636e63';
            myform.prod_id.value = cat + id_no + 'H';
            myform.lbl.value = 'half-gals';
          }
          return;

        }

        myform.color.value = type;
        document.getElementById("i" + id_no).src = 'images/' + cat + id_no + myform.color.value + '.gif';
        if(type == 'M')
        {
          document.getElementById("sel" + id_no + "m").style.backgroundColor = '#636e63';
          document.getElementById("sel" + id_no + "d").style.backgroundColor = 'transparent';
          document.getElementById("sel" + id_no + "w").style.backgroundColor = 'transparent';
        }
        if(type == 'D')
        {
          document.getElementById("sel" + id_no + "d").style.backgroundColor = "#636e63";
          document.getElementById("sel" + id_no + "m").style.backgroundColor = 'transparent';
          document.getElementById("sel" + id_no + "w").style.backgroundColor = 'transparent';
        }
        if(type == 'W')
        {
          document.getElementById("sel" + id_no + "w").style.backgroundColor = '#636e63';
          document.getElementById("sel" + id_no + "d").style.backgroundColor = 'transparent';
          document.getElementById("sel" + id_no + "m").style.backgroundColor = 'transparent';
        }

        if(myform.sell_by.value == 'Z')
        {
          myform.prod_id.value = 'ZZ' + id_no + type;
        }
        else
        {
          myform.prod_id.value = cat + id_no + type;
        }
      }

function size_select(id_no, type, cat)
{                          
  var myform = document.getElementById("it" + id_no);

  if(type == 'S')
  {
    document.getElementById("sel" + id_no + "s").style.backgroundColor = '#636e63';
    document.getElementById("sel" + id_no + "m").style.backgroundColor = 'transparent';
    document.getElementById("sel" + id_no + "l").style.backgroundColor = 'transparent';
    document.getElementById("sel" + id_no + "x").style.backgroundColor = 'transparent';
  }
  if(type == 'M')
  {
    document.getElementById("sel" + id_no + "s").style.backgroundColor = 'transparent';
    document.getElementById("sel" + id_no + "m").style.backgroundColor = '#636e63';
    document.getElementById("sel" + id_no + "l").style.backgroundColor = 'transparent';
    document.getElementById("sel" + id_no + "x").style.backgroundColor = 'transparent';
  }
  if(type == 'L')
  {
    document.getElementById("sel" + id_no + "s").style.backgroundColor = 'transparent';
    document.getElementById("sel" + id_no + "m").style.backgroundColor = 'transparent';
    document.getElementById("sel" + id_no + "l").style.backgroundColor = '#636e63';
    document.getElementById("sel" + id_no + "x").style.backgroundColor = 'transparent';
  }
  if(type == 'X')
  {
    document.getElementById("sel" + id_no + "s").style.backgroundColor = 'transparent';
    document.getElementById("sel" + id_no + "m").style.backgroundColor = 'transparent';
    document.getElementById("sel" + id_no + "l").style.backgroundColor = 'transparent';
    document.getElementById("sel" + id_no + "x").style.backgroundColor = '#636e63';
  }

  myform.prod_id.value = cat + id_no + type;
}


function addtocart(id_no)
{
  var myform = document.getElementById('it'+ id_no);
  
  if(myform.fract.value == '') myform.fract.value = '0';

  if(myform.sell_by.value == 'N')
  {
    myform.quantity.value = parseFloat(myform.qty_whole.value) + parseFloat(myform.fract.value);

    return;
  }

  myform.quantity.value = parseFloat(myform.qty_whole.value);
}
