non conosco bene il linguaggio ma credo inizi da li a riempire l'arrey che dicevi ciao grazie

codice:
//``````````````````````````````````````````````````
//function getPageSummary( arg_s_fileContents, arg_ary_match )
//-Argument(s):	arg_s_fileContents - the entire file text
//				arg_ary_match - the array containing the found search terms
//-Returns:		The finished summary text
//-Description:	Scans the entire page for the search term, then pulls a bit of text
//				before and after the found term. How much text it pulls is semi-random.
//				It uses the number of characters in the lary_spacingBegining & 
//				lary_spacingEnd arrays. This function also wraps the found term(s) 
//				in a <span> tag so you can highlight it via CSS.
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
function getPageSummary( arg_s_fileContents, arg_ary_match ) {
	var lary_spacingBegining	= new Array( 30, 50, 70 );
	var lary_spacingEnd			= new Array( 100, 80, 60 );
	
	var li_spacingBegining		= 0;
	var li_spacingEnd			= 0;
	var ls_summary				= "";
	var ls_strippedResults		= "";
	var ls_highlightedTerm		= "";
	
	var lreg_newLine			= /[\f\n\r\t]+/g;
	var lreg_spaces				= / {2,}/g;
	var lreg_htmlSpaces			= /(?:)*/gi;
	
	
	//This randomizes the number of characters grabbed for the
	//summary so all of the high lighting doesn't appear in the
	//same place.
	var lobj_Date		= new Date();
	var i				= lobj_Date.getMilliseconds() % 3;
	li_spacingBegining	= lary_spacingBegining[i];
	li_spacingEnd		= lary_spacingEnd[i];
	delete lobj_Date;
	
	//remove any new line characters and anything with more then 2 spaces.
	ls_strippedResults	= arg_s_fileContents.replace( lreg_newLine,' ' ).replace( lreg_spaces, ' ' ).replace(lreg_htmlSpaces, '' );
	li_searchIndex = ls_strippedResults.search( arg_ary_match[i] );
	ls_summary = ls_strippedResults.substring( ( li_searchIndex - li_spacingBegining ), ( li_searchIndex + arg_ary_match[0].length + li_spacingEnd ) );

	for ( var i=0; i<arg_ary_match.length; i++ ){
		ls_highlightedTerm = '<span class="search_term">' + arg_ary_match[i] + '</span>';
		if ( ls_summary.indexOf( ls_highlightedTerm ) == -1 )ls_summary = ls_summary.replace( arg_ary_match[i], ls_highlightedTerm );
	}
	
	return ls_summary;
}