function setFieldAmount(field,val) { var obj = findCurrentObj("entry_form",field); if (obj) { // val= "$" + addCommas(val); // dollar way val= addCommas(val); //val= val.replace(/,/g," ") ; // for European format val= "\u20AC " + val; //val= val.replace(".",","); // change decimal back now for European format obj.innerHTML= val; } } function addCommas(nStr) { nStr += ''; x = nStr.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; } var dHash = {}; function myDebug(key, value) { if (!dHash[key]) { alert(value); } dHash[key]="1"; } function riskColor(risk) { if (risk>12) { return "red"; } else if (risk>=5) { return "yellow"; } else { return "darkgreen"; } } // set the impact var impactFields = [ "49", "43", "44", "45", "48", "47" ]; var impactNames = [ "Cost", "Governance", "Image", "Legal", "Schedule", "Technical" ]; var impactValues = [ "Low", "Moderate", "Significant", "Damaging", "Catastrophic" ]; var likelihoodValues = [ "Remote", "Unlikely", "Possible", "Likely", "Very Likely" ]; var probAlpha= [ "", "A", "B", "C", "D", "E" ]; var probRange = [ "<10%", "10-30%", "30-50%", "50-70%", ">70%" ]; var probValue = [ 10, 30, 50, 70, 90 ]; var domainNotes = ""; function scoreFunction () { domainNotes= "Risk Impact scores are assigned values (1-5) based on the highest Risk Domain score:

"; for (var i=0;i<5; i++) { domainNotes+= "
- "+impactValues[i]+"="+(i+1)+"
"; } domainNotes+= "

Risk Likelihood scores are assigned values (1-5) :

"; for (var i=0;i<5; i++) { domainNotes+= "
- "+likelihoodValues[i]+"="+(i+1)+"
"; } domainNotes+= "

Each score then relates to a probability value of [ 10%, 30%, 50%, 70%, 90% ]
"; domainNotes+= "Residual scores are then calculated for each plan as follows:
"; if (document.entry_form) { var resImpactObj = jQuery("#field72"); var resImpactScoreObj = jQuery("#field74"); var resLikelihoodObj = jQuery("#field71"); var resLikelihoodScoreObj = jQuery("#field73"); var resRiskObj = jQuery("#field40"); var resRiskScoreObj = jQuery("#field75"); if (document.entry_form.cloneBugFlag) { // default back to "" resImpactObj.html(""); resImpactScoreObj.html(""); resLikelihoodObj.html(""); resLikelihoodScoreObj.html(""); resRiskObj.html(""); resRiskScoreObj.html(""); } domainNotes += "Residual Likelihood Score = Risk Probability Score * Reduction To Likelihood %
"; var reductionToLikelihood = "" + findCurrentObj("entry_form","field7").value; var resLikelihoodScore = riskLikelihoodScore ; if (reductionToLikelihood) { resLikelihoodScore = Math.round(riskLikelihoodScore * (1-reductionToLikelihood/100)); } if (resLikelihoodScore<1) resLikelihoodScore =1; domainNotes += resLikelihoodScore + " = " + riskLikelihoodScore + " * " + (1-reductionToLikelihood/100) +"
"; resLikelihoodObj.html(likelihoodValues[resLikelihoodScore-1]); resLikelihoodScoreObj.html(resLikelihoodScore); // probability resRiskObj.html(probValue[resLikelihoodScore-1]+"%"); domainNotes += "Residual Impact Score is the highest of the residual impact scores where a reduction % is applied to each impact from the risk. Scores for each impact are :

"; var resImpactScore=1; for (var i=0;i<6;i++) { var reduction = "" + findCurrentObj("entry_form","field" +impactFields[i]).value; var score = window["riskImpactScore"+impactFields[i]]; //safer eval if (reduction) { score = Math.round(score * (1-reduction/100)); } domainNotes += "
- "+impactNames[i]+"="+score + "
"; if (resImpactScore<score) { resImpactScore= score; } } domainNotes+= "</ul>Residual Impact Score is "+resImpactScore+" ["+impactValues[resImpactScore-1]+"] <br>
"; resImpactObj.html(impactValues[resImpactScore-1]); resImpactScoreObj.html(resImpactScore); var resRiskScore = Math.round(resImpactScore * resLikelihoodScore); domainNotes+= "Residual Risk Score is "+resRiskScore+"
"; resRiskScoreObj.html(resRiskScore); var color=riskColor(resRiskScore); resRiskScoreObj.css("backgroundColor",color); } setTimeout("scoreFunction()",500); } function showImpactDomainNotes(event) { fitDialog(event,domainNotes,true); } scoreFunction();