if(typeof jQuery=="undefined")jQuery=function(){};if(typeof jQuery.classBehaviours=="undefined")jQuery.classBehaviours=function(){};if(typeof jQuery.classBehaviours.handlers=="undefined")jQuery.classBehaviours.handlers=function(){};jQuery.classBehaviours.handlers.calculateSteps={name:"calculateSteps",start:function(b){allInputs=b.getElementsByTagName("INPUT");for(var a=0;a<allInputs.length;a++){if(allInputs[a].className.indexOf("multiply_")>-1)allInputs[a].onchange=this.calculate;if(allInputs[a].className.indexOf("constant_")>-1)allInputs[a].onchange=this.calculate}this.calculate(b)},calculate:function(c){var b=typeof this.nodeName=="undefined"?c:this,d=jQuery.classBehaviours.handlers.calculateSteps;rootNode=jQuery.classBehaviours.utilities.rootNode(b,null,null,d.name);totalValue=0;allInputs=rootNode.getElementsByTagName("INPUT");for(var a=0;a<allInputs.length;a++){if(allInputs[a].className.indexOf("constant_")>-1){inputValue=parseFloat(allInputs[a].value);totalValue+=isNaN(inputValue)?0:inputValue}if(allInputs[a].className.indexOf("multiply_")>-1){inputValue=parseFloat(allInputs[a].value);multiplyValue=parseFloat(jQuery.classBehaviours.utilities.getClassParameter(allInputs[a],"multiply","1"));addValue=parseFloat(jQuery.classBehaviours.utilities.getClassParameter(allInputs[a],"add","0"));totalValue+=isNaN(inputValue)?0:inputValue*multiplyValue+addValue;jQuery.classBehaviours.utilities.nextNode(allInputs[a].parentNode,1).innerHTML=isNaN(inputValue)?"-":parseInt(inputValue*multiplyValue+addValue)}}totalNodes=rootNode.getElementsByTagName("SPAN");totalNodes[totalNodes.length-1].innerHTML=parseInt(totalValue)}};if(typeof jQuery.fn!="undefined"){jQuery.fn.calculateSteps=function(){return this.each(function(){jQuery.classBehaviours.handlers.calculateSteps.start(this)})};$(document).ready(function(){$(".calculateSteps").calculateSteps()})}
