// JavaScript Document

function doWhitmanSearch() {
	if ($('whitman_txt').value != 'Search Whitman') {
		window.location = '/Search.asp?q=' + $('whitman_txt').value;
	}	
}

function doNewsSearch() {
	if ($('news_txt').value != 'Search News') {
		window.location = '/Newsroom/Search.aspx?q=' + $('news_txt').value;
	}
}

function doVideoSearch() {
	if ($('video_txt').value != 'Search Video') {
		window.location = '/VideoArchive/Search.aspx?q=' + $('video_txt').value;
	}
}

function doPeopleSearch() {
	if ($('people_txt').value != 'Search People') {
		window.location = '/Directory/?q=' + $('people_txt').value;
	}
}

function changeSearchType(searchType, sender) {
	
	// hide all search forms; then show correct one later
	var searchForms = $A($('searchForms').childElements());
	searchForms.each(Element.hide);
	
	// find all search indicator cells and remove them; then show the correct one later
	var searchIndicators = $A($('searchLinks').descendants());
	searchIndicators.each(function(e) {				  
			if (e.tagName == 'td' || e.tagName == 'TD') {
				e.removeClassName('searchIndicator');
			}
	});
	
	// find all search links and set class "off" state
	searchIndicators.each(function(e) {				  
			if (e.tagName == 'a' || e.tagName == 'A') {
				e.className = 'searchLink';
			}
	});
	
	sender.blur();
	
	// show search form
	$(searchType).style.display = 'block';
	
	// change arrow location
	$(searchType + '_ind').addClassName('searchIndicator');

	// change the class of the clicked button
	sender.className = 'searchLinkOn';
	
}

function clearDefaultText(el, defaultText) {
	if (el.value == defaultText) {
		el.value = '';
	}
}

function SearchKeyHandler(e,btn)
{
	// capture key event
	var KeyID = (window.event) ? event.keyCode : e.keyCode;
	// test for Enter key
	if(KeyID==13) {
		// cancel the default submit
		e.returnValue=false;
		e.cancel = true;
		// submit the form by programmatically clicking the specified button
		btn.click();
	}
}