// Copyright © 2002 Microsoft Corporation.  All rights reserved. 
function Verbage(){
	this.search_gate_type = new search_gate_type();
	this.search_input_expression_type = new search_input_expression_type();
	this.search_gate_key_type = new search_gate_key_type();
	this.search_gate_tokens = new search_gate_tokens();
}
var Verbage = new Verbage();

function search_gate_type(){
	this._BOOL = 0;	this._AND = 1;	this._OR = 2;	this._NOT = 3;	this._QUOTE = 4;
}

function search_input_expression_type(){
	this._BOOLEAN = 0;	this._ALL = 1;	this._ANY = 2;	this._EXACT = 3;
}

function search_gate_key_type(){
	this._GK_AND = 0;	this._GK_OR = 1;	this._GK_NOT = 2;	this._GK_QUOTE = 3;
}

function search_gate_tokens() {
	this.keys_or = new Array( "OR", String.fromCharCode( 0xFF2F ) +  String.fromCharCode( 0xFF32 ), "|", "||" );
	this.keys_and = new Array( "AND", String.fromCharCode( 0xFF21 ) +  String.fromCharCode( 0xFF2E ) + String.fromCharCode( 0xFF24 ), "+", "&&", "&" );
	this.keys_not = new Array( "NOT", String.fromCharCode( 0xFF2E ) +  String.fromCharCode( 0xFF2F ) + String.fromCharCode( 0xFF34 ), "-" );
	this.keys_quote = new Array( "'", '\"' );
}

function search_stat_obj ( stat_string, in_input_index, in_collection_index ){
	this.collection_index = in_collection_index;
	this.input_index = in_input_index;
	var split1 = stat_string.split("-");
	this.url_index = split1[0];
	this.rank =  split1[1];
}

