/* SEARCH */

/* : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : functions
- evaluate search type and value, then assign urls
- send user to url
*/
function evalSearch(s) {
	var searchType;
	for (var i = 0; i < s.length; i++) { if (s[i].checked) { searchType = s[i].value; break; } }
	var query = (s.q.value).replace(/\s/, "+");
	
	switch(searchType) {
		case "dhc":
			var goURL = "http://health.discovery.com/search/google.html?query=" + query + "&site=all";
			searchGo(goURL, "current");
			break;
			
		case "web":
			var goURL = "http://health.discovery.com/search/kosmix.html?query=" + query + "&category=vhealth.all";
			searchGo(goURL, "current");
			break;
			
		case "vid":
			var goURL = "http://health.discovery.com/beyond/?searchQuery=" + query;
			searchGo(goURL, "new");
			break;
			
		default:
			var goURL = "http://health.discovery.com/search/google.html?query=" + query + "&site=all";
			searchGo(goURL, "current");
			break;
	}
}

function searchGo(s, type) { 
	if (type == "new") { window.open(s); }
	else { window.top.location.href = s; }
}


/* END SEARCH */