
  function getDateFromAttr(attribute_string) {
    date_array = attribute_string.split('-')
    year = date_array[0]
    month = date_array[1] - 1
    date = date_array[2]
    return new Date(year, month, date)
  }
  $j(function() {
    var now = new Date()
    $j('[start], [expire]').each(function() {
      not_ready_to_show = false;
      expired = false;
      if ($j(this).attr('start')) {
        if (getDateFromAttr($j(this).attr('start')) > now) not_ready_to_show = true;
      }
      if ($j(this).attr('expire')) {
        if (getDateFromAttr($j(this).attr('expire')) < now) expired = true;
      }
      if (not_ready_to_show || expired) {
        $j(this).addClass('hide')
      }
    })
  })