function searchgate ( in_string, in_iet, in_type, in_breaker_id ) {
	this.results = null;
	this.scids = new Array();
	this.toks = new Array();  
	this.mixed_case = new Array();
	this.tok_exp_ops = new Array();
	this.expressions = new Array();
	this.exp_toks = new Array();
	this.terminator = true;
	this.b_quoted = false;
	this.str = trim( in_string );
	this.gate_l = null;
	this.gate_r = null;
	this.breaker_id = in_breaker_id;

	this.validate = function(){
		if ( this.type == Verbage.search_gate_type._BOOL ) {
			alert( "Error in searchgate  ( type _BOOL unexpected ) - resetting to type _OR");
			this.type = Verbage.search_gate_type._OR;
		}
		if ( this.terminator == true ) {
			if (( this.gate_l != null ) || ( this.gate_r != null )){
				alert("Error in searchgate  ( terminator gates shouldn't have left and right memebers ) - set to type _OR as non-terminator and flushing string ");
				this.terminator = false;
				this.str = "";
				this.type = Verbage.search_gate_type._OR;
			}
		} else {
			if ( this.str != "" ){
				alert("Error in searchgate  ( non-terminator should have invalid string ) - resetting as OR non-terminator");
				if (( this.gate_l != null ) || ( this.gate_r != null )){
					this.terminator = false;
					this.type = Verbage.search_gate_type._OR;
				}
			}
		}
	}
	this.convert_expression_type = function( in_iet ){
		switch ( in_iet ) {
			case Verbage.search_input_expression_type._BOOLEAN:
				return Verbage.search_gate_type._BOOL;
			case Verbage.search_input_expression_type._ALL:
				return Verbage.search_gate_type._AND;
			case Verbage.search_input_expression_type._ANY:
				return Verbage.search_gate_type._OR;
			case Verbage.search_input_expression_type._EXACT:
				return Verbage.search_gate_type._QUOTE;
			default:
				return Verbage.search_gate_type._OR;
		}
	}
	this.is_inside_quotes = function( in_s, in_e ){
		if (( in_s == 0 ) || ( in_s == this.str.length-1 )) return false;
		for( var q_i = 0; q_i < Verbage.search_gate_tokens.keys_quote.length; q_i++ ) {
			var quote = Verbage.search_gate_tokens.keys_quote[q_i];
			if ( this.str.indexOf( quote ) == -1 ) continue;		
			var qs_l = 0;
			var i = 0;
			while( i < in_s ){
				if ( this.str[i] == quote[0] ) qs_l++;
				i++;
			}
			if (( qs_l % 2 ) == 0 ) continue;
			i = in_e+1;
			while( i < this.str.length ){
				if ( this.str[i] == quote[0] ) return true;
				i++;
			}
		}
		return false;
	}
	this.clean_bad_operator_gates = function( in_string ) {
		var ret = trim(in_string);
		var s_pos = 0;
		var e_pos = -1;
		var lstpos = 2;
		while(( s_pos == 0 ) || ( e_pos == lstpos )){
			for ( var i = 0; i < 3; i++ ) {
				var gate_type = i;
				var keys = null;
				switch( gate_type ){
					case Verbage.search_gate_key_type._GK_AND:
						keys = Verbage.search_gate_tokens.keys_and; break;
					case Verbage.search_gate_key_type._GK_OR:
						keys = Verbage.search_gate_tokens.keys_or; break;
					case Verbage.search_gate_key_type._GK_NOT:
						keys = Verbage.search_gate_tokens.keys_not; break;
				}
				var restart = false;
				for( var k = 0; k < keys.length; k++ ) {
					s_pos = ret.indexOf( keys[k] );
					if ( s_pos == 0 ) {
						ret = trim(ret.substr( keys[k].length ));
						restart = true;
						break;
					}
					e_pos = ret.lastIndexOf( keys[k] );
					lstpos = ( ret.length ) - keys[k].length;
					if (( e_pos != -1 ) && ( e_pos == lstpos )){
						ret = trim(ret.substr( 0, ret.length - keys[k].length ));
						restart = true;
						break;
					}
				}
				if ( restart == true ) break;
			}
			if (( s_pos == -1 ) && ( e_pos == -1 )) break;
		}
		return ret;
	}
	this.find_next_gate = function( in_gate_type, outkey ){
		var ind = -1;
		out_gate_length = "0";
		if ( this.str.length < 1 ) return ind;
		var keys = null;
		switch( in_gate_type ) {
			case Verbage.search_gate_key_type._GK_AND:
				keys = Verbage.search_gate_tokens.keys_and; break;
			case Verbage.search_gate_key_type._GK_OR:
				keys = Verbage.search_gate_tokens.keys_or; break;
			case Verbage.search_gate_key_type._GK_NOT:
				keys = Verbage.search_gate_tokens.keys_not; break;
			case Verbage.search_gate_key_type._GK_QUOTE:
				keys = Verbage.search_gate_tokens.keys_quote; break;
		}		
		for( var k = 0; k < keys.length; k++ ) {
			var pos = 0;
			while( pos != -1 ) {
				pos = this.str.indexOf( keys[k], pos );
				if ( pos == -1 ) break;
				if(( ind == -1 ) || ( pos < ind )){
					var b = this.is_inside_quotes( pos, pos + keys[k].length-1 );
					if ( b == false ){
						ind = pos;
						var ogl = keys[k].length;
						outkey.keylen = keys[k].length;
						break;
					}
				}
				pos++;
			}
		}
		return ind;
	}
	this.process_operator_gate = function( in_gate_key_type  ){
		var ret = false;
		var key_len = new Object();
		key_len.constructor.prototype.keylen = 0;
		this.str = this.clean_bad_operator_gates( this.str );
		if ( in_gate_key_type == Verbage.search_gate_key_type._GK_QUOTE ) return ret;
		var ind = this.find_next_gate( in_gate_key_type, key_len );
		if ( ind > 0 ) {
			ret = true;
			switch( in_gate_key_type ) {
				case Verbage.search_gate_key_type._GK_OR:
					this.type = Verbage.search_gate_type._OR;
					break;
				case Verbage.search_gate_key_type._GK_NOT:
					this.type = Verbage.search_gate_type._NOT;
					break;
				default:
					this.type = Verbage.search_gate_type._AND;
					break;
			}
			var left =  this.clean_bad_operator_gates( this.str.substr( 0, ind ) );
			var right = this.clean_bad_operator_gates( this.str.substr( ( ind + 1 ) + key_len.keylen ));
			if ( left != "" ) this.gate_l = new searchgate( left, Verbage.search_gate_type._BOOL, null, this.breaker_id );
			if ( right != "" ) this.gate_r = new searchgate( right, Verbage.search_gate_type._BOOL, null, this.breaker_id );
			this.str = "";
		}
		return ret;
	}

	this.process_children = function(){

		if ( this.process_operator_gate ( Verbage.search_gate_key_type._GK_NOT ) == true ) return;		
		if ( this.process_operator_gate ( Verbage.search_gate_key_type._GK_AND ) == true ) return;
		if ( this.process_operator_gate ( Verbage.search_gate_key_type._GK_OR  ) == true ) return;			

		var A = 0;
		var B = 1;
		var indA2 = -1;
		var indB2 = -1;
		var indA1 = this.str.indexOf( Verbage.search_gate_tokens.keys_quote[A] );
		var indB1 = this.str.indexOf( Verbage.search_gate_tokens.keys_quote[B] );
		if (( indA1 == -1 ) && ( indB1 == -1 )) {
			if ( indA1 != -1 )	indA2 = this.str.indexOf( Verbage.search_gate_tokens.keys_quote[A], indA1 + 1 );
			if ( indB1 != -1 )	indB2 = this.str.indexOf( Verbage.search_gate_tokens.keys_quote[B], indB1 + 1 );
			if (( indA2 == -1 ) && ( indB2 == -1 ))	{
				if ((( indA1 == -1 ) || ( indA2 == -1 )) && (( indB1 == -1 ) || ( indB2 == -1 ))) {
					var q_ind_1 = -1;
					var q_ind_2 = -1;
					if (( indA1 != -1 ) && ( indA2 != -1 )){
						q_ind_1 = indA1;
						q_ind_2 = indA2;
					}
					if ( q_ind_1 == -1 ) {
						q_ind_1 = indB1;
						q_ind_2 = indB2;
					}
					if (( indB1 < q_ind_1 ) && (( indB1 != -1 ) && ( indB2 != -1 ))){
						q_ind_1 = indB1;
						q_ind_2 = indB2;
					}
					if ( q_ind_2 == q_ind_1 + 1 ) {
						if ( q_ind_1 > 0 ){
							this.type = Verbage.search_gate_type._AND;
							var left =  this.clean_bad_operator_gates( this.str.substr( 0, q_ind_1 ) );
							var right = this.clean_bad_operator_gates( this.str.substr( q_ind_1 ));
							if ( left != "" ) this.gate_l = new searchgate( left, Verbage.search_gate_type._BOOL, null, this.breaker_id );
							if ( right != "" ) this.gate_r = new searchgate( right, Verbage.search_gate_type._BOOL, null, this.breaker_id );
							this.str = ""; return;
						} else {
							if ( q_ind_2 < this.str.length - 1 ) {
								this.type = Verbage.search_gate_type._AND;
								var left =  this.clean_bad_operator_gates( this.str.substr( 0, q_ind_2 + 1 ) );
								var right = this.clean_bad_operator_gates( this.str.substr( q_ind_2 + 1 ));
								if ( left != "" ) this.gate_l = new searchgate( left, Verbage.search_gate_type._BOOL, null, this.breaker_id );
								if ( right != "" ) this.gate_r = new searchgate( right, Verbage.search_gate_type._BOOL, null, this.breaker_id );
								this.str = ""; return;
							} else {
								this.type = Verbage.search_gate_type._QUOTE;
								var tempstring = this.clean_bad_operator_gates( this.str );
								this.str = tempstring.substr( 1, this.str.length - 2 );
								this.b_quoted = true;
							}
						}
					}
				}
			}
		}
		if ( this.gate_l != null ) this.gate_l.process_children();
		if ( this.gate_r != null ) this.gate_r.process_children();
		if (( this.gate_l == null ) && ( this.gate_l == null )) this.terminator = true;
		if ( this.type == Verbage.search_gate_type._BOOL ) this.type = Verbage.search_gate_type._AND;
	}
	
	this.build_sb_expressions = function(){
		if ( this.terminator == true ) {
			var exp_strs = new Array();
			var escapes = new Array("-", "$", "(", ")", "*", "+", ".", "[", "?", "\\", "^", "{", "|");
			var tok_ops_copy = this.tok_exp_ops;
			var out_toks = new Array();
			if ( this.type == Verbage.search_gate_type._QUOTE ) out_toks = this.mixed_case;
			else {
				out_toks = this.toks;
				for( var i = 0; i < this.mixed_case.length; i++ ) {
					var mixed_item = this.mixed_case[i];
					var newstr = "";
					for ( var j = 0; j < mixed_item.length; j++ ) {
						var in_char = mixed_item.substr(j,1);
						var l = mixed_item.charCodeAt(j);
						if (( l >= 0xFF01 ) && ( l <= 0xFFEE )) {
							var rep_char = c_fold_c( mixed_item.substr(j,1) );
							if ( rep_char != "" ) newstr+=mixed_item.substr(j,1);
							else newstr+=in_char;
						} else newstr+=in_char;
					}
					out_toks[i] = newstr;
				}
			}
			this.exp_toks = out_toks;
			for( var i = 0; i < out_toks.length; i++ ) {
				var out_tok = out_toks[i];
				for ( var j = 0; j < out_tok.length; j++ ) {
					var test = out_tok.substr(j,1);
					for ( var k = 0; k < escapes.length; k++ ) {
						if ( escapes[k] == test ) {
							var rt = ""; var lft = "";
							if ( j != 0 ) lft = out_tok.substr(0,j);
							if ( j + 1 < out_tok.length ) rt =  out_tok.substr(j+1);
							out_tok = lft + "\\" + escapes[k] + rt;
							j++;
						}
					}
				}
				exp_strs[exp_strs.length] = out_tok;
			}
			if ( exp_strs.length > 1 ) {
				for( var i = 1; i < exp_strs.length; i++ ){
					var exp_str = exp_strs[i];
					var tok_op = tok_ops_copy[i];
					if (( tok_op == _JOIN_ALL ) || ( tok_op == _JOIN_R ) || ( tok_op == _JOIN_L )){
						if (( tok_op == _JOIN_ALL ) || ( tok_op == _JOIN_L )){
							if ( i < exp_strs.length ) {
								exp_strs[i-1]+=exp_strs[i];
								exp_strs = array_remove_item( i, exp_strs );
								this.exp_toks[i-1]+=this.exp_toks[i];
								this.exp_toks = array_remove_item( i, this.exp_toks );
								tok_ops_copy = array_remove_item( i, tok_ops_copy );
								i--;
								if ( i > exp_strs.length-1 ) break;
							}
						}
						if (( tok_op == _JOIN_ALL )|| ( tok_op == _JOIN_R )){
							if ( i < exp_strs.length-1 ) {
								exp_strs[i]+=exp_strs[i+1];
								exp_strs = array_remove_item( i+1, exp_strs );
								this.exp_toks[i]+=this.exp_toks[i+1];
								this.exp_toks = array_remove_item( i+1, this.exp_toks );
								tok_ops_copy = array_remove_item( i+1, tok_ops_copy );
							}
						}
					}
				}
			}
			var drop_bounds = new Array( exp_strs.length );
			for( var i = 0; i < exp_strs.length; i++ ) {
				var exp_item = exp_strs[i]; var new_exp = "";
				for ( var j = 0; j < exp_item.length; j++ ) {
					var in_char = exp_item.substr(j,1);
					var l = exp_item.charCodeAt(j);
					drop_bounds[i] = false;
					if (( l >= 0xFF01 ) && ( l <= 0xFFEE )) {
						var rep_char = c_fold_c( in_char );
						if ( rep_char != "" ) {
							drop_bounds[i] = true;
							new_exp+="[" + in_char + rep_char + "]";
						} else new_exp+=in_char;
					} else {
						var rep_char = getvoicedhalfwidthkana( in_char.charCodeAt(0) ); 
						if ( rep_char.length > 1 ) new_exp+="(" + in_char + "|" + rep_char + ")";
						else new_exp+=in_char;
					}
				}
				exp_strs[i] = comp_locale( new_exp, this.breaker_id, true );
			}
			for( var i = 0; i < exp_strs.length; i++ ){
				var tok_op = tok_ops_copy[i];
				switch( tok_op ) {
					case _BOUNDS_:
						if ( drop_bounds[i] == false ) exp_strs[i] = "\\b" + exp_strs[i] + "\\b";
						break;
					case _JOIN_L:
						if ( drop_bounds[i] == false ) exp_strs[i] = exp_strs[i] + "\\b";
						break;
					case _JOIN_R:
						if ( drop_bounds[i] == false ) exp_strs[i] = "\\b" + exp_strs[i];
						break;
					default:
						break;
				}
			}
			if ( this.type == Verbage.search_gate_type._QUOTE ) {
				var expression = "";
				var str_op = " ";
				for( var i = 0; i < exp_strs.length; i++ ){
					var exp_str = exp_strs[i];
					if ( this.type != Verbage.search_gate_type._NOT ) {
						if ( i == 0 ) expression = exp_strs[i];
						else expression += str_op + exp_strs[i];
					}
				}
				this.expressions[this.expressions.length] = expression;
				return;
			}
			this.expressions = exp_strs;
		} else return;
	}

	if ( in_type == null ) this.type = this.convert_expression_type( in_iet );
	else this.type = in_type;
	if ( this.type == Verbage.search_gate_type._BOOL ){
		this.terminator = false;
		this.process_children();
	}
	this.validate();
}

