
var SearchWord;
var FindWord;
var result = 0;
var Final = new Array();
var WritePage;
var ShowPage;
var search = new Array();
var site = new Array();

// This is where you can edit the colors and the font along with some other things in order for the script to fit your site.
var websitetitle="";
var websiteurl="CAT";
var objectbg="#e4eefd";
var tableborder="#000000";
var tablewidth="100%";
var resultbg="#b1c9f1";
var headerbg="#b1c9f1";
var objecttext="#000000";
var headertitle="#000080";
var searchtext="#000080";
var searchborder="#000000";
var searchbg="#ffffff";
var searchsitetext="#000000";
var buttonbg="#c0c0c0";
var buttontext="#000000";
var buttonborder="#000000";
var resulttext="#000000";
var fortext="#000000";
var font="Verdana";
var linecolor="#808080";


document.write("<div align='center'><center>\n" +
               "<table border='0' cellpadding='5' cellspacing='0' width='" + tablewidth + "' height='50' style='border: 1px solid " + tableborder + "' bgcolor='" + headerbg + "'>\n" +
               "<tr>\n" +
               "<td width='10%'><font face='" + font + "' color='" + headertitle + "'><big><strong><big>" + websitetitle + "</big></strong></big></font></td>\n" +
               "<td width='90%'><div align='left'><table border='0' cellpadding='0' cellspacing='0'>\n" +
               "<tr>\n" +
               "<td colspan='3'><strong><small><small><font face='" + font + "'>Search " + websiteurl + ": </font></small></small></strong></td>\n" +
               "</tr>\n" +
               "<tr>\n" +
               "<td><input type='text' name='searchbox' size='20' style='font-family: " + font + "; font-size: xx-small; background-color: " + searchbg + "; color: " + searchtext + "; font-weight: bold; border-left: 2px solid " + searchborder + "; border-right: 1px solid " + searchborder + "; border-top: 2px solid " + searchborder + "; border-bottom: 1px solid " + searchborder + "'></td>\n" +
               "<td width='3'></td>\n" +
               "<td><input type='button' value='Ok' onclick='SearchSite(searchbox.value.toLowerCase())' style='font-family: " + font + "; font-size: xx-small; background-color: " + buttonbg + "; color: " + buttontext + "; font-weight: bold; border: 1px solid " + buttonborder + "'></td>\n" +
               "</tr>\n" +
               "</table>\n" +
               "</div></td>\n" +
               "</tr>\n" +
               "</table>\n" +
               "</center></div><div id='searchresult'></div>")


// This is where you add your own links and keywords. As for now you are limited to 15 keywords. and the number(#) in
//brackets must begin with 0 and count from there. When creating your keywords you do not have to have exactly 15 words you
//may have less in the event that you do have less then make sure you add extra "|" to the end as if there were 15 words.

// search[#]="word1|word2|word3|word4|word5|word6|word7|word8|word9|word10|word11|word12|word13|word14|word15"
// site[#]="title|url|description"

search[0]="ace|software|text-to-speech|speech|||||||||||"
site[0]="ACE Home Automation Software|ace.htm|Remote monitoring and control of your home automation system"

search[1]="assistive|technology|disabled|handicapped|cat-solo|cat|solo|ecu|environmental|unit|||||"
site[1]="Assistive Technology|at.htm|Helping people with disabilities be more independent"

search[2]="hv|homevision|hv-pro||||||||||||"
site[2]="HomeVision|hv.htm|Home automation controller"

search[3]="hardware||||||||||||||"
site[3]="Products|products.htm|CAT Products"

search[4]="services||||||||||||||"
site[4]="Services|services.htm|CAT Services"

search[5]="automation||||||||||||||"
site[5]="Home Automation|ha.htm|Home Automation"

search[6]="audio|whole|house|whole-house|stereo||||||||||"
site[6]="Whole-house audio|whole-house_audio.htm|Listen to music throughout your home"

search[7]="security||||||||||||||"
site[7]="Security|security.htm|Security systems"

search[8]="camera|cameras|video|surveillance|dvr||||||||||"
site[8]="Camera systems|cameras.htm|Cameras can let you keep an eye on your kids, or record for surveillance and security"

search[9]="mss100|hv-pronet|pronet||||||||||||"
site[9]="Networks|products.htm|Networking products"

search[10]="lighting|lightolier|compose|control|light|lights|||||||||"
site[10]="Lighting|scene_lighting.htm|Scene lighting and automated lighting systems"

search[11]="video|distribution|||||||||||||"
site[11]="Video Distribution|video_distribution.htm|Distribute cable tv, cameras, and more to all TV's"

function SearchSite(wrd){

  for (i = 0; i < search.length; i++){
    for (a = 0; a < 14; a++){ // If you need to use more keywords for each site change the number to one less than how many you need in this case we use 15 keywords so we use the number 14
      FindWord = search[i].split("|")[a]
      for (n = 0; n < wrd.length; n++){
        SearchWord = wrd.split(" ")[n]
        if(FindWord == SearchWord){
          Final[i] = "<tr>\n<td bgcolor='" + objectbg + "' colspan='2'><font face='" + font + "' size='2'><a href='" + site[i].split("|")[1] + "' target='_top'><b>" + site[i].split("|")[0] + "</b></a> : " + site[i].split("|")[1] + "<br><hr size='1' color='" + linecolor + "'><font face='" + font + "' size='1'>" + site[i].split("|")[2] + "</font></td>\n</tr>\n";
        }
      }
    }
  }

  WritePage = "<center><table width='" + tablewidth + "' cellpadding='5' cellspacing='1' bgcolor='" + tableborder + "'><tr>\n<td bgcolor='" + resultbg + "'>\n<table border='0' width='100%' cellpadding='0' cellspacing='0'>\n<tr>\n<td><p align='left'><font face='" + font + "' size='2'>Searched " + websiteurl + " for <b>" + wrd + "</b>.</font></p></td>\n<td><p align='right'><font face='" + font + "' size='2'><span id='pagecount'></span></font></p></td>\n</tr></table></td></tr>"

  for (i = 0; i < Final.length; i++){
    if(Final[i] != null) { 
      WritePage= WritePage + Final[i];
      result=result+1;
    }
  }

  WritePage = WritePage + "</table></center>"
  searchresult.innerHTML=WritePage;
  //pagecount.innerHTML = "Results <b>" + result + "</b> of <b>" + site.length + "</b> pages."
  pagecount.innerHTML = "<b>" + result + " </b>results"

  SearchWord = null;
  FindWord = null;
  result = 0;
  for(i = 0; i < search.length; i++){
    Final[i] = null;
  }

}
