// Search box default values - show / hide
jQuery(document).ready(function() {
	
	var valueCache = jQuery('#qt').val() || "Search This Community";
	
	jQuery('#qt').focus(function(){
				
		if (!StringUtils.isEmpty(jQuery(this).val())) {
			jQuery(this).val('');
			jQuery(this).removeClass('placeholder');
		}
	});
	
	jQuery('#qt').blur(function(){
		if (StringUtils.isEmpty(jQuery(this).val())) {
			
			jQuery(this).val(valueCache);
			jQuery(this).addClass('placeholder');
		}
	});
	
	
	// animate the back to citrix tab
	jQuery("#backtocitrixtab a").hover(
		function(){
			jQuery("#backtocitrixtab a").animate({height: '24px'}, 'fast' );
		},
		function() {
			jQuery("#backtocitrixtab a").animate({height: '12px'}, 'fast' );
		}
	   );	
	

	// do communities menu
	jQuery('#unav_viewcommunities a').click(function(){
		jQuery('#communities_menu').fadeIn('fast');
		
		jQuery(document).bind('mousedown',function(e){
			if(!(jQuery(e.target).parents("#communities_menu").is(":visible") || jQuery(e.target).is("#communities_menu")))
			{
				jQuery('#communities_menu').fadeOut('fast');
				jQuery(document).unbind('mousedown');
				
				// make drop down dissapear on esc button press
				jQuery(document).keyup(function(event){
					if (event.keyCode == 27) {
						jQuery('#communities_menu').fadeOut('fast');
				    }				
				});				
			} 
		});
	});	
});
