title = new Object();
desc = new Object();
links= new Object();
matched= new Object();
keywords= new Object();
found= new Object();
var temp=0;

title[0]=11

keywords[0]=0

found[0]=0

title[1]="Carlsbad"
desc[1]="Carlsbad"
links[1]="carlsbad.html"
matched[1]=0

title[2]="La Jolla"
desc[2]="La Jolla"
links[2]="lajolla.html"
matched[2]=0

title[3]="Encinitas"
desc[3]="Encinitas"
links[3]=" encinitas.html"
matched[3]=0

title[4]="Solana Beach"
desc[4]="Solana Beach Solanabeach"
links[4]="solanabeach.html"
matched[4]=0

title[5]="Del Mar"
desc[5]="Del Mar Delmar"
links[5]="delmar.html"
matched[5]=0

title[6]="Rancho Sante Fe"
desc[6]="Rancho Sante Fe"
links[6]="ranchosantefe.html"
matched[6]=0

title[7]="Phone Numbers"
desc[7]="Phone Numbers Telephone Addresses"
links[7]="phoneaddresses.html"
matched[7]=0

title[8]="help info information assistance emergency"
desc[8]="Help and Information"
links[8]="help.html"
matched[8]=0

title[9]="Great Things Happiness Happy Joy Love Peace"
desc[9]="Be Happy Joyful Helpful Loving Kind"
links[9]="happiness.html"
matched[9]=0

title[10]="news"
desc[10]="News"
links[10]="news.html"
matched[10]=0

title[11]=""
desc[11]=""
links[11]="null.html"
matched[11]=0

function search(){

var skeyword=document.quicksearch.keywords.value.toLowerCase();
var check=1;
var pos=0;
var i=0;
var j=0;
var  itemp=0;
var config='';

while (true)
	{
	if (skeyword.indexOf("+") == -1 )
		{
		keywords[check]=skeyword;
		break;
		}
	pos=skeyword.indexOf("+");
	if (skeyword !="+")	
	{
	keywords[check]=skeyword.substring(0,pos);
	check++;
	}
	else
	{
	check--;
	break;
	}
	skeyword=skeyword.substring(pos+1, skeyword.length);	
	if (skeyword.length ==0)
		{
		check--;
		break;
		}
			 
	}

keywords[0]=check;

for ( i=1; i<=keywords[0];i++)
	{
	for (j=1;j<=title[0];j++)
		{
		if (title[j].toLowerCase().indexOf(keywords[i]) > -1 )
			{
			  matched[j]++;
			}
		}	
	}

for (i=1;i<=title[0];i++)
{
	if (matched[i] > 0 )
		{
		  found[0]++;

		  found[found[0]]=i;
			
		}	
}


for (i=1;i<=found[0]-1;i++)
	{
	for(j=i+1;j<=found[0];j++)
		{
		if ( matched[found[i]]< matched[found[j]] )
			{
			temp= found[j];
			found[j]=found[i];
			found[i]=temp;
			}
		}
	}

config='toolbar=yes,location=no,directories=no,status=no,menubar=no,' 
config += 'scrollbars=yes,resizable=yes' 
output = window.open ("","outputwindow",config) 
output.document.write('<title>CCC QUICK SEARCH RESULTS</title>');
output.document.write('<style> a{text-decoration:none;} </style>');
output.document.write('<BODY bgcolor=#ffffff text=#0066CC link=#0066CC vlink =#0066CC background=bg17.jpg>');
output.document.write('<center><a href="index.htm"><img border="0" src="ccc8sm.jpg" width="80" height="76" alt="Click Here to Return to Main Page"></a>');
output.document.write ("<form><center>"); 
output.document.write ("<input type='button' style='font-family: SansSerif,Arial; font-size: 8pt; color : #3366CC; background-color : #F2F3EE;' value='Close' onClick = 'self.close()'>"); 
output.document.write ("</center></form>"); 
output.document.write('<center><table border=0 cellpadding=0 cellspacing=0 width=98% align="center">');
output.document.write('<FONT FACE="VERDANA" FONT SIZE="2" FONT COLOR="#0066CC"></TABLE>');
output.document.write('<B><CENTER> <a href="index.htm"> QUICK SEARCH RESULTS </a> </B>');    
output.document.write('<hr width=100% size=1>');
output.document.write('<FONT FACE="VERDANA" FONT SIZE="1">The Keyword(s) you searched : '.big() )
for (i=1;  i<=keywords[0]; i++)
	{
	output.document.write( keywords[i].bold() +"   ");
	}
output.document.write('<br>');

if (found[0]==0)
	{
	 output.document.write('<hr width=100% size=1>');
	 output.document.write("<b>No matches resulted in this search </b> <br>");

	}
else
	{
	output.document.write(" <hr width=100% size=1> <b> The Results of the search are  : </b>  ");
	output.document.write( found[0] +"  Entries found  ".italics());
	output.document.write("<table border=1 width=100%>");
	for (i=1; i<=found[0];i++)
		{
		output.document.write("<tr><td valign=top bgcolor=#DAE7FF>");
		output.document.write("" +i +"");
		output.document.write("<td valign=top>");
		output.document.write("<Font Face=SansSerif,Verdana size=1>");
		itemp=found[i];
		output.document.write(desc[itemp].link() +" --- " +"<b>" +
links[itemp].link(links[itemp])+"<br>" +"</b>");
		temp= (matched[itemp]/keywords[0])*100
		output.document.write("<i> Matched  with keywords : " +temp+" %  </i>" );
		matched[itemp]=0
		} 
	found[0]=0;
	output.document.write("</table>");
	}
output.document.write ("");
output.document.write ("<form><center>")
output.document.write ("<input type='button' style='font-family: SansSerif,Arial; font-size: 8pt; color : #3366CC; background-color : #F2F3EE;' value='Close' onClick = 'self.close()'>")
output.document.write ("</center></form>")
}
