I have the following code on a page I am working on:

<script language="JavaScript">
function discounter(oForm)

{

if (isNaN(oForm.itemprice.value))

{

alert('Please enter a valid price.');

oForm.itemprice.focus();

oForm.itemprice.select();

return false;

}

else

{

oForm.total.value = oForm.itemprice.value / 100 * 10;

oForm.discountedprice.value = (oForm.itemprice.value - oForm.total.value);

}

}



function $format(num)

{

var $str = String(Math.round(num * 100) / 100);

var hasdot = ($str.indexOf('.') != -1);

$str = (hasdot) ? $str + '00' : $str + '.00';

return '' + $str.substring(0, $str.indexOf('.') + 3);

}



</script>

The page contains some PHP which is causing me problems with the bit from function $format onwards. Basically, the JS is failing (I think this is because the $ signs are being interpreted as PHP)

can anyone offer me any advice on how to get around this?

Thanks for any help you can provide