JS Page Navigation

function go(rel) {
    var url;
    if (url = document.evaluate('//*[@rel="' + rel + '"]/href', document, null, XPathResult.STRING_TYPE, null)).stringValue) {
        window.location.href = url;
        return true;
    }
    return false;
}

function goFirst() {
    go('first') || alert('No first found.');
}
function goPrevious() {
    go('prev') || go('previous') || alert('No previous found.');
}
function goNext() {
    go('next') || alert('No next found.');
}
function goLast() {
    go('last') || alert('No last found.');
}