/*Currency Converter (c) Mick White, http://mickweb.com/javascript/javascript2.html*/
function to_currency(val){
currency="";
  if(isNaN(val)){
  	alert(val+" is an invalid input");
	return;
  }
  val=""+Math.round(val);
  while (val.length <= 0) {
  	val="0"+val
  }
  
  var first_part=val.substring(0);
  var second_part=val.substring(val.length);
  var result=first_part+""+second_part;
  result=currency+result;
  return result;
}


/*Calculate Form Totals
  (c) 2003 Creed Communications :: All Rights Reserved
  http://www.creedcomm.com/ :: info@creedcomm.com
  May NOT be used without express written permission
*/
function showPrice(){
	var total = 0;
	var countBeg = 0;		// number of form elements in front of the checkboxes
	var countEnd = 1;		// number of form elements following the checkboxes
// Cycle thru checkboxes, ignoring other form elements	
	for (i=countBeg; i<(document.forms[0].length - countEnd); i++){
		if (document.forms[0].elements[i].checked){
		total = total + parseFloat(document.forms[0].elements[i].value);
		//var Total = to_currency(total);
		//var Commision = to_currency(total*.15);
		}
	}
// Convert to currency format and insert into price elements
	var Total = to_currency(total);
	var Commision = to_currency(total*.15);
	document.forms[0].price.value = Total;
	document.forms[0].commision.value = Commision;
}

