var searchBox = document.getElementById("searchField");
var searchIsFocused = false;
var SEARCH_LABEL = "Search";

function onSearchFocus() {
	this.className = "active";
	if (this.value == SEARCH_LABEL) {
		this.value = "";
	}
	searchIsFocused = true;
}

function onSearchOver() {
	this.className = "active";
}

function onSearchExit() {
	this.className = "";
	if (this.value.length < 1) {
		this.value = SEARCH_LABEL;
	}
}

function onSearchOut() {
	if (!searchIsFocused) {
		this.className = "";
		if (this.value.length < 1) {
			this.value = SEARCH_LABEL;
		}
	}
}

searchBox.onmouseover = onSearchOver;
searchBox.onmouseout = onSearchOut;
searchBox.onfocus = onSearchFocus;
searchBox.onblur = onSearchExit;
