/*
reformats dates entered as m/d/yyyy to mm/dd/yyyy
*/
function reformatDate(inp) {
var d = inp.value;
if(d.length==0) {
return;
}
d = d.replace(/\/\//gi,'/'); // replace double slashes
var parsedDate = new Date(d);
var month = (parsedDate.getMonth() + 1).toString();
var date = parsedDate.getDate().toString(); //date is the day of the month
var year = parsedDate.getFullYear().toString();
if(month.length == 1)
month = '0' + month;
if(date.length == 1)
date = '0' + date.toString();
parsedDate = month + '/' + date + '/' + year;
inp.value = parsedDate;
}