function trimString (str) {
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function calculate() {
var price = 79;
var bandwidth_cost = 100;
var backup = 20;
var number=document.coloform.number.options[document.coloform.number.selectedIndex].value;
var bandwidth=document.coloform.bandwidth.options[document.coloform.bandwidth.selectedIndex].value;
var period=document.coloform.period.options[document.coloform.period.selectedIndex].value;
var additionalinfo=document.coloform.additionalinfo.value;

additionalinfo = trimString(additionalinfo);
if (additionalinfo=="WHT Special"){
price = 69;
}

bandwidth_cost = (bandwidth_cost*bandwidth);
price = ((price*number)+bandwidth_cost);

if (document.coloform.backup[1].checked){
	price += backup;
}
if (document.coloform.backup[2].checked){
	price += 2*backup;
}
if (document.coloform.backup[3].checked){
	price += 3*backup;
}
if (document.coloform.backup[4].checked){
	price += 4*backup;
}
if (document.coloform.backup[5].checked){
	price += 5*backup;
}
if (document.coloform.backup[6].checked){
	price += 6*backup;
}

  if (period == "Annually"){
	price = ((price * 12)*0.85);
  } 
price = Math.round(price);
document.coloform.price.value = price;
}
