/**
 * @method vertices
 */
;(function( $, undefined ) {

	var systemPrefix = 'vertices',
		systemPrefixLower = systemPrefix.toLowerCase();

	$.fn[systemPrefix] = function() {

		var toReturn,
			options,
			i, len;

		toReturn = [];

		options = [].slice.call(arguments);

		i = 0;
		len = options.length;

		this.each(function( index, item ) {
			
			var $this,
				thisReturns,
				width, height,
				offset,
				vertices;

			$this = $(this);

			thisReturns = {};

			offset = $this.offset();
			width = $this.outerWidth();
			height = $this.outerHeight();

			vertices = {
				n	: {
					x	: offset.left + ( width / 2 ),
					y	: offset.top
				},
				ne	: {
					x	: offset.left + width - 1,
					y	: offset.top
				},
				e	: {
					x	: offset.left + width - 1,
					y	: offset.top + ( height / 2 )
				},
				se	: {
					x	: offset.left + width - 1,
					y	: offset.top + height - 1
				},
				s	: {
					x	: offset.left + ( width / 2 ),
					y	: offset.top + height - 1
				},
				sw	: {
					x	: offset.left,
					y	: offset.top + height - 1
				},
				w	: {
					x	: offset.left,
					y	: offset.top + ( height / 2 )
				},
				nw	: {
					x	: offset.left,
					y	: offset.top
				},
				c	: {
					x	: offset.left + ( width / 2),
					y	: offset.top + ( height / 2)
				}
			};

			if ( len ) {
				for ( ; i < len; i++ ) {
					thisReturns[options[i]] = vertices[options[i]];
				}
				toReturn.push(thisReturns);
			}

			else {
				toReturn.push(vertices);
			}
		});
		
		if ( toReturn.length === 1 ) {
			toReturn = toReturn[0];
		}

		return toReturn;
	};
})(jQuery);
