function isIE() {

	try 
	{
		if (document.body.createTextRange() != 'undefined') {
			return true;
		}
		return false;
	}
	catch (err)
	{
		return false;
	}	
}


function GetValue() {

	return document.forms[0].texto.value;
}

var txtrange;
var oldValue;

function FindText(frame, str) { 

  if (str == '') {
	return 
  }

  var encontrou;
  
  if (isIE()) { 
  
	if (str != oldValue) {
		oldValue = str;

		if (frame != "") {
			txtrange = parent.frames[frame].document.body.createTextRange(); 
		} else {
			txtrange = document.body.createTextRange(); 
		}
		
		encontrou = txtrange.findText(str);
	} else {
		txtrange.moveStart('word', 1);

		encontrou = txtrange.findText(str);

		if (!encontrou)  { 
			if (frame != "") {
				txtrange = parent.frames[frame].document.body.createTextRange(); 
			} else {
				txtrange = document.body.createTextRange(); 
			}

			encontrou = txtrange.findText(str);
		} 
	}

    if (encontrou)  { 
		txtrange.select(); 
		txtrange.scrollIntoView(); 
	} else {
		alert("O texto não foi encontrado");
    } 
    
  } else { 

	if (str != oldValue) {
		oldValue = str;
		
		if (frame != "") {
			parent.frames[frame].scrollTo(0,0);
		} else {
			window.scrollTo(0,0);
		}	


	}
	
	if (frame != "") {
		encontrou = parent.frames[frame].find(str, false, false, false, false, true, false) 
	} else {
		encontrou = window.find(str);
	}
	
	if ( !encontrou)  { 
		alert("O texto não foi encontrado");
    } 

  } 
} 


