/*
 * Justifychildren - jQuery plugin for justifying any elements in a container.
 *
 * Copyright (c) 2008 Adam Emsley
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.metadata.js 3620 2007-10-10 20:55:38Z pmclanahan $
 *
 */
(function($){
	$.fn.justifychildren = function(options){
        // build main options before element iteration
		var opts = $.extend({}, $.fn.justifychildren.defaults, options);
     	return this.each(function() {
			var total_width = $(this).width();
			var total_children = 0;
			var total_children_width = 0;
			$("#"+this.id+" > *").each(function(i){
				total_children += 1;
				total_children_width += $(this).width();
			});
			var right_margin = (total_width - total_children_width) / (total_children -1);
			$("#"+this.id+" > *:not(:last)").each(function(i){
				$(this).css('margin-right',right_margin+"px");
			});
     	});
	};
   // default options - these are used of none others are specified
	$.fn.justifychildren.defaults = {
		// from: '#016bbd',
	};
//  invoke the function we just created passing it
//  the jQuery object
})(jQuery);
