YAHOO.widget.Calendar2up_DE_Cal = function(id, containerId, monthyear, selected) {
	if (arguments.length > 0)
	{
		this.init(id, containerId, monthyear, selected);
	}
}

YAHOO.widget.Calendar2up_DE_Cal.prototype = new YAHOO.widget.Calendar2up_Cal();

YAHOO.widget.Calendar2up_DE_Cal.prototype.customConfig = function() {
	this.Config.Locale.MONTHS_SHORT = ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dec"];
	this.Config.Locale.MONTHS_LONG = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"];
	this.Config.Locale.WEEKDAYS_1CHAR = ["D", "L", "M", "M", "G", "V", "S"];
	this.Config.Locale.WEEKDAYS_SHORT = ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa"];
	this.Config.Locale.WEEKDAYS_MEDIUM = ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"];
	this.Config.Locale.WEEKDAYS_LONG = ["Domenica", "Lunedi", "Martedi", "Mercoledi", "Giovedi", "Venerdi", "Sabato"];

	this.Config.Options.START_WEEKDAY = 1;
}

/*************************************/

YAHOO.widget.Calendar2up_DE = function(id, containerId, monthyear, selected) {
	if (arguments.length > 0)
	{	
		this.buildWrapper(containerId);
		this.init(2, id, containerId, monthyear, selected);
	}
}

YAHOO.widget.Calendar2up_DE.prototype = new YAHOO.widget.Calendar2up();

YAHOO.widget.Calendar2up_DE.prototype.constructChild = function(id,containerId,monthyear,selected) {
	var cal = new YAHOO.widget.Calendar2up_DE_Cal(id,containerId,monthyear,selected);
	return cal;
};




/*********************************************************/
YAHOO.namespace("example.calendar");

function init()
{

	this.today = new Date();

	var thisMonth = this.today.getMonth();
	var thisDay = this.today.getDate();
	var thisYear = this.today.getFullYear();

	this.link1 = document.getElementById('dateLink1');
	this.link2 = document.getElementById('dateLink2');

	this.selMonth1 = document.getElementById('selMonth1');
	this.selDay1 = document.getElementById('selDay1');
	this.selYear1 = document.getElementById('selYear1');

	this.selMonth1.selectedIndex = thisMonth;
	this.selDay1.selectedIndex = thisDay-1;
	this.selYear1.value = thisYear;

	this.selMonth2 = document.getElementById('selMonth2');
	this.selDay2 = document.getElementById('selDay2');
	this.selYear2 = document.getElementById('selYear2');

	this.selMonth2.selectedIndex = thisMonth;
	this.selDay2.selectedIndex = thisDay-1;
	this.selYear2.value = thisYear;

	YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar2up_DE("YAHOO.example.calendar.cal1","container1",(thisMonth+1)+"/"+thisYear,(thisMonth+1)+"/"+thisDay+"/"+thisYear);
	YAHOO.example.calendar.cal1.setChildFunction("onSelect",setDate1);
	YAHOO.example.calendar.cal1.title = "Seleziona La Data di Inizio";

	YAHOO.example.calendar.cal1.addRenderer("1/1,1/6,5/1,8/15,10/3,10/31,12/25,12/26", YAHOO.example.calendar.cal1.pages[0].renderCellStyleHighlight1);

	YAHOO.example.calendar.cal1.render();


			YAHOO.example.calendar.cal2 = new YAHOO.widget.Calendar2up_DE("YAHOO.example.calendar.cal2","container2",(thisMonth+1)+"/"+thisYear,(thisMonth+1)+"/"+thisDay+"/"+thisYear);
			YAHOO.example.calendar.cal2.setChildFunction("onSelect",setDate2);
			YAHOO.example.calendar.cal2.title = "Seleziona La Data Di Fine";

			YAHOO.example.calendar.cal2.addRenderer("1/1,1/6,5/1,8/15,10/3,10/31,12/25,12/26", YAHOO.example.calendar.cal2.pages[0].renderCellStyleHighlight1);

			YAHOO.example.calendar.cal2.render();
}


		function showCalendar1() {
			YAHOO.example.calendar.cal2.hide();
			
			var pos = YAHOO.util.Dom.getXY(link1);
			YAHOO.example.calendar.cal1.outerContainer.style.display='block';
			YAHOO.util.Dom.setXY(YAHOO.example.calendar.cal1.outerContainer, [pos[0],pos[1]+link1.offsetHeight+1]);
		}

		function showCalendar2() {
			YAHOO.example.calendar.cal1.hide();

			var pos = YAHOO.util.Dom.getXY(link2);
			YAHOO.example.calendar.cal2.outerContainer.style.display='block';
			YAHOO.util.Dom.setXY(YAHOO.example.calendar.cal2.outerContainer, [pos[0],pos[1]+link2.offsetHeight+1]);
		}

		function setDate1() {
			var date1 = YAHOO.example.calendar.cal1.getSelectedDates()[0];
			selMonth1.selectedIndex=date1.getMonth();
			selDay1.selectedIndex=date1.getDate()-1;
            selYear1.value = date1.getFullYear();
            
			YAHOO.example.calendar.cal1.hide();
		}

		function setDate2() {
			var date2 = YAHOO.example.calendar.cal2.getSelectedDates()[0];
			selMonth2.selectedIndex=date2.getMonth();
			selDay2.selectedIndex=date2.getDate()-1;
            selYear2.value = date2.getFullYear();
			YAHOO.example.calendar.cal2.hide();
		}

		function changeDate1() {
			var month = this.selMonth1.selectedIndex;
			var day = this.selDay1.selectedIndex + 1;
			var year = this.selYear1.value;

			YAHOO.example.calendar.cal1.select((month+1) + "/" + day + "/" + year);
			YAHOO.example.calendar.cal1.setMonth(month);
			YAHOO.example.calendar.cal1.render();
             
		}

		function changeDate2() {
			var month = this.selMonth2.selectedIndex;
			var day = this.selDay2.selectedIndex + 1;
			var year = this.selYear2.value; 
			
			YAHOO.example.calendar.cal2.select((month+1) + "/" + day + "/" + year);
			YAHOO.example.calendar.cal2.setMonth(month);
			YAHOO.example.calendar.cal2.render();
		}		
        
