function round(num) {
amount = Math.round(num*Math.pow(10,2))/Math.pow(10,2);
amount -= 0;
// .99 cent format courtsey of Martin Webb
return (amount == Math.floor(amount)) ? amount + '.00' : ( (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}

function stocks(form) {
shares = form.shares.value * 1;

buyprice = form.buyprice.value * 1;
mycomm = 25;

bought = round(parseFloat(shares * buyprice + mycomm)); // price for purchase

form.buycost.value  = "$ " + bought;
}