function triggerSeatingMaps() {
	$('.seatingMap').each(function(index) {
		if ($(this).is(':visible')) {
			triggerSeatingMap($(this).attr('id'));
		}
	});
}

function triggerSeatingMap(mapId) {
	$('#' + mapId + ' .draggableContainer').draggable();
	
	prepareMapPoints(mapId);
}

function prepareMapPoints(mapId) {
	$('#' + mapId + ' .point').each(function(index) {
		prepareMapPoint($(this).attr('id'));
	});
}

function prepareMapPoint(pointId) {
	var pointParts = pointId.split('_');
	
	$('#' + pointId).bind('click', function(event) {
			if ($('#mapPointBubble_' + String(pointParts[1])).is(':visible'))
				;
			else
				$('#mapPointBubble_' + String(pointParts[1])).fadeIn('fast');
		}
	);
}

function closeBubble(pointId) {
	$('#mapPointBubble_' + String(pointId)).fadeOut('fast');
}


function switchSeatMap(mapId, eventId) {
	$('.seatingMap').html('<img src="tickets/images/loader-circle.gif" style="position: absolute; top: 184px; left: 321px;" />');
	$.ajax({
		url: 'tickets/engine/pages/mappedSeats.php',
		type: 'post',
		data: [{ name: 'mapId', value: mapId }, { name: 'eventId', value: eventId }, { name: 'switcher', value: 1 }],
		success: function(transport) {
			$('#seatMapContainer').html(transport);
		}
	});
}
