/**
 * @author: RB
 * @date: 29-01-2009
 * @version: 1.0
 * 
 * @fileoverview:
 * Contains functionality to display / hide the google custom search box background image on user click
 * including ASP.NET implementation
 * 
 */

function registerGoogleSearch(id)  {
	
    // ASP.NET implementation of google custom search
    var q = document.getElementById(id);
	
	if (q) {		
		var n = navigator;
		var l = location;
		
		var b = function() {
		
			if (q.value === '') {
				q.style.background = '#fff url(http:\x2F\x2Fwww.google.com\x2Fcoop\x2Fintl\x2Fen\x2Fimages\x2Fgoogle_custom_search_watermark.gif) left no-repeat';
			}
		};
		
		var f = function() {
			q.style.background = '#fff';
		};
		
		q.onfocus = f;
		q.onblur = b;
		
		var wo = function() {
			
			if (!/[&?]q=[^&]/.test(l.search)) {
				b();
			}
		}
		
		if (window.attachEvent) {
			window.attachEvent('onload', wo);
		}
		else {
			window.addEventListener('load', wo, false);
		}
	}
}
