function tidyDate (workingDate)
{
var monthNames = new Array ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
var dayNames = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var thisDayName = dayNames[workingDate.getDay()];
var thisDay = workingDate.getDate();
var thisMonth = monthNames[workingDate.getMonth()];
var thisYear = workingDate.getFullYear();
var formattedDate =  thisDayName +  ", " + thisDay +  "-" + thisMonth + "-" + thisYear;
return  formattedDate;
}


function sortDates(diarydates) {
  var x, y, holder;
  // The Bubble Sort method.
  for(x = 0; x < diarydates.length; x++) {
    for(y = 0; y < (diarydates.length-1); y++) {
      if(diarydates[y][3] > diarydates[y+1][3]) {
        holder = diarydates[y+1];
        diarydates[y+1] = diarydates[y];
        diarydates[y] = holder;
      }
    }
  }


}

var diarydates = new Array();

//******* EDIT AREA FOR 'LATEST NEWS' HEADLINES AND FILES !!! ***************

//START//
diarydates[diarydates.length] = new Array();

diarydates[diarydates.length-1][0] =  "New Reception children full-time today";
diarydates[diarydates.length-1][1] =   "";
diarydates[diarydates.length-1][2] =   "No more half days from now on!";
tempDate = new Date ();
tempDate.setMonth(09);			//Enter the month as a number (0-Jan, 11-Dec)
tempDate.setDate(4);			//Enter the date (a number between 1 and 31) 
tempDate.setFullYear(2007);			//Enter the year
diarydates[diarydates.length-1][3] =  tempDate;
//END//

//START//
diarydates[diarydates.length] = new Array();

diarydates[diarydates.length-1][0] =  "Harvest Festival";
diarydates[diarydates.length-1][1] =   "";
diarydates[diarydates.length-1][2] =   "For children only";
tempDate = new Date ();
tempDate.setMonth(09);			//Enter the month as a number (0-Jan, 11-Dec)
tempDate.setDate(16);			//Enter the date (a number between 1 and 31) 
tempDate.setFullYear(2007);			//Enter the year
diarydates[diarydates.length-1][3] =  tempDate;
//END//

//START//
diarydates[diarydates.length] = new Array();

diarydates[diarydates.length-1][0] =  "Parent's Evening";
diarydates[diarydates.length-1][1] =   "";
diarydates[diarydates.length-1][2] =   "From 5.30 - 8pm";
tempDate = new Date ();
tempDate.setMonth(09);			//Enter the month as a number (0-Jan, 11-Dec)
tempDate.setDate(16);			//Enter the date (a number between 1 and 31) 
tempDate.setFullYear(2007);			//Enter the year
diarydates[diarydates.length-1][3] =  tempDate;
//END//

//START//
diarydates[diarydates.length] = new Array();

diarydates[diarydates.length-1][0] =  "School Photographer";
diarydates[diarydates.length-1][1] =   "";
diarydates[diarydates.length-1][2] =   "Don't forget to look smart today!";
tempDate = new Date ();
tempDate.setMonth(09);			//Enter the month as a number (0-Jan, 11-Dec)
tempDate.setDate(16);			//Enter the date (a number between 1 and 31) 
tempDate.setFullYear(2007);			//Enter the year
diarydates[diarydates.length-1][3] =  tempDate;
//END//


//START//
diarydates[diarydates.length] = new Array();

diarydates[diarydates.length-1][0] =  "Parent's Evening";
diarydates[diarydates.length-1][1] =   "";
diarydates[diarydates.length-1][2] =   "From 5.30 - 8pm";
tempDate = new Date ();
tempDate.setMonth(09);			//Enter the month as a number (0-Jan, 11-Dec)
tempDate.setDate(18);			//Enter the date (a number between 1 and 31) 
tempDate.setFullYear(2007);			//Enter the year
diarydates[diarydates.length-1][3] =  tempDate;
//END//

//START//
diarydates[diarydates.length] = new Array();

diarydates[diarydates.length-1][0] =  "Break up for Half term";
diarydates[diarydates.length-1][1] =   "";
diarydates[diarydates.length-1][2] =   "No school from Monday 22nd - Friday 26th October";
tempDate = new Date ();
tempDate.setMonth(09);			//Enter the month as a number (0-Jan, 11-Dec)
tempDate.setDate(19);			//Enter the date (a number between 1 and 31) 
tempDate.setFullYear(2007);			//Enter the year
diarydates[diarydates.length-1][3] =  tempDate;
//END//


//START//
diarydates[diarydates.length] = new Array();

diarydates[diarydates.length-1][0] =  "Return to school";
diarydates[diarydates.length-1][1] =   "";
diarydates[diarydates.length-1][2] =   "...and the mornings are getting colder and darker...";
tempDate = new Date ();
tempDate.setMonth(09);			//Enter the month as a number (0-Jan, 11-Dec)
tempDate.setDate(29);			//Enter the date (a number between 1 and 31) 
tempDate.setFullYear(2007);			//Enter the year
diarydates[diarydates.length-1][3] =  tempDate;
//END//

//START//
diarydates[diarydates.length] = new Array();

diarydates[diarydates.length-1][0] =  "Dance club for Year 3 starts";
diarydates[diarydates.length-1][1] =   "";
diarydates[diarydates.length-1][2] =   "Best foot forward.....";
tempDate = new Date ();
tempDate.setMonth(10);			//Enter the month as a number (0-Jan, 11-Dec)
tempDate.setDate(1);			//Enter the date (a number between 1 and 31) 
tempDate.setFullYear(2007);			//Enter the year
diarydates[diarydates.length-1][3] =  tempDate;
//END//

//START//
diarydates[diarydates.length] = new Array();

diarydates[diarydates.length-1][0] =  "Christmas Concerts";
diarydates[diarydates.length-1][1] =   "";
diarydates[diarydates.length-1][2] =   "Concerts start today for four mornings - 10th, 11th, 12th and 13th of December";
tempDate = new Date ();
tempDate.setMonth(11);			//Enter the month as a number (0-Jan, 11-Dec)
tempDate.setDate(10);			//Enter the date (a number between 1 and 31) 
tempDate.setFullYear(2007);			//Enter the year
diarydates[diarydates.length-1][3] =  tempDate;
//END//

//START//
diarydates[diarydates.length] = new Array();

diarydates[diarydates.length-1][0] =  "Theatre Visit";
diarydates[diarydates.length-1][1] =   "";
diarydates[diarydates.length-1][2] =   "A production of 'Wind in the Willows' in the afternoon (children only)";
tempDate = new Date ();
tempDate.setMonth(11);			//Enter the month as a number (0-Jan, 11-Dec)
tempDate.setDate(13);			//Enter the date (a number between 1 and 31) 
tempDate.setFullYear(2007);			//Enter the year
diarydates[diarydates.length-1][3] =  tempDate;
//END//

sortDates(diarydates);



// *******END OF EDIT AREA !!! ***************
