/*
 * current offer
 * param to highlight row
 */
if(current_offer == 'undefined') {
    var current_offer = 0;
}

/*
 * @author: agazke
 * load detail view via ajax
 */
function update(url, id, frame, params)
{
    try{
        var old_id = current_offer;
        current_offer = id;
        hover_result(false, old_id, '#FFFFFF');
        $('#detailbox').html('<div class="owg-ajax-loader"><img src="/images/ajax-loader.gif" alt="" title="" /></div>');
        $.ajax({
            url: url,
            cache: false,
            data: params,
            success: function(html) {
                $('#detailbox').html(html);
                //window.location='#ajax-content';
            }
        });
    }catch(e){

    }
}

/*
 * @author: agazke
 * highlight row
 */
function hover_result(hover, id, frame)
{
    try{
        if(current_offer == 0 || current_offer == 'undefined') {
            current_offer = id;
        }
        $('#'+id+' td').each(function() {
            if(hover == true || current_offer == id) {
            	if($(this).hasClass('owg-result-row-0-left') || $(this).hasClass('owg-result-row-1-left') || $(this).hasClass('owg-result-row-white-left')) {
            		$(this).addClass('owg-result-row-choose-left');
            	}
                $(this).addClass('owg-highlight-table-row');
            } else {
               	if($(this).hasClass('owg-result-row-choose-left')) {
            		$(this).removeClass('owg-result-row-choose-left');
            	}
                $(this).removeClass('owg-highlight-table-row');
            }
        });
        if(hover == true) {
            $('#'+id+' td:last').addClass('owg-result-row-choose');
        } else if(current_offer != id) {
            $('#'+id+' td:first').css('borderColor','#FFFFFF');
            $('#'+id+' td:last').removeClass('owg-result-row-choose');
        }
    }catch(e){

    }
}

