
function remove_link(link,next_prev){
    link.hide();
    link.after("<img id=\"img_"+next_prev+"\" alt=\"Anterior\" src=\"/images/botao_link_"+next_prev+"_transp.png\"/>");
}

function put_link(link,next_prev){
    link.show();
    $("#img_"+next_prev).remove();
}

function check_position(item){
    check_if_first(item);
    check_if_last(item);
}

function check_if_last(item){
    if (item.html() == $(separator+":last").html()){
        remove_link($("#next_n"), "next");
        return true;
    }else{
        put_link($("#next_n"), "next");
        return false;
    }
}

function check_if_first(item){
    if (item.html() == $(separator+":first").html()){
        remove_link($("#previous_n"), "previous")
        return true;
    }else{
        put_link($("#previous_n"), "previous")
        return true;
    }
}

function next_transition(){
    indice++;
    check_position($(separator+":eq("+indice+")"));
}

function previous_transition(){
    indice--;
    check_position($(separator+":eq("+indice+")"));
}

separator = "#separator-content span.separator";
indice = 0;
check_position($(separator+":eq("+indice+")"));

$("#next_n").click(function(){
    next_transition();
});

$("#previous_n").click(function(){
    previous_transition();
});

