function gotobook(f)
{
    if (f.livros.value.length!=-1) {
        dest=f.livros.value;
    }
    if (f.capitulo.value.lenght!=-1) {
        dest+=f.capitulo.value;
    }
    else {
        dest+='1';
    }
    location.href=dest;
}


function trim(str) 
{
    var i=1;
    n=str.length;
    cstr=str;
    while (cstr.charAt(0)==' ' || cstr.charAt(0)=='\n' || cstr.charAt(0)=='\t') {
        cstr=str.substring(i, n);
        i=i+1;
    }
    n=cstr.length;
    while (cstr.charAt(n-1)==' ' || cstr.charAt(n-1)=='\n' || 
           cstr.charAt(n-1)=='\t') {
        cstr=cstr.substring(0, n-1);
        n=cstr.length;
    }
    return cstr;
}