function doc_result_titem( in_tindex, in_rank ) {
	this.tindex = in_tindex; this.rank = in_rank;
	this.add_to_rank = function( in_rank ) {
		this.rank+=in_rank;
	}
}

function documentresult( in_stat ) {
	this.collection_index = in_stat.collection_index;
	this.url_index = parseInt( in_stat.url_index );
	this.titems = new Array();
	var titem = new doc_result_titem( in_stat.input_index, parseFloat( in_stat.rank ) );
	this.titems[this.titems.length] = titem;
	this.compiled_rank = titem.rank;
	this.add_to_rank = function( in_token_index, in_rank ) {
		this.compiled_rank = 0.0;
		var titem = null;
		var i = -1;
		for( i = 0; i < this.titems.length; i++ ){
			var titem = this.titems[i];
			if ( titem.tindex == in_token_index ) {
				titem.rank+=in_rank;
				this.titems[i] = titem;
			}
			this.compiled_rank+=titem.rank;
		}
	}

	this.add_titem = function( in_titem ){
		this.titems[this.titems.length] = in_titem;
		this.compiled_rank+=in_titem.rank;
	}

	this.remove_titem = function( in_index ){
		if ( this.titems.length-1 >= in_index ){
			var titem = this.titems[in_index];
			this.compiled_rank-=titem.rank;			
			this.titems = array_remove_item( in_index, this.titems );
		}
	}

	this.get_titem = function( in_tindex ){
		if ( this.titems.length == 0 )	return null;
		for( var i = 0; i < this.titems.length; i++ ){
			var titem = this.titems[i];
			if ( titem.tindex == in_tindex ) return titem;
		}
		return null;
	}
}

function collection_offset( in_start, in_end ){
	this.start = in_start;
	this.end = in_end;
}

function document_result_set() {	
	this.documentresults = new Array();
	this.cig = new Array();

	this.adjust_offset = function( in_collection_index, modified_index, added ){		

		if (( !added ) && ( this.cig.length< 1 )) return;
		if (( !added ) && ( this.cig.length < in_collection_index )) return;
		var a = this.cig.length;
		while( a <= in_collection_index ){
			this.cig[this.cig.length] = new Array();
			a++;
		}
		if ( added ){
			for( var b = 0; b < this.cig.length; b++ ){
				for( var c = 0; c < this.cig[b].length; c++ ){
					var v = this.cig[b][c];
					if ( v >= modified_index )	this.cig[b][c] = v + 1;
				}
			}
			this.cig[in_collection_index][this.cig[in_collection_index].length] = modified_index;
		} else {
			for( var i = 0; i < this.cig[in_collection_index].length; i++ ){
				if ( this.cig[in_collection_index][i] == modified_index ){
					this.cig[in_collection_index] = array_remove_item( i, this.cig[in_collection_index] );
					for( var b = 0; b < this.cig.length; b++ ){
						for( var c = 0; c < this.cig[b].length;c++ ){
							var v = this.cig[b][c];
							if ( v > modified_index )	this.cig[b][c] = v - 1;
							if ( v == modified_index )	this.cig[b] = this.cig[in_collection_index] = array_remove_item( c, this.cig[b] );
						}
					}
					break;
				}
			}
		}
	}

	this.get_offsets = function( in_collection_index ){
		if ( in_collection_index >= this.cig.length ) return new Array();
		return this.cig[in_collection_index];
	}
	
	this.get_documentresult = function( in_collection_index, in_url_index ){
		var offs = this.get_offsets( in_collection_index );
		for( var i = 0; i < offs.length; i++ ){	
			var doc_res = this.documentresults[offs[i]];
			if (( doc_res.collection_index == in_collection_index ) && ( doc_res.url_index == in_url_index )) return doc_res;
		}
		return null;
	}
	
	this.get_documentresult_index = function( in_collection_index, in_url_index ){
		var i = -1;
		if ( this.documentresults.length == 0 ) return i;
		for( i = 0; i < this.documentresults.length; i++ ){
			var doc_res = this.documentresults[i];
			if (( doc_res.collection_index == in_collection_index ) &&  ( doc_res.url_index == in_url_index )) return i;
		}
		return -1;
	}

	this.add_documentresult = function( in_tok_res ) {
		for( var i = 0; i < in_tok_res.stats.length; i++ ) {
			var stat = in_tok_res.stats[i];
			this.documentresults[this.documentresults.length] = new documentresult( in_tok_res.stats[i] );
			this.adjust_offset( in_tok_res.stats[i].collection_index, this.documentresults.length-1, true );
		}
	}
	
	this.add_documentresult2 = function( in_result ) {
		var doc_res = this.get_documentresult( in_result.collection_index, in_result.url_index );
		if ( doc_res != null ){
			for( var j = 0; j < in_result.titems.length; j++ )
				doc_res.add_titem( new doc_result_titem( in_result.titems[j].tindex, in_result.titems[j].rank ));
		} else {
			this.documentresults[this.documentresults.length] = in_result;
			this.adjust_offset( in_result.collection_index, this.documentresults.length-1, true );
		}
	}

	this.filter_results_AND_compile = function( right_set ) {
		for( var i = 0; i < this.documentresults.length; i++ ){
			var l_result = this.documentresults[i];
			var r_result = right_set.get_documentresult( l_result.collection_index, l_result.url_index );
			if ( r_result == null ) {		
				this.documentresults = array_remove_item( i, this.documentresults );
				this.adjust_offset( l_result.collection_index, i, false );
				i--;
			} else {
				for( var j = 0; j < r_result.titems.length; j++ )
					this.documentresults[i].add_titem( new doc_result_titem( r_result.titems[j].tindex, r_result.titems[j].rank ));
			}
		}	
	}

	this.filter_results_NOT = function( right_set ) {
		for( var i = 0; i < right_set.documentresults.length; i++ ){
			var r_result = right_set.documentresults[i];
			var index = this.get_documentresult_index( r_result.collection_index, r_result.url_index );
			if ( index > -1 ) {
				this.documentresults = array_remove_item( index, this.documentresults );
				this.adjust_offset( r_result.collection_index, index, false );
//				this.adjust_offset( index, i, false );
			}
		}
	}

	this.compile_final_results = function( search ) {
		if ( search.indexed_collections.length == 0 ) return null;
		if ( this.documentresults.length == 0 ) return null;
		var final_results = new Array();	
		for( var i = 0; i < this.documentresults.length; i++ ) {		
			var doc_res = this.documentresults[i];
			if ( search.indexed_collections.length-1 >= doc_res.collection_index ){
				collection = search.indexed_collections[doc_res.collection_index];
				if ( collection.documents.length == 0 ) continue;
				if ( collection.documents.length-1 < doc_res.url_index ) continue;
				doc_obj = collection.documents[doc_res.url_index];
				doc_obj.last_rank = doc_res.compiled_rank;
				doc_obj.coll_title = search.indexed_collections[doc_res.collection_index].title;
				if (( doc_obj.hide != "true" ) && 
				    ( doc_obj.hide != "True" ) && 
				    ( doc_obj.hide != "TRUE" ) &&
				    ( doc_obj.hide != "yes" ) && 
				    ( doc_obj.hide != "Yes" ) && 
				    ( doc_obj.hide != "YES" )){
					final_results[final_results.length] = doc_obj;
				}
			}
		}
		final_results.sort(sort_final_results);
		return final_results;
	}
}

