function addToCart(sku) {
	var form = document.getElementById('form_' + sku);

	// Validate entered quantity
	var quantity = form.qty.value;
        var newquantity = quantity.replace(/^\s*|\s*$/,"");
        //alert ("Quantity ="+ quantity);

	if (isNaN(newquantity) || (newquantity == '') || (newquantity == 0) || (newquantity == null) ) 
        {
		alert("Please enter a number.");
		form.qty.focus();
		return;
	}
        // call AddVSItemToCart()
	MXfer.AddVSItemToCart(sku);
	//form.submit();
}

function ltrim(input) 
{
   //if it starts with spaces... remove them!
   return input.replace(/^\s+/gm,'')
}

function rtrim(input) 
{
   //if it ends with spaces... remove them!
   return input.replace(/\s+$/gm,'')
}

function trim(input) {
  //trim spaces from the front and the back of the string.
  //alert("The modified results= " + ltrim(rtrim(input)));
  return ltrim(rtrim(input));
  
}
