function addBulk(thisobj, bulkgroup, beantype) {

	var baseprice = 0;
	var myqty = 0;

	var myform = document.getElementById(thisobj.name);

	if (IsNumeric(myform.qtyBulk.value))
	{
		myqty = myform.qtyBulk.value;
	}
	else
	{
		myqty = 0;
	}

	if (bulkgroup ==  1)  // 2-5 quantity
	{
		if (beantype==9 && (myqty == 0 || myqty > 5 || myqty < 3)) // min 3 qty for ground
		{
			alert('Please select a valid number of pounds (lbs.) to add to your cart. [3-5]');
			return false;
		}
		else if (myqty == 0 || myqty > 5 || myqty < 2)
		{
			alert('Please select a valid number of pounds (lbs.) to add to your cart. [2-5]');
			return false;
		}
		else
		{
			if (beantype==1) // uganda gold
			{
				baseprice = 58.99;
				myform.item_name.value = 'Uganda Gold Vanilla Beans (' + myqty + ' lbs.)';
			}
			else if (beantype==2) // mad SL
			{
				baseprice = 57.99;
				myform.item_name.value = 'Madagascar Vanilla Beans - SL (' + myqty + ' lbs.)';
			}
			else if (beantype==3) // mad L
			{
				baseprice = 53.99;
				myform.item_name.value = 'Madagascar Vanilla Beans - L (' + myqty + ' lbs.)';
			}
			else if (beantype==4) // mad R
			{
				baseprice = 50.99;
				myform.item_name.value = 'Madagascar Vanilla Beans - R (' + myqty + ' lbs.)';
			}
			else if (beantype==5) // Indo
			{
				baseprice = 48.99;
				myform.item_name.value = 'Indonesia Vanilla Beans (' + myqty + ' lbs.)';
			}
			else if (beantype==6) // PNG
			{
				baseprice = 53.99;
				myform.item_name.value = 'PNG Vanilla Beans (' + myqty + ' lbs.)';
			}
			else if (beantype==7) // tahitian
			{
				baseprice = 53.99;
				myform.item_name.value = 'Tahitian Vanilla Beans - SL (' + myqty + ' lbs.)';
			}
			else if (beantype==8) // tahitian
			{
				baseprice = 41.49;
				myform.item_name.value = 'Tahitian Vanilla Beans - L (' + myqty + ' lbs.)';
			}
			else if (beantype==9) // post-extracted ground
			{
				baseprice = 9.00;
				myform.item_name.value = 'Post Extract Ground Vanilla Beans (' + myqty + ' lbs.)';
			}
			else if (beantype==10) // pure ground
			{
				baseprice = 54.49;
				myform.item_name.value = 'Pure Ground Vanilla Beans (' + myqty + ' lbs.)';
			}
			else if (beantype==11) // organic gourmet
			{
				baseprice = 61.99;
				myform.item_name.value = 'Organic Gourmet Vanilla Beans - UGANDA GOLD - L (' + myqty + ' lbs.)';
			}
			else if (beantype==12) // organic grd 1
			{
				baseprice = 49.49;
				myform.item_name.value = 'Organic Extraction Vanilla Beans - U (' + myqty + ' lbs.)';
			}
			else if (beantype==13) // india
			{
				baseprice = 35.95;
				myform.item_name.value = 'India Vanilla Beans - SL (' + myqty + ' lbs.)';
			}
			else if (beantype==14) // india
			{
				baseprice = 34.50;
				myform.item_name.value = 'India Vanilla Beans - L (' + myqty + ' lbs.)';
			}
			else
			{
				return false;
			}

			myform.amount.value = (myqty * baseprice).toFixed(2);
			//alert('item to add: '+ myform.item_name.value);
			return true;
		}
	}
	else
	{
		if (myqty == 0 || myqty > 9 || myqty < 6)
		{
			alert('Please select a valid number of pounds (lbs.) to add to your cart. [6-9]');
			return false;
		}
		else
		{
			if (beantype==1) // uganda gold
			{
				baseprice = 55.49;
				myform.item_name.value = 'Uganda Gold Vanilla Beans (' + myqty + ' lbs.)';
			}
			else if (beantype==2) // mad SL
			{
				baseprice = 54.49;
				myform.item_name.value = 'Madagascar Vanilla Beans - SL (' + myqty + ' lbs.)';
			}
			else if (beantype==3) // mad L
			{
				baseprice = 50.99;
				myform.item_name.value = 'Madagascar Vanilla Beans - L (' + myqty + ' lbs.)';
			}
			else if (beantype==4) // mad R
			{
				baseprice = 47.99;
				myform.item_name.value = 'Madagascar Vanilla Beans - R (' + myqty + ' lbs.)';
			}
			else if (beantype==5) // Indo
			{
				baseprice = 46.49;
				myform.item_name.value = 'Indonesia Vanilla Beans (' + myqty + ' lbs.)';
			}
			else if (beantype==6) // PNG
			{
				baseprice = 50.99;
				myform.item_name.value = 'PNG Vanilla Beans (' + myqty + ' lbs.)';
			}
			else if (beantype==7) // tahitian
			{
				baseprice = 50.99;
				myform.item_name.value = 'Tahitian Vanilla Beans - SL (' + myqty + ' lbs.)';
			}
			else if (beantype==8) // tahitian
			{
				baseprice = 38.99;
				myform.item_name.value = 'Tahitian Vanilla Beans - L (' + myqty + ' lbs.)';
			}
			else if (beantype==9) // post-extracted ground
			{
				baseprice = 8.00;
				myform.item_name.value = 'Post Extract Ground Vanilla Beans (' + myqty + ' lbs.)';
			}
			else if (beantype==10) // pure ground
			{
				baseprice = 51.75;
				myform.item_name.value = 'Pure Ground Vanilla Beans (' + myqty + ' lbs.)';
			}
			else if (beantype==11) // organic gourmet
			{
				baseprice = 58.25;
				myform.item_name.value = 'Organic Gourmet Vanilla Beans - UGANDA GOLD - L (' + myqty + ' lbs.)';
			}
			else if (beantype==12) // organic grd 1
			{
				baseprice = 46.75;
				myform.item_name.value = 'Organic Extraction Vanilla Beans - U (' + myqty + ' lbs.)';
			}
			else if (beantype==13) // india SL
			{
				baseprice = 31.95;
				myform.item_name.value = 'India Vanilla Beans - SL (' + myqty + ' lbs.)';
			}
			else if (beantype==14) // india L
			{
				baseprice = 30.95;
				myform.item_name.value = 'India Vanilla Beans - L (' + myqty + ' lbs.)';
			}
			else
			{
				return false;
			}

			myform.amount.value = (myqty * baseprice).toFixed(2);
			//alert('item to add: '+ myform.item_name.value);
			return true;
		}
	}

}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;


   for (i = 0; i < sText.length && IsNumber == true; i++)
      {
      Char = sText.charAt(i);
      if (ValidChars.indexOf(Char) == -1)
         {
         IsNumber = false;
         }
      }
   return IsNumber;

}

function isChecked(object) {
    if (object.checked) return true;
    else return false;
}
