/* create a random number to chose image */



var rand1 = Math.floor(Math.random()*15)+1;


/* create an array of images to utilise the rand outcome */

imageChoice = new Array(15);

imageChoice[1] = "thumb1.jpg";
imageChoice[2] = "thumb2.jpg";
imageChoice[3] = "thumb3.jpg";
imageChoice[4] = "thumb4.jpg";
imageChoice[5] = "thumb5.jpg";
imageChoice[6] = "thumb6.jpg";
imageChoice[7] = "thumb7.jpg";
imageChoice[8] = "thumb8.jpg";
imageChoice[9] = "thumb9.jpg";
imageChoice[10] = "thumb10.jpg";
imageChoice[11] = "thumb11.jpg";
imageChoice[12] = "thumb12.jpg";
imageChoice[13] = "thumb13.jpg";
imageChoice[14] = "thumb14.jpg";
imageChoice[15] = "thumb15.jpg";

/* write the images to the page */

function writeImage() {
document.write("<img src='images/"+imageChoice[rand1]+"' width='110' height='244'/>");
}


function writeDate(){

	var now = new Date();
	var minutes = now.getMinutes();
	var hours = now.getHours();
	var day = now.getDay();
	var date = now.getDate();
	var month = now.getMonth();
	var year = now.getYear();


	if (minutes < 10){
		minutes = "0" + minutes;
		}

	if (hours > 11){
		var half = "pm";
		hours = hours-12;
		}else{
		var half = "am";
		}

	if (hours == 0){
		hours = 12;
		}

if (day == 0){
day = "Sunday";
}
if (day == 1){
day = "Monday";
}
if (day == 2){
day = "Tuesday";
}
if (day == 3){
day = "Wednesday";
}
if (day == 4){
day = "Thursday";
}
if (day == 5){
day = "Friday";
}
if (day == 6){
day = "Saturday";
}

if (date == 1 || date == 21 || date == 31 || date == 2 || date == 22 || date == 3 || date == 23){
if (date == 1 || date == 21 || date == 31){
dateEnd = "st";
}
if (date == 2 || date == 22){
dateEnd = "nd";
}
if (date == 3 || date == 23){
dateEnd = "rd";
}
}else{
dateEnd = "th";
}


switch(month){
case 0 :
month = "January";
break;
case 1 :
month = "February";
break;
case 2 :
month = "March";
break;
case 3 :
month = "April";
break;
case 4 :
month = "May";
break;
case 5 :
month = "June";
break;
case 6 :
month = "July";
break;
case 7 :
month = "August";
break;
case 8 :
month = "September";
break;
case 9 :
month = "October";
break;
case 10 :
month = "November";
break;
case 11 :
month = "December";
break;
default :
month = "";
}


document.write(day + " : " + date + dateEnd + " : " + month + " : " + hours + ":" + minutes + ' ' + half)
}

function writeModified(){

var mod = document.lastModified;

var modDate = mod.charAt(9);
var modMonth = mod.substring(4,7);
var modYear = mod.substring(20,24);

document.write("© Copyright Flavours: "+ modDate +"/"+ modMonth +"/"+ modYear);
}

function printPage() {
window.print();
}