var garrSortChar=new Array();
var gaFtsStop=new Array();
var gaFtsStem=new Array();
var gbWhLang=false;

garrSortChar[0] = 0;
garrSortChar[1] = 1;
garrSortChar[2] = 2;
garrSortChar[3] = 3;
garrSortChar[4] = 4;
garrSortChar[5] = 5;
garrSortChar[6] = 6;
garrSortChar[7] = 7;
garrSortChar[8] = 8;
garrSortChar[9] = 40;
garrSortChar[10] = 41;
garrSortChar[11] = 42;
garrSortChar[12] = 43;
garrSortChar[13] = 44;
garrSortChar[14] = 9;
garrSortChar[15] = 10;
garrSortChar[16] = 11;
garrSortChar[17] = 12;
garrSortChar[18] = 13;
garrSortChar[19] = 14;
garrSortChar[20] = 15;
garrSortChar[21] = 16;
garrSortChar[22] = 17;
garrSortChar[23] = 18;
garrSortChar[24] = 19;
garrSortChar[25] = 20;
garrSortChar[26] = 21;
garrSortChar[27] = 22;
garrSortChar[28] = 23;
garrSortChar[29] = 24;
garrSortChar[30] = 25;
garrSortChar[31] = 26;
garrSortChar[32] = 38;
garrSortChar[33] = 45;
garrSortChar[34] = 46;
garrSortChar[35] = 47;
garrSortChar[36] = 48;
garrSortChar[37] = 49;
garrSortChar[38] = 50;
garrSortChar[39] = 33;
garrSortChar[40] = 51;
garrSortChar[41] = 52;
garrSortChar[42] = 53;
garrSortChar[43] = 88;
garrSortChar[44] = 54;
garrSortChar[45] = 34;
garrSortChar[46] = 55;
garrSortChar[47] = 56;
garrSortChar[48] = 115;
garrSortChar[49] = 119;
garrSortChar[50] = 121;
garrSortChar[51] = 123;
garrSortChar[52] = 125;
garrSortChar[53] = 126;
garrSortChar[54] = 127;
garrSortChar[55] = 128;
garrSortChar[56] = 129;
garrSortChar[57] = 130;
garrSortChar[58] = 57;
garrSortChar[59] = 58;
garrSortChar[60] = 89;
garrSortChar[61] = 90;
garrSortChar[62] = 91;
garrSortChar[63] = 59;
garrSortChar[64] = 60;
garrSortChar[65] = 131;
garrSortChar[66] = 148;
garrSortChar[67] = 150;
garrSortChar[68] = 154;
garrSortChar[69] = 158;
garrSortChar[70] = 168;
garrSortChar[71] = 171;
garrSortChar[72] = 173;
garrSortChar[73] = 175;
garrSortChar[74] = 185;
garrSortChar[75] = 187;
garrSortChar[76] = 189;
garrSortChar[77] = 191;
garrSortChar[78] = 193;
garrSortChar[79] = 197;
garrSortChar[80] = 214;
garrSortChar[81] = 216;
garrSortChar[82] = 218;
garrSortChar[83] = 220;
garrSortChar[84] = 225;
garrSortChar[85] = 230;
garrSortChar[86] = 240;
garrSortChar[87] = 242;
garrSortChar[88] = 244;
garrSortChar[89] = 246;
garrSortChar[90] = 252;
garrSortChar[91] = 61;
garrSortChar[92] = 62;
garrSortChar[93] = 63;
garrSortChar[94] = 64;
garrSortChar[95] = 66;
garrSortChar[96] = 67;
garrSortChar[97] = 131;
garrSortChar[98] = 148;
garrSortChar[99] = 150;
garrSortChar[100] = 154;
garrSortChar[101] = 158;
garrSortChar[102] = 168;
garrSortChar[103] = 171;
garrSortChar[104] = 173;
garrSortChar[105] = 175;
garrSortChar[106] = 185;
garrSortChar[107] = 187;
garrSortChar[108] = 189;
garrSortChar[109] = 191;
garrSortChar[110] = 193;
garrSortChar[111] = 197;
garrSortChar[112] = 214;
garrSortChar[113] = 216;
garrSortChar[114] = 218;
garrSortChar[115] = 220;
garrSortChar[116] = 225;
garrSortChar[117] = 230;
garrSortChar[118] = 240;
garrSortChar[119] = 242;
garrSortChar[120] = 244;
garrSortChar[121] = 251;
garrSortChar[122] = 252;
garrSortChar[123] = 68;
garrSortChar[124] = 69;
garrSortChar[125] = 70;
garrSortChar[126] = 71;
garrSortChar[127] = 27;
garrSortChar[128] = 114;
garrSortChar[129] = 28;
garrSortChar[130] = 82;
garrSortChar[131] = 170;
garrSortChar[132] = 85;
garrSortChar[133] = 112;
garrSortChar[134] = 109;
garrSortChar[135] = 110;
garrSortChar[136] = 65;
garrSortChar[137] = 113;
garrSortChar[138] = 223;
garrSortChar[139] = 86;
garrSortChar[140] = 213;
garrSortChar[141] = 29;
garrSortChar[142] = 255;
garrSortChar[143] = 30;
garrSortChar[144] = 31;
garrSortChar[145] = 80;
garrSortChar[146] = 81;
garrSortChar[147] = 83;
garrSortChar[148] = 84;
garrSortChar[149] = 111;
garrSortChar[150] = 36;
garrSortChar[151] = 37;
garrSortChar[152] = 79;
garrSortChar[153] = 229;
garrSortChar[154] = 222;
garrSortChar[155] = 87;
garrSortChar[156] = 212;
garrSortChar[157] = 32;
garrSortChar[158] = 254;
garrSortChar[159] = 251;
garrSortChar[160] = 39;
garrSortChar[161] = 72;
garrSortChar[162] = 97;
garrSortChar[163] = 98;
garrSortChar[164] = 99;
garrSortChar[165] = 100;
garrSortChar[166] = 73;
garrSortChar[167] = 101;
garrSortChar[168] = 74;
garrSortChar[169] = 102;
garrSortChar[170] = 133;
garrSortChar[171] = 93;
garrSortChar[172] = 103;
garrSortChar[173] = 35;
garrSortChar[174] = 104;
garrSortChar[175] = 75;
garrSortChar[176] = 105;
garrSortChar[177] = 92;
garrSortChar[178] = 122;
garrSortChar[179] = 124;
garrSortChar[180] = 76;
garrSortChar[181] = 106;
garrSortChar[182] = 107;
garrSortChar[183] = 108;
garrSortChar[184] = 77;
garrSortChar[185] = 120;
garrSortChar[186] = 199;
garrSortChar[187] = 94;
garrSortChar[188] = 116;
garrSortChar[189] = 117;
garrSortChar[190] = 118;
garrSortChar[191] = 78;
garrSortChar[192] = 131;
garrSortChar[193] = 131;
garrSortChar[194] = 131;
garrSortChar[195] = 131;
garrSortChar[196] = 131;
garrSortChar[197] = 131;
garrSortChar[198] = 131;
garrSortChar[199] = 150;
garrSortChar[200] = 158;
garrSortChar[201] = 158;
garrSortChar[202] = 158;
garrSortChar[203] = 158;
garrSortChar[204] = 175;
garrSortChar[205] = 175;
garrSortChar[206] = 175;
garrSortChar[207] = 175;
garrSortChar[208] = 154;
garrSortChar[209] = 193;
garrSortChar[210] = 197;
garrSortChar[211] = 197;
garrSortChar[212] = 197;
garrSortChar[213] = 197;
garrSortChar[214] = 197;
garrSortChar[215] = 95;
garrSortChar[216] = 197;
garrSortChar[217] = 230;
garrSortChar[218] = 230;
garrSortChar[219] = 230;
garrSortChar[220] = 230;
garrSortChar[221] = 246;
garrSortChar[222] = 227;
garrSortChar[223] = 224;
garrSortChar[224] = 131;
garrSortChar[225] = 131;
garrSortChar[226] = 131;
garrSortChar[227] = 131;
garrSortChar[228] = 131;
garrSortChar[229] = 131;
garrSortChar[230] = 131;
garrSortChar[231] = 150;
garrSortChar[232] = 158;
garrSortChar[233] = 158;
garrSortChar[234] = 158;
garrSortChar[235] = 158;
garrSortChar[236] = 175;
garrSortChar[237] = 175;
garrSortChar[238] = 175;
garrSortChar[239] = 175;
garrSortChar[240] = 154;
garrSortChar[241] = 193;
garrSortChar[242] = 197;
garrSortChar[243] = 197;
garrSortChar[244] = 197;
garrSortChar[245] = 197;
garrSortChar[246] = 197;
garrSortChar[247] = 96;
garrSortChar[248] = 197;
garrSortChar[249] = 230;
garrSortChar[250] = 230;
garrSortChar[251] = 230;
garrSortChar[252] = 230;
garrSortChar[253] = 246;
garrSortChar[254] = 227;
garrSortChar[255] = 250;

