﻿var cityView = function() {
    var $cityWallPanel;

    function setCityWallTableSeparator() {
        var $allRows = $cityWallPanel.find('table .cityWall-row');
        var $allLineRows = $cityWallPanel.find('table tr:has(hr)');

        $allLineRows.each(function(i) {
            $(this).remove();
        });

        $allRows.each(function(i) {
            if (i == $allRows.length - 1) {
                return;
            }

            if ($(this).next().find('hr').length == 0) {
                $(this).after('<tr><td colspan="3"><hr /></td></tr>');
            }
        });
    };

    function setCityPhotoTooltip(img) {
        $('#' + img).ezpz_tooltip({
            contentId: 'cityPhotoPanel',
            contentPosition: 'rightStatic',
            stayOnContent: true,
            offset: -10
        });
    };

    return {
        init: function() {
            $cityWallPanel = $('#cityWallPanel');
        },
        setCityWallTableSeparator: setCityWallTableSeparator,
        setCityPhotoTooltip: setCityPhotoTooltip
    };
} ();

$(function() {
    cityView.init();
    cityView.setCityWallTableSeparator();
});
