// onload
if      (window.addEventListener) window.addEventListener("load", searchbox_main, false); //for W3C DOM
else if (window.attachEvent)      window.attachEvent("onload", searchbox_main);	//for IE



// for searchbox's default value w/o WebKit
function searchbox_main() {
	var defValue;
	var defColor   = '#666';
	var focusColor = '#222';
	var sf         = document.forms[0];
	var sb         = sf.elements[0];
	
	if (sb.value.match('.検索')) {
		defValue       = sb.value;
		sb.style.color = defColor;
	}
	
	
	// onforcus
	sb.onfocus  = function sbFocused() {
		if (this.value == defValue) {
			this.value       = '';
			this.style.color = focusColor;
		}
	}
	
	// onblur
	sb.onblur  = function sbDefault() {
		if (!this.value && defValue.match('.検索')) {
			this.value       = defValue;
			this.style.color = defColor;
		}
	}
	
	// onsubmit
	sf.onsubmit = function sbSubmit() {
		if (this.elements[0].value == defValue) this.elements[0].value = '';
	}
}