
/*
-----------------------
coptic calc help
----------------------
The coptic leap year happens one year before the normal leap year. So 2003
is a coptic leap year. So Sept 11 is Nasi 6 and all days get pushed forward 1 so 
Christmas is Jan 8 2004. Up until Feb 29 when all the days return to normal.
So Days are pushed forward from Sept 11  (Nasi 6) 2003 until Feb29 2004
*/
today = new Date()
myDate = today.getDate()
month = today.getMonth() + 1
year = today.getFullYear()

var cday = 0
var cday2
var cmonth = 0
var cyear= 0
var eday = 0
var Feasts=0
var icon=0

//var specialDate = 0
var mart = "The Martyrdom of "
var comm = "The Commemoration of "
var depa = "The Departure of "

function full(){
	w=window.open('desktop2.htm','_self', 'fullscreen=yes')
}

// resets the date to todays date
function reset(){
	today = new Date()
	date = today.getDate()
	month = today.getMonth() + 1
	year = today.getFullYear()
//	specialDate = 0
	day = date
	main(0)
}
main(0)
function main(number){
	copticdate(number)
	//refresh body
	//document.bgColor = "#3A6EA5"
	//document.getElementById("body").innerHTML = generateHTML()
	
	
	
	//mm = '<marquee scrollamount="4" width=420 bgcolor="#3A6EA5" id="scroll">'
	//mm += scrollhtml()
	//mm += '<\marquee>'
	//document.getElementById("mm").innerHTML = mm
	/*alert("Scrolling is" + document.getElementById("body").scrollHeight + 
		"\n available height is"+ screen.availHeight);
		*/
}

function copticdate(number){
	//todays date plus number of days clicking next
	today.setDate(today.getDate()+number)
	myDate = today.getDate()
	month = today.getMonth()+1
	year = today.getFullYear()


	
	// calculates when the day is pushed forward NOTE: doesnt include Nasi 6
	if (((year+1)%4==0 && ((month >= 9 && myDate >= 11)  || month >= 10)) // if next year is a leap year and  its greater than sept 12
	|| ((year)%4==0 && month < 3)) { // if  its a leap year and less than feb 29
	   eday=-1
	}
	 
	offset = new Array();
	offset[1] = 8;
	offset[2] = 7;
	offset[3] = 9;	
	offset[4] = 8;
	offset[5] = 8;
	offset[6] = 7;
	offset[7] = 7;
	offset[8] = 6;
	offset[9] = 0;
	offset[10] = 10;
	offset[11] = 9;
	offset[12] = 9;
	
	
	//all months except month 9
	if (month < 9 || month > 9) {
		temp = 30 + myDate - offset[month]  + eday
		cday = (temp-1)%30 + 1  // mod is range from 1 - 30 instead of  0 - 29
		cmonth = 3 + month + Math.floor(temp/31) // 31 used so if its 31 its a next month
		cmonth = (cmonth-1)%12 + 1 // cmonth range from 1 - 12
	
	}
	
	
	//month 9
	else if (myDate <= 5 && month == 9) {
		cday = 30 + myDate - 5
		cmonth = 12
	}
	
	else if (myDate > 5  && myDate < 11 && month == 9) {
		cday = myDate - 5
		cmonth = 13
	}
	else if (myDate >= 11 && month == 9) {
		cday = myDate - 10 + eday
		cmonth = 1
		// if its a leap year
		if (cday == 0) {
			cday = 6
			cmonth = 13
		}
	}
	
	
	//Year
	if (month >= 1 && month <= 8 || month == 9 && myDate < 11) {
		cyear = year - 284
	}
	
	if (month >= 10 || month == 9 && myDate > 10) {
		cyear = year - 283
	}
	//Coptic day full
	if (cday==1)
	{cday2="st"}
	if (cday==2)
	{cday2="nd"}
	if (cday==3)
	{cday2="rd"}
	if (cday>3)
	{cday2="th"}
}
//Month Full
cmonth2=new Array(13);
cmonth2[1]="Tute";
cmonth2[2]="Babah";
cmonth2[3]="Hatour";
cmonth2[4]="Kiahk";
cmonth2[5]="Tubah";
cmonth2[6]="Amshir";
cmonth2[7]="Baramhat";
cmonth2[8]="Baramoudah";
cmonth2[9]="Bashans";
cmonth2[10]="Baounah";
cmonth2[11]="Abib";
cmonth2[12]="Misra";
cmonth2[13]="El-Nasi";


//*************Feasts**************

//*******************General********************





