/*
*Tea Template Language Code Sample - Marc Needham - 11/13/00
*I'm assuming you have already looked at the other sample and
*now have some idea what Tea is, so I won't go into it again.
*This sample is a sub-template that loops through a collection,
*alphabetizes the content, then spits them out.
*Tea, being until recently a proprietary language, is a little limited
*and doesn't have any kind of alphabetizing function. So I had
*to build my own. Hence the alphabet array at the top.
*Again, I removed my comments to avoid clutter...
*/


<% alphabet = #("0","1","2","3","4","5","6","7","8", "9","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")

found = 1
firstrun = ''
 
  if (obj.callout != null)  {
    foreach (alphacount in 0..alphabet.length-1)  {
      foreach (callout in obj.callout) {
        if (callout isa msb.content.MSBCallout)  {
          if (callout.linkToFeature != null)  {
            count = 1
            foreach (link in callout.linkToFeature)  {
              if (link isa msb.content.MSBMovieReview)  {
                if (startsWith(toLowerCase(link.name), toLowerCase(alphabet[alphacount])))  {
                    
                        max_length = 20
                        if (link.name.length > max_length) {
                        hillemeyer = link.name    
				 len = substring(hillemeyer, 0, max_length)
%>                                                                       
<option value="<%link.cinemaSourceMovieID%>"><%len%>...
<%                                                                       
                        }
                        if (link.name.length <= max_length) {
%>
<option value="<%link.cinemaSourceMovieID%>"><%link.name%>
<%                                                                                   
                        }                                                                               
                    

   
                }
              }
              count = count + 1
            }
          }
        }
    }

       
       
     }
  }
  %>