<!-- cca_prices_fn.js Version 1.2 -->
<!-- global variable to avoid recomputing the array length for ever-->
var l=prices_arr.length;

function display_prices( p_code, p_i)
{
    var c = 0;
    //var l=prices_arr.length;

    // Look for the prices for the specific House Key
    for ( i = 0; i < l; i++)
    {
        if ( ( i + p_i ) > l ) break; //ie false
        if ( prices_arr[i][0] == p_code )
        {
            if ( c == p_i )
            {
                _display_prices(prices_arr[i]);
                return true;
            }
            c++;
        }
    }
    return false;
} // display_prices()

function _display_prices( m )
{
    var Target = this;

    Target.document.write('<CENTER><TABLE BORDER="4" CELLPADDING="4">');
    Target.document.write('<TR>');
    Target.document.write('<TD colspan="4"><CENTER><STRONG><FONT SIZE="+1">'+m[0]+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+m[1]+'</FONT></STRONG></CENTER></TD>');
    Target.document.write('</TR>');
    Target.document.write('<TR>');
    Target.document.write('<TD><CENTER><STRONG>Low</STRONG></CENTER></TD>');
    Target.document.write('<TD><CENTER><STRONG>Mid</STRONG></CENTER></TD>');
    Target.document.write('<TD><CENTER><STRONG>High</STRONG></CENTER></TD>');
    Target.document.write('<TD><CENTER><STRONG>Peak</STRONG></CENTER></TD>');
    Target.document.write('</TR>');
    Target.document.write('<TR>');
    Target.document.write('<TD><CENTER><STRONG>'+m[6]+'</STRONG></CENTER></TD>');
    Target.document.write('<TD><CENTER><STRONG>'+m[7]+'</STRONG></CENTER></TD>');
    Target.document.write('<TD><CENTER><STRONG>'+m[8]+'</STRONG></CENTER></TD>');
    Target.document.write('<TD><CENTER><STRONG>'+m[9]+'</STRONG></CENTER></TD>');
    Target.document.write('</TR>');
    Target.document.write('<TR>');
    Target.document.write('<TD><CENTER><STRONG>'+m[2]+'</STRONG></CENTER></TD>');
    Target.document.write('<TD><CENTER><STRONG>'+m[3]+'</STRONG></CENTER></TD>');
    Target.document.write('<TD><CENTER><STRONG>'+m[4]+'</STRONG></CENTER></TD>');
    Target.document.write('<TD><CENTER><STRONG>'+m[5]+'</STRONG></CENTER></TD>');
    Target.document.write('</TR>');
    Target.document.write('<TR>');
    Target.document.write('<TD colspan="4"><CENTER><STRONG><FONT SIZE="-1">'+m[10]+'<BR>'+m[11]+'</FONT></STRONG></CENTER></TD>');
    Target.document.write('</TR>');
    Target.document.write('</TABLE></CENTER>');
} // _display_prices()

function display_range( p_code)
{
    var Target = this;
    //var l=prices_arr.length - 1;
    var c;
    
    var min="";
    var max="";

    // Look for the prices for the specific House Key
    for ( i = l-1; i >= 0; i--)
    {
        if ( prices_arr[i][0] == p_code )
        {
          for(c=2; prices_arr[i][c] == 'n/a'&& c<5; c++);
          // found min
          min=prices_arr[i][c];
          if ( c == 5 ) // min = max
          {
            Target.document.write(min);
            return true;
          }          
          for (c = 5; prices_arr[i][c] == 'n/a' && c>2; c--);
          // found max
          max=prices_arr[i][c];         
          min == max ? Target.document.write(min):Target.document.write(min+'&nbsp;-&nbsp;'+max);
          return true;
        }
    }
    return false;
}  // display_range()