Eos = {
	addLoadEvent: function(f) {
		var oo = window.onload; 
		if (typeof window.onload != 'function') { 
			window.onload = f; 
		} else { 
			window.onload = function() { 
				if (oo) oo(); 
				f(); 
			} 
		} 
	},
	search: {
		d: null,
		init: function() {
			var s = document.getElementById('SearchQuery');
			var div_s		= document.getElementById('SearchBox');
			var button_s	= document.getElementById('SearchButton');
			var focus		= false;
			Eos.search.d = s.value;
			s.onfocus = function() {
				if (this.value == Eos.search.d)
					this.value = '';
				focus = true;
			};
			
			s.onblur = function() {
				if (this.value == '')
					this.value = Eos.search.d;
				focus = false;
				div_s.onmouseout();
			}
			
			div_s.onmouseover = function() {
				div_s.style.backgroundImage = 'url(/wp-content/themes/eos-asi/images/search_red.png)';
				button_s.style.background = 'url(/wp-content/themes/eos-asi/images/search_red.png) no-repeat -143px -3px';
			};
			
			div_s.onmouseout = function() {
				if ( !focus )  {
					div_s.style.background = 'url(/wp-content/themes/eos-asi/images/search.png) no-repeat';
					button_s.style.background = 'url(/wp-content/themes/eos-asi/images/search.png) no-repeat -143px -3px';
				};
			};
		}
	},
	//Dropdown for IE6
	dd: function() {
		var els = document.getElementById("HeaderMenu").getElementsByTagName("LI");
		for (var i=0; i<els.length; i++) {
			els[i].onmouseover = function() {
				this.className += " jHover";
				this.style.zIndex = '2';
			};
			els[i].onmouseout = function() {
				this.className = this.className.replace(new RegExp(" jHover\\b"), "");
				this.style.zIndex = '1';
			};
		}

	}
};

Eos.addLoadEvent(Eos.search.init);
Eos.addLoadEvent(Eos.dd);
