/**
 * dbg jQuery plugin - http://jquery.5s.ro/
 *
 * Easy debug of your jQuery objects.
 *
 * @author     Gunther Konig <gunther.s.konig@gmail.com>
 */
(function($)
{
  $.dbg = function()
  {
    if (!("console" in window))
    {
      return this;
    }

    if(navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1)
    {
      console.log('<<<');
      for (var i = 0, l = arguments.length; i < l; i++)
      {
        console.log(arguments[i]);
      }
      console.log('>>>');
    }
    else
    {
      console.log.apply(this, arguments);
    }

    return this;
  }

  $.fn.dbg = function()
  {
    var args = [];

    //typeof arguments = object, we need an array
    for (var i = 0; i < arguments.length; i++)
    {
      args[i] = arguments[i];
    }
    args[i] = this;

    $.dbg.apply(this, args);

    return this;
  }
})(jQuery);
