		
var w;
	
$(document).ready(function() {
	
	//preload pop up icons using jquery image preloader plugin - http://farinspace.com/jquery-image-preload-plugin/

	$.imgpreload([
		'/images/buttons/fba-chat-header-max-close-hover.png',
		'/images/buttons/fba-chat-header-close-hover.png',
		'/images/buttons/fba-chat-teaser-max.png',
		'/images/buttons/fba-chat-teaser.png'
	],function() {
		// once images loaded then show whos online box
		$('#whos-online-header').css("background-image","url(../../images/buttons/fba-chat-teaser-max.png)");
		$('#whos-online-popup').show();
	});
	
});	
	
	


	// custom toggle for whos online box based on header clicks
	// allows for animations called elsewhere
	// uses multiple selectors - http://api.jquery.com/multiple-selector/
	$(document).ready(function()
	{
		$('h2.trigger,#whos-online-min').click(function() {
			if ($('#whos-online-popup').height() == 18) {
				
				//clearTimeout(w);	// stop previous whos online timers
				//refreshWhosOnline(true);		
				$('#whos-online-popup').animate({
				height: "250", 
				}, 500, function() {
				// change min/max header once animation complete
				$('#whos-online-header').css("background-image","url(../../images/buttons/fba-chat-teaser.png)");
				$('#whos-online-header').css({backgroundPosition: '0px 0px'});
			});
			}
			else {
				$('#whos-online-popup').animate({
				height: "18", 
				}, 500, function() {
				// change min/max header once animation complete
				$('#whos-online-header').css("background-image","url(../../images/buttons/fba-chat-teaser-max.png)");
				$('#whos-online-header').css({backgroundPosition: '0px 0px'});
			});
			}
		});
		

		$('#whos-online-header').hover(function() {
			$(this).css({backgroundPosition: '0px -32px'});
			}, function() {
			$(this).css({backgroundPosition: '0px 0px'});
		});	
				 
	});