function sort_final_results( l_item, r_item ){
if(l_item.last_rank>r_item.last_rank) return -1;
if(l_item.last_rank<r_item.last_rank) return 1;
return 0;
}

function array_insert_item( index, arrobj, item ){
	if ( ( index >= arrobj.length ) || ( index < 0 ) ){
		arrobj[arrobj.length] = item;
		return arrobj;
	}
	if (( arrobj.length == 1 ) || ( index == 0 )){
		var a = new Array(item);
		arrobj = a.concat( arrobj );
		return arrobj;
	}
	var a = arrobj;
	var b = arrobj.slice( index );
	a.length = index;
	a[a.length] = item;
	arrobj = a.concat(b);
	return arrobj;
}

function array_remove_item( index, arrobj ){
	if (( arrobj.length == 1 ) && ( index == 0 ))	return new Array();
	if (( index < 0 ) || ( index >= arrobj.length )) return arrobj;
	if ( index == 0 ) {
		arrobj = arrobj.slice( 1 );
		return arrobj;
	}
	var a = arrobj;
	var b = arrobj.slice( index + 1 );
	a.length = index;
	arrobj = a.concat(b);
	return arrobj;
}

function tokenresult( node, in_collection_index, in_input_index ) {
		var stext = node.text;
		this.input_index = in_input_index;
		this.token = stext;
		this.rankstr = node.getAttribute( "r" );
		this.collection_index = in_collection_index;
		this.stats = new Array();
		if ( this.rankstr == null ) return;
		if ( this.rankstr == "" ) return;
		split1 = this.rankstr.split(' ');
		for ( var i = 0; i < split1.length; i++ )
			this.stats[this.stats.length] = new search_stat_obj( split1[i], in_input_index, in_collection_index );
}

function indexed_tokens_range_obj( elm ) {
	this.bvalid = true;
	this.url = elm.getAttribute("s");
	if ( this.url == "" ) {
		this.bvalid = false;
		return;
	}
	var v = elm.getAttribute("v");
	if ( v == "" ){
		this.bvalid = false;
		return;
	}
	var _e = v.lastIndexOf(" - ");
	var _s = _e + 3;
	this.start = v.substr( 0, _e );
	if ( this.start == "" ) {
		this.bvalid = false;
		return;
	}
	this.end = v.substr( _s );
	if ( this.end == "" ) {
		this.bvalid = false;
		return;
	}
	this.istargetfor = function( in_token ) {
		var lvalS = "";
		var lvalE = "";
		lvalS = this.start;
		lvalE = this.end;
		var cmp_l = vbCompareString( in_token, this.start, true );
		var cmp_r = vbCompareString( in_token, this.end, true );
		if (( cmp_l == 0 ) || ( cmp_r == 0 )) return true;
		if (( cmp_l  > 0 ) && ( cmp_r  < 0 )) return true;
		return false;
	}
}

function indexed_document_obj(elm, in_url_base) {
	this.last_rank = 0.0;
	this.bvalid = true;
	this.id = elm.getAttribute("id");
	this.url = elm.getAttribute("u");

	this.hide = elm.getAttribute("hide");

	this.url_base = in_url_base;
//	this.wordcount = elm.getAttribute("w");
//	this.tokencount = elm.getAttribute("t");

	this.title = elm.getAttribute("s");
	this.coll_title = "";
	var dt_val = elm.getAttribute("m");
	if ( dt_val == "" )	this.doctype = 0;
	else	this.doctype = parseInt( dt_val );

//	if (( this.id == "" )||( this.url == "")||( this.wordcount == ""  )||( this.tokencount == "" )) this.bvalid = false;
	if (( this.id == "" )||( this.url == "")) this.bvalid = false;

	if (( this.doctype < 0 ) || ( this.doctype > 1 ))	this.bvalid = false;
	if (( this.doctype == 1 ) && ( this.title == "" ))	this.bvalid = false;

}

function indexed_collection_obj( url ){
	this.bvalid = false;
	srcdom = xml_load( url );
	if ( srcdom == null ) return;
	this.title = srcdom.documentElement.getAttribute("title");
	this.url = url;
	this.url_base = "";
	var ub = srcdom.documentElement.getAttribute("relbase");
	if (API.LRNIsViewerHosted())
	{
	    ub = "../" + ub;
	}
	if ( ub != "" ) this.url_base  = ub;
	this.base_path = getbasepath( url );
	this.documents = new Array();
	nodes = srcdom.selectNodes("//d");	
	if ( nodes.length < 1 ) return;
	for( var i = 0; i < nodes.length; i++ ) {
		var ind_doc_obj = new indexed_document_obj( nodes[i], this.url_base );
		if ( ind_doc_obj.bvalid != true ) return;
		this.documents[this.documents.length] = ind_doc_obj;
	}
	this.ranges = new Array();
	var rngsurl = srcdom.documentElement.getAttribute("rangesref");
	if ( rngsurl == "" ) return;
	srcdom = xml_load( this.base_path + "/" + rngsurl );
	if ( srcdom == null ) return;
	nodes = srcdom.selectNodes("//rng");
	if ( nodes.length == 0 ) return;
	for( var i = 0; i < nodes.length; i++ ) {
		var ind_tok_rng = new indexed_tokens_range_obj( nodes[i] );
		if ( ind_tok_rng.bvalid == true ) this.ranges[this.ranges.length] = ind_tok_rng;
		else return;
	}
	this.bvalid = true;
}

