$(function(){
	var txtSearchBox = '#txtSearch';
	
	// Set style of User pulldown menu
	var menuId = '#userMenuPullDown';
	if ($(menuId).length > 0){
		var menuOffSet = $(menuId).offset();
		$(menuId).find('ul').css({
			position: "absolute",
			opacity: 1.0,
			top: menuOffSet.top + $(menuId).outerHeight() + "px",
			left: menuOffSet.left,
			zIndex: 20000
		});
	}

	// display user menu when hover on username
	$(menuId).find('li:first').hover(
		function(){ $(this).find('ul').removeClass('hide');},
		function(){ $(this).find('ul').addClass('hide');}
	);
	
	// submit search form when click on search icon
	$('#headerSearchIcon').click(function(){
		$('#frmHeaderSearch').submit();
	});
	
	// select all text in search text box
	$(txtSearchBox).focus(function(){
		$(this).select();
	});
	// display the hint of search text box	
	$(txtSearchBox).blur(function(){
		if($.trim($(this).val()).length == 0){
			$(this).val(searchBoxHint);
		}
	});
});
