<!--
function seeashow() {
	var slideshow = window.open("","slideshow","height=605,width=660,left=10,top=10,scrollbars=no,resizable=yes,statusbar=no,menubar=yes,toolbar=no,location=no,status=no");
}

function roundTo2(num) {
	var result = Math.round(num*Math.pow(10,2))/Math.pow(10,2);
	return result;
}

function stripChars(str)
{
  str += '';
  var rgx = /^\d|\.|-$/;
  var out = '';
  for( var i = 0; i < str.length; i++ )
  {
    if( rgx.test( str.charAt(i) ) ){
      if( !( ( str.charAt(i) == '.' && out.indexOf( '.' ) != -1 ) ||
             ( str.charAt(i) == '-' && out.length != 0 ) ) ){
        out += str.charAt(i);
      }
    }
  }
  return out;
}

function addCommas(str)
{
  str += '';
  x = str.split('.');
  x1 = x[0];
  x2 = x.length > 1 ? '.' + x[1] : '';
  var rgx = /(\d+)(\d{3})/;
  while (rgx.test(x1)) {
    x1 = x1.replace(rgx, '$1' + ',' + '$2');
  }
  return x1 + x2;
}

function solveMystery() {
	var price = parseInt(stripChars(document.mystery.price.value));
	var owed = parseInt(stripChars(document.mystery.owed.value));
	var commission = parseFloat(stripChars(document.mystery.commission.value));

	var equity = price - owed;
	var commissionbucks = price * (commission / 100);
	var commissionpercent = (commissionbucks / equity) * 100;

	document.mystery.price.value = addCommas(price);
	document.mystery.owed.value = addCommas(owed);
	document.mystery.commission.value = roundTo2(commission) + "%";
	document.mystery.equity.value = addCommas(equity);
	document.mystery.commissionbucks.value = addCommas(Math.round(commissionbucks));
	document.mystery.commissionpercent.value = roundTo2(commissionpercent) + "%";
}
-->