

function searchForText( toFind,showAlerts ) {
	
	if( !toFind ) { 
		if (showAlerts == "true"){
			alert( 'You have not entered any text to search for' ); 
			return; 
		}
	}
	if( document.body && document.body.createTextRange ) {
		//IE or compatible use various TextRange features
		if( document.selection && document.selection.type != 'None' ) {
			//If some text is selected already (previous search or if they have selected it)
			//make that the text range. Then move to the end of it to search beyond it
			var theRange = document.selection.createRange();
			theRange.collapse( false );
		} else {
			//If no text is selected, start from the start of the document
			var theRange = document.body.createTextRange();
		}
		//find the next occurrence of the chosen string
		var ifFound = theRange.findText( toFind );
		if( ifFound ) { 
			theRange.select(); 
		}
	} 
	else {
		if (showAlerts == "true"){
			alert ( 'Please use your browser\'s search facility' );
		}
	}
	if( !ifFound ) { 
		if (showAlerts == "true"){
			alert ( 'Could not find text:\n' + toFind ); 
		}
	}
}  
