	var reminderPeriod  	= 7;
	var thisYear			= todaysDate.getFullYear();

function preSelectedDate(f)
{
	with (f)
	{
		if (rs.selectedIndex == 0)
		{
			alert('Please choose an occasion');
		}
		else
		{
			if (rs.selectedIndex == 3 ||
				rs.selectedIndex == 5 ||
				rs.selectedIndex == 6 ||
				rs.selectedIndex == 8 ||
				rs.selectedIndex == 11)
			{
				occasionvalue.value		= rs.options[rs.selectedIndex].value;
				var value				= AssessAll(occasionvalue,"07 ","");
				occasiontitle   		= rs.options[rs.selectedIndex].title;
				occasionDatey			= occasiontitle.split('-');

				day  = occasionDatey[0];
				month  = occasionDatey[1];
				year  = occasionDatey[2];

				day  -= 0;
				month -=  0;
				year  -= 0;

				occ_day.selectedIndex	= day;
				occ_month.selectedIndex	= month;
				
				
				for (i = 0; i < occ_year.options.length; i++)
				{
					if (occ_year.options[i].value == year)
					{
						occ_year.selectedIndex = i;
						break;
					}
				}

				changeSRDay(document.emailReminder);
			}
		}
	}
}

function changeSRDay(f)
{
	with (f)
	{
		switch (occ_month.selectedIndex)
		{
			case 0:		// January
			case 7:		// August
			{
				dayInMonth  		= 31;
				dayInPreviousMonth	= 31;
				break;
			}
			case 1:		// February
			{
				dayInMonth  		= ((thisYear % 4) == 0) ? (((thisYear % 1000) == 0) ? 28 : 29) : 28
				dayInPreviousMonth	= 31;
				break;
			}
			case 2:		// March
			{
				dayInMonth  		= 31;
				dayInPreviousMonth  = ((thisYear % 4) == 0) ? (((thisYear % 1000) == 0) ? 28 : 29) : 28
				break;
			}
			case 3:		// April
			case 5:		// June
			case 8:		// September
			case 10:	// November
			{
				dayInMonth  		= 30;
				dayInPreviousMonth	= 31;
				break;
			}
			case 4:		// May
			case 6:		// July
			case 9:		// October
			case 11:	// December
			{
				dayInMonth  		= 31;
				dayInPreviousMonth	= 30;
				break;
			}
		}

		if (occ_day.selectedIndex >= reminderPeriod)
		{
			sr_day.selectedIndex	= occ_day.selectedIndex - reminderPeriod;
			sr_month.selectedIndex	= occ_month.selectedIndex;
			sr_year.selectedIndex	= occ_year.selectedIndex;
		}
		else
		{
			if (occ_year.selectedIndex > 0 && occ_month.selectedIndex == 0) sr_year.selectedIndex = occ_year.selectedIndex - 1;
			sr_month.selectedIndex  = (occ_month.selectedIndex > 0) ? occ_month.selectedIndex - 1 : 11;
			sr_day.selectedIndex	= ((dayInPreviousMonth + occ_day.selectedIndex) - reminderPeriod);
		}
	}
}

function CheckItEmailReminder(f)
{
	thisDate			= new Date(); 
	occDate				= new Date(); 
	srDate				= new Date(); 

	with (f)
	{
		if (AssessAll(fname,	"09", "Please enter your first name") == false)		return false;
		if (AssessAll(lname,	"09", "Please enter your last name") == false)		return false;
		if (AssessAll(email,	"15", "Please enter your email address") == false)	return false;
	
		if (rs.selectedIndex == 0)
		{
			alert('Please choose an occasion');
			return false;
		}
		srDate.setDate(sr_day.value);
		srDate.setMonth(sr_month.value - 1);
		srDate.setFullYear(sr_year.value);

		if (srDate.getTime() <= thisDate.getTime())
		{
			alert('Please choose a valid reminder date');
			return false;
		}
	}
	return true;
}

function getThisDayName(d)
{
	var	todaysDay		= '';

	switch (d)
	{
		case 0: 	todaysDay = 'Sunday';   	break;
		case 1: 	todaysDay = 'Monday';   	break;
		case 2:		todaysDay = 'Tuesday';   	break;
		case 3: 	todaysDay = 'Wednesday';	break;
		case 4: 	todaysDay = 'Thursday';		break;
		case 5:		todaysDay = 'Friday';		break;
		case 6:		todaysDay = 'Saturday';  	break;
	}
	return  todaysDay;
}