function token_section_obj( collection_url, range_obj ) {
	this.bvalid = false;
	this.collection_url = collection_url;
	var base_path = getbasepath( collection_url );
	this.range_url	= range_obj.url;
	this.xmlobj = xml_load( base_path + "/" + this.range_url );
	if ( this.xmlobj == null ) return;
	this.bvalid = true;
	this.token_search = function( in_string, in_collection_index, in_input_index ) {
		if ( ( in_string.indexOf("\\") > -1 ) || ( in_string.indexOf("'") > -1 ) || ( in_string.indexOf("\"") > -1 )) {
			for( var i = 0; i < this.xmlobj.documentElement.childNodes.length; i++ ){
				var node = this.xmlobj.documentElement.childNodes[i];
				var comp = vbCompareString( node.text, in_string, true );
				if ( comp == 0 ) return new tokenresult( node, in_collection_index, in_input_index);
			}
			return null;
		} else {
			var selection = "./t/text()[. = '" + in_string + "']";
			node = this.xmlobj.documentElement.selectSingleNode( selection );
			if ( node == null ) return null;
			return new tokenresult( node.parentNode, in_collection_index, in_input_index);
		}
	}
}

function searchobj( in_breaker_id ) {
	this.lastgate = null;
	this.indexed_collections = new Array();
	this.indexed_token_sections = new Array();
	this.breaker_id = in_breaker_id;

	this.add_indexed_collection = function( srcfile ){
		if ( srcfile == "" ) return false;
		var badd = true;
		for( var i = 0; i < this.indexed_collections.length; i++ ) {
			var ind_coll = this.indexed_collections[i];
			if ( srcfile == ind_coll.url ) badd = false;
		}
		if ( badd == true ) {
			var collection = new indexed_collection_obj( srcfile );
			if ( collection.bvalid == true ) this.indexed_collections[this.indexed_collections.length] = collection;
			else badd = false;
		}
		return badd;
	}

	this.add_indexed_token_section = function( in_collection_url, in_tokens_range_obj ){
		var iret = -1; var badd = true;
		for( var i = 0; i < this.indexed_token_sections.length; i++ ) {
			var tok_sect = this.indexed_token_sections[i];
			if (( in_tokens_range_obj.url == tok_sect.range_url ) &&  ( in_collection_url == tok_sect.collection_url )){
				iret = i; badd = false; break;
			}
		}
		if ( badd == true ) {
			tok_sect = new token_section_obj( in_collection_url, in_tokens_range_obj );
			if ( tok_sect.bvalid == true ) {
				iret = this.indexed_token_sections.length;
				this.indexed_token_sections[this.indexed_token_sections.length] = tok_sect;
			} else badd = false;
		}
		return iret;
	}
	
 	this.tokensearch = function( gate ) {
		gate.results = new document_result_set();
		var out_scids 	      = new Array();
		var out_mixed_case    = new Array();
		var out_tok_exp_ops   = new Array();
		tokens = create_tokens( gate.str, out_scids, out_mixed_case, out_tok_exp_ops );
		if ( tokens == null ) return;
		if ( tokens.length == 0 ) return;
		gate.scids = out_scids;
		gate.toks = tokens;
		gate.mixed_case = out_mixed_case;
		gate.tok_exp_ops = out_tok_exp_ops;
		var results = new document_result_set();
		for( var a = 0; a < this.indexed_collections.length; a++ ){
			var collection_results = new document_result_set();
			var collection = this.indexed_collections[a];
			var ranges = collection.ranges;
			for( var t = 0; t < tokens.length; t++ ) {
				var token_results = new document_result_set();
				var tok_sect_index = -1;
				for ( var b = 0; b < ranges.length; b++ ) {
					range = ranges[b];
					if ( range.istargetfor( tokens[t] )) {
						tok_sect_index = this.add_indexed_token_section( collection.url, range );
						break;
					}
				}
				if ( tok_sect_index > -1 ) {
					var tok_sect = this.indexed_token_sections[tok_sect_index];
					rs = tok_sect.token_search( tokens[t], a, t );
					if ( rs != null ) token_results.add_documentresult( rs );
					else {
						if ( gate.type != Verbage.search_gate_type._OR ) {
							collection_results = new document_result_set(); break;
						}
					}
				}			
				if (( t > 0 ) && ( gate.type != Verbage.search_gate_type._OR )) collection_results.filter_results_AND_compile( token_results );
				else {
					for( var i = 0; i < token_results.documentresults.length; i++ )
						collection_results.add_documentresult2( token_results.documentresults[i] );
				}
			}
			for( var i = 0; i < collection_results.documentresults.length; i++ )
				results.add_documentresult2( collection_results.documentresults[i] );
		}
		gate.results = results;
	}

	this.gated_item_search = function( gate ){
		if ( gate.terminator == true ) {
			this.tokensearch( gate );
			gate.build_sb_expressions();
		} else {
			if ( gate.gate_l != null ) this.gated_item_search( gate.gate_l );
			if ( gate.gate_r != null ) this.gated_item_search( gate.gate_r );
			if ( gate.gate_r != null ){
				if ( gate.gate_r.results == null )		gate.gate_r = null;
				else {
					if ( gate.gate_r.results.documentresults == null )		gate.gate_r = null;
				}
			}
			if ( gate.gate_l != null ){
				if ( gate.gate_l.results == null )		gate.gate_l = null;
				else {
					if ( gate.gate_l.results.documentresults == null )		gate.gate_l = null;
				}
			}

			if (( gate.gate_l == null ) && ( gate.gate_r == null )) return;


			if (( gate.gate_l != null ) && ( gate.gate_r != null )){
				if (( gate.gate_l.results.documentresults.length == 0 ) && ( gate.gate_r.results.documentresults.length == 0 )) return;
			}				

			if  (( gate.type == Verbage.search_gate_type._AND )  || ( gate.type == Verbage.search_gate_type._QUOTE)){
				if (( gate.gate_l == null ) || ( gate.gate_r == null )) return;
				if (( gate.gate_l.results.documentresults.length == 0 ) ||  ( gate.gate_r.results.documentresults.length == 0 )) return;
			}

			if (( gate.type == Verbage.search_gate_type._NOT ) && ( gate.gate_l == null )) return;
			if (( gate.type == Verbage.search_gate_type._NOT ) && ( gate.gate_l.results.documentresults.length == 0 )) return;

			if (( gate.type == Verbage.search_gate_type._NOT ) && ( gate.gate_r == null )) {
				gate.results = gate.gate_l.results; return;
			}
			if (( gate.type == Verbage.search_gate_type._NOT ) && ( gate.gate_r.results.documentresults.length == 0 )){
				gate.results = gate.gate_l.results; return;
			}
			if (( gate.type == Verbage.search_gate_type._OR ) && (( gate.gate_l == null )||( gate.gate_r == null ))) {
				if ( gate.gate_r == null ) gate.results = gate.gate_l.results;
				else gate.results = gate.gate_r.results;
				return;
			}
			if  (( gate.type == Verbage.search_gate_type._OR )&&(( gate.gate_l.results.documentresults.length == 0 )||( gate.gate_r.results.documentresults.length == 0 ))){
				if ( gate.gate_r.results.documentresults.length == 0 ) gate.results = gate.gate_l.results;
				else gate.results = gate.gate_r.results;
				return;
			}
			var results = new document_result_set();
			if ( gate.type == Verbage.search_gate_type._OR ){
				results = gate.gate_l.results;
				for( var i = 0; i < gate.gate_r.results.documentresults.length; i++ )
					results.add_documentresult2( gate.gate_r.results.documentresults[i] );
				gate.results = results; return;
			}
			if ( gate.type == Verbage.search_gate_type._NOT ){
				gate.gate_l.results.filter_results_NOT( gate.gate_r.results );
				gate.results = gate.gate_l.results; return;
			}
			if (( gate.type == Verbage.search_gate_type._AND ) || ( gate.type == Verbage.search_gate_type._QUOTE )) {
				gate.gate_l.results.filter_results_AND_compile( gate.gate_r.results );
				gate.results = gate.gate_l.results; return;
			}
			return;
		}
	}

	this.gatedsearch = function( in_string, in_collection_urls, in_type, in_max_results ) {
		for( var i = 0; i < in_collection_urls.length; i++ )	this.add_indexed_collection( in_collection_urls[i] ); 
		var gate = new searchgate( in_string, in_type, null, this.breaker_id );
		this.gated_item_search( gate );
		if ( gate.results == null ) return new Array();
		var final_results = gate.results.compile_final_results( this );
		if (( final_results != null ) && ( in_max_results != null ) && ( in_max_results > 0 )){
			if ( final_results.length > in_max_results ) final_results.length = in_max_results;
		}
		this.lastgate = gate;
		return final_results;
	}
}
// SIG // Begin signature block
// SIG // MIIbDwYJKoZIhvcNAQcCoIIbADCCGvwCAQExCzAJBgUr
// SIG // DgMCGgUAMGcGCisGAQQBgjcCAQSgWTBXMDIGCisGAQQB
// SIG // gjcCAR4wJAIBAQQQEODJBs441BGiowAQS9NQkAIBAAIB
// SIG // AAIBAAIBAAIBADAhMAkGBSsOAwIaBQAEFDs4oVvWFful
// SIG // F6g4160NeK5iA2S0oIIV6jCCBIUwggNtoAMCAQICCmEF
// SIG // 9x4AAAAAADIwDQYJKoZIhvcNAQEFBQAweTELMAkGA1UE
// SIG // BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNV
// SIG // BAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBD
// SIG // b3Jwb3JhdGlvbjEjMCEGA1UEAxMaTWljcm9zb2Z0IENv
// SIG // ZGUgU2lnbmluZyBQQ0EwHhcNMDkwNzEzMjMwMDE4WhcN
// SIG // MTAxMDEzMjMxMDE4WjCBgzELMAkGA1UEBhMCVVMxEzAR
// SIG // BgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1v
// SIG // bmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlv
// SIG // bjENMAsGA1UECxMETU9QUjEeMBwGA1UEAxMVTWljcm9z
// SIG // b2Z0IENvcnBvcmF0aW9uMIIBIjANBgkqhkiG9w0BAQEF
// SIG // AAOCAQ8AMIIBCgKCAQEAtYypnJSEYRrMLiLEoJNkCd6F
// SIG // obCQXfzJbGi18e/8jmv0+KBu11HeYKMnY9T237ZM0kUL
// SIG // pz3Yb/7tpxhj0x/GgdS/BzeXQCt/519aNdmTT6vzKpLw
// SIG // po2B7AUk3Nu4YWNTYQI1ONa49e57VKbJWDXp9BXv2gds
// SIG // BS1NpLa6mzu4MTB+RbypoSU5DEOkRzuXnCBEcjfPUKBN
// SIG // TfTDZdxE0Qg7ON0+xRdsRsetcyTAj4nB6uq6zWipEtZY
// SIG // DFMWDP45A9aB8j5cV/N622bhBxjZGQMU9uZFmSpRTJDX
// SIG // Wu+vtzsMKU1tIK4Ht5Iu6GnKnzBC58MyigsiSjLonAzG
// SIG // UQMmAW2ScwIDAQABo4IBAjCB/zATBgNVHSUEDDAKBggr
// SIG // BgEFBQcDAzAdBgNVHQ4EFgQUh4G33+76d/pZBWM3BArX
// SIG // 6dqg4OAwDgYDVR0PAQH/BAQDAgeAMB8GA1UdIwQYMBaA
// SIG // FFdFdBxdsPbIQwXgjFQtjzKn/kiWMEkGA1UdHwRCMEAw
// SIG // PqA8oDqGOGh0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9w
// SIG // a2kvY3JsL3Byb2R1Y3RzL0NvZGVTaWdQQ0EuY3JsME0G
// SIG // CCsGAQUFBwEBBEEwPzA9BggrBgEFBQcwAoYxaHR0cDov
// SIG // L3d3dy5taWNyb3NvZnQuY29tL3BraS9jZXJ0cy9Db2Rl
// SIG // U2lnUENBLmNydDANBgkqhkiG9w0BAQUFAAOCAQEANiGE
// SIG // 9Y+DIU2HqD+L58WkD0wwbll0mwuXdBapsfNwpK/CDDMk
// SIG // 86BK+sHkIca22epcW5Fh9yJt/zH8F07XzUDjndLltNL6
// SIG // jWwH2neayivuDVlHzwTCEGf66ulDO7fm0ZzZjiNgbhKb
// SIG // w9l+XFcy3ZQN333FSJJNSHa3osBTlT78OqOTfPKFBMfG
// SIG // hTiXNvgSkyIAmU55r5brWiCDrNBcWjCwAOJrOY8kido9
// SIG // DKRGeWI2U2rXyc2SCPuH5VT1fFnFxHd9sMEsmMeXbEOn
// SIG // +CD4g1RknmD44kqlZ9RJv1SIfVJE81HAJtHFfPCJ1hEJ
// SIG // KMJFRYAdkCK9jqIFPjyzT73XOeCIkzCCBM0wggO1oAMC
// SIG // AQICCmEWtSkAAAAAABAwDQYJKoZIhvcNAQEFBQAwdzEL
// SIG // MAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24x
// SIG // EDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jv
// SIG // c29mdCBDb3Jwb3JhdGlvbjEhMB8GA1UEAxMYTWljcm9z
// SIG // b2Z0IFRpbWUtU3RhbXAgUENBMB4XDTEwMDEwNDIxMTIw
// SIG // M1oXDTEzMDEwNDIxMjIwM1owgbYxCzAJBgNVBAYTAlVT
// SIG // MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdS
// SIG // ZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9y
// SIG // YXRpb24xEDAOBgNVBAsTB25DaXBoZXIxJzAlBgNVBAsT
// SIG // Hm5DaXBoZXIgRFNFIEVTTjpBQ0QzLUFFNjYtRTBCNTEl
// SIG // MCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2Vy
// SIG // dmljZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
// SIG // ggEBAOMoqtk8Q0L4BhO64sf5wS9ZyzyV51SQbMNYlWKz
// SIG // D2y9g9stWIgIkgvbzXbHVsbg7irTiDtcyqlwowAjIixT
// SIG // OOhQx/EUCY0dy3yL9aYza6/IRl9Le17556bHL0KFZzaN
// SIG // YEryE2bcsDltzhDK3XIFWHKd8gA7ADntJlM+Hs3uUJLN
// SIG // hfQ6/YGhBV8L6UQO79VZQCYoy4JOTivIFCK7cB3kPdH9
// SIG // YHZUTDns73c4i4z+dK/nFvRwMbjLrdTdi7b6AK3tdBSw
// SIG // Rb78ZYjhrfxJ21/R1M50edSNhm+z9ZcHIS2aYcn8uhtM
// SIG // 0uiruVDk0yv0wdlN1kCsFKeIhXNeaD5jt0HUZr0CAwEA
// SIG // AaOCARkwggEVMB0GA1UdDgQWBBTh8K4PDQX8MvMcfRl/
// SIG // z8TFv5FVTTAfBgNVHSMEGDAWgBQjNPjZUkZwCu1A+3b7
// SIG // syuwwzWzDzBUBgNVHR8ETTBLMEmgR6BFhkNodHRwOi8v
// SIG // Y3JsLm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0
// SIG // cy9NaWNyb3NvZnRUaW1lU3RhbXBQQ0EuY3JsMFgGCCsG
// SIG // AQUFBwEBBEwwSjBIBggrBgEFBQcwAoY8aHR0cDovL3d3
// SIG // dy5taWNyb3NvZnQuY29tL3BraS9jZXJ0cy9NaWNyb3Nv
// SIG // ZnRUaW1lU3RhbXBQQ0EuY3J0MBMGA1UdJQQMMAoGCCsG
// SIG // AQUFBwMIMA4GA1UdDwEB/wQEAwIGwDANBgkqhkiG9w0B
// SIG // AQUFAAOCAQEAjVtJKFSHyYqpk/6b+I1UcSCdwDiTJym5
// SIG // y5ZTios1tZQ3Fli9nj4XJ19ZL+Rdfh3iWdwH+2IY5WO/
// SIG // 9AvPTdpbMPbImv8mWb8ZwxCy8OMewQyZ2lWSxswS38BY
// SIG // TN2a1B0j+YYSROcmAuiAQWgWVDYdp2WzxDOh46SY2b5i
// SIG // kE+SN7apiBdUSB+dwiLYciq5wzCTPjfsKam5zgvVwskW
// SIG // pudeVQ3MgYRh6SwD25umG1MCOIsKWJEXyHFwFs4uxmP8
// SIG // eZ+DBIK0gecvV2mtuKUfIzZ29hWUhgoe6t0RO2ZE0hVa
// SIG // z6YrKB9OxQpzV0uVA2Ci6+kyfr09j6a9SSopwVcxwBDf
// SIG // UTCCBgcwggPvoAMCAQICCmEWaDQAAAAAABwwDQYJKoZI
// SIG // hvcNAQEFBQAwXzETMBEGCgmSJomT8ixkARkWA2NvbTEZ
// SIG // MBcGCgmSJomT8ixkARkWCW1pY3Jvc29mdDEtMCsGA1UE
// SIG // AxMkTWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNhdGUgQXV0
// SIG // aG9yaXR5MB4XDTA3MDQwMzEyNTMwOVoXDTIxMDQwMzEz
// SIG // MDMwOVowdzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldh
// SIG // c2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNV
// SIG // BAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8GA1UE
// SIG // AxMYTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBMIIBIjAN
// SIG // BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAn6Fssd/b
// SIG // SJIqfGsuGeG94uPFmVEjUK3O3RhOJA/u0afRTK10MCAR
// SIG // 6wfVVJUVSZQbQpKumFwwJtoAa+h7veyJBw/3DgSY8InM
// SIG // H8szJIed8vRnHCz8e+eIHernTqOhwSNTyo36Rc8J0F6v
// SIG // 0LBCBKL5pmyTZ9co3EZTsIbQ5ShGLieshk9VUgzkAyz7
// SIG // apCQMG6H81kwnfp+1pez6CGXfvjSE/MIt1NtUrRFkJ9I
// SIG // AEpHZhEnKWaol+TTBoFKovmEpxFHFAmCn4TtVXj+AZod
// SIG // UAiFABAwRu233iNGu8QtVJ+vHnhBMXfMm987g5OhYQK1
// SIG // HQ2x/PebsgHOIktU//kFw8IgCwIDAQABo4IBqzCCAacw
// SIG // DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUIzT42VJG
// SIG // cArtQPt2+7MrsMM1sw8wCwYDVR0PBAQDAgGGMBAGCSsG
// SIG // AQQBgjcVAQQDAgEAMIGYBgNVHSMEgZAwgY2AFA6sgmBA
// SIG // VieX5SUT/CrhClOVWeSkoWOkYTBfMRMwEQYKCZImiZPy
// SIG // LGQBGRYDY29tMRkwFwYKCZImiZPyLGQBGRYJbWljcm9z
// SIG // b2Z0MS0wKwYDVQQDEyRNaWNyb3NvZnQgUm9vdCBDZXJ0
// SIG // aWZpY2F0ZSBBdXRob3JpdHmCEHmtFqFKoKWtTHNY9AcT
// SIG // LmUwUAYDVR0fBEkwRzBFoEOgQYY/aHR0cDovL2NybC5t
// SIG // aWNyb3NvZnQuY29tL3BraS9jcmwvcHJvZHVjdHMvbWlj
// SIG // cm9zb2Z0cm9vdGNlcnQuY3JsMFQGCCsGAQUFBwEBBEgw
// SIG // RjBEBggrBgEFBQcwAoY4aHR0cDovL3d3dy5taWNyb3Nv
// SIG // ZnQuY29tL3BraS9jZXJ0cy9NaWNyb3NvZnRSb290Q2Vy
// SIG // dC5jcnQwEwYDVR0lBAwwCgYIKwYBBQUHAwgwDQYJKoZI
// SIG // hvcNAQEFBQADggIBABCXisNcA0Q23em0rXfbznlRTQGx
// SIG // LnRxW20ME6vOvnuPuC7UEqKMbWK4VwLLTiATUJndekDi
// SIG // V7uvWJoc4R0Bhqy7ePKL0Ow7Ae7ivo8KBciNSOLwUxXd
// SIG // T6uS5OeNatWAweaU8gYvhQPpkSokInD79vzkeJkuDfcH
// SIG // 4nC8GE6djmsKcpW4oTmcZy3FUQ7qYlw/FpiLID/iBxoy
// SIG // +cwxSnYxPStyC8jqcD3/hQoT38IKYY7w17gX606Lf8U1
// SIG // K16jv+u8fQtCe9RTciHuMMq7eGVcWwEXChQO0toUmPU8
// SIG // uWZYsy0v5/mFhsxRVuidcJRsrDlM1PZ5v6oYemIp76Kb
// SIG // KTQGdxpiyT0ebR+C8AvHLLvPQ7Pl+ex9teOkqHQ1uE7F
// SIG // cSMSJnYLPFKMcVpGQxS8s7OwTWfIn0L/gHkhgJ4VMGbo
// SIG // QhJeGsieIiHQQ+kr6bv0SMws1NgygEwmKkgkX1rqVu+m
// SIG // 3pmdyjpvvYEndAYR7nYhv5uCwSdUtrFqPYmhdmG0bqET
// SIG // pr+qR/ASb/2KMmyy/t9RyIwjyWa9nR2HEmQCPS2vWY+4
// SIG // 5CHltbDKY7R4VAXUQS5QrJSwpXirs6CWdRrZkocTdSIv
// SIG // MqgIbqBbjCW/oO+EyiHW6x5PyZruSeD3AWVviQt9yGnI
// SIG // 5m7qp5fOMSn/DsVbXNhNG6HY+i+ePy5VFmvJE6P9MIIG
// SIG // gTCCBGmgAwIBAgIKYRUIJwAAAAAADDANBgkqhkiG9w0B
// SIG // AQUFADBfMRMwEQYKCZImiZPyLGQBGRYDY29tMRkwFwYK
// SIG // CZImiZPyLGQBGRYJbWljcm9zb2Z0MS0wKwYDVQQDEyRN
// SIG // aWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3Jp
// SIG // dHkwHhcNMDYwMTI1MjMyMjMyWhcNMTcwMTI1MjMzMjMy
// SIG // WjB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu
// SIG // Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMV
// SIG // TWljcm9zb2Z0IENvcnBvcmF0aW9uMSMwIQYDVQQDExpN
// SIG // aWNyb3NvZnQgQ29kZSBTaWduaW5nIFBDQTCCASIwDQYJ
// SIG // KoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ+N34U3jLEG
// SIG // VmY2TtQK6zYjkR6vq41Y6cTPwZ86CiTExMResO4VFMX6
// SIG // PpkzaxlpcvR8BV/lmSVE1zUZipDcKI6QDO/VkGGt3twY
// SIG // cC2DyW+vhSz43bm5MP1xeByD/cipuYJnDXq4wQnCvBaX
// SIG // Vz8cmNNp1zCQkJCNMB/YJtSee4jZ4gntl0lF6wRSgXV7
// SIG // uLUiuC5Wu9fPqU48CoOiqDrFrbYBDmrPIrQjH2zVJ+e3
// SIG // fsG01TKteSUcQobinYX0V9obWS8tJpIpxbPXhaOeYFqU
// SIG // 5nuce16CNEtt/9TuJ9Ci3NGQDM59DhV8iKw0x8BsmIRK
// SIG // yUR5aCjfIoMNuIosSGHi/hECAwEAAaOCAiMwggIfMBAG
// SIG // CSsGAQQBgjcVAQQDAgEAMB0GA1UdDgQWBBRXRXQcXbD2
// SIG // yEMF4IxULY8yp/5IljALBgNVHQ8EBAMCAcYwDwYDVR0T
// SIG // AQH/BAUwAwEB/zCBmAYDVR0jBIGQMIGNgBQOrIJgQFYn
// SIG // l+UlE/wq4QpTlVnkpKFjpGEwXzETMBEGCgmSJomT8ixk
// SIG // ARkWA2NvbTEZMBcGCgmSJomT8ixkARkWCW1pY3Jvc29m
// SIG // dDEtMCsGA1UEAxMkTWljcm9zb2Z0IFJvb3QgQ2VydGlm
// SIG // aWNhdGUgQXV0aG9yaXR5ghB5rRahSqClrUxzWPQHEy5l
// SIG // MFAGA1UdHwRJMEcwRaBDoEGGP2h0dHA6Ly9jcmwubWlj
// SIG // cm9zb2Z0LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL21pY3Jv
// SIG // c29mdHJvb3RjZXJ0LmNybDBUBggrBgEFBQcBAQRIMEYw
// SIG // RAYIKwYBBQUHMAKGOGh0dHA6Ly93d3cubWljcm9zb2Z0
// SIG // LmNvbS9wa2kvY2VydHMvTWljcm9zb2Z0Um9vdENlcnQu
// SIG // Y3J0MHYGA1UdIARvMG0wawYJKwYBBAGCNxUvMF4wXAYI
// SIG // KwYBBQUHAgIwUB5OAEMAbwBwAHkAcgBpAGcAaAB0ACAA
// SIG // qQAgADIAMAAwADYAIABNAGkAYwByAG8AcwBvAGYAdAAg
// SIG // AEMAbwByAHAAbwByAGEAdABpAG8AbgAuMBMGA1UdJQQM
// SIG // MAoGCCsGAQUFBwMDMA0GCSqGSIb3DQEBBQUAA4ICAQAw
// SIG // vLAgpGKgp+85JmE93KzGmdCGxC71gzJlXiI+m9aG+Oi2
// SIG // n8qL1jt1C6GRPkzdZHSMSfKIjBhnbP4VZka4OkZCl8iR
// SIG // N9Qksees0+pBFIN308lPBV+jFFK/lqQvPlZbEHXOU8PO
// SIG // BVRptGXJJKUP4SW4GrlN5QK5UB5Ps5gMHZUC7iJZrSLL
// SIG // BXQLBEV7BFng2A+z60z4YN3CeJ7Rup9r9/PufkQRQNK9
// SIG // uptLFghupL5V5KY4EqNI9BxVeoog0X3+kduUjy/Ce2um
// SIG // ZIVPo+UsNCldC7/1xzgvxCDEVjH2ac6F+AqR7NDWrro4
// SIG // BQzrbk9MnAMpqqL8GKApDA1cXFYjV9oclg3IJjbBRMvl
// SIG // 4eZvieeP6Zi1c9N44+2jATx05V68bPYhiWcF7JedtbH9
// SIG // r6bpcqXDNOEvn/n0ajniLQSCW/zQnK58nRH55rVTGXS6
// SIG // OUo5631Cs0o7Nz3CSnsnmOfiTpsbSlQ4aiM3vmq3SO7q
// SIG // Qg1JJJGOtwQul2/k50W7j039YNnXWcLYgNZgNHu3oZMg
// SIG // /oG4qqVcCemKDb4oTX7X6A/tZXjRMV+5ZtvfQucLzAIH
// SIG // jd//IAajRWW0szKNLpHiTbSpyfq8awQOsp/qn96kyQqW
// SIG // 9I332Jio8IUCCFmkIKYsCxryUgbtaeVkGBvgo6veynwU
// SIG // YUO4ZfU2o1UTK2csTRswTDGCBJEwggSNAgEBMIGHMHkx
// SIG // CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9u
// SIG // MRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy
// SIG // b3NvZnQgQ29ycG9yYXRpb24xIzAhBgNVBAMTGk1pY3Jv
// SIG // c29mdCBDb2RlIFNpZ25pbmcgUENBAgphBfceAAAAAAAy
// SIG // MAkGBSsOAwIaBQCggb4wGQYJKoZIhvcNAQkDMQwGCisG
// SIG // AQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisGAQQB
// SIG // gjcCARUwIwYJKoZIhvcNAQkEMRYEFOLsgtIB3J5sgEE8
// SIG // 5U5Q1CbvfBnlMF4GCisGAQQBgjcCAQwxUDBOoCaAJABN
// SIG // AGkAYwByAG8AcwBvAGYAdAAgAEwAZQBhAHIAbgBpAG4A
// SIG // Z6EkgCJodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vbGVh
// SIG // cm5pbmcgMA0GCSqGSIb3DQEBAQUABIIBACZYdABRDrz6
// SIG // 8b/PIat+gKXqIVPrvrk3rJsHPShJNzV667fc465d71Xq
// SIG // iKyEVZb2FWV3cUxE2mYwotIgMsLwrgQFC1ciXtiNma64
// SIG // RPqTYqaLTVvCDscN5ihyHLAvIYGySwpFHQKdBkOOhhTt
// SIG // ckGc+vfo/oiagNDemTIj7U4PZbMB0LiCpfADSkYtar6V
// SIG // s7D0BLhwcufpbXWoGNcj7qwzHUsThU2+yu/nl0Tw1hY/
// SIG // RlzZDPVHMcpxDuAqFtWOvCy3OwtIF/BLX+Zr+JPIL7Ap
// SIG // 4o0bPHMdrw33RW7KFX9duKi4IHJhYyGrk/dotbELMISk
// SIG // FT1WODA3joZwjkATcyoh4zmhggIdMIICGQYJKoZIhvcN
// SIG // AQkGMYICCjCCAgYCAQEwgYUwdzELMAkGA1UEBhMCVVMx
// SIG // EzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1Jl
// SIG // ZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jh
// SIG // dGlvbjEhMB8GA1UEAxMYTWljcm9zb2Z0IFRpbWUtU3Rh
// SIG // bXAgUENBAgphFrUpAAAAAAAQMAcGBSsOAwIaoF0wGAYJ
// SIG // KoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0B
// SIG // CQUxDxcNMTAwMjE5MjIzNzM1WjAjBgkqhkiG9w0BCQQx
// SIG // FgQUlbA5UgviZ3g2a/9le1FypncOKPcwDQYJKoZIhvcN
// SIG // AQEFBQAEggEApq8GmTEqVPHqSILSTtUuNR7hc/Fx+d3D
// SIG // eLrazWgn6/aFsfdRRzxhrPsMplKO8OZkuEut1noqtcse
// SIG // mGD7yDuI3T2xIlatbxXkQeYlB7xWCLhZJizp6jojl1VC
// SIG // nlzE5n9pRQszRTpTOdVEXDY5yyrRqoRCF2en3Z0tblxT
// SIG // X7QqPgDc1c13dFJ8Y9HvEbTe7fWe0iRUfMn1usxUZU5j
// SIG // WPrTy8+6dbMwVHrj06DCL0AjggMtZSmDiBn0JKWzoNGI
// SIG // h6oP7jt4qVz3hwn78phVSrhFAotSZ2KyNMQX86zAA2X0
// SIG // MOELNWt0QTRUjgm2aqIF7oJMkwDaDDhAZad488jNhw6ocQ==
// SIG // End signature block
