function isNumberGreaterThan(elem,num,errmsg) {
  var str = elem.value;
  var re = /^\d*$/;
  str = str.toString();
  if (!str.match(re)) {
    alert("Enter only numbers into the field.");
    // setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);
    return false;
  }
  if (str<num) {
    elem.value = num;
    alert(errmsg+num);
  }
  return true;
}

function add_product(qt) {
  document.forms['add_to_cart'].quantity.value=qt;
  document.forms['add_to_cart'].submit();
  return true;
}

function display_price_for_quantity(quantity) {
  var target_frame = getElement("pricedisplay");
  // alert(quantity);
  target_frame.innerHTML="Loading price ...";

  var re = /^\d*$/;
  str = quantity.toString();
  if (!str.match(re)) {
    target_frame.innerHTML='<div style="color: red;">Invalid quantity</div>';
    return false;
  }


  xml_http_call_url('price_for_quantity/'+quantity+'/','',
    function(content) {
      target_frame.innerHTML = content;
    },
    function(status) {
      target_frame.innerHTML="<br>Price Request Failed.";
    }
  );

}



