(function($) {
	
	var root, protocol, host, undefined;
	
	if ( window[ 'liburl' ] == undefined ) {
		
		$( "script[@src*=jquery.widget]" ).each( function( i, item ) {
			
			protocol = item.src.split( '://' ).shift() + '://';
			
			host = protocol + item.src.split( protocol ).pop().split( '/' ).shift();
			
		} );
		
		liburl = host + '/lib/js';
		
	};
	
	root = liburl.split( '/' );
	
	root.pop();
	
	root = root.join( '/' );
	
	$.library = {
		
		url: liburl
		
		, root: root
		
		, host: host
		
		, initialized: 0
		
	};
	
	$.fn.widget = function( options ) {
		
		return this.each(function() {
			
			var data, url;
			
			$this = $( this );
			
			data = $this.metadata();
			
			url = $.library.url + '/jquery.' + data.name + '.js';
			
			$.getScript( url );
			
		} );
		
	};
	
	$( document ).ready( function() {
		
		$('.widget').widget();
		
		$.library.initialized = 1;

	} );

})(jQuery);