
/*  --------------------------------------------------------

    If visitor is using Safari, this will add the 'search' 
	field attributes to the mini search text field. If 
	using any other browser, it will add the extra span 
	tags to style the search field to look like the Safari 
	search box.
	
	-> <span id="sbl"></span>
	-> <span id="sb"><input... /></span>
	-> <span id="sbr"></span>

 -------------------------------------------------------- */

function customSearchBox() {
	
	if ( navigator.userAgent.toLowerCase().indexOf('safari') < 0  && document.getElementById ) {
	
			/* 
			    Visitor isn't using safari - add extra elements
			    to the search field required to add rounded edges
			*/
	
			if (!document.getElementById || !document.createElement || !document.appendChild) return false;
			search_field = document.getElementById('search_keywords');
	
			if(search_field) {
			
				var parent = search_field.parentNode;
	
				var left_end = document.createElement("span");
				var right_end = document.createElement("span");
				var middle = document.createElement("span");
	
				left_end.id = 'sbl';
				right_end.id = 'sbr';
				middle.id = 'sb';
	
				middle.appendChild(search_field);
				parent.appendChild(left_end);
				parent.appendChild(middle);
				parent.appendChild(right_end);
				
	
			}
						
			/* 
			    if using Opera, padding in the search field will be all out of whack
			*/
			if(navigator.userAgent.indexOf("Opera") != -1) {
				search_field.style.padding = '0px 0px 0px 2px';
			}
	
	
	} else {
	
		/*  
		    visitor is using safari - add safari's proprietary attributes
			to the textfield to turn it into a spotlight search box
		*/
	
		search_field = document.getElementById('search_keywords');
		search_field.style.marginTop = '5px';
		search_field.style.width = '178px';
		
		if(search_field) {
			search_field.setAttribute('type', 'search');
			search_field.setAttribute('placeholder', 'Search...');
			search_field.setAttribute('value', '');
			search_field.setAttribute('autosave', 'bsn_srch');
			search_field.setAttribute('results', '5');
		}
	
	}
		
}








/*  --------------------------------------------------------

    Sets the Search field to the default value specified. 
	Toggle between default value and blank on blur/focus 
	respectively. Does nothing if value has been changed 
	by user. 

 -------------------------------------------------------- */


function setDefaultSearchValueTo(default_value) {
		
	if (!document.getElementById || !document.createElement || !document.appendChild) return false;
	search_field = document.getElementById('search_keywords');
	
	search_field.onclick = function() { search_field.focus(); };
		
	search_field.onfocus = function() {
		if(search_field.value == default_value) {
			search_field.value = "";
		}
	};
		
	search_field.onblur = function() {
		if(search_field.value == "") {
				search_field.value = default_value;
		}
	};
		
	search_field.value = default_value;
	
}
	












startList = function() {

	if (document.all && document.getElementById) {

		navRoot = document.getElementById("nav");

		for (i = 0; i < navRoot.childNodes.length; i++) {

				node = navRoot.childNodes[i];
				if (node.nodeName == "LI") {

					node.onmouseover = function() {
						this.className += " over";
					}

				  node.onmouseout = function() {
					 this.className = this.className.replace(" over", "");
				  }

			   }
		}

	}

}






window.onload = function() { customSearchBox(); setDefaultSearchValueTo("Search..."); startList();  };