var returnPath = 0;

function setReturnPath(id)
{
    returnPath = id;
}

function showResults()
{
    JQ("#otherEntity").show();
    JQ("#summaryresults").show();
    JQ(".result").hide();
}

function returnToResults()
{
    showEntity(returnPath);
}

function showEntity(id)
{
    JQ("#summaryresults").hide();
    JQ("#otherEntity").hide();
    JQ(".result").hide();
    JQ("#result_"+id).show();
    setReturnPath(id);
}

function showPreviousPage(id)
{
    if(id == 0)
        return;
    id -= 20;
    JQ(".results_page").hide();
    JQ("#results_page_"+id).show();
    JQ(".results").hide();
    JQ("#results_"+id).show();
}

function showNextPage(id)
{
    id += 20;
    page = JQ("#results_page_"+id);
    if(page.length > 0)
    {
        JQ(".results_page").hide();
        page.show();
        JQ(".results").hide();
        JQ("#results_"+id).show();
    }
}

function showPage(id)
{
    page = JQ("#results_page_"+id);
    if(page.length > 0)
    {
        JQ(".results_page").hide();
        page.show();
        JQ(".results").hide();
        JQ("#results_"+id).show();
    }
}

function showOtherEntite(id, link)
{
    JQ("#summaryresults").hide();
    JQ(".result").hide();

    JQ("#otherEntity").show();
    JQ("#otherEntity").html('<img src="cms/images/network-save.gif" alt="" />&nbsp;Recherche en cours...&nbsp;<img src="cms/images/network-save.gif" alt="" />');
    JQ.get(link+"?return="+returnPath,
        {
        },
        function(data){
            JQ("#otherEntity").html(data);
        }
    );
}
