function setCalendar(target)
  {
    if (!document.getElementById(target)) { return false; }

    // Choose your date range
    scwBaseYear      = scwDateNow.getFullYear();
    scwDropDownYears = 2;

    // Choose your date format
    scwDateDisplayFormat = 'dd-mm-yyyy';
    scwDateOutputFormat  = 'dd-mm-yyyy';

    // Disable dates up to and including today
    scwDisabledDates[0] = [new Date(0),
                           new Date(scwDateNow.getFullYear(),
                                    scwDateNow.getMonth(),
                                    scwDateNow.getDate()
                                   )
                          ];

    // Disable dates too far in the future (e.g. 1 month)
    scwDisabledDates[1] = [new Date(scwDateNow.getFullYear(),
                                    scwDateNow.getMonth()+1,
                                    scwDateNow.getDate()+1
                                   ),
                           new Date(scwBaseYear+scwDropDownYears,0,0)
                          ];

    var ele = document.getElementById(target);

    // Set the attribute to be readonly so that only the
    // calendar can be used to set the date
    ele.readOnly = true;

    // Default the attribute to today's date
    ele.value=[scwDateNow.getDate(),
               (scwDateNow.getMonth()+1).toString().scwPadLeft(2),
               scwDateNow.getFullYear()].join('-');

    // Set the attribute to trigger the calendar with the onclick event

    var args = Array.prototype.slice.call(arguments, 1);

    ele.onclick=function(evt)
      {
        if (!evt) { evt = window.event; }
        args.unshift(evt);
        args.unshift(evt.target?evt.target:evt.srcElement);
        scwShow.apply(this, args);
      };

  };
