<!--

var nTotal = 0;
var asFilename = new Array();
var asTitle = new Array();
var aasWords = new Array();
var anCount = new Array();

var nNumPages = 4

// Home Page (default.asp)

asFilename[0] = "default.asp";
asTitle[0] = "Home Page";
anCount[0] = 5;
aasWords[0] = new Array();

aasWords[0][0] = "hipotecas";
aasWords[0][1] = "call";
aasWords[0][2] = "miyoro";
aasWords[0][3] = "com";
aasWords[0][4] = "today";


// About Us (about.html)

asFilename[1] = "about.html";
asTitle[1] = "About Us";
anCount[1] = 35;
aasWords[1] = new Array();

aasWords[1][0] = "founded";
aasWords[1][1] = "2000";
aasWords[1][2] = "tony";
aasWords[1][3] = "miyoro";
aasWords[1][4] = "com";
aasWords[1][5] = "backed";
aasWords[1][6] = "6";
aasWords[1][7] = "years";
aasWords[1][8] = "industry";
aasWords[1][9] = "experience";
aasWords[1][10] = "miyoro";
aasWords[1][11] = "com";
aasWords[1][12] = "provides";
aasWords[1][13] = "top";
aasWords[1][14] = "notch";
aasWords[1][15] = "prestamos";
aasWords[1][16] = "great";
aasWords[1][17] = "customer";
aasWords[1][18] = "support";
aasWords[1][19] = "combination";
aasWords[1][20] = "beat";
aasWords[1][21] = "commitment";
aasWords[1][22] = "experience";
aasWords[1][23] = "expertise";
aasWords[1][24] = "miyoro";
aasWords[1][25] = "com";
aasWords[1][26] = "established";
aasWords[1][27] = "business";
aasWords[1][28] = "relationship";
aasWords[1][29] = "customers";
aasWords[1][30] = "lifetime";
aasWords[1][31] = "call";
aasWords[1][32] = "miyoro";
aasWords[1][33] = "com";
aasWords[1][34] = "today";


// Contact Us (contact.html)

asFilename[2] = "contact.html";
asTitle[2] = "Contact Us";
anCount[2] = 20;
aasWords[2] = new Array();

aasWords[2][0] = "send";
aasWords[2][1] = "request";
aasWords[2][2] = "form";
aasWords[2][3] = "get";
aasWords[2][4] = "back";
aasWords[2][5] = "soon";
aasWords[2][6] = "possible";
aasWords[2][7] = "name";
aasWords[2][8] = "required";
aasWords[2][9] = "address";
aasWords[2][10] = "city";
aasWords[2][11] = "state";
aasWords[2][12] = "zip";
aasWords[2][13] = "phone";
aasWords[2][14] = "fax";
aasWords[2][15] = "mail";
aasWords[2][16] = "address";
aasWords[2][17] = "required";
aasWords[2][18] = "questions";
aasWords[2][19] = "comments";


// Site Map (sitemap.html)

asFilename[3] = "sitemap.html";
asTitle[3] = "Site Map";
anCount[3] = 14;
aasWords[3] = new Array();

aasWords[3][0] = "listed";
aasWords[3][1] = "pages";
aasWords[3][2] = "web";
aasWords[3][3] = "site";
aasWords[3][4] = "click";
aasWords[3][5] = "link";
aasWords[3][6] = "go";
aasWords[3][7] = "page";
aasWords[3][8] = "home";
aasWords[3][9] = "page";
aasWords[3][10] = "site";
aasWords[3][11] = "map";
aasWords[3][12] = "contact";
aasWords[3][13] = "search";



var sQuery = window.location.search;

var asKeywords = new Array(50);
var nNumKeywords = 0;

var bAll;

function ParseKeywords()
{
  str = sQuery;


  n = str.search("keyword=");

  while (n != -1)
  {
    nEnd = str.search("&");

    if (nEnd != -1)
    {
      sKeywords = str.slice(n + 8, nEnd);
      str = str.slice(nEnd + 1);
    }

    else
    {
      sKeywords = str.slice(n + 8);
      str = "";
    }

    sKeywords = unescape(sKeywords.toLowerCase());

    n = sKeywords.search('\\+');

    while (n != -1)
    {
      asKeywords[nNumKeywords++] = sKeywords.slice(0, n);

      sKeywords = sKeywords.slice(n + 1);

      n = sKeywords.search('\\+');
    }

    asKeywords[nNumKeywords++] = sKeywords;

    n = str.search("keyword=");
  }
}

function ParseFlags()
{
  str = sQuery;


  n = str.search("match=");

  cMatch = str.slice(n + 6);

  if (cMatch.charAt(0) == 'L')
    bAll = true;

  else
    bAll = false;
}

function Page(sTitle, sFilename, nRelevance)
{
  this.sTitle = sTitle;
  this.sFilename = sFilename;
  this.nRelevance = nRelevance;
}

function compare(page1, page2)
{
  if (page1.nRelevance < page2.nRelevance)
    return 1;

  else if (page1.nRelevance > page2.nRelevance)
    return -1;

  return 0;
}

function PerformSearch()
{
  bSearchStore = false;
  str = sQuery;
  n = str.search("loc=");
  if (n != -1)
  {
    cMatch = str.slice(n + 4);
    if (cMatch.charAt(0) == 'S')
      bSearchStore = true;
  }    

  if (bSearchStore)
  {
    searchform.loc[1].checked=true;
    commerceopts.style.visibility='visible';
    return false;
  }

  if (sQuery.length > 0)
  {
    if (sQuery.search('sbutton=') != -1)
      return false;

    ParseKeywords();
    ParseFlags();

    nNumMatches = 0;

    aPages = new Array();
    for (w = 0; w < nNumPages; w++)
    {
      nCount = 0;
      bAllMatchFailed = false;

      for (j = 0; j < nNumKeywords; j ++)
      {
        bMatch = false;

        for (i = 0; i < anCount[w]; i ++)
        {
          if (aasWords[w][i].search(asKeywords[j]) != -1)
          {
            nCount++;
            bMatch = true;
          }
        }

        if ((bAll) && (!bMatch))
        {
          bAllMatchFailed = true;
        }
      }

      if ((nCount > 0) && (!bAllMatchFailed))
      {
        aPages[nNumMatches] = new Page(asTitle[w], asFilename[w], nCount);

        nNumMatches++;
        if (nCount > nTotal)
          nTotal = nCount;
      }
    }

    if (nNumMatches == 0)
      alert('There are no pages that match your keywords.  Please broaden your search.');

    else
    {
      aPages.sort(compare);

      document.writeln('<table align=center width="90 %"><tr><td colspan=2 align=center><font size="+1"><b>Search results<hr></b></font></td></tr>');
      document.writeln('<tr><td align=left><b>Document</b></td><td align=right><b>Relevance</b></td></tr>');
      document.writeln('<tr><td colspan=2><hr></td></tr>');

      for (i = 0; i < nNumMatches; i ++)
        document.writeln('<tr><td><a href="' + aPages[i].sFilename + '">' + aPages[i].sTitle + '</a></td><td align=right>' + Math.round(aPages[i].nRelevance * 100 / nTotal) + ' %</td></tr>');

      document.writeln('<tr><td colspan=2><hr></td></tr></table>');
    }
  }
}
//-->