(function($)
{
	$.fn.tabs = function()
	{
		// Set up the tabPanels for sliding animation.
		$("#tabPanels").cycle(
		{ 
			fx: "scrollHorz",
		    timeout: 0, 
		    speed: 300, 
		    startingSlide: 0,
			cleartypeNoBg: true
		});
		
		// When a tab image is clicked, make the previous disabled tab a normal tab, 
		// make the clicked tab disabled, and  return the cursor to its pointer state.
		this.click(function()
		{
			var $disabled = $("img.tab").filter("[src*=-disabled.jpg]");
			$disabled.css("cursor", "pointer");
			
			$disabled.attr("src", $disabled.attr("src").replace("-disabled.jpg", ".jpg"));
			
			// Switch the clicked tab to disabled.
			if (this.src.indexOf("-over") != -1)
			{
				$(this).attr("src", this.src.replace("-over.jpg", "-disabled.jpg"));
			}
			else
			{
				$(this).attr("src", this.src.replace(".jpg", "-disabled.jpg"));
			}
	
			// Change the hand cursor to its default pointer.
			this.style.cursor = "default";
   			
			// Animate movement to the clicked tab.
			$("#tabPanels").cycle(this.id.charAt(this.id.length - 1) - 1);
		});
		return this;
    }
})(jQuery)
