<!--

function error_message(error) {
  error_win = Window.open("","Error","height=200,width=300,resize=no");
  error_win.document.write(error);
  error_win.document.close;
}

// rounds number to X decimal places
function variable_round(number,x) {
  return Math.round(number*Math.pow(10,x))/Math.pow(10,x);
}
 
// convert a numeric value to dollars and cents
function format_to_dollars(dollar_amount) {
  // force code to treat this as a number
  dollar_amount = dollar_amount - 0;
  // now round it to specified precision
  dollar_amount = (dollar_amount == Math.floor(dollar_amount)) ? dollar_amount + '.00' : (  (dollar_amount*10 == Math.floor(dollar_amount*10)) ? dollar_amount + '0' : dollar_amount);
  return dollar_amount;
}

function object_is_ok(string_to_validate,min_length,max_length,validation_string,error_string) {

  for (var i = 0; i < string_to_validate.length; i++) {
    if (validation_string.indexOf(string_to_validate.charAt(i)) < 0) {
      alert(error_string + ' has invalid characters');
      return false;
    }
  }

  // zero for min and max means ignore length
  if (string_to_validate.length < min_length) {
    alert(error_string+' is too short');
    return false;
  }

  if (string_to_validate.length > max_length) {
    alert(error_string + ' has too many characters');
    return false;
  }

  return true;
}

function validate_cart (thisForm){
  var errors="";
  if (thisForm.extended_price.value == "0.00") {
    errors += "You did not order anything.\n";
  }
  if (errors == "") {
    return true;
  } else {
    alert('The following error(s) occurred:\n'+errors);
	return false;
  }
}


//-->