var costOfAf=0;var costOfIraq=0;var costOfTotal=0;var geographicscale=1;function calculateIraq(){var totalDollars=687000000000;var startOfWar=new Date("Mar 20, 2003");var budgetedThrough=new Date("Sept 30, 2009");var totalMS=budgetedThrough-startOfWar;var ratePerMS=totalDollars/totalMS;var curDate=new Date();var diff=curDate-startOfWar;costOfIraq=(diff*ratePerMS)*geographicscale;}
function calculateAf(){var totalDollars=228000000000;var startOfWar=new Date("Oct 7, 2001");var budgetedThrough=new Date("Sept 30, 2009");var totalMS=budgetedThrough-startOfWar;var ratePerMS=totalDollars/totalMS;var curDate=new Date();var diff=curDate-startOfWar;costOfAf=(diff*ratePerMS)*geographicscale;}
function updateCostOfAf(rate){calculateAf();var costOfWarAf_Total=document.getElementById('costOfWarAf_Total');costOfWarAf_Total.innerHTML="$"+number_str(costOfAf);setTimeout('updateCostOfAf('+rate+');',rate);}
function updateCostOfIraq(rate){var costOfWarIraq_Total=document.getElementById('costOfWarIraq_Total');calculateIraq();costOfWarIraq_Total.innerHTML="$"+number_str(costOfIraq);setTimeout('updateCostOfIraq('+rate+');',rate);}
function updateCostOfTotal(rate){calculateAf();calculateIraq();costOfTotal=(costOfAf+costOfIraq);var costOfWarTotal_Total=document.getElementById('costOfWarTotal_Total');costOfWarTotal_Total.innerHTML="$"+number_str(costOfTotal);setTimeout('updateCostOfTotal('+rate+');',rate);}
function initCostOfIraq(){var costOfWarIraq=document.getElementById("costOfWarIraq");var costOfWarIraq_Title=document.createElement('div');costOfWarIraq_Title.setAttribute('id','costOfWarIraq_Title');var costOfWarIraq_Total=document.createElement('div');costOfWarIraq_Total.setAttribute('id','costOfWarIraq_Total');var costOfWarIraq_Link=document.createElement('div');costOfWarIraq_Link.setAttribute('id','costOfWarIraq_Link');costOfWarIraq.appendChild(costOfWarIraq_Title);costOfWarIraq.appendChild(costOfWarIraq_Total);costOfWarIraq.appendChild(costOfWarIraq_Link);costOfWarIraq_Title.innerHTML='Cost of War in Iraq';costOfWarIraq_Link.innerHTML='See the cost to your community at <a href="http://www.costofwar.com" title="CostOfWar.com brought to you by National Priorities Project" target="_blank">www.costofwar.com</a>';}
function initCostOfAf(){var costOfWarAf=document.getElementById("costOfWarAf");var costOfWarAf_Title=document.createElement('div');costOfWarAf_Title.setAttribute('id','costOfWarAf_Title');var costOfWarAf_Total=document.createElement('div');costOfWarAf_Total.setAttribute('id','costOfWarAf_Total');var costOfWarAf_Link=document.createElement('div');costOfWarAf_Link.setAttribute('id','costOfWarAf_Link');costOfWarAf.appendChild(costOfWarAf_Title);costOfWarAf.appendChild(costOfWarAf_Total);costOfWarAf.appendChild(costOfWarAf_Link);costOfWarAf_Title.innerHTML='Cost of War in Afghanistan';costOfWarAf_Link.innerHTML='See the cost to your community at <a href="http://www.costofwar.com" title="CostOfWar.com brought to you by National Priorities Project" target="_blank">www.costofwar.com</a>';}
function initCostOfTotal(){var costOfWarTotal=document.getElementById("costOfWarTotal");var costOfWarTotal_Title=document.createElement('div');costOfWarTotal_Title.setAttribute('id','costOfWarTotal_Title');var costOfWarTotal_Total=document.createElement('div');costOfWarTotal_Total.setAttribute('id','costOfWarTotal_Total');var costOfWarTotal_Link=document.createElement('div');costOfWarTotal_Link.setAttribute('id','costOfWarTotal_Link');costOfWarTotal.appendChild(costOfWarTotal_Title);costOfWarTotal.appendChild(costOfWarTotal_Total);costOfWarTotal.appendChild(costOfWarTotal_Link);costOfWarTotal_Title.innerHTML='Cost of U.S. Wars Since 2001';costOfWarTotal_Link.innerHTML='See the cost to your community at <a href="http://www.costofwar.com" title="CostOfWar.com brought to you by National Priorities Project" target="_blank">www.costofwar.com</a>';}
function number_str(n){var x=n.toString();var dot=x.lastIndexOf('.');x=x.substr(0,dot);var l=x.length;var res="";for(l-=3;l>0;l-=3){res=","+x.substr(l,3)+res;}
res=x.substr(0,l+3)+res;return res;}
function inc_totals_at_rate(rate){calculateIraq();var raw=document.getElementById("raw");raw.id='costOfIraq';setTimeout('updateIraq('+rate+');',rate);}
function inc_totals()
{inc_totals_at_rate(100);}



