// 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(){
	for (var i=0; i < document.searchfrm.searchRad.length; i++){
	   if (document.searchfrm.searchRad[i].checked){
			if(document.searchfrm.searchRad[i].value == "site"){
				document.searchfrm.submit();
			}else{
				//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.ks1075.com/home.aspx");
				myKey_array[1]  = new Array("ITUNES","http://itunes.ks1075.com/");
				myKey_array[2]  = new Array("JOCKS","http://www.ks1075.com/ksJocks.aspx");	
				myKey_array[3]  = new Array("LISTEN","http://www.ks1075.com/listenOnline.aspx");	
				myKey_array[4]  = new Array("PODCAST","http://www.ks1075.com/podcasts/Episodes.aspx?PID=1504");	
				myKey_array[5]  = new Array("SHOWS|CONCERTS","http://www.ks1075.com/ksConcerts/Listings.aspx");
				myKey_array[6]  = new Array("WIN","http://www.ks1075.com/contests.aspx");	
				myKey_array[7]  = new Array("ADVERTISE","http://www.ks1075.com/Advertise.aspx");	
				myKey_array[8]  = new Array("KSAMSHOW|MORNING|KENDAL|KATH|WIG|LARRY|ULI","http://www.ks1075.com/morningShow/");	
				myKey_array[9]  = new Array("TONYV","http://www.ks1075.com/tonyV/");
				myKey_array[10] = new Array("GINA","http://www.ks1075.com/gina/");
				myKey_array[11] = new Array("CHONZ","http://www.ks1075.com/Blog/djchonz/home.aspx");
				myKey_array[12] = new Array("SLIM","http://www.ks1075.com/");
				myKey_array[13] = new Array("GOTTI|BUHRM","http://www.ks1075.com/buhrmGotti/");
				myKey_array[14] = new Array("WEEKEND","http://www.ks1075.com/weekends/");
				myKey_array[15] = new Array("MIXER","http://www.ks1075.com/ksMixers/");
				myKey_array[16] = new Array("BASH","http://www.ks1075.com/MorningShow/CelebrityTrashBash/browse.aspx");	
				myKey_array[17] = new Array("FLASH","http://www.ks1075.com/MorningShow/Paparazzi/browse.aspx");
				myKey_array[18] = new Array("AFTER","http://www.ks1075.com/podcasts/Episodes.aspx?PID=1504");
				myKey_array[19] = new Array("AMVIDEO","http://www.ks1075.com/VideoChannel/morningShow/Channel.aspx?ChanID=1522");
				myKey_array[20] = new Array("PSA","http://www.ks1075.com/channels/kathieJPSAs/Home.aspx");
				myKey_array[21] = new Array("FUTURE","http://www.ks1075.com/futurejamz.aspx");
				myKey_array[22] = new Array("DEALS","http://lincolndenver.mediawebconnect.com/");
				myKey_array[23] = new Array("CREDIT|DCCU","http://www.ks1075.com/DCCU.aspx");
				myKey_array[24] = new Array("ULTIMATE|ULTIMENT","http://www.ks1075.com/UltimateElectronicsUltimatePad.aspx");
				myKey_array[25] = new Array("SUMMERJAM","http://www.ks1075.com/summerjam/");
				myKey_array[26] = new Array("MYPHOTO","http://www.ks1075.com/myPhotos/");
				
				//loop through array - set max to last array number + 1
				for (i=0; i < 27; 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 or change your search to Site.");
				} //end if show error
			} //end if site or keyword
		} //end if for checked
	} //end loop form variables
} //end function
//-->