// JavaScript Document
<!--
//check for enter key on input
function checkEnter(e){ //e is event object passed from function invocation
	var characterCode; //literal character code will be stored in this variable

	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which; //character code is contained in NN4's which property
	}else{
		e = event
		characterCode = e.keyCode; //character code is contained in IE's keyCode property
	}

	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		searchfnc(); //call the search function
		return false;
	}
}

//clean up inputs
function cleanUpInput(strInput) {
     strInput = strInput.toUpperCase();
	 strInput = strInput.replace(/\'/g, "");
	 strInput = strInput.replace(/-/g, "");
	 strInput = strInput.replace(/\s+/g,"");
	 return strInput;
}

//look at search criteria
function searchfnc(){
	
		//Function Begin
		var iKey = document.searchfrm.q.value
		var key = cleanUpInput(iKey);
		var showError = true;
		
		/*
		set up array with keywords and URLs
		Use ALL caps for keywords 
		No need for plural version of keywards
		Use the | to have more than one keyword
		*/
		var myKey_array = new Array();
		myKey_array[0]  = new Array("HOME","http://www.froggy929.com/");
        myKey_array[1]  = new Array("LISTEN","http://player.streamtheworld.com/_players/maverick/index.php?callsign=KFGYFM");
        myKey_array[2]  = new Array("SCRAPBOOK|SCRAP|BOOK","http://www.froggy929.com/Scrapbook.aspx");    
        myKey_array[3]  = new Array("CONCERTS","http://www.froggy929.com/Concerts/listings.aspx");  
        myKey_array[4]  = new Array("CONTACT","http://www.froggy929.com/Contact.aspx");
		myKey_array[5]  = new Array("ROB|JOSS|JOSH","http://www.froggy929.com/RobandJoss.aspx");
		myKey_array[6]  = new Array("CREW|FROGGY","http://www.froggy929.com/FroggyCrew.aspx");
		myKey_array[7]  = new Array("FROG|NATION","http://www.froggy929.com/Login.aspx");
		myKey_array[8]  = new Array("COMMUNITY|CORNER","http://www.froggy929.com/CommunityCorner.aspx");
		myKey_array[9]  = new Array("SURVEY","http://www.froggy929.com/Froggy_929_Website_Survey.aspx");
		myKey_array[10]  = new Array("101","http://www.101survey.org/");
		myKey_array[11]  = new Array("1O1","http://www.101survey.org/");
		myKey_array[12]  = new Array("RAFFLE","http://www.marinraffle.com");
		myKey_array[13]  = new Array("HOLIDAY","http://www.froggy929.com/MontgomeryVillageHolidays2010.aspx");
		myKey_array[14]  = new Array("RACE","http://www.calistogaspeedway.org");
		myKey_array[15]  = new Array("MAP","http://www.froggy929.com/Map.aspx");
		myKey_array[16]  = new Array("VILLAGE","http://www.froggy929.com/MontgomeryVillageFreeCountryConcertSeries2011.aspx");
		myKey_array[17]  = new Array("LASER|ZERONA","http://www.froggy929.com/DowntownZeronaLaser.aspx");
		myKey_array[18]  = new Array("HOLIDAY|HOLLYDAY|CHRISTMAS|WINTER","http://www.froggy929.com/MontgomeryVillageHoliday2011.aspx");
		
		
	
		//loop through array - set max to last array number + 1
		for (i=0; i < 19; i++) {
			//look for search match
			if(key.search(myKey_array[i][0]) != -1) {
				showError = false;
				top.window.location = myKey_array[i][1];						
			} //end if search match
		} //end loop array
		
		if (showError) {
			alert("We're Sorry, There are no pages matching the keyword "+iKey+".\nPlease try another keyword.");
		} //end if show error
	
} //end function
//-->

