gremmie@1: $(document).ready(function() {
bgneal@138:    var bday = $('#id_birthday');
bgneal@138:    // jquery ui may not always be loaded
bgneal@138:    if (bday.length) {
bgneal@138:       bday.datepicker({changeMonth: true, 
bgneal@138:          changeYear: true,
bgneal@138:          dateFormat: 'yy-mm-dd',
bgneal@138:          defaultDate: '-30y',
bgneal@138:          minDate: new Date(1909, 0, 1),
bgneal@138:          maxDate: new Date(),
bgneal@138:          yearRange: '-100:+0'});
bgneal@138:    }
bgneal@138:    $('a.profile-flag').click(function() {
bgneal@138:       var id = this.id;
bgneal@138:       if (id.match(/fp-(\d+)/)) {
bgneal@138:          id = RegExp.$1;
bgneal@138:          if (confirm('Only report a profile if you feel it is spam, abuse, ' +
bgneal@138:                  'violates site rules, or is not appropriate. ' +
bgneal@138:                  'A moderator will be notified and will review the profile. ' +
bgneal@138:                  'Are you sure you want to report this profile?')) {
bgneal@138:              $.ajax({
bgneal@138:                url: '/profile/flag/' + id + '/',
bgneal@138:                type: 'POST',
bgneal@138:                dataType: 'text',
bgneal@138:                success: function (response, textStatus) {
bgneal@138:                   alert(response);
bgneal@138:                },
bgneal@138:                error: function (xhr, textStatus, ex) {
bgneal@138:                   alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText);
bgneal@138:                }
bgneal@138:              });
bgneal@138:          }
bgneal@138:      }
bgneal@138:      return false;
bgneal@138:    });
gremmie@1: });