function imageSwap(id) {
	var links = document.getElementById(id).getElementsByTagName("a");
	
	var imgLoad = []

	for(var i = 0; i < links.length; i++) {
		attachBehavior(links[i], i);
	}

	function attachBehavior(obj, iter) {
		
		var img = obj.getElementsByTagName('img')[0];
		var imgSrc = img.getAttribute("src");
		var ext = imgSrc.match(/\.\S{3}$/);
		var overSrc = imgSrc.replace(ext, "_on" + ext);
		
                    // preLoad over states
		imgLoad[iter] = new Image();
		imgLoad[iter].src = overSrc
		
                    // use event listeners if appropriate
		obj.onmouseover = function(){
			img.setAttribute("src", overSrc);
		}
		obj.onmouseout = function(){
			img.setAttribute("src", imgSrc);
		}
	}
}
function setSearchString(id) {
	var obj = document.getElementById(id);
	obj.value = "Search";
	attachBehavior(obj);
	attachBehaviorParent(obj.parentNode.parentNode, obj);
	function attachBehavior(obj) {
		obj.onfocus= function(){
			resetTextBox(this, "Search")
		}
		obj.onblur= function(){
			resetTextBox(this, "Search")
		}
	}
	function attachBehaviorParent(objParent, obj) {
		objParent.onsubmit= function(){
			resetTextBox(obj, "Search")
		}
	}
}
function resetTextBox(textBox, strValue)
{
	if(textBox.value == "")
	{
		textBox.value = strValue;
	}
	else if(textBox.value == strValue)
	{
		textBox.value = "";
	}
}
imageSwap("fontTools");
imageSwap("english");
setSearchString("searchtop");
