/*******************************************************************
  Copyright eSolutions Limited
  Licensed for eSolutions customer usage only.
  For enquiries, please email info@esol-group.com.

  RELATEDLINKS OBJECT
  ar1 = ['lev0_title|lev0_name'], ..., ['levN_title|levN_name']
*******************************************************************/
function relatedLinks(ar,pfx){
  if(typeof pfx=='undefined') pfx = 'default.asp?xid='
  this.ar = ar
  this.pfx = pfx
  this.className = 'relatedLinks'
  this.className_on = 'relatedLinks_on'
  this.getTitle=function(s){
    if(typeof s!='string')s=s[0] // if array item is passed
    return s.split('|')[0]
  }
  this.getName=function(s){
    if(typeof s!='string')s=s[0] // if array item is passed
    return s.split('|')[1]
  }
  this.getHTML = function(xid,s0,s1){
    if(typeof s0=='undefined')s0=''
    if(typeof s1=='undefined')s1='<BR>'
    for(var s='', i=0; i<ar.length; i++){
      s += s0
        + '<A class="'+(this.getName(ar[i]) == xid ? this.className_on : this.className)+'" '
        + 'href="'+this.pfx+this.getName(ar[i])+'">'+this.getTitle(ar[i])+'</A>'
        + s1
    }
    return s
  }
}

