﻿var searchbox;

function centersheaderinit () {
	searchbox = document.getElementById('centersheadersearchbox');
	searchbox.onfocus = searchfocus;
	searchbox.onblur = searchblur;
	
	//links to current page are marked "currentpage"
	var here = document.URL;
	for (var i = 0; i < document.links.length; i++) {
		var link = document.links[i];
		if (here.match(link.pathname) && link.hostname == 'www.uwsp.edu') {
			if (link.className) link.className += ' currentpage';
			else link.className = 'currentpage';}}}

function searchfocus () {
	if (searchbox.value == 'UWSP Search') {
		searchbox.value = '';
		searchbox.style.textAlign = 'left';
		searchbox.style.color = '#000000';
		searchbox.style.fontWeight = 'normal';}}

function searchblur () {
	if (searchbox.value == '') {
		searchbox.style.textAlign = 'center';
		searchbox.style.color = '#9f9f9f';
		searchbox.style.fontWeight = 'bold';
		setTimeout("searchbox.value = 'UWSP Search';", 100);}}

//make sure a previous window.onload is not overwritten
if (window.onload) {
	var chprevinit = window.onload;
	window.onload = function() {
		chprevinit();
		centersheaderinit();
	}
}
else window.onload = centersheaderinit;