Target = {
	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');
			Target.search.d = s.value;
			s.onfocus = function() {
				if (this.value == Target.search.d)
					this.value = '';
			};
			s.onblur = function() {
				if (this.value == '')
					this.value = Target.search.d;
			}
		}
	},
	//Dropdown for IE6
	dd: function() {
		var HeaderMenu = document.getElementById("HeaderMenu");
		if (HeaderMenu)
		{
			var els = 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';
				};
			}
		}

		var HeaderSubMenu = document.getElementById("HeaderSubMenu");
		if (HeaderSubMenu)
		{
			var els = HeaderSubMenu.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';
				};
			}
		}

	}
};

Target.addLoadEvent(Target.search.init);
Target.addLoadEvent(Target.dd);

function locations(ID)
{
	var caption = 'Agents located at ' + jQuery('#'+ID+' h2').text();
	tb_show(caption, "/locations/#TB_inline?height=300&width=400&inlineId="+ID, false);
	if (jQuery('#TB_window').length)
	{
		jQuery('#TB_window').append('<div id="linkTB"><a href="/customer-services/">For agent details<br/>please click here</a></div>');
		linkTB = jQuery('#linkTB');
	}
//	try{ jQuery('#TB_window').draggable({handle: "#TB-title"}); } catch (e) { }
}

