


			function dateDiff( dateOne, dateTwo )
			{
				dateOne.setMinutes(0);
				dateOne.setHours(0);
				dateOne.setSeconds(0);

				dateTwo.setMinutes(0);
				dateTwo.setHours(0);
				dateTwo.setSeconds(0);

				difference = dateOne - dateTwo;

				days = Math.round(difference/(1000*60*60*24));

				return days;
			}



			function AddBusDays( startDate, daysToAdd )
			{
				var daysAdded = 0;
				while ( daysAdded < daysToAdd)
				{
					startDate.setDate(startDate.getDate()+1);
					if (IsBusDay(startDate) && !IsHoliday(startDate) )
					{
						daysAdded++;
					}			
				}
				return startDate;
			}

			function IsBusDay( dateToCheck )
			{
				return ( dateToCheck.getDay() != 0 && dateToCheck.getDay() != 6 )
			}

			function IsHoliday( dateToCheck )
			{
				var n_date = dateToCheck.getDate();
				var n_month = dateToCheck.getMonth() + 1;
				var s_date1 = n_month + '/' + n_date;

				if ( s_date1 == '1/1' // New Year's Day
						|| s_date1 == '7/4' // Independence Day
					|| s_date1 == '12/25' // Christmas Day
					) return true;

					// weekday from beginning of the month (month/num/day)
					var n_wday = dateToCheck.getDay(),
					n_wnum = Math.floor((n_date - 1) / 7) + 1;
					var s_date2 = n_month + '/' + n_wnum + '/' + n_wday;

					if ( s_date2 == '9/1/1' // Labor Day, first Monday in September
					|| s_date2 == '11/4/4' // Thanksgiving Day, fourth Thursday in November
					|| s_date2 == '11/4/5' // Thanksgiving Day, fourth friday in November
					) return true;


	
	// weekday number from end of the month (month/num/day)
var dt_temp = new Date (dateToCheck);
dt_temp.setDate(1);
dt_temp.setMonth(dt_temp.getMonth() + 1);
dt_temp.setDate(dt_temp.getDate() - 1);
n_wnum = Math.floor((dt_temp.getDate() - n_date - 1) / 7) + 1;
var s_date3 = n_month + '/' + n_wnum + '/' + n_wday;

if ( s_date3 == '5/1/1' // Memorial Day, last Monday in May
) return true;

					// extra days around a holiday
					if ( s_date1 == '12/26')
					{
						return true;
					}

				return false;			

			}



			function disableDays( cal )
			{
				var now = new Date();

				// disable current day
				cal.addDisabledDates(null,formatDate(now,"yyyy-MM-dd"));

				for (x=0;x<=90;x++ )
				{
					now.setDate(now.getDate()+1);
					if ( now.getDay() == 0 || now.getDay() == 6 || IsHoliday(now) )
					{
						cal.addDisabledDates(formatDate(now,"yyyy-MM-dd"));
					}
					else
					{
						// weekday and we can't ship today, make sure we kill next business day as arrival date
						if (!canShipToday && !nextBusDayDisabled)
						{
							cal.addDisabledDates(formatDate(now,"yyyy-MM-dd"));
							nextBusDayDisabled = true;
						}	

					}
				}
				cal.addDisabledDates(formatDate(now,"yyyy-MM-dd"),null );
	
			}

