I have been putting together a calculator script and I am desperately trying to change it in a couple of places with not success.

If you fill in the form fields now the the result from the three fields looks something like this (for example):

50,000,000
8.000
1,500.00

I want it to look like this:

50 000,000
8,000
1 500,00

Basically changed some of the fullstops to commas and commas to spaces.

I just cant get my head around it.
Any help please:-)



The script is:

<!-- calculator start -->

<script language="javascript" type="text/javascript"><!--
var co = new Object;
function recalc_onclick(ctl) {
if (true) {


co.pA5B=eeparseFloatTh(document.formc.pA5B.value);co.pA6B=eeparseFloat(document.formc.pA6B.value);ca lc(co);document.formc.pA11B.value=eedisplayFloatNDTh(co.pA11B,2);document.formc.pA17B.value=eedispla yFloatNDTh(co.pA17B,2);document.formc.pA17C.value=eedisplayFloatNDTh(co.pA17C,2);document.formc.pA17 D.value=eedisplayboolean(co.pA17D);document.formc.pA17E.value=eedisplayboolean(co.pA17E);document.fo rmc.pA17F.value=eedisplayFloatNDTh(co.pA17F,2);document.formc.pA17G.value=eedisplayFloatNDTh(co.pA17 G,2);document.formc.pA17H.value=eedisplayFloatNDTh(co.pA17H,2);document.formc.pA18B.value=eedisplayF loatNDTh(co.pA18B,2);document.formc.pA18C.value=eedisplayFloatNDTh(co.pA18C,2);document.formc.pA18D. value=eedisplayboolean(co.pA18D);document.formc.pA18E.value=eedisplayboolean(co.pA18E);document.form c.pA18F.value=eedisplayFloatNDTh(co.pA18F,2);document.formc.pA18G.value=eedisplayFloatNDTh(co.pA18G, 2);document.formc.pA18H.value=eedisplayFloatNDTh(co.pA18H,2);document.formc.pA19B.value=eedisplayFlo atNDTh(co.pA19B,2);document.formc.pA19C.value=eedisplayFloatNDTh(co.pA19C,2);document.formc.pA19D.va lue=eedisplayboolean(co.pA19D);document.formc.pA19E.value=eedisplayboolean(co.pA19E);document.formc. pA19F.value=eedisplayFloatNDTh(co.pA19F,2);document.formc.pA19G.value=eedisplayFloatNDTh(co.pA19G,2) ;document.formc.pA19H.value=eedisplayFloatNDTh(co.pA19H,2);document.formc.pA20B.value=eedisplayFloat NDTh(co.pA20B,2);document.formc.pA20C.value=eedisplayFloatNDTh(co.pA20C,2);document.formc.pA20D.valu e=eedisplayboolean(co.pA20D);
document.formc.pA20E.value=eedisplayboolean(co.pA20E);document.formc.pA20F.value=eedisplayFloatNDTh( co.pA20F,2);document.formc.pA20G.value=eedisplayFloatNDTh(co.pA20G,2);document.formc.pA20H.value=eed isplayFloatNDTh(co.pA20H,2);document.formc.pA21B.value=eedisplayFloatNDTh(co.pA21B,2);document.formc .pA21D.value=eedisplayboolean(co.pA21D);document.formc.pA21E.value=eedisplayboolean(co.pA21E);docume nt.formc.pA21F.value=eedisplayFloatNDTh(co.pA21F,2);document.formc.pA21G.value=eedisplayFloatNDTh(co .pA21G,2);document.formc.pA21H.value=eedisplayFloatNDTh(co.pA21H,2);
};};


var eeisus=1;var eetrue="TRUE";var eefalse="FALSE";var eedec=".";var eeth=",";var eedecreg=new RegExp("\\.","g");var eethreg=new RegExp(",","g");var eecurrencyreg=new RegExp("[$]","g");var eepercentreg=new RegExp("%","g");

