  //shimmyShim(document.getElementById('Matches'));
 
  var matchesShown = false;

  var selectedMatch = 1;

  function showMatches(matchString, key, width)
  {
    
    //if (navigator.userAgent.indexOf("Safari") != -1)
    //{
    //  return false;
    //}

    document.getElementById("Matches").style.display = "none";

    if(key == 40||key==39) selectedMatch++;
    if(key == 38||key==37) selectedMatch--;
    if(selectedMatch > matchesShown) selectedMatch = matchesShown;
    if(selectedMatch < 1) selectedMatch = 1;
    matchString = matchString.toLowerCase();
    numCities = CityList.length;
    matchHTML = "<table border=0 cellpadding=0 cellspacing=0 width="+width+" bgcolor=white>\n";
    numMatches = 0;
    moreMatches = false;
    shimHeight = 0;

    for(i = 0; i < numCities; i++ )
    {
      if(matchString == CityList[i].substring(0, matchString.length).toLowerCase())
      {
        if(numMatches == 10)
        {
          moreMatches = true;
          break;
        }

        numMatches++;

        if(numMatches == selectedMatch) 
        {
          linkClass = "TXT_selectedMatch";
          cellClass = "BG_selectedMatch";
          if(key == 13 || key == 9) return setKeyWords(CityList[i]);
		  

        }
        else
        {
          linkClass = "TXT_unSelectedMatch";
          cellClass = "BG_unSelectedMatch";
        }

        var safeCity = CityList[i].replace(/([\\"'])/g, "\\$1").replace(/\u0000/g, "\\0");
        matchHTML += " <tr>\n";
        matchHTML += "  <td height=18 class='"+cellClass+"' onMouseDown=\"setKeyWords('" + safeCity + "');\"><a class='"+linkClass+"' onMouseDown=\"setKeyWords('" + safeCity + "');\" href='javascript: void(0)'>" + CityList[i] + "</a></td>\n";
        matchHTML += " </tr>\n";
        shimHeight += 18;
      }
    }

    if(moreMatches)
    {
      matchHTML += " <tr>\n";
      matchHTML += "  <td height=18 class='TXT_unSelectedMatch'>More matches found, please refine your search...</td>\n";
      matchHTML += " </tr>\n";
      shimHeight += 18;
    }

    matchHTML += "</table>\n";
    if(numMatches > 0)
    {
      document.getElementById("MatchesHTML").innerHTML = matchHTML;
      document.getElementById("Matches").style.display = "block";
      matchesShown = numMatches;

	  $('#Matches').bgiframe();
	

      /*if (navigator.userAgent.indexOf("MSIE") != -1)
      {
        document.getElementById('shimMatches').style.height = shimHeight;
      }*/

      return true;
    }
    else
    {
      //this return false makes enter key submit stop working
      //commentting out for testing
      //return false;
    }
  }

  function setKeyWords(SearchTerm)
  {
    document.theForm.SearchWord.value = SearchTerm;
    hideMatches();
    return false;
  }

  function hideMatches()
  {
    document.getElementById("Matches").style.display = "none";
    matchesShown = false;
  }

