
<br />
<b>Notice</b>:  Undefined index:  c in <b>/var/www/vhosts/commutebybike.com/httpdocs/widget2.php</b> on line <b>4</b><br />
<br />
<b>Notice</b>:  Undefined index:  c in <b>/var/www/vhosts/commutebybike.com/httpdocs/widget2.php</b> on line <b>12</b><br />
	measure = 'Gallon';
	cmeasure = 'Gas';
	currency = '$';
	per = 'MPG';
	daily = 'Miles';
	
document.write('<script src="http://commutebybike.com/js/prototype.js" type="text/javascript"></script>'); 
document.write('<script src="http://commutebybike.com/js/effects.js" type="text/javascript"></script>');

function dogascalc() {
	if (isNaN(document.getElementById('miles').value) || isNaN(document.getElementById('price').value) || isNaN(document.getElementById('mpg').value) || isNaN(document.getElementById('days').value)) {
		alert("Please enter only numbers!");
	} else if (!document.getElementById('miles').value || !document.getElementById('price').value || !document.getElementById('mpg').value || !document.getElementById('days').value) {
		alert("Please fill in every field!");
	} else if (document.getElementById('days').value > 7) {
		alert("There's only 7 days in a week!");
	} else {
		miles = document.getElementById('miles').value;
		price = document.getElementById('price').value;
		mpg = document.getElementById('mpg').value;
		days = document.getElementById('days').value;
		dailytotal = Math.round(((miles/mpg)*price)*100)/100;
		weeklytotal = Math.round((((miles/mpg)*price)*days)*100)/100;
		yearlytotal = Math.round(((((miles/mpg)*price)*days)*52)*100)/100;
	
		total = "<br />Daily Savings: " + currency + dailytotal.toFixed(2) + "<br />Weekly Savings: " + currency + weeklytotal.toFixed(2) + "<br />Yearly Total: " + currency + yearlytotal.toFixed(2);
	
		document.getElementById('answer').innerHTML=total;
		
		new Effect.Appear(document.getElementById('answer'));
	}
}

document.write('<div id="gascalc">');
document.write('<form><table width="185" style="width:185px;">');
document.write('<tr><td style="padding:0;margin:0;"><h3 class="grad">The Gas Savings Calculator</h3></td></tr>');
document.write('<tr><td style="padding:0;margin:0;">Daily '+daily+' Ridden</td></tr>');
document.write('<tr><td style="padding:0;margin:0;"><input type="text" id="miles" value="" class="text incalc" style="width:100%;border:1px #aaaaaa solid;margin:0;padding:3px 0;" /></td></tr>');
document.write('<tr><td style="padding:0;margin:0;">Price of '+cmeasure+' Per '+measure+'</td></tr>');
document.write('<tr><td style="padding:0;margin:0;"><input type="text" id="price" value="" class="text incalc" style="width:100%;border:1px #aaaaaa solid;margin:0;padding:3px 0;" /></td></tr>');
document.write('<tr><td style="padding:0;margin:0;">Your Car\'s '+per+'</td></tr>');
document.write('<tr><td style="padding:0;margin:0;"><input type="text" id="mpg" value="" class="text incalc" style="width:100%;border:1px #aaaaaa solid;margin:0;padding:3px 0;" /></td></tr>');
document.write('<tr><td style="padding:0;margin:0;">Days You Ride Per Week</td></tr>');
document.write('<tr><td style="padding:0;margin:0;"><input type="text" id="days" value="" class="text incalc" style="width:100%;border:1px #aaaaaa solid;margin:0;padding:3px 0;" /></td></tr>');
document.write('<tr><td style="vertical-align:top;padding:5px 0;"><input type="button" value="Calculate" id="gassubmit" name="gassubmit" onClick="dogascalc()" style="width:100%;border:1px #aaaaaa solid;margin:0;padding:3px 0; margin:0;" /></td></tr>');
document.write('<tr><td><span id="answer" style="display:none;">15</span></td></tr>');
document.write('<tr><td style="padding:0;margin:0; text-align:center;"><a href="http://commutebybike.com" style="font-size:.8em;" target="_blank">bike commuting</a></td></tr>')
document.write('</table></form></div>');