Date.prototype.timeOfDay = function() {
		var hour = this.getHours();
		var ap = "am";
	   	if (hour   > 11) { ap = "pm";             }
		if (hour   > 12) { hour = hour - 12;      }
		if (hour   == 0) { hour = 12;             }
		
		return $H({hour : hour, ap : ap});
}

Date.prototype.getTimeString = function() {
	var hour = this.timeOfDay().get('hour');
	var minutes = this.getMinutes();
	var ap =  this.timeOfDay().get('ap');
	return hour+":"+padNumber(minutes)+ap;
}

Object.extend(String.prototype, {
  // if a string doesn't end with str it appends it
  ensureEndsWith: function(str) {
    return this.endsWith(str) ? this : this + str;
  },

  // makes sure that string ends with px (for setting widths and heights)
  px: function() {
    return this.ensureEndsWith('px');
  }
});

Object.extend(Number.prototype, {
  // makes sure that number ends with px (for setting widths and heights)
  px: function() {
    return this.toString().px();
  }
});
