(function($) {
	$.bizits = {
		_list: new Array(),
		_editable: false,

		_editHook: function($e) {
			if ($e.data('editMode')) {
				return;
			}

			if (!($before = $e.parent('a')).length) {
				$before = $e;
			}
			$editBox = $('<div class="_bizEditBox"><div class="_bizEditBorder" edit="'+$e.attr('id')+'"></div></div>').data('id', $e.attr('id'));
			$e.data('editMode', $editBox);
			$before.before($editBox);
			$editBox.css({
				top: Math.round($e.position().top - ($editBox.outerHeight() / 2))+'px',
				left: Math.round($e.position().left - ($editBox.outerWidth() / 2))+'px',
				width: Math.round($e.outerWidth())+'px',
				height: Math.round($e.outerHeight())+'px',
				marginTop: $e.css('margin-top'),
				marginBottom: $e.css('margin-bottom'),
				marginLeft: $e.css('margin-left'),
				marginRight: $e.css('margin-right')
			});
			if (
				(eval('typeof $.bizits.'+$e.attr("bizit")) == 'object')
				&& (eval('typeof $.bizits.'+$e.attr("bizit")+'._edit') == 'object')
				) {
				$editBox.bind(eval('$.bizits.'+$e.attr("bizit")+'._edit'));
			}
			$editBox.show();
		},

		_editMode: function($bEnabled) {
			if ($bEnabled != null) {
				if ($bEnabled) {
					$('*[bizit][id]').each(function() {
						$.bizits._editHook($(this));
					});
				}
				$.bizits._editable = $bEnabled;
			}

			return $.bizits._editable;
		}
	};

	$(document).ready(function() {
		//$.bizits._editMode(true);
		});
})(jQuery);
