	function doSearch() {
		var s,d,url;
		s = document.forms[0].searchText.value;
		d = checkRadios("searchSelect");
		s = escape(s);
		switch (d) {
			case "1":
				url = "http://search.okanagan.bc.ca/search?output=xml_no_dtd&oe=UTF-8&ie=UTF-8&client=default_frontend&proxystylesheet=default_frontend&site=Calendar&q=" + s;
				break
			case "2":
				url = "http://webapps-1.okanagan.bc.ca/ok/staffdirectory/default.aspx?last_name=" + s;
				break
			default:
				url = "http://search.okanagan.bc.ca/search?output=xml_no_dtd&oe=UTF-8&ie=UTF-8&client=default_frontend&proxystylesheet=default_frontend&site=default_collection&q=" + s;
		}
		window.location = url;
	}
	
	
// ---------------------------------------------------------------------------------------
// checkRadios(form,radios)
// * Must supply the name of the form followed by the name of the radio buttons
// * Returns the value that is checked, else 0
// ---------------------------------------------------------------------------------------
	function checkRadios(radios) {
		var obj, checkvalue = 0;
		obj = eval('document.forms[0]' + '.' + radios + ''); // obj is a handle for the radio buttons
		if (obj.options) {
			// selection list test
			checkvalue = obj.options[obj.selectedIndex].value;
		}
		else {
			// radio button test
			for (i=0, n=obj.length; i<n; i++) {
				if (obj[i].checked) {
					checkvalue = obj[i].value;
					break; // Checked value found. no need to search any further.
				}
			}
		}
		return checkvalue; // Returns the value that is checked
	}	
	
	
	function checkReturn(e,s) {
		var characterCode;
		
		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)
			doSearch();
			return false;
		}
		else{
			return true;
		}	
		
	}