gaFtsStop[0] = "0";
gaFtsStop[1] = "1";
gaFtsStop[2] = "2";
gaFtsStop[3] = "3";
gaFtsStop[4] = "4";
gaFtsStop[5] = "5";
gaFtsStop[6] = "6";
gaFtsStop[7] = "7";
gaFtsStop[8] = "8";
gaFtsStop[9] = "9";
gaFtsStop[10] = "a";
gaFtsStop[11] = "à";
gaFtsStop[12] = "ai";
gaFtsStop[13] = "ainsi";
gaFtsStop[14] = "après";
gaFtsStop[15] = "as";
gaFtsStop[16] = "aucun";
gaFtsStop[17] = "aucune";
gaFtsStop[18] = "aussi";
gaFtsStop[19] = "autre";
gaFtsStop[20] = "autre";
gaFtsStop[21] = "avec";
gaFtsStop[22] = "avec";
gaFtsStop[23] = "avez";
gaFtsStop[24] = "avoir";
gaFtsStop[25] = "avons";
gaFtsStop[26] = "besoin";
gaFtsStop[27] = "ce";
gaFtsStop[28] = "celle";
gaFtsStop[29] = "celui";
gaFtsStop[30] = "certaines";
gaFtsStop[31] = "certains";
gaFtsStop[32] = "ces";
gaFtsStop[33] = "cet";
gaFtsStop[34] = "cette";
gaFtsStop[35] = "ceux";
gaFtsStop[36] = "chaque";
gaFtsStop[37] = "comment";
gaFtsStop[38] = "dans";
gaFtsStop[39] = "davantage";
gaFtsStop[40] = "de";
gaFtsStop[41] = "déjà ";
gaFtsStop[42] = "des";
gaFtsStop[43] = "devez";
gaFtsStop[44] = "devoir";
gaFtsStop[45] = "devons";
gaFtsStop[46] = "dois";
gaFtsStop[47] = "doit";
gaFtsStop[48] = "doivent";
gaFtsStop[49] = "du";
gaFtsStop[50] = "en";
gaFtsStop[51] = "ensuite";
gaFtsStop[52] = "entre";
gaFtsStop[53] = "est";
gaFtsStop[54] = "et";
gaFtsStop[55] = "étaient";
gaFtsStop[56] = "étais";
gaFtsStop[57] = "était";
gaFtsStop[58] = "etc.";
gaFtsStop[59] = "été";
gaFtsStop[60] = "être";
gaFtsStop[61] = "eux";
gaFtsStop[62] = "façon";
gaFtsStop[63] = "faire";
gaFtsStop[64] = "fait";
gaFtsStop[65] = "ici";
gaFtsStop[66] = "il";
gaFtsStop[67] = "ils";
gaFtsStop[68] = "l'extérieur";
gaFtsStop[69] = "l'intérieur";
gaFtsStop[70] = "l'intérieur de";
gaFtsStop[71] = "la";
gaFtsStop[72] = "laquelle";
gaFtsStop[73] = "le";
gaFtsStop[74] = "lequel";
gaFtsStop[75] = "les";
gaFtsStop[76] = "lesquelles";
gaFtsStop[77] = "lesquels";
gaFtsStop[78] = "leur";
gaFtsStop[79] = "ligne";
gaFtsStop[80] = "maintenant";
gaFtsStop[81] = "mais";
gaFtsStop[82] = "même";
gaFtsStop[83] = "moins";
gaFtsStop[84] = "n'est";
gaFtsStop[85] = "n'importe";
gaFtsStop[86] = "ne";
gaFtsStop[87] = "nous";
gaFtsStop[88] = "objet";
gaFtsStop[89] = "obtenir";
gaFtsStop[90] = "OK";
gaFtsStop[91] = "ont";
gaFtsStop[92] = "ou";
gaFtsStop[93] = "où";
gaFtsStop[94] = "par";
gaFtsStop[95] = "parce";
gaFtsStop[96] = "parmi";
gaFtsStop[97] = "pas";
gaFtsStop[98] = "peut";
gaFtsStop[99] = "peut-être";
gaFtsStop[100] = "peuvent";
gaFtsStop[101] = "peux";
gaFtsStop[102] = "plus";
gaFtsStop[103] = "plutôt";
gaFtsStop[104] = "pour";
gaFtsStop[105] = "pouvez";
gaFtsStop[106] = "pouvoir";
gaFtsStop[107] = "pouvons";
gaFtsStop[108] = "quand";
gaFtsStop[109] = "que";
gaFtsStop[110] = "quoi";
gaFtsStop[111] = "sans";
gaFtsStop[112] = "si";
gaFtsStop[113] = "soit";
gaFtsStop[114] = "soit";
gaFtsStop[115] = "sont ";
gaFtsStop[116] = "sur";
gaFtsStop[117] = "tel";
gaFtsStop[118] = "telle";
gaFtsStop[119] = "telles";
gaFtsStop[120] = "tels";
gaFtsStop[121] = "ton";
gaFtsStop[122] = "tous";
gaFtsStop[123] = "tout";
gaFtsStop[124] = "toute";
gaFtsStop[125] = "toutes ";
gaFtsStop[126] = "tu";
gaFtsStop[127] = "un";
gaFtsStop[128] = "une";
gaFtsStop[129] = "usage";
gaFtsStop[130] = "usagé";
gaFtsStop[131] = "utilisant";
gaFtsStop[132] = "utilisation";
gaFtsStop[133] = "utilisé";
gaFtsStop[134] = "utiliser";
gaFtsStop[135] = "veulent";
gaFtsStop[136] = "veut";
gaFtsStop[137] = "veux";
gaFtsStop[138] = "voir";
gaFtsStop[139] = "vôtre";
gaFtsStop[140] = "voulez";
gaFtsStop[141] = "vouloir";
gaFtsStop[142] = "voulons";
gaFtsStop[143] = "vous";



