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

YAHOO.widget.Calendar1up.prototype = new YAHOO.widget.Calendar();

YAHOO.widget.Calendar1up.prototype.customConfig = function() {
	this.Config.Locale.MONTHS_SHORT = ["Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"];
	this.Config.Locale.MONTHS_LONG = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"];
	this.Config.Locale.WEEKDAYS_1CHAR = ["S", "M", "D", "M", "D", "F", "S"];
	this.Config.Locale.WEEKDAYS_SHORT = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
	this.Config.Locale.WEEKDAYS_MEDIUM = ["Son", "Mon", "Die", "Mit", "Don", "Fre", "Sam"];
	this.Config.Locale.WEEKDAYS_LONG = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"];

	this.Config.Options.START_WEEKDAY = 1;
}

YAHOO.widget.Calendar1up.prototype.hide = function() {
	this.oDomContainer.style.display='none';
}

YAHOO.widget.Calendar1up.prototype.show = function() {
	this.oDomContainer.style.display='block';
}

YAHOO.widget.Calendar1up.prototype.showAt = function(id) {
	obj = document.getElementById(id);
	pos = elPos(obj);
	this.oDomContainer.style.top = (pos.y+obj.height-1) + "px";
	this.oDomContainer.style.left = pos.x + "px";
	this.oDomContainer.style.display='block';
}

YAHOO.widget.Calendar1up.prototype.sinc = function() {
	val = document.getElementById(this.controlId).value;
	if (val)	{
		a = val.split('\.');
		this.select((a[1]) + "/" + a[0] + "/" + a[2]);
		this.setMonth(a[1]-1);
		this.render();
	}
}

YAHOO.widget.Calendar1up.prototype.wireCustomEvents = function() {
	/**
	* The default event function that is attached to a date link within a calendar cell
	* when the calendar is rendered.
	* @param	e		The event
	* @param	cal		A reference to the calendar passed by the Event utility
	*/
	this.doSelectCell = function(e, cal) {
		cal.selectCell(this.index);
		var date1 = cal.getSelectedDates()[0];

		day = '0'+date1.getDate(); day = day.substr(day.length-2);
		month = '0'+(date1.getMonth()+1); month = month.substr(month.length-2);

		document.getElementById(cal.controlId).value = day+'.'+month+'.'+date1.getFullYear();
		cal.hide();
	}
}

function elPos(el) {
	var posx = el.offsetLeft;
	var posy = el.offsetTop;
	while (el.offsetParent != null) {
		el = el.offsetParent;
		posx += el.offsetLeft;
		posy += el.offsetTop;
	}
	this.x = posx;
	this.y = posy;
	return this;
}