
function calculate(d,p,joker){


switch (joker){


//case statement for each ROI quick box
case "vov":
var subtotal = Math.round(p.value * .75 * .5 * .2 * 35);
	var total = subtotal * 12;
	document.getElementById("total").innerHTML = formatCurrency(total);
	document.getElementById("perdoc").innerHTML = formatCurrency(total/d.value);
	document.getElementById("showresults").style.display = "block";
break;

default : //nothing.
}

}
	



	
function ifnum(doctors,people,yesnum,meth){
	if(people.value!=''){
	for(var k=0;k<people.value.length;k++){
		var getChrCode=people.value.charCodeAt(k);
		if(!(getChrCode>=48 && getChrCode<=57)){
			if(yesnum=="Y"){
				if(!(getChrCode==46)){
					people.value=people.value.substring(0,k)+people.value.substring(k+1);
					people.focus();
					return false;
				}
			}
			else{
				people.value=people.value.substring(0,k)+people.value.substring(k+1);
				people.focus();
				return false;
				}
			}
		}
    calculate(document.roi.docs,document.roi.patients,meth);	
	}
	
	if(doctors.value!=''){
	for(var k=0;k<doctors.value.length;k++){
		var getChrCode=doctors.value.charCodeAt(k);
		if(!(getChrCode>=48 && getChrCode<=57)){
			if(yesnum=="Y"){
				if(!(getChrCode==46)){
					people.value=doctors.value.substring(0,k)+doctors.value.substring(k+1);
					people.focus();
					return false;
				}
			}
			else{
				people.value=doctors.value.substring(0,k)+doctors.value.substring(k+1);
				people.focus();
				return false;
				}
			}
		}
    calculate(document.roi.docs,document.roi.patients,meth);	
	}
}



function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num + '.' + cents);
}


