// new variable to handle long event names
var maxNameLength = 40;
var linkurl = 'http://www.eventkeeper.com/code/events.cfm?curOrg=HAZEN';
// EventKeeper first returns a javascript variable called fString for FeedString 
// which tells us what varibles are returned. 
// characters in the string can be: 
// D : date 
// T : time 
// N : name 
// 1 : keyword 1 
// 2 : keyword 2       
// EventKeeper has created an javascript array variable called evtArray
// with fields = evt_date, evt_time, evt_name, evt_ID, evt_Key1 and evtKey2

document.write("<ul style='list-style-type: none;' class='ek_list'>");

// loop through the array, creating a list item for each row in the array.
for (i=0; i<evtArray.length; i++)
{
  if (FeedString.indexOf("N") != -1)
  {
    // handle long event names
    var theName = evtArray[i][evt_name];
    if (theName.length > maxNameLength)
    theName = theName.substring(0,maxNameLength-2) + '...';

    // create the hyperlink based on the Event Name and the Event ID
    
    var thislink = linkurl + "#" + evtArray[i][evt_id];
    var namelink = '<a href="' + thislink + '" target="_blank" title="';
    namelink += evtArray[i][evt_name] + '">' + theName + '</a>';
    document.write("<li class='ek_item'>" + namelink + "<br />");
  }
  if (FeedString.indexOf("D") != -1)
    document.write("<span class='ek_date'>" + evtArray[i][evt_date]);

  if (FeedString.indexOf("T") != -1)
    document.write(" | " +evtArray[i][evt_time] + "</span></li> ");
} 
document.write("</ul>");
document.write("<a href='" + linkurl + "' class='ek_see_all' target='_blank'>See All Events</a>");
