function show_calendar(targetOBJ, lan, color)
{
	var HtmlFinal='';

	if(lan=='it')
	{
		monthnames = new Array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre");
		days = new Array("Lun", "Mar", "Mer", "Gio", "Ven", "Sab", "Dom");
	}
	else
	{
		monthnames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
		days = new Array("Mo", "Tu", "We", "Th", "Fr", "Sa", "Su");
	}

	var linkcount=0;
	function addlink(month, day, href) {
	var entry = new Array(3);
	entry[0] = month;
	entry[1] = day;
	entry[2] = href;
	this[linkcount++] = entry;
	}
	Array.prototype.addlink = addlink;
	linkdays = new Array();
	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;
	todayDate=new Date();
	thisday=todayDate.getDay();
	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 + 0;
	if (startspaces < 0) startspaces+=7;
	HtmlFinal=HtmlFinal+"<table cellpadding=\"0\" cellspacing=\"0\" style=\"margin:0px;color:"+color+";font-size:8pt;\" >";
	HtmlFinal=HtmlFinal+"<tr><td colspan=7><div style=\"margin-top:3mm;margin-bottom:3mm;text-align:center;font-weight:bold;\">" 
	+ monthnames[thismonth] + " " + thisyear 
	+ "</div></td></tr>";
	HtmlFinal=HtmlFinal+"<tr>";
	HtmlFinal=HtmlFinal+"<td style=\"width:30px;height:20px;border-bottom:1px;border-bottom-style:solid;border-bottom-color:"+color+";\" align=center>"+days[0]+"</td>";
	HtmlFinal=HtmlFinal+"<td style=\"width:30px;height:20px;border-bottom:1px;border-bottom-style:solid;border-bottom-color:"+color+";\" align=center>"+days[1]+"</td>";
	HtmlFinal=HtmlFinal+"<td style=\"width:30px;height:20px;border-bottom:1px;border-bottom-style:solid;border-bottom-color:"+color+";\" align=center>"+days[2]+"</td>";
	HtmlFinal=HtmlFinal+"<td style=\"width:30px;height:20px;border-bottom:1px;border-bottom-style:solid;border-bottom-color:"+color+";\" align=center>"+days[3]+"</td>";
	HtmlFinal=HtmlFinal+"<td style=\"width:30px;height:20px;border-bottom:1px;border-bottom-style:solid;border-bottom-color:"+color+";\" align=center>"+days[4]+"</td>";
	HtmlFinal=HtmlFinal+"<td style=\"width:30px;height:20px;border-bottom:1px;border-bottom-style:solid;border-bottom-color:"+color+";\" align=center>"+days[5]+"</td>";
	HtmlFinal=HtmlFinal+"<td style=\"width:30px;height:20px;border-bottom:1px;border-bottom-style:solid;border-bottom-color:"+color+";\" align=center>"+days[6]+"</td>"; 
	HtmlFinal=HtmlFinal+"</tr>";
	HtmlFinal=HtmlFinal+"<tr>";
	for (s=0;s<startspaces;s++) {
	HtmlFinal=HtmlFinal+"<td style=\"height:20px;\"></td>";
	}
	count=1;
	while (count <= monthdays[thismonth]) {
	for (b = startspaces;b<7;b++) {
	linktrue=false;
	HtmlFinal=HtmlFinal+"<td style=\"height:20px;vertical-align:middle;text-align:center;\">";
	for (c=0;c<linkdays.length;c++) {
	if (linkdays[c] != null) {
	if ((linkdays[c][0]==thismonth + 1) && (linkdays[c][1]==count)) {
	HtmlFinal=HtmlFinal+"<a href=\"" + linkdays[c][2] + "\">";
	linktrue=true;
	}
	}
	}
	if (count==thisdate) {
	HtmlFinal=HtmlFinal+"<div style=\"font-weight:bold;width:25px;height:17px;border:1px;border-style:solid;border-color:"+color+";font-size:11pt;\">";
	}
	if (count <= monthdays[thismonth]) {
	HtmlFinal=HtmlFinal+count;
	}
	else {
	HtmlFinal=HtmlFinal+" ";
	}
	if (count==thisdate) {
	HtmlFinal=HtmlFinal+"</div>";
	}
	if (linktrue)
	HtmlFinal=HtmlFinal+"</a>";
	HtmlFinal=HtmlFinal+"</td>";
	count++;
	}
	HtmlFinal=HtmlFinal+"</tr>";
	HtmlFinal=HtmlFinal+"<tr>";
	startspaces=0;
	}

	//LINEA DI SEPARAZIONE
	HtmlFinal=HtmlFinal+"<tr><td colspan=\"7\" style=\"height:25px;vertical-align:middle;text-align:center;\"><hr style=\"border:0px;width:100%;border-bottom:1px;border-bottom-style:solid;border-bottom-color:"+color+";\" /></td></tr>"
	
	//POSTO PER L'OROLOGIO
	HtmlFinal=HtmlFinal+"<tr><td id=\"watch\" colspan=\"7\" style=\"height:25px;vertical-align:middle;text-align:left; font-size:11pt;\"></td></tr>";
	HtmlFinal=HtmlFinal+"</table>";

	getObject(targetOBJ).innerHTML=HtmlFinal;
	
// 	InsWatch();
}



function InsWatch()
{
	krucial = new Date;
	heure = krucial.getHours();
	min = krucial.getMinutes();
	sec = krucial.getSeconds();
	jour = krucial.getDate();
	mois = krucial.getMonth()+1;
	annee = krucial.getFullYear();
	if (sec < 10)
		sec0 = "0";
	else
		sec0 = "";
	if (min < 10)
		min0 = "0";
	else
		min0 = "";
	if (heure < 10)
		heure0 = "0";
	else
		heure0 = "";
	DinaHeure = heure0 + heure + ":" + min0 + min + ":" + sec0 + sec;
	
	if(getObject('watch')) getObject('watch').innerHTML=DinaHeure;
	
	setTimeout("InsWatch()", 1000)
}
