$.fn.countdown = function(options) {

  var nowDate = new Date();
  var countDate = new Date();
  var options = $.extend({
    day: 0,
    mounth: 0,
    year: 0
  }, options);

  return this.each(function() {
    countDate = new Date(options.year, options.mounth, options.day);
    getIntervel(this);
  });

  function getIntervel (t) {
    nowDate = new Date();
    var intInterval = countDate - nowDate;
    var m;
    days = intInterval / 1000 / 60 / 60 / 24 | 0;
    intInterval -= days * 1000 * 60 * 60 * 24;
    hours = intInterval / 1000 / 60 / 60 | 0;
    intInterval -= hours * 1000 * 60 * 60;
    minutes = intInterval / 1000 / 60 | 0;
    intInterval -= minutes * 1000 * 60;
    seconds = intInterval / 1000 | 0;
    writeInterval(t, days, hours, minutes, seconds);
  }

  function writeInterval (t, d, h, m, s) {
    if (m.toString().length < 2) { m = "0" + m; }
    if (s.toString().length < 2) { s = "0" + s; }
    if (h.toString().length < 2) { h = "0" + h; }

    $(t).html('<i>' + d + ' дн.,</i> ' + h + ':' + m + ":" + s);
    setTimeout(function() { getIntervel(t); }, 1000);
  }

}
