//(c)2002 George Alexander McIlwraith V (Quintinus Alexander) Used by permission [scripts.txt]

/* (c)2002 George Alexander McIlwraith V 


	Permission is granted for free use of this script within the Society 

	for Creative Anachronism, as long as the copyright information stays.  



	This script will write out the Current Date Anno Societatis

	including the year in roman numerals based on the local system time.  

	It will function Normally for just under 30 years. If in 30 years, I 

	need to rewrite this script, I will be royally (especially if I'm on the 

	throne by then) impressed that someone has used it that long.  

*/



//find date of local system computer

var xxx = new Date();

var year = xxx.getYear();

var asyear = 0;

var month = xxx.getMonth();

var today = xxx.getDate();

var monthtxt = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

var gram = new Array('th','st','nd','rd')

var uten = new Array('','I','II','III','IV','V','VI','VII','VIII','IX')

var gramm = 0;



//Netscape date fix

if(year < 2000)year = (year - 100) + 2000;



//Calculate AS Year

asyear = year - 1966

if (month > 3) asyear++;





//fix grammar

if (today == 1) gramm = 1;

if (today == 21) gramm = 1;

if (today == 31) gramm = 1;



if (today == 2) gramm = 2;

if (today == 22) gramm = 2;



if (today == 3) gramm = 3;

if (today == 23) gramm = 3;



//Write out first part of date

document.write("<p>Today's date is the "+ today + gram[gramm] +" day of "+ monthtxt[month] + ", Anno Societatis ");



//Convert year to Roman Numerals and write out



	if ( asyear > 59 ) { //69+

		document.write(" !!!THIS SCRIPT NEEDS TO BE RE WRITTEN!!! ");

		asyear = 0;

	}

	if ( asyear > 49 ) { // 50-59

		document.write("L");

		asyear = asyear - 50;

	}

	if ( asyear > 39 ) { 40-49

		document.write("XL");

		asyear = asyear - 40;

	}

	if ( asyear > 29 ) { 30-39

		document.write("XXX");

		asyear = asyear - 30;

	}

	if ( asyear < 10 ) document.write(uten[asyear]);



document.write("</p>");
