(function(){
	function triggerNormalState(img) {
		img.src = img.src.replace("-over.png", ".png");	
	}
	
	function triggerHoverState(img) {
		img.src = img.src.replace(".png", "-over.png");
	}
	
	function isActive(img) {
		return $(img).hasClass("current");
	}
	
	jQuery.fn.newWindow = function(name, options) {
		$(this).click(function() {
			window.open(this.href, name, options);
			return false;
		});	
	};
	
	$(document).ready(function() {
		$("#mainNavigation a img").hover(function() {
			if(!isActive(this)) {
				triggerHoverState(this);
			}
		}, function() {
			if(!isActive(this)) {
				triggerNormalState(this);
			}				
		});
		$(".chatLauncher").newWindow();
	});
	
})()