// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function fullScreen(theURL) {
window.open(theURL, '', 'fullscreen=yes, scrollbars=auto');
}

function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain only numbers.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

//EMR ROI Calculator
function roi(form) {
var numprov
var patday
var chartcost
var management
var transcriptions
var storspace
var storcost
var storage
var malpractice
var malsavings
var transcost
var newcharts
var newchartcost
var fax
var faxcost
var hist
var histcost
var paper
var papercost
var post
var postcost
var materials
var finalroi
var ytranscriptions;
var ymanagement
var ymaterials
var ystorage
var ymalsavings


numprov = form.numprov.value;
transcost = form.transcost.value;
transcriptions = (numprov * transcost);
document.form.transcriptions.value = transcriptions;

patday = form.patday.value;
chartcost = form.chartcost.value;
management = (22 * patday * chartcost);
document.form.management.value = Math.round(management*100)/100;

newcharts = form.newcharts.value;
newchartcost = form.newchartcost.value;
fax = form.fax.value;
faxcost = form.faxcost.value;
hist = form.hist.value;
histcost = form.histcost.value;
paper = form.paper.value;
papercost = form.papercost.value;
post = form.post.value;
postcost = form.postcost.value;
materials = (22 * newcharts * newchartcost) + (22 * fax * faxcost) + (22 * hist * histcost) + (22 * paper * papercost) + (22 * post * postcost);
document.form.materials.value = Math.round(materials*100)/100;

storspace = form.storspace.value;
storcost = form.storcost.value;
storage = (storspace * storcost);
document.form.storage.value = Math.round(storage*100)/100;

malpractice = form.malpractice.value;
malsavings = (.05 * malpractice);
document.form.malsavings.value = malsavings;

ytranscriptions = (12 * transcriptions);
document.form.ytranscriptions.value = Math.round(ytranscriptions*100)/100;

ymanagement = (12 * management);
document.form.ymanagement.value = Math.round(ymanagement*100)/100;

ymaterials = (12 * materials);
document.form.ymaterials.value = Math.round(ymaterials*100)/100;

ystorage = (12 * storage);
document.form.ystorage.value = Math.round(ystorage*100)/100;


finalroi = (12 * transcriptions) + (12 * management) + (12 * materials) + (malsavings);
document.form.finalroi.value = finalroi;

ymalsavings = (1 * malpractice);
document.form.ymalsavings.value = ymalsavings;
	}
