Need an awk script to calculate the percentage of value field and replace

Need an awk script to calculate the percentage of value field and replace
I have a input file called file.txt with the following content:

john|622.5674603562933|8|br:1;cn:3;fr:1;jp:1;us:2
andy|0.0|12|**:3;br:1;ca:2;de:2;dz:1;fr:2;nl:1

in fourth filed of input file, calulate percentage of each sub filed seperated by ; semicolon and replace value with percentage .
i need output in below format

john|622.5674603562933|8|br:12;cn:38;fr:12;jp:12;us:25
andy|0.0|12|**:25;br:8;ca:17;de:17;dz:8;fr:17;nl:8

I have to pass the pararmeters in to the awk script and calculate the percentage.
ex:

input br:1;cn:3;fr:1;jp:1;us:2
output: br:12;cn:38;fr:12;jp:12;us:25

pls advice me

duplicate post I guess
http://www.unix.com/unix-dummies-questions-answers/224921-need-awk-script-calculate-percentage-value-field-replace.html\#post302810071