$(document).ready(function(){
	$('.infoTarget').each(function (i) {
		var id = $(this).attr('id');
		var ti = $(this).text();
		var url = '/main/.in/ajax/dialogBox.php?d' + id.match(/[0-9]+$/);

		$(this).attr('href', '#').css({
			'font-weight':'bold'
		}).append('<div></div>');


		$(this).children('div:last').attr({
			'title': ti,
			'id': id + '_dialog',
			'class': 'infoBubble'
		}).load( url ).dialog({
			width: 600,
			height: 480,
			position: ['center','center'],
			buttons: {
				'Close':function(){
					$(this).dialog("close");
			}},
			open: function(e) {
				$( '#' + e.target.id ).parent().children('button:last').focus();
			},
			close: function(e) {
				$( '#' + e.target.id.replace(/_dialog$/, '') ).focus();
			},
			autoOpen: false,
			draggable: false,
			modal: true,
			resizable: false
		});

		$(this).click( function(e){
			$('#' + $(this).attr('id') + '_dialog').dialog('open');
		});
	});
}); // end $(document).ready
