document.write('<span id="clock"></span>');

DaysofWeek = new Array()
	DaysofWeek[0]="Sunday"
	DaysofWeek[1]="Monday"
	DaysofWeek[2]="Tuesday"
	DaysofWeek[3]="Wednesday"
	DaysofWeek[4]="Thursday"
	DaysofWeek[5]="Friday"
	DaysofWeek[6]="Saturday"

Months = new Array()
	Months[0]="January"
	Months[1]="February"
	Months[2]="March"
	Months[3]="April"
	Months[4]="May"
	Months[5]="June"
	Months[6]="July"
	Months[7]="August"
	Months[8]="September"
	Months[9]="October"
	Months[10]="November"
	Months[11]="December"

dte = new Date();
base = dte.valueOf()-27830609;
quant = 10000+Math.round((dte.valueOf()-1133527830609)/40000);	// increase by 1 every 40 seconds

function upclock(){
	dte = new Date();
	hrs = dte.getHours();
	min = dte.getMinutes();
	sec = dte.getSeconds();
	day = DaysofWeek[dte.getDay()]
	date = dte.getDate()
	month = Months[dte.getMonth()]
	year = dte.getFullYear()

	if (date == 1 || date == 21 || date == 31) ender = "st";
	else if (date == 2 || date == 22) ender = "nd";
	else if (date == 3 || date == 23) ender = "rd";
	else ender = "th";

	if (12 < hrs) {
		apm="pm";
		hrs-=12;
		}
	else apm="am";

	if (hrs == 0) hrs=12;
	if (min<=9) min="0"+min;
	if (sec<=9) sec="0"+sec;

	ran_number= Math.random(); 
	if (ran_number<0.3) quant = 10000+Math.round((dte.valueOf()-base)/10000);

	clock.innerHTML = day+', '+month+' '+date+ender+', '+year+' - '+hrs+':'+min+' '+apm
		+'<br>Current index: '+quant+' degrees, schools, colleges & online universities<br>';
	}

setInterval("upclock()",1000);
