Need to search data for a last name...(posting again)

Hi, I have a text file with a list of names. I access the last names from an alphabetical pulldown. this is someone else’s project (they’re no longer here) and for space reasons i now need to break up all the people in the “S” category into 2 groups.

the original code follows:

if(lastname[x].substring(1,0) == "A" || lastname[x].substring(1,0) == "B" || lastname[x].substring(1,0) == "C" || lastname[x].substring(1,0) == "D" || lastname[x].substring(1,0) == "E" || lastname[x].substring(1,0) == "F" || lastname[x].substring(1,0) == "G" || lastname[x].substring(1,0) == "H" || lastname[x].substring(1,0) == "I" || lastname[x].substring(1,0) == "J" || lastname[x].substring(1,0) == "K" || lastname[x].substring(1,0) == "L"){
	currentHALF = "1st"
}	
else if(lastname[x].substring(1,0) == "M" || lastname[x].substring(1,0) == "N" || lastname[x].substring(1,0) == "O" || lastname[x].substring(1,0) == "P" || lastname[x].substring(1,0) == "Q" || lastname[x].substring(1,0) == "R" || lastname[x].substring(1,0) == "S" || lastname[x].substring(1,0) == "T" || lastname[x].substring(1,0) == "U" || lastname[x].substring(1,0) == "V" || lastname[x].substring(1,0) == "W" || lastname[x].substring(1,0) == "X" || lastname[x].substring(1,0) == "Y" || lastname[x].substring(1,0) == "Z"){
	currentHALF = "2nd"
}

here’s what i’m trying to do with it –

add a statement that looks for the next letter after S:

if(lastname[x].substring(1,3) == "a" || lastname[x].substring(1,3) == "b" || lastname[x].substring(1,3) == "c" || lastname[x].substring(1,3) == "d" || lastname[x].substring(1,3) == "e" || lastname[x].substring(1,3) == "f" || lastname[x].substring(1,3) == "g" || lastname[x].substring(1,3) == "h" || lastname[x].substring(1,3) == "i" || lastname[x].substring(1,3) == "j" || lastname[x].substring(1,3) == "k" || lastname[x].substring(1,3) == "l"){
	sHALF = "b1st"
}	
else if(lastname[x].substring(1,3) == "m" || lastname[x].substring(1,3) == "n" || lastname[x].substring(1,3) == "o" || lastname[x].substring(1,3) == "p" || lastname[x].substring(1,3) == "q" || lastname[x].substring(1,3) == "r" || lastname[x].substring(1,3) == "s" || lastname[x].substring(1,3) == "t" || lastname[x].substring(1,3) == "u" || lastname[x].substring(1,3) == "v" || lastname[x].substring(1,3) == "w" || lastname[x].substring(1,3) == "x" || lastname[x].substring(1,3) == "y" || lastname[x].substring(1,3) == "z"){
	sHALF = "b2nd"
}

then pull all the S w/second letter from the first part of the alphabet “Sa” and then from the second part of the aplhabet “Sb”:

Not sure about this bit:

if(lastname[x].substring(1,0) == "S"){
	firstLetter = "S";
}
else if(lastname[x].substring(1,0) != "S"){
	firstLetter != "S";
}

if(_root.currentdatatype == "lastname" && _root.currentdataID == "S" && lastname[x] == ""){
	tempLASTNAMEnormalized = ""	
}
else if(_root.currentdatatype == "lastname" && _root.currentdataID == "Sa" && lastname[x] == "S" && sHALF == "b1st"){
	tempLASTNAMEnormalized = "Sa"
	tempGRIDADDITION1 = ""
	tempGRIDADDITION2 = " (Last Names Beginning With Sa - Sl)"
}
else if(_root.currentdatatype == "lastname" && _root.currentdataID == "Sb" && lastname[x] == "S" && sHALF == "b2nd"){
	tempLASTNAMEnormalized = "Sb"
	tempGRIDADDITION1 = ""
	tempGRIDADDITION2 = " (Last Names Beginning With Sm - Sz)"
}

can i get some help for this without having to completely rewrite the code from scratch? can we work with the original code to get this working?

thanks!