var arr1xF17G17=new Array(1);for(var ii=0;ii<1;ii++){arr1xF17G17[ii]=new Array(2);for(var jj=0;jj<2;jj++){arr1xF17G17[ii][jj]=0}};var arr1xH17H21=new Array(5);for(var ii=0;ii<5;ii++){arr1xH17H21[ii]=new Array(1);for(var jj=0;jj<1;jj++){arr1xH17H21[ii][jj]=0}};var arr1xF18G18=new Array(1);for(var ii=0;ii<1;ii++){arr1xF18G18[ii]=new Array(2);for(var jj=0;jj<2;jj++){arr1xF18G18[ii][jj]=0}};var arr1xF19G19=new Array(1);for(var ii=0;ii<1;ii++){arr1xF19G19[ii]=new Array(2);for(var jj=0;jj<2;jj++){arr1xF19G19[ii][jj]=0}};var arr1xF20G20=new Array(1);for(var ii=0;ii<1;ii++){arr1xF20G20[ii]=new Array(2);for(var jj=0;jj<2;jj++){arr1xF20G20[ii][jj]=0}};var arr1xF21G21=new Array(1);for(var ii=0;ii<1;ii++){arr1xF21G21[ii]=new Array(2);for(var jj=0;jj<2;jj++){arr1xF21G21[ii][jj]=0}};var eecm2=new Array();var eecm6=new Array(new Array(arr1xF17G17,0,0,0,1));var eecm5=new Array(new Array(arr1xF18G18,0,0,0,1));var eecm4=new Array(new Array(arr1xF19G19,0,0,0,1));var eecm3=new Array(new Array(arr1xF20G20,0,0,0,1));var eecm1=new Array(new Array(arr1xF21G21,0,0,0,1));var eecm7=new Array(new Array(arr1xH17H21,0,0,4,0));function calc(data){var cA5B=data.pA5B;var cA6B=data.pA6B;var cA5C=(0);var tmp43=(((cA6B)*(12500)));var sumcnt44_sum=0+tmp43;var sumcnt44_cnt=1;var cA9B=(sumgeneral(0,sumcnt44_sum,sumcnt44_cnt,eecm2));
var tmp41=(((cA6B)*(3000.01)));var sumcnt42_sum=0+tmp41;var sumcnt42_cnt=1;var cA17B=(sumgeneral(0,sumcnt42_sum,sumcnt42_cnt,eecm2));var tmp39=(((cA6B)*(50000)));var sumcnt40_sum=0+tmp39;var sumcnt40_cnt=1;var cA17C=(sumgeneral(0,sumcnt40_sum,sumcnt40_cnt,eecm2));var tmp36=(((cA5B)>(cA17B)));var tmp37=(((cA5B)<(cA17C)));var sumcnt38_sum=((true&&tmp37)&&tmp36);var sumcnt38_cnt=2;var cA17D=(andgeneral(0,sumcnt38_sum,sumcnt38_cnt,eecm2));var tmp34=(((cA5B)==(cA17C)));var sumcnt35_sum=(false||tmp34);var sumcnt35_cnt=1;var cA17E=(orgeneral(0,sumcnt35_sum,sumcnt35_cnt,eecm2));arr1xF17G17[0][0]=(((cA17D)?(((cA5B)*(0.05))):(0)));arr1xF17G17[0][1]=(((cA17E)?(((cA5B)*(0.05))):(0)));var tmp32=(((cA6B)*(50000.01)));var sumcnt33_sum=0+tmp32;var sumcnt33_cnt=1;var cA18B=(sumgeneral(0,sumcnt33_sum,sumcnt33_cnt,eecm2));var tmp30=(((cA6B)*(200000)));var sumcnt31_sum=0+tmp30;var sumcnt31_cnt=1;var cA18C=(sumgeneral(0,sumcnt31_sum,sumcnt31_cnt,eecm2));var tmp27=(((cA5B)>(cA18B)));var tmp28=(((cA5B)<(cA18C)));var sumcnt29_sum=((true&&tmp28)&&tmp27);var sumcnt29_cnt=2;var cA18D=(andgeneral(0,sumcnt29_sum,sumcnt29_cnt,eecm2));var tmp25=(((cA5B)==(cA18C)));var sumcnt26_sum=(false||tmp25);var sumcnt26_cnt=1;var cA18E=(orgeneral(0,sumcnt26_sum,sumcnt26_cnt,eecm2));arr1xF18G18[0][0]=(((cA18D)?(((((cA17C)*(0.05)))+(((((cA5B)-(cA18B)))*(0.03))))):(0)));arr1xF18G18[0][1]=(((cA18E)?(((((cA17C)*(0.05)))+(((cA5C)*(0.03))))):(0)));
var tmp23=(((cA6B)*(200000.01)));var sumcnt24_sum=0+tmp23;var sumcnt24_cnt=1;var cA19B=(sumgeneral(0,sumcnt24_sum,sumcnt24_cnt,eecm2));var tmp21=(((cA6B)*(350000)));var sumcnt22_sum=0+tmp21;var sumcnt22_cnt=1;var cA19C=(sumgeneral(0,sumcnt22_sum,sumcnt22_cnt,eecm2));var tmp18=(((cA5B)>(cA19B)));var tmp19=(((cA5B)<(cA19C)));var sumcnt20_sum=((true&&tmp19)&&tmp18);var sumcnt20_cnt=2;var cA19D=(andgeneral(0,sumcnt20_sum,sumcnt20_cnt,eecm2));var tmp16=(((cA5B)==(cA19C)));var sumcnt17_sum=(false||tmp16);var sumcnt17_cnt=1;var cA19E=(orgeneral(0,sumcnt17_sum,sumcnt17_cnt,eecm2));arr1xF19G19[0][0]=(((cA19D)?(((((((cA17C)*(0.05)))+(((((cA18C)-(cA18B)))*(0.03)))))+(((((cA5B)-(cA19B)))*(0.01))))):(0)));var tmp14=(((cA6B)*(350000.01)));var sumcnt15_sum=0+tmp14;var sumcnt15_cnt=1;var cA20B=(sumgeneral(0,sumcnt15_sum,sumcnt15_cnt,eecm2));var tmp12=(((cA6B)*(500000)));var sumcnt13_sum=0+tmp12;var sumcnt13_cnt=1;var cA20C=(sumgeneral(0,sumcnt13_sum,sumcnt13_cnt,eecm2));var tmp9=(((cA5B)>(cA20B)));var tmp10=(((cA5B)<(cA20C)));var sumcnt11_sum=((true&&tmp10)&&tmp9);var sumcnt11_cnt=2;var cA20D=(andgeneral(0,sumcnt11_sum,sumcnt11_cnt,eecm2));var tmp7=(((cA5B)==(cA20C)));var sumcnt8_sum=(false||tmp7);var sumcnt8_cnt=1;var cA20E=(orgeneral(0,sumcnt8_sum,sumcnt8_cnt,eecm2));arr1xF20G20[0][0]=(((cA20D)?(((((((((cA17C)*(0.05)))+(((((cA18C)-(cA18B)))*(0.03)))))+(((((cA19C)-(cA19B)))*(0.01)))))+(((((cA5B)-(cA20B)))*(0.005))))):(0)));
var tmp5=(((cA6B)*(500000.01)));var sumcnt6_sum=0+tmp5;var sumcnt6_cnt=1;var cA21B=(sumgeneral(0,sumcnt6_sum,sumcnt6_cnt,eecm2));var tmp3=(((cA5B)>(cA21B)));var sumcnt4_sum=(true&&tmp3);var sumcnt4_cnt=1;var cA21D=(andgeneral(0,sumcnt4_sum,sumcnt4_cnt,eecm2));var tmp1=(((cA5B)==(cA21B)));var sumcnt2_sum=(false||tmp1);var sumcnt2_cnt=1;var cA21E=(orgeneral(0,sumcnt2_sum,sumcnt2_cnt,eecm2));arr1xF21G21[0][0]=(((cA21D)?(((((((((((cA17C)*(0.05)))+(((((cA18C)-(cA18B)))*(0.03)))))+(((((cA19C)-(cA19B)))*(0.01)))))+(((((cA20C)-(cA20B)))*(0.005)))))+(((((cA5B)-(cA21B)))*(0.0025))))):(0)));arr1xF21G21[0][1]=(((cA21E)?(((((((((((cA17C)*(0.05)))+(((((cA18C)-(cA18B)))*(0.03)))))+(((((cA19C)-(cA19B)))*(0.01)))))+(((((cA20C)-(cA20B)))*(0.005)))))+(((((cA5B)-(cA21B)))*(0.0025))))):(0)));arr1xH17H21[0][0]=(sumgeneral(2,0,0,eecm6));arr1xH17H21[1][0]=(sumgeneral(2,0,0,eecm5));arr1xF19G19[0][1]=(((cA19E)?(((((((cA17C)*(0.05)))+(((((cA18C)-(cA18B)))*(0.03)))))+(((((cA19C)-(cA19B)))*(0.01))))):(0)));arr1xH17H21[2][0]=(sumgeneral(2,0,0,eecm4));arr1xF20G20[0][1]=(((cA20E)?(((((((((cA17C)*(0.05)))+(((((cA18C)-(cA18B)))*(0.03)))))+(((((cA19C)-(cA19B)))*(0.01)))))+(((((cA20C)-(cA20B)))*(0.005))))):(0)));arr1xH17H21[3][0]=(sumgeneral(2,0,0,eecm3));arr1xH17H21[4][0]=(sumgeneral(2,0,0,eecm1));var cA8B=(sumgeneral(5,0,0,eecm7));var cA11B=(((((cA8B)>(cA9B)))?(cA9B):(cA8B)));data.pA11B=cA11B;
data.pA17B=cA17B;data.pA17C=cA17C;data.pA17D=cA17D;data.pA17E=cA17E;data.pA17F=arr1xF17G17[0][0];data.pA17G=arr1xF17G17[0][1];data.pA17H=arr1xH17H21[0][0];data.pA18B=cA18B;data.pA18C=cA18C;data.pA18D=cA18D;data.pA18E=cA18E;data.pA18F=arr1xF18G18[0][0];data.pA18G=arr1xF18G18[0][1];data.pA18H=arr1xH17H21[1][0];data.pA19B=cA19B;data.pA19C=cA19C;data.pA19D=cA19D;data.pA19E=cA19E;data.pA19F=arr1xF19G19[0][0];data.pA19G=arr1xF19G19[0][1];data.pA19H=arr1xH17H21[2][0];data.pA20B=cA20B;data.pA20C=cA20C;data.pA20D=cA20D;data.pA20E=cA20E;data.pA20F=arr1xF20G20[0][0];data.pA20G=arr1xF20G20[0][1];data.pA20H=arr1xH17H21[3][0];data.pA21B=cA21B;data.pA21D=cA21D;data.pA21E=cA21E;data.pA21F=arr1xF21G21[0][0];data.pA21G=arr1xF21G21[0][1];data.pA21H=arr1xH17H21[4][0];};

