function time() {
    var ts = (new Date().getTime()) / 1000;
    return (Math.round(ts));
}
function loadProperties(pageNum) {
    $('#propertyList').hide();
    $('#propertyLoader').show()
    $.post('/properties/search/page:' + pageNum,$('#PropertyIndexForm').serialize(),function(response) {
        $('#propertyList').html(response);
        $('.pagination a').each(function() {
            var link = $(this).attr('href').split(':');
            $(this).attr('onClick','loadProperties(' + link[1] + ');');
            $(this).attr('href','javascript:void(0);');
        });
        $('#propertyLoader').hide();
        $('#propertyList').show();
    });
    relatedProperties();
}
    
function relatedProperties() {
    $('#relatedProperties').load('/properties/related/' + ($('#PropertyLocation').val() ? escape($('#PropertyLocation').val()) : 'all') + '/' + ($('#PropertyTypeId').val() ? $('#PropertyTypeId').val() : 'all') + '/' + numRelated + '/');
}
    
function viewMore(propertyID) {
    $.facebox({
        ajax : '/properties/view/' + propertyID + '/' + time()
        });
}
