function formatCurrency(num) {
num = num?num.toString().replace(/\$|\,/g, ""):"";
if (isNaN(num)) {
num = "0";
}
sign = (num == (num = Math.abs(num)));
num = Math.floor(num * 100 + 0.50000000001);
cents = num % 100;
num = Math.floor(num / 100).toString();
if (cents < 10) {
cents = "0" + cents;
}
for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) {
num = num.substring(0, num.length - (4 * i + 3)) + "," + num.substring(num.length - (4 * i + 3));
}
return (((sign) ? "" : "-") + num + "." + cents);
}
function setRadio(name,sRadioValue){
var oRadio = document.getElementsByName(name);
for(var i=0;i<oRadio.length;i++){
if(oRadio[i].value==sRadioValue){
oRadio[i].checked=true;
break;
}
}
}
function getRadioValue(name){
var radioes = document.getElementsByName(name);
for(var i=0;i<radioes.length;i++){
if(radioes[i].checked){
return radioes[i].value;
}
}
return false;
}
function setRadioUnCheck(name){
var oRadio = document.getElementsByName(name);
for(var i=0;i<oRadio.length;i++){
oRadio[i].checked=false;
}
}
String.prototype.Trim=function() {
var m = this.match(/^\s*(\S+(\s+\S+)*)\s*$/);
return (m == null) ? "" : m[1];
}