<!-- Begin

// Created by Eric Skarpac
// on June 10th, 2002
// acknowledgement to irt.org for their wonderful help


// This script was created for the purpose of 
// updating the expiration date of a 'coupon page'
// for DependableCleaners.com.  This JavaScript
// will use a start date and print out a end date
// or "expiration date" a set number of days after 
// the start date.  Once the expiration date has
// passed, a new expiration date will be shown 
// which is the same number of days afterwards.

// To use this script in the HEAD tags include
// the line:  <SCRIPT LANGUAGE="JavaScript" SRC="expiredDate.js"></SCRIPT>

// And where ever the expiration date 
// should appear (in the BODY tag) include 
// the line: <script>writeDate(endDay, endDate, endMonth,endYear);</script>

// One comment on the usage of this script:  This
// script is executed on the clients computer and
// therefore the date of expiration relies solely
// on the accuracy of the users date on their computer. 

// This script was tested in IE 5.50 and
// Netscape 6.2.1


// The start date:  To adjust the date, change
// each one of the integers in startMonth, 
// startDate, and startYear.

var startMonth=6;
var startDate=6;
var startYear=2002;


// This is number of days till the expiration
// date updates.

var daysTillExpire=14;


--startMonth;

var endMonth=startMonth;
var endDate=startDate;
var endYear=startYear;


// This function advances a given date a certain
// number of days.

function advance_days(date,days) {
    return new Date(date.getTime() + (days * 86400000));
}


// This functions adjusts for years given in yy format.
// This is needed for Netscape.

function y2Adjust(number) { 
	return (number < 1000) ? number + 1900 : number; 
}


// This function returns the number of days between
// two given dates.

function daysDifferent(date1,date2) {
    var difference =
        Date.UTC(y2Adjust(date1.getYear()),date1.getMonth(),date1.getDate(),0,0,0)
      - Date.UTC(y2Adjust(date2.getYear()),date2.getMonth(),date2.getDate(),0,0,0);
    return difference/1000/60/60/24;
}


// This function finds the expiration date based
// on the start date given above, the number of
// days till the coupon expires, and the current
// date.  The expiration date is determined by 
// adding the number of days till the coupon expires
// to the start date.  If the current date is after 
// the expiration date, the number of days till
// the coupon expires is added until the expiration
// date exceeds the current date.

function find_expired_day(beginningYear,beginningMonth,beginningDate,days){

	var beginning = new Date(beginningYear,beginningMonth,beginningDate);
	var now = new Date();
	var expireDate = new Date();
	expireDate = advance_days(beginning,days);

	while (daysDifferent(expireDate,now) < 0) 
	{
		expireDate = advance_days(expireDate,days);
	}

	return expireDate;
}

// This function displays the expiration date in the 
// format:  Thursday, June 20, 2002

function writeDate(day, date, month, year){

var days=new Array(7);
days[0]="Sunday";
days[1]="Monday";
days[2]="Tuesday";
days[3]="Wednesday";
days[4]="Thursday";
days[5]="Friday";
days[6]="Saturday";

var months=new Array(13);
months[0]="January";
months[1]="February";
months[2]="March";
months[3]="April";
months[4]="May";
months[5]="June";
months[6]="July";
months[7]="August";
months[8]="September";
months[9]="October";
months[10]="November";
months[11]="December";


document.write(days[day] + ", " + months[month] + " " + date + ", " + y2Adjust(year));

}


var expiredDate = new Date();
expiredDate = find_expired_day(startYear,startMonth,startDate,daysTillExpire);

var endDay=expiredDate.getDay();
var endMonth=expiredDate.getMonth();
var endDate=expiredDate.getDate();
var endYear=expiredDate.getYear();



// End -->
        
