var products={reportCopy:{text:"I confirm I require a copy of my completed report",price:19.98},reportUpdate:{text:"I require an update of my report",price:9.99},reportNewCRB:{text:"I require a new report",price:134},reportNew:{text:"I require a new report",price:99.99}};function screenReporting(){var a=$("#screeningReport");this.field=a;if(a.length){this.form=a;this.init()}}screenReporting.prototype.form=null;screenReporting.prototype.qtyFields=null;screenReporting.prototype.total=0;screenReporting.prototype.field=null;screenReporting.prototype.round=function(b){var c=2;var a=Math.round(Math.round(b*Math.pow(10,c+1))/Math.pow(10,1))/Math.pow(10,c);return a};screenReporting.prototype.getTotal=function(a){var b=this.total;if(!a){b="£"+this.currencyFormat(this.round(this.total))}return b};screenReporting.prototype.currencyFormat=function(b){var a=parseFloat(b);if(isNaN(a)){a=0}var c="";if(a<0){c="-"}a=Math.abs(a);a=parseInt((a+0.005)*100);a=a/100;s=new String(a);if(s.indexOf(".")<0){s+=".00"}if(s.indexOf(".")==(s.length-2)){s+="0"}s=c+s;return s};screenReporting.prototype.calculate=function(){this.total=new Number(0);var a=new Number(0);this.qtyFields.each(function(){$this=$(this);var d=new Number($this.val());var b=$this.data("toggle");if(b.is(":checked")){for(x in products){if($this.hasClass(x)){var c=d*products[x].price;a+=c}}}});this.total=a};screenReporting.prototype.init=function(){var a=$("input.quantity",this.field);this.qtyFields=a;var b=this;var d=$("#total");var c=$("#fieldTotal");a.each(function(){$this=$(this);var e=$(".toggle",$this.parent().parent());e.click(function(f){return function(){b.calculate();var g=b.getTotal();c.val(g);d.html(g);$self=$(this);if($self.is(":checked")){f.removeAttr("readonly").removeClass("disabled")}else{f.attr("readonly","readonly").addClass("disabled")}}}($this));$this.data("toggle",e)});a.keyup(function(g){$this=$(g.target);$this.val($this.val().replace(/[^\d]/g,"1"));b.calculate();var f=b.getTotal();c.val(f);d.html(f)})};