function XcCalendar( id, container )
{
  this.id = id;
  this.container = container;
  
  var fieldValue = Dom.get(this.id).value;
  var fieldDate = fieldValue.split("-");
  
  this.showCalendar = function()
  {
    this.calendar.render();
    
    var containerEl = Dom.get(this.container);
    var region = YAHOO.util.Region.getRegion( Dom.get(this.id) );
    
    xc.show(this.container);
    Dom.setXY(this.container, new Array(region.left, region.bottom + 5));
    
  }
  
  this.hideCalendar = function()
  {
    xc.hide(this.container);
  }
  
  this.selectDate = function( type, args )
  { 
    var date = args[0][0]; 
    var year = date[0], 
        month = date[1], 
        day = date[2];
    
    Dom.get(this.id).value = year + "-" + (month < 10 ? "0" : "") + month + "-" + (day < 10 ? "0" : "") + day;
    this.hideCalendar();
  }
  
  this.setProperty = function( property, value )
  {
    this.calendar.cfg.setProperty(property, value, false);
  }
  
  this.calendar = new YAHOO.widget.Calendar("calendar", this.container, 
    {
      start_weekday: 1, 
      months_long: [ "Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December" ], 
      weekdays_short: [ "Va", "Hé", "Ke", "Sze", "Csü", "Pé", "Szo" ]
    });
  if ( fieldDate.length == 3 )
  {
    this.calendar.cfg.setProperty("selected", fieldDate[1] + "/" + fieldDate[2] + "/" + fieldDate[0], false);
    this.calendar.cfg.setProperty("pagedate", fieldDate[1] + "/" + fieldDate[0], false);
  }
  this.calendar.selectEvent.subscribe(this.selectDate, this, true);
  
}