function myIsNaN(x){return(isNaN(x)||(typeof x=='number'&&!isFinite(x)));};function round(n,nd){if(isFinite(n)&&isFinite(nd)){var sign_n=(n<0)?-1:1;var abs_n=Math.abs(n);var factor=Math.pow(10,nd);return sign_n*Math.round(abs_n*factor)/factor;}else{return NaN;}};function sum2(arr,rt,rb){var sum=0;for(var ii=rt;ii<=rb;ii++){sum+=arr[ii]};return sum};function sum3(arr,rt,ct,rb,cb){var sum=0;for(var ii=rt;ii<=rb;ii++){for(var jj=ct;jj<=cb;jj++){sum+=arr[ii][jj]}};return sum};function sumgeneral(cnt,vsum,vcnt,x){var sum=vsum;for(var ii=0;ii<x.length;ii++){sum+=sum3(x[ii][0],x[ii][1],x[ii][2],x[ii][3],x[ii][4]);};return sum;};function andgeneral(cnt,vsum,vcnt,x){if(!vsum){return false;};for(var ii=0;ii<x.length;ii++){var arr=x[ii][0];for(var jj=x[ii][1];jj<=x[ii][3];jj++){for(var kk=x[ii][2];kk<=x[ii][4];kk++){if(!arr[jj][kk]){return false;};};};};return true;};function orgeneral(cnt,vsum,vcnt,x){if(vsum){return true;};for(var ii=0;ii<x.length;ii++){var arr=x[ii][0];for(var jj=x[ii][1];jj<=x[ii][3];jj++){for(var kk=x[ii][2];kk<=x[ii][4];kk++){if(arr[jj][kk]){return true;};};};};return false;};function eeparseFloat(str){str=String(str).replace(eedecreg,".");var res=parseFloat(str);if(isNaN(res)){
return 0;}else{return res;}};function eedisplayFloatND(x,nd){if(myIsNaN(x)){return Number.NaN;}else{var res=round(x,nd);if(nd>0){var str=String(res);if(str.indexOf('e')!=-1)return str;if(str.indexOf('E')!=-1)return str;var parts=str.split('.');if(parts.length<2){var decimals=('00000000000000').substring(0,nd);return(parts[0]).toString()+eedec+decimals;}else{var decimals=((parts[1]).toString()+'00000000000000').substring(0,nd);return(parts[0]).toString()+eedec+decimals;}}else{return res;}}};function eeparseFloatTh(str){str=String(str).replace(eethreg,"");str=String(str).replace(eedecreg,".");var res=parseFloat(str);if(isNaN(res)){return 0;}else{return res;}};function eedisplayFloatNDTh(x,nd){if(myIsNaN(x)){return Number.NaN;}else{var res=round(x,nd);if(nd>0){var str=String(res);if(str.indexOf('e')!=-1)return str;if(str.indexOf('E')!=-1)return str;var parts=str.split('.');var res2=eeinsertThousand(parts[0].toString());if(parts.length<2){var decimals=('00000000000000').substring(0,nd);return(res2+eedec+decimals);}else{var decimals=((parts[1]).toString()+'00000000000000').substring(0,nd);return(res2+eedec+decimals);}}else{return(eeinsertTho usand(res.toString()));}}};function eedisplayboolean(b){
return b?eetrue:eefalse;};function eeinsertThousand(whole){if(whole==""||whole.indexOf("e")>=0){return whole;}else{var minus_sign="";if(whole.charAt(0)=="-"){minus_sign="-";whole=whole.substring(1);};var res="";var str_length=whole.length-1;for(var ii=0;ii<=str_length;ii++){if(ii>0&&ii%3==0){res=eeth+res;};res=whole.charAt(str_length-ii)+res;};return minus_sign+res;}};function eeisstring(v){switch(typeof v){case "string":return true;case "object":return v.constructor==String;default:return false;}};
//-->
</script>

