
function todaydate() {

	days = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
	months = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
	ths = new Array("st","nd","rd","th");
	
	th = ths[3];
	
	d = new Date()
	
	if(d.getDate() == 1 || d.getDate() == 21 || d.getDate() == 31){th = ths[0];}
	if(d.getDate() == 2 || d.getDate() == 22 ){th = ths[1];}
	if(d.getDate() == 3 || d.getDate() == 23 ){th = ths[2];}
	
	dDay = days[d.getDay()]
	dMonth = months[d.getMonth()]
	
	tempdate = dDay + " " + d.getDate() + th + " " + dMonth + " " + d.getFullYear()
}



function nowTime(){
	rightNow = new Date();
	timezone = rightNow.getTimezoneOffset()/60;
	nowHours = rightNow.getHours();
	nowMonth = rightNow.getMonth();
	nowDate  = rightNow.getDate();
	nowDay   = rightNow.getDay();
	
	// is it BST??
	bst = 0;
	if(nowMonth > 2 && nowMonth <10) {bst = 1;}
	// after last sunday in march??
	// could be simpler in one line but harder to remember why:
	//  if((nowDate - nowDay) == 25){bst = 1}
	if(nowMonth == 2){
		if(nowDate == 25 && nowDay <= 0){bst = 1}
		if(nowDate == 26 && nowDay <= 1){bst = 1}
		if(nowDate == 27 && nowDay <= 2){bst = 1}
		if(nowDate == 28 && nowDay <= 3){bst = 1}
		if(nowDate == 29 && nowDay <= 4){bst = 1}
		if(nowDate == 30 && nowDay <= 5){bst = 1}
		if(nowDate == 31 && nowDay <= 6){bst = 1}
		}
	// after last sunday in october??
	if(nowMonth == 9){
		if(nowDate == 25 && nowDay <= 0){bst = 0}
		if(nowDate == 26 && nowDay <= 1){bst = 0}
		if(nowDate == 27 && nowDay <= 2){bst = 0}
		if(nowDate == 28 && nowDay <= 3){bst = 0}
		if(nowDate == 29 && nowDay <= 4){bst = 0}
		if(nowDate == 30 && nowDay <= 5){bst = 0}
		if(nowDate == 31 && nowDay <= 6){bst = 0}
		}
	// southern hemishpere summer time - dst
	dst = 1;
	if(bst == 0){dst = 1;}

	ukHours = nowHours + timezone + bst;
	cnHours = nowHours + timezone + 8;
	auHours = nowHours + timezone + 10 + dst;
	usHours = nowHours + timezone - 5;
	 
	
	nowMins = rightNow.getMinutes();
	if(nowMins < 10){nowMins = "0" + nowMins;}
	
	if(ukHours < 10){ukHours = "0" + ukHours;}
	ukTime = ukHours + ":" + nowMins;

	if(auHours >= 24 ){auHours = auHours - 24;}
	if(auHours < 10){auHours = "0" + auHours;}
	auTime =  auHours + ":" + nowMins;

	if(cnHours >= 24 ){cnHours = cnHours - 24;}
	if(cnHours < 10){cnHours = "0" + cnHours;}
	cnTime =  cnHours + ":" + nowMins;

	if(usHours < 0 ){usHours = usHours + 24;}
	if(usHours < 10){usHours = "0" + usHours;}
	usTime =  usHours + ":" + nowMins;
}


