// vim: set tabstop=2 shiftwidth=2 foldmethod=marker:
// +----------------------------------------------------------+
// |   __             _                               _
// |  / _| __ ___   _(_) ___ ___  _ __     __ _ _ __ (_)
// | | |_ / _` \ \ / / |/ __/ _ \| '_ \   / _` | '_ \| |
// | |  _| (_| |\ V /| | (_| (_) | | | | | (_| | |_) | |
// | |_|  \__,_| \_/ |_|\___\___/|_| |_|  \__,_| .__/|_|
// |                                           |_|
// | 
// | Copyright (c) 2006 Favicon API 
// |                    (http://favicon.aruko.net/) - aruko.net
// |                              jquery plugin version - 0.0.2
// +----------------------------------------------------------+
// |  * This script is freely distributable under 
// |    the terms of an MIT-style license.
// |    http://favicon.aruko.net/dl/license.txt
// +----------------------------------------------------------+

(function() { 

  jQuery.fn.faviconapi = function(config){

    config = jQuery.extend({
        size: 'm',
        def: 'f',
        margin: '0 0 0 3px',
        padding: '0 0 2px 19px',
        backgroundColor: null,
        backgroundPosition: '1px 1px'
      },config);

    var target = this;

    jQuery.each(target,function(i,val) {
      var bk = '';

      if(config.backgroundColor != null) {
        bk += config.backgroundColor + ' ';
      }
      bk += 'url("http://favicon.aruko.net/'+
            config.size+'/'+
            config.def+'/'+ 
            $(this).attr('href') + 
            '") no-repeat'; 

      $(this).css({
        margin:config.margin,
        padding:config.padding,
        background:bk,
        backgroundPosition:config.backgroundPosition
      });
    }); 

  };
})(jQuery);

