// JavaScript Document

<!--
  window.onerror = silentHandler;
  function silentHandler() {return false};

  var push = function() 
  {
    var j = this.length;
    for (var i=0;i<push.arguments.length;++i) 
    {
      this[j] = push.arguments[i]
      j++
    }
  }
  Array.prototype.push = push

  var associativeClass = function(j) 
  {
    for (var i=1;i<=j;++i) 
    {
      this[i] = new associativeObj();
    }
  }
  var associativeObj = function() {}

  var getBannerTemplate = function() 
  {
    // define the total number of banners in the set
    var iBannerTotal = 33;

    // create an implicit array
    var ia = new associativeClass(iBannerTotal); 

    // create an explicit array
    var ar = new Array();

    // define each image within the set (the set must be equal in number to iBannerTotal)
    ia[1].imageName = '/ftproot/images/Banner_2_ladies.jpg';
    ia[2].imageName = '/ftproot/images/Banner_bronwyn.jpg';
    ia[3].imageName = '/ftproot/images/Banner_emma.jpg';
    ia[4].imageName = '/ftproot/images/Banner_felicity.jpg';
    ia[5].imageName = '/ftproot/images/Banner_freya.jpg';
    ia[6].imageName = '/ftproot/images/Banner_greg.jpg';
    ia[7].imageName = '/ftproot/images/Banner_jenny.jpg';
    ia[8].imageName = '/ftproot/images/Banner_RosheehanOmeagher.jpg';
    ia[9].imageName = '/ftproot/images/Banner_kristin.jpg';
    ia[10].imageName = '/ftproot/images/Banner_H098-015.jpg';
    ia[11].imageName = '/ftproot/images/Banner_louise.jpg';
    ia[12].imageName = '/ftproot/images/Banner_louise_2.jpg';
    ia[13].imageName = '/ftproot/images/Banner_louise_other.jpg';
    ia[14].imageName = '/ftproot/images/Banner_32_CSeeto.jpg';
    ia[15].imageName = '/ftproot/images/Banner_WesleyRogers.jpg';
    ia[16].imageName = '/ftproot/images/Banner_michael.jpg';
    ia[17].imageName = '/ftproot/images/Banner_BMaynard.jpg';
    ia[18].imageName = '/ftproot/images/Banner_Robbie_Bronwyn.jpg';
    ia[19].imageName = '/ftproot/images/Banner_paul.jpg';
    ia[20].imageName = '/ftproot/images/Banner_robert.jpg';
    ia[21].imageName = '/ftproot/images/Banner_sandra.jpg';
    ia[22].imageName = '/ftproot/images/Banner_shana.jpg';
    ia[23].imageName = '/ftproot/images/Banner_28_HBlack.jpg';
    ia[24].imageName = '/ftproot/images/Banner_29_NPayne.jpg';
    ia[25].imageName = '/ftproot/images/Banner_24_EPritchard.jpg';
    ia[26].imageName = '/ftproot/images/Banner_31_JChan.jpg';
    ia[27].imageName = '/ftproot/images/Banner_26_BBuff.jpg';
    ia[28].imageName = '/ftproot/images/Banner_27_GRobertson.jpg';
    ia[29].imageName = '/ftproot/images/Banner_28_LMaclou.jpg';
    ia[30].imageName = '/ftproot/images/Banner_29_PClarke.jpg';
    ia[31].imageName = '/ftproot/images/Banner_30_RFewings.jpg';
    ia[32].imageName = '/ftproot/images/Banner_SarahRizk.jpg';
    ia[33].imageName = '/ftproot/images/Banner_KyleScott.jpg';




    ia[1].weight = 1;
    ia[2].weight = 1;
    ia[3].weight = 1;
    ia[4].weight = 1;
    ia[5].weight = 1;
    ia[6].weight = 1;
    ia[7].weight = 1;
    ia[8].weight = 1;
    ia[9].weight = 1;
    ia[10].weight = 1;
    ia[11].weight = 1;
    ia[12].weight = 1;
    ia[13].weight = 1;
    ia[14].weight = 1;
    ia[15].weight = 1;
    ia[16].weight = 1;
    ia[17].weight = 1;
    ia[18].weight = 1;
    ia[19].weight = 1;
    ia[20].weight = 1;
    ia[21].weight = 1;
    ia[22].weight = 1;
    ia[23].weight = 1;
    ia[24].weight = 1;
    ia[25].weight = 1;
    ia[26].weight = 1;
    ia[27].weight = 1;
    ia[28].weight = 1;
    ia[29].weight = 1;
    ia[30].weight = 1;
    ia[31].weight = 1;
    ia[32].weight = 1;
    ia[33].weight = 1;


    // get the sum of the weighted values
    var iWeightTotal = 0;
    for (i in ia) 
    {
      iWeightTotal += ia[i].weight
    }

    // calculate and store the weight percentages
    for (i in ia) 
    {
      ia[i].percentage = Math.round((ia[i].weight / iWeightTotal) * 100);
    }

    // push an implicit array object id onto the explicit array once for each id percentage point 
    for (i in ia) 
    {
      for (var j=0;j<ia[i].percentage;++j) 
      {
         ar.push(i)
      }
    }

    // get a random integer value between 0 and the explicit array length
    var k = Math.round(Math.random()*ar.length)

    // return a weighted imageName object
    // return ia[ar[k]].imageName

    // as an alternative to returning an explicit value embed multiple values within script
    var scriptText = '<div style="margin-bottom: 6px;"><table border="0" cellspacing="0" cellpadding="0" width="924px" height="129px">';  
      scriptText += '  <tr><td style="background: #1f6750 url(' + ia[ar[k]].imageName + ') top left no-repeat;" valign="top" width="906"><a href="/"><img title="Click to return to the Harmers home page" alt="Click to return to the Harmers home page" height="129" src="/images/cs_tm.gif" width="924" border="0" /></td></tr>';
    scriptText += '</table></div>';  
    return scriptText;
  }

  document.write(getBannerTemplate());
// -->