<!-- calculator script end -->


The form is:

<form action="(EmptyReference!)" method="post" name="formc" id="formc">
<div id="panel1" style="display:block"></div>
<div class="eebuttonbar_bottom" align="center">
<table border="0" cellspacing="2" cellpadding="4">
<tr>
<td class="tableborder" width="361">TAST INN tilslagspris inkl. sal&aelig;r ekskl.mva<br />
(i HELE norske kroner)</td>
<td class="tableborder" width="86"><input id="pA5B" class="ee111" style=" width:100% " type="text" name="pA5B" size="12" tabindex="1" onblur="this.value=eedisplayFloatNDTh(eeparseFloatTh(this.value),0);recalc_onclick('pA5B')" /></td>
</tr>
<tr>
<td class="tableborder" width="361">TAST INN dagens valutakurs (<u>med FIRE desimaler</u>)<br />
(1 euro i norske kroner - sjekk valutakursen <a href="http://www.norges-bank.no/stat/valutakurser/kurs_dn1.html" target="_blank">her</a>)</td>
<td class="tableborder" width="86"><input id="pA6B" class="ee117" style=" width:100% " type="text" name="pA6B" size="12" tabindex="2" onblur="this.value=eedisplayFloatND(eeparseFloat(this.value),4);recalc_onclick('pA6B')" /></td>
</tr>
</table>
<br />
<table width="457" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="361"><input class="eebuttons" onclick="recalc_onclick('')" type="button" name="xl_update_bottom" value="Regn ut" /><input class="eebuttons" onclick="reset_onclick('')" type="button" name="xl_reset_bottom" value="Nullstill" /></td>
<td width="74"></td>
</tr>
</table>
<br />
<table border="0" cellspacing="2" cellpadding="4">
<tr>
<td class="tableborder" width="361">F&oslash;lgerettsvederlag &aring; betale (i norske kroner)</td>
<td class="tableborder" width="86"><input id="pA11B" class="ee111" style="overflow:hidden; border:0px solid #000000; width:100% " type="text" name="pA11B" value="0" readonly="readonly" size="12" tabindex="-1" /></td>
</tr>
</table>
<span style="margin-left:60px;"></span></div>
<div align="center">

</div>
</form>