// as javascript 1.3 support unicode instead of ISO-Latin-1
// need to transfer come code back to ISO-Latin-1 for compare purpose
// Note: Different Language(Code page) maybe need different array:
var gaUToC=new Array();
gaUToC[8364]=128;
gaUToC[8218]=130;
gaUToC[402]=131;
gaUToC[8222]=132;
gaUToC[8230]=133;
gaUToC[8224]=134;
gaUToC[8225]=135;
gaUToC[710]=136;
gaUToC[8240]=137;
gaUToC[352]=138;
gaUToC[8249]=139;
gaUToC[338]=140;
gaUToC[381]=142;
gaUToC[8216]=145;
gaUToC[8217]=146;
gaUToC[8220]=147;
gaUToC[8221]=148;
gaUToC[8226]=149;
gaUToC[8211]=150;
gaUToC[8212]=151;
gaUToC[732]=152;
gaUToC[8482]=153;
gaUToC[353]=154;
gaUToC[8250]=155;
gaUToC[339]=156;
gaUToC[382]=158;
gaUToC[376]=159;

var gsBiggestChar="";
function getBiggestChar()
{
	if(gsBiggestChar.length==0)
	{
		if(garrSortChar.length<256)
			gsBiggestChar=String.fromCharCode(255);
		else
		{
			var nBiggest=0;
			var nBigChar=0;
			for(var i=0;i<=255;i++)
			{
				if(garrSortChar[i]>nBiggest)
				{
					nBiggest=garrSortChar[i];
					nBigChar=i;
				}
			}
			gsBiggestChar=String.fromCharCode(nBigChar);
		}

	}	
	return gsBiggestChar;
}

function getCharCode(str,i)
{
	var code=str.charCodeAt(i)
	if(code>256)
	{
		code=gaUToC[code];
	}
	return code;
}

function compare(strText1,strText2)
{
	if(garrSortChar.length<256)
	{
		var strt1=strText1.toLowerCase();
		var strt2=strText2.toLowerCase();
		if(strt1<strt2) return -1;
		if(strt1>strt2) return 1;
		return 0;
	}
	else
	{
		for(var i=0;i<strText1.length&&i<strText2.length;i++)
		{
			if(garrSortChar[getCharCode(strText1,i)]<garrSortChar[getCharCode(strText2,i)]) return -1;
			if(garrSortChar[getCharCode(strText1,i)]>garrSortChar[getCharCode(strText2,i)]) return 1;
		}
		if(strText1.length<strText2.length) return -1;
		if(strText1.length>strText2.length) return 1;
		return 0;
	}
}
gbWhLang=true;