Am I on the right track?
Code:
<p align="center"><br><b>Est. Shipping Date:</b><br> <br>
<script type="text/javascript">
Number.prototype.mod = function(n) {
return ((this%n)+n)%n;
}
Date.prototype.addBusDays = function(dd) {
var wks = Math.floor(dd/5);
var dys = dd.mod(5);
var dy = this.getDay();
if (dy === 6 && dys > -1) {
if (dys === 0) {dys-=2; dy+=2;}
dys++; dy -= 6;}
if (dy === 0 && dys < 1) {
if (dys === 0) {dys+=2; dy-=2;}
dys--; dy += 6;}
if (dy + dys > 5) dys += 2;
if (dy + dys < 1) dys -= 2;
this.setDate(this.getDate()+wks*7+dys);
}
var d = new Date();
var products = {
'Page Title 1':{ businessDays: 3},
'Page Title 2':{ businessDays: 6}
};
d.addBusDays(products[document.title]);
var curr_date = d.getDate();
var curr_month = d.getMonth();
curr_month++;
var curr_year = d.getFullYear();
document.write(curr_month + "/" + curr_date + "/" + curr_year);
</script>
Bookmarks