var ns4 = (document.layers)? true:false;
var ns6 = (document.getElementById)? true:false;
var ie4 = (document.all)? true:false;

timeA = new Date();
ENmonth_Str = new Array("January","February","Mars","April","May","June","July","August","September","October","November","December")
ENday_Str = new Array("S","M","T","W","T","F","S")
FRmonth_Str = new Array("Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre")
FRday_Str = new Array("D","L","M","M","J","V","S")
todayColor = "FFFF00"
weekendColor = "99FF99"
alarmColor = "FF8000"
alarmDayColor = "FF0000"
white = "FFFFDD"
conteur = 0
interuptor = false
function Timex(interuptor){
		conteur++
		window.location.hash = conteur +"-"+ (1440-(timeA.getHours()*60+timeA.getMinutes())) //1440=min ds 1 jour
		timerTo = setTimeout("Timex(true)",(1440-(timeA.getHours()*60+timeA.getMinutes()))*60*1000)
	if (interuptor == true){
		window.location.reload()
		//clearTimeout(timerTo)
		interuptor = false
	}
}
function preMonth(){
	if (timeA.getMonth()==0){
		ixMonth = 12
		theYear = timeA.getFullYear()-1
	} else {
		ixMonth = timeA.getMonth()
		theYear = timeA.getFullYear()
	}
timeA = new Date(ENmonth_Str[ixMonth-1]+" "+timeA.getDate()+", "+theYear)
writeZ()
}
function nexMonth(){
	if (timeA.getMonth()==11){
		ixMonth = -1
		theYear = timeA.getFullYear()+1
	} else {
		ixMonth = timeA.getMonth()
		theYear = timeA.getFullYear()
	}
timeA = new Date(ENmonth_Str[ixMonth+1]+" "+timeA.getDate()+", "+theYear)
writeZ()
}

function writeZ(){
FirstDayOfMonth = new Date(ENmonth_Str[timeA.getMonth()]+" 1, "+timeA.getFullYear())
dayStart = FirstDayOfMonth.getDay()
var inZone
inZone = "<TABLE width=120 border=0 cellpadding=0 cellspacing=0><TR><TD><FONT color=0000FF>"+ENmonth_Str[timeA.getMonth()]+"<BR>"+timeA.getFullYear()+"</FONT></TD><TD></TD></TR></TABLE>"

inZone += "<TABLE border=1 cellpadding=0 cellspacing=0 bgcolor=CCCCFF bordercolordark=FFFFFF bordercolorlight=999999><TR>"
for (i=0 ; i<7 ; i++){//Start empty case
	inZone += "<TD align=center>"+ENday_Str[i]+"</TD>"
	if (i==6){
		inZone += "</TR><TR>"
	}
}
for (i=0 ; i<dayStart ; i++){//Start empty case
	inZone += "<TD>&nbsp;</TD>"
}
for (i=dayStart, j=1 ; i<=6 ; i++, j++){//First week
	if (j==timeA.getDate()){
		color = todayColor
	} else {
		if (i==0 || i==6){
			color = weekendColor
		} else {
			color = white
		}
	}
	inZone += "<TD bgcolor="+color+">"+j+"</TD>"
}
//Find last Date of Month
if (timeA.getMonth()==1){
	if (timeA.getFullYear()%4==0){
		endDate = 29
	} else {
		endDate = 28
	}
} else {
	if (timeA.getMonth()>=7){
		if (timeA.getMonth()%2 == 0){
			endDate = 30
		} else {
			endDate = 31
		}
	} else {
		if (timeA.getMonth()%2 == 0){
			endDate = 31
		} else {
			endDate = 30
		}
	}
}
for (i=j, k=0 ; i<=endDate ; i++ , k++){//Write month starting second week
	if (k%7 == 0){
		inZone += "</TR><TR>"
	}
	if (i==timeA.getDate()){
		color = todayColor
	} else {
		if (k%7 == 0 || k%7 == 6%7){
			color = weekendColor
		} else {
			color = white
		}
	}
	inZone += "<TD bgcolor="+color+">"+i+"</TD>"	
}
	inZone += "</TR></TABLE>"
if (ns4){
	document.zone.document.open()
	document.zone.document.write(inZone)
	document.zone.document.close()
} else if (ns6){
    document.getElementById("zone").innerHTML = inZone
} else if (ie4){
    document.all.zone.innerHTML = inZone
}
}