
//*** write date selection
// ************

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


document.write("<img border='0' src='http://www.bizzyballoons.f2s.com/makeimage.php' width='0' height='0'><br>");


var nthismonth=0;
var maxdayss=0;
var LastHourForDeliveriesNextDay=15;	// 24 hr clock (only hours 0-23)
var SatLastHourForDeliveriesNextDay=9;	// 24 hr clock (only hours 0-23)


// max 28 days pre-order or maxdays needs to be recalculated
var NumPrintedDates=80;		
//var NumPrintedDates=28;		

// put dates that PO cant deleiver in here
NoDeliveryDays = new Array(
15,8,2006,
16,8,2006,
17,8,2006,
18,8,2006,
19,8,2006,
20,8,2006,
21,8,2006,
22,8,2006,
23,8,2006,
24,8,2006,
25,8,2006,
26,8,2006,
27,8,2006,
28,8,2006,
29,8,2006,
30,8,2006
);
var NumberNoDeliveryDays=NoDeliveryDays.length/3;

thismonth = getCookie("themonthC");
if (thismonth!=null)
{
thisyear = getCookie("theyearC");
thisday = getCookie("thedayC");
thisweekday = getCookie("theweekdayC");
thishour = getCookie("thehourC");
}
else
{
today = new Date();
thismonth = today.getMonth()+1;
thisyear = today.getFullYear();
thisday = today.getDate();
thisweekday=today.getDay();
thishour = today.getHours();
}
var thisactualweekday=0;



montharray=new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
Txday = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
Txmonth = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul" ,"Aug", "Sep", "Oct", "Nov" ,"Dec");
Txdatexx= new Array("xx","st","nd","rd","th","th","th","th","th","th","th","th","th","th","th","th","th","th","th","th","th","st","nd","rd","th","th","th","th","th","th","th","st");



maxdays=montharray[thismonth-1];


nthismonth=thismonth;
nthismonth++;
if (nthismonth==13) nthismonth=1;
maxdayss=montharray[nthismonth-1];

nnthismonth=nthismonth;
nnthismonth++;
if (nnthismonth==13) nnthismonth=1;
maxdaysss=montharray[nnthismonth-1];

if (thismonth==2)
{
if ((thisyear/4)!=parseInt(thisyear/4)) maxdays=28;
else maxdays=29;
}

thisactualweekday=thisweekday;

// is it sunday
if (thisweekday==0) 
	{
	thisday++;
	thisweekday++;
	if (thisweekday==7) thisweekday=0;
	
		if (thisday>maxdays)
		{
		thisday=1;
		thismonth++;
		if (thismonth==13)
			{
			thismonth=1;
			thisyear++;
			}
		}
	}


// add a day to today for next day delivery
	thisday++;
	thisweekday++;
	if (thisweekday==7) thisweekday=0;
	
		if (thisday>maxdays)
		{
		thisday=1;
		thismonth++;
		if (thismonth==13)
			{
			thismonth=1;
			thisyear++;
			}
		}
// is it sunday
if (thisweekday==0) 
	{
	thisday++;
	thisweekday++;
	if (thisweekday==7) thisweekday=0;
	
		if (thisday>maxdays)
		{
		thisday=1;
		thismonth++;
		if (thismonth==13)
			{
			thismonth=1;
			thisyear++;
			}
		}
	}


// check hour for last chance of deliveries next day
// if past this hour then its the day after next for delivery (unless is sunday afternoon now!)
if (((thishour>=SatLastHourForDeliveriesNextDay)&&(thisactualweekday==6))|| ((thishour>=LastHourForDeliveriesNextDay)&&(thisactualweekday!=0))) 
	{
	thisday++;
	thisweekday++;
	if (thisweekday==7) thisweekday=0;
	
		if (thisday>maxdays)
		{
		thisday=1;
		thismonth++;
		if (thismonth==13)
			{
			thismonth=1;
			thisyear++;
			}
		}
	}
// is it sunday
if (thisweekday==0) 
	{
	thisday++;
	thisweekday++;
	if (thisweekday==7) thisweekday=0;
	
		if (thisday>maxdays)
		{
		thisday=1;
		thismonth++;
		if (thismonth==13)
			{
			thismonth=1;
			thisyear++;
			}
		}
	}



var Browser;
Browser=navigator.appName;

