// neopets showlinks function
function showLinks4(linkData, startIndex, endIndex) {

  if (startIndex == undefined) {
    startIndex = 0;
  }
  var links = linkData.getItems();
  var outString = "";
  var arrLength = links.length;
  if (endIndex == undefined || endIndex == 0) {
    endIndex = arrLength;
  } else {
    if (endIndex > arrLength) {
      endIndex = arrLength;
    }
  }

  var emptyText = "No Links";
  if (endIndex <= startIndex) {
    return emptyText;
  }
  /* disabled tracking
  mul_10551 = 4099;
  if ( Math.ceil(Math.random()* mul_10551) == mul_10551) {
  img_track_10551 = "<img src=\"http://www.neopets.com/process_click.phtml?item_id=10551&type_id=12&beacon=1&r="
  + Math.ceil(Math.random()*10000)
  + "\" width=\"1\" height=\"1\">";
  } else {
  img_track_10551 = "";
  }
  outString += img_track_10551;
  */
  var i = startIndex;
  while ( i <= endIndex) {
    var currItem = links[i];
    if (!(currItem == undefined)) {

      // truncate the url if too long
      var siteHost = currItem.getSitehost();
      if(siteHost.length > wrapUrl)
      {
        siteHost = siteHost.substr(0,wrapUrl) + "<br>" + siteHost.substr(wrapUrl,siteHost.length);
      }
      outString += "<table>";
      outString += "<tr><td><a class=\"item_title\" href=\"" + currItem.getClickUrl() + "\" >" + currItem.getTitle() + "</a></td></tr>";
      outString += "<tr><td><a class=\"item_desc\"  href=\"" + currItem.getClickUrl() + "\" >" + currItem.getDescription() + "</a></td></tr>";
      outString += "<tr><td><a class=\"item_host\"  href=\"" + currItem.getClickUrl() + "\" title=\"" + currItem.getSitehost() + "\" >" + siteHost + "</a></td></tr>";
      outString += "</table>";
    }
    i++;
  }
  return outString;
}
