var pos = 0;
function findit() {
    if (document.myform.mytext.value == '') {
        alert('Nothing to search for');
        return;
    }
    if (document.all) {
        var found = false;
        var text = document.body.createTextRange();
        for (var i=0; i<=pos && (found=text.findText(document.myform.mytext.value)) != false; i++) {
            text.moveStart("character", 1);
            text.moveEnd("textedit");
        }
        if (found) {
            text.moveStart("character", -1);
            text.findText(document.myform.mytext.value);
            text.select();
            text.scrollIntoView();
            pos++;
        }
        else {
            if (pos == '0')
                alert('"' + document.myform.mytext.value +'" was not found on this page.');
            else
                alert('No further occurences of "' + document.myform.mytext.value +'" were found.');
            pos=0;
        }
    }
    else if (document.layers) {
        find(document.myform.mytext.value,false);
    }
}
