// JavaScript Document
<!-- Begin
function clrText(n) {
	document.getElementById(n).innerText="";
}
function pcal(giorno,mese,anno) {
// Preferences
// Use the followinf var to set your preferred style of calendar (english or italian)
	var english=false;
//  BodyBgColor
	var BodyBgColor ="00ccaa";
//	Event date bg color
	var EventBgColor= "00ccaa";
//	Repeted Event date bg color
	var RepEventBgColor= "00DDff";
//	Table Bg Color
	var	TableBgColor="FFFFFF";
// 	Page title 
	var	PageTitle="Pagina Calendario";	
	var HeadLine ="Calendario eventi";
	var HeadLineColor ="006600";	
	
	
	if (english) {
		monthnames = new Array( 
		"January", 
		"Februrary", 
		"March", 
		"April", 
		"May", 
		"June", 
		"July", 
		"August", 
		"September", 
		"October", 
		"November", 
		"December"); 
	}
	if (!(english)) {
		monthnames = new Array( 
		"Gennaio", 
		"Febbraio", 
		"Marzo", 
		"Aprile", 
		"Maggio", 
		"Giugno",
		"Luglio", 
		"Agosto", 
		"Settembre", 
		"Ottobre", 
		"Novembre", 
		"Dicembre"); 
	}
	monthdays = new Array(12); 
	monthdays[0]=31; 
	monthdays[1]=28; 
	monthdays[2]=31; 
	monthdays[3]=30; 
	monthdays[4]=31; 
	monthdays[5]=30; 
	monthdays[6]=31; 
	monthdays[7]=31; 
	monthdays[8]=30; 
	monthdays[9]=31; 
	monthdays[10]=30; 
	monthdays[11]=31; 

	var linkcount=0; 

	if (giorno==null) {
		todayDate=new Date(); 
	} else {
		todayDate=new Date(anno,mese-1,giorno)
	}

	adesso= new Date()
	document.open()
	document.write("<html>\n<head>\n<title>")
	document.write(PageTitle)	
	document.write("</title>\n</head>\n")
	document.write("<body bgcolor='#")
	document.write(BodyBgColor)
	document.write("'>\n")
	document.write("<SCRIPT LANGUAGE='JavaScript' SRC='calendar.js'></SCRIPT>\n")
	
	document.write("<div id='Layer1' style='position:absolute; width:600px; height:300px; z-index:1; left: 100px; top: 10px;'>\n")
	document.write("<div align='center'>\n"
	+ "<font color='#"
	+ HeadLineColor
	+ "' size='+6'>"
	+ HeadLine
	+ "</font></div></p>\n")

	function addlink( day,month,year, href,comment) { 
		var entry = new Array(4); 
		entry[0] = day; 
		entry[1] = month; 
		entry[2] = year; 
		entry[3] = href;
		entry[4] = comment;
		this[linkcount++] = entry; 
	}
	 
	Array.prototype.addlink = addlink; 
	linkdays = new Array(); 
// ===========================================================================
	<!-- here you should put your events and related Href....--> 
	c01="Agosto insieme, 2000";
	c02="Veni, vini vinci - 2000";
	c11="Festa di Fine Squola 2001";
	c12="Luglio insieme 2001";
	c31="Festa del Solstizio d\\'Estate - 2003";
	c32="Festa Medioevale - 2003";
	c33="Corso base di Stencil";
	c34="Festa di Fine Scuola 2005",
	linkdays.addlink(19,8,2000,"grandi 2000/index.htm",c01);
	linkdays.addlink(12,11,2000,"vvv 2000/index.htm",c02);
	linkdays.addlink(24,6,2001,"scuola2001/index.htm",c11);
	linkdays.addlink(15,7,2001,"grandi2001/index.htm",c12);
	linkdays.addlink(21,6,2003,"solstizio 2003/index.htm",c31);
	linkdays.addlink(15,6,2003,"2.htm","Festa di Fine Squola - 2003");
	linkdays.addlink(3,8,2003,"medioevale 2003/index.htm",c32);	
	linkdays.addlink(7,9,2003,"stencil/index.htm",c33);	
	linkdays.addlink(7,1,0,"2.htm","Compleanno di Marco");
	linkdays.addlink(5,6,2005,"scuola2005/index.htm",c34);
// ===========================================================================	
	if (english) {
		thisday=todayDate.getDay(); 
	} else {
		thisday=todayDate.getDay()-1; 
		if (thisday<0)  thisday=6;
	}
	thismonth=todayDate.getMonth(); 
	thisdate=todayDate.getDate(); 
	thisyear=todayDate.getYear(); 
	thisyear = thisyear % 100; 
	thisyear = ((thisyear < 50) ? (2000 + thisyear) : (1900 + thisyear)); 
	if (((thisyear % 4 == 0)  
		&& !(thisyear % 100 == 0)) 
		||(thisyear % 400 == 0)) monthdays[1]++; 
		startspaces=thisdate; 
	while (startspaces > 7) startspaces-=7; 
	startspaces = thisday - startspaces + 1; 
	if (startspaces < 0) startspaces+=7; 
//
//	modify here the table apperance 
	document.write("<table border=2 bgcolor='#"
	+ TableBgColor
	+ "' align='center'"); 
	document.write("bordercolor=black><font color=black>"); 
//   --- end 
	document.write("<tr><td bordercolor='#"
	+ TableBgColor
	+ "'>" + "<img src='frsx.gif'  onClick='pcal("
	+ thisdate + "," + thismonth + "," + thisyear
	+ ")'></td>"
	+ "<td colspan=5 bordercolor='#"
	+ TableBgColor
	+ "'><center><strong>"
	+ monthnames[thismonth] + "&nbsp;" + thisyear  + "</strong></center></font></td>"
	+ "<td bordercolor='#"
	+ TableBgColor
	+ "'><img src='frdx.gif'  onClick='pcal("
	+ thisdate + "," + (thismonth+2) + "," + thisyear
	+ ")'>" 
	+ "</td></tr>"); 
	document.write("<tr>"); 
	if (english) document.write("<td align=center>Su</td>"); 
	if (english) document.write("<td align=center>M</td>"); 
	if (english) document.write("<td align=center>Tu</td>"); 
	if (english) document.write("<td align=center>W</td>"); 
	if (english) document.write("<td align=center>Th</td>"); 
	if (english) document.write("<td align=center>F</td>"); 
	if (english) document.write("<td align=center>Sa</td>");  
	if (!(english)) document.write("<td align=center>Lun</td>"); 
	if (!(english)) document.write("<td align=center>Mar</td>"); 
	if (!(english)) document.write("<td align=center>Mer</td>"); 
	if (!(english)) document.write("<td align=center>Gio</td>"); 
	if (!(english)) document.write("<td align=center>Ven</td>"); 
	if (!(english)) document.write("<td align=center>Sab</td>");  
	if (!(english)) document.write("<td align=center>Dom</td>"); 
	document.write("</tr>"); 
	document.write("<tr>"); 
	for (s=0;s<startspaces;s++) { 
	document.write("<td> </td>"); 
} 
count=1; 
while (count <= monthdays[thismonth]) { 
	for (b = startspaces;b<7;b++) { 
		linktrue=false; 
		swtd=true;
		for (c=0;c<linkdays.length;c++) { 		
			if (linkdays[c] != null) { 
				if (((linkdays[c][2]==thisyear) || (linkdays[c][2]==0 ))&&(linkdays[c][1]==thismonth + 1) && (linkdays[c][0]==count)) { 
					
					document.write("   <td bgcolor='#")
					if (linkdays[c][2]!=0 ) {
						document.write(EventBgColor)
					} else {
						document.write(RepEventBgColor)
					}
					document.write("'><a href=\"" + linkdays[c][3] + "\"  onMouseOver=\"document.getElementById('com1').innerText='" + linkdays[c][4] + "'\"  onMouseOut=\"clrText('com1')\">"); 
					linktrue=true; 
					swtd=false
				} 
		   } 
		} 
		if (swtd)	document.write("   <td>");
		if (count==adesso.getDate()) { 
			if  ((thismonth==adesso.getMonth()) && (thisyear==adesso.getYear())			){
				document.write("<font color='FF0000'><strong>"); 
			}
		} 
		if (count <= monthdays[thismonth]) { 
			document.write(count); 
			} else { 
			document.write(" "); 
		} 
		if (count==adesso.getDate()) { 
			if  ((thismonth==adesso.getMonth()) && (thisyear==adesso.getYear())			){
				document.write("</strong></font>\n"); 
			}
		} 
		if (linktrue) 
			document.write("</a>"); 
			document.write("</td>\n"); 
			count++; 
		} 
		document.write("</tr>\n"); 
		document.write("<tr>\n"); 
		startspaces=0; 
	} 
	document.write("</table>\n"); 
	document.write("<p align='center'><strong><font color='#006600'><span id='com1'></span></font></strong></p>")
	document.write("</div>\n"); 
	document.write("</body>\n</html>\n")
	document.close()
	
}

