// CARs LIST
function onCarClick(id, hash) {
    hash = hash || null;
    
    activateCarInList(id);
    
    if (window.carClicked != undefined) {
        if (typeof(window.carClicked) == 'function') {
            carClicked(id);
        }
    }
    if (hash != null) {
        window.location.href = hash;
    }
}

function activateCarInList(id) {
    $('.content-result-active').removeClass('content-result-active');
    $('#div_car_'+id).addClass('content-result-active');
}
// ----------------------------------------------


//CARs FILTER
function unsetFiltersValues(filterName, filterNames)
{
    if (!filterNames) {
        var filterNames = Array('price','age','sold','no_images','colors', 'location', 'keyword');
    }
    if (filterName) {
        $('#'+filterName).val(0);
    } else {
        $.each(filterNames, function(idx, itm){
            $('#'+itm).val(0);
        });
    }
}
//----------------------------------------------


// NEWS LIST
function buildNewsList() {
    $('div.content-result').unbind('click');
    $('div.content-result').click(clickInNewsList);
}

function clickInNewsList(e) {
    _preventDefault(e);

    activateNewsInList(this.id);

    hash = $("#" + this.id + " > h3 > a").attr("href");
    window.location.href = hash;

    return false;
}

function activateNewsInList(id) {
    $('.content-result-active').removeClass('content-result-active');
    $('#'+id).addClass('content-result-active');
}
// ----------------------------------------------

