(function($){	$.fn.slider = function(settings)	{		// Config Array		var config = 		{ 			id:						0,			direction:				"hor",			holder:					null,			btnNextStr:				"",			btnPrevStr:				"",			numItems:				1,			moveVal:				0,			moveItem:				"",			numItemsVisible:		1,						btnDisabledStr:			"-dis",			imagesFolder:			"/common/images/",						swapFeature:			false,			swapHolder:				null,			swapHolderItemClass:	"",			itemClass:				""		}				// Variables to determine the position of the slider		var currentItem = 0;		var pos = 0;		var prevPos = [];				// Update the config array with the settings passed in the function		if (settings) { $.extend(config, settings); }				// Variables to hold the previous and next buttons		var btnNext = $("." + config.btnNextStr + ":eq(" + config.id + ")");		var btnPrev = $("." + config.btnPrevStr + ":eq(" + config.id + ")");						// Removed the href link from the buttons and set the previous button to disabled		btnPrev.removeAttr('href').css({backgroundImage: "url(" + config.imagesFolder + config.btnPrevStr + config.btnDisabledStr + ".gif)", cursor: "default"});		btnNext.removeAttr('href').css({cursor: "pointer"});				// If the number of items is less than or equal to the number of items visible - disable the next button		if (config.numItems <= config.numItemsVisible)		{			btnNext.css({backgroundImage: "url(" + config.imagesFolder + config.btnNextStr + config.btnDisabledStr + ".gif)"}).css({cursor: "default"});		}				// If the slider has a swapping functionality		// Ability to click on an item and swap a content area		if (config.swapFeature)		{			createSwapFunctionality();		}				// This is to prevent a flicker while the page is loading		// The buttons are set to invisible in the CSS		btnNext.css({display: 'block'});		btnPrev.css({display: 'block'});			//  ========== FUNCTIONS ==========  \\				// Next Button Click Function		btnNext.click(function()		{						if (currentItem < config.numItems - config.numItemsVisible)			{				if (config.moveVal == 0)				{					var nextItem = $(config.moveItem, config.holder);													if (currentItem >= 1)					{						prevPos[currentItem] = prevPos[currentItem - 1] - $(nextItem[currentItem - 1]).outerHeight(true);					}					else					{						prevPos[currentItem] = 0;					}										pos -= $(nextItem[currentItem + config.numItemsVisible]).outerHeight(true);				}				else				{					pos -= config.moveVal;				}								if (config.direction == "hor")				{					$(config.holder).animate({ left: pos + "px" }, 350);				}				else if (config.direction == "vert")				{					$(config.holder).animate({ top: pos + "px" }, 350);				}				currentItem++;								if (checkMaxValue(currentItem, config.numItems - config.numItemsVisible))				{					btnNext.css({backgroundImage: "url(" + config.imagesFolder + config.btnNextStr + config.btnDisabledStr + ".gif)"}).css({cursor: "default"});				}				else				{					btnNext.css({backgroundImage: "url(" + config.imagesFolder + config.btnNextStr + ".gif)"}).css({cursor: "pointer"});				}								btnPrev.css({backgroundImage: "url(" + config.imagesFolder + config.btnPrevStr + ".gif)"}).css({cursor: "pointer"});			}		});				// Previous Button Click Function		btnPrev.click(function()		{						if (currentItem > 0)			{				if (config.moveVal == 0)				{					pos = prevPos[currentItem - 1];				}				else				{					pos += config.moveVal;				}								if (config.direction == "hor")				{					$(config.holder).animate({ left: pos + "px" }, 350);				}				else if (config.direction == "vert")				{					$(config.holder).animate({ top: pos + "px" }, 350);				}				currentItem--;								if (checkMinValue(currentItem, 0))				{					btnPrev.css({backgroundImage: "url(" + config.imagesFolder + config.btnPrevStr + config.btnDisabledStr + ".gif)"}).css({cursor: "default"});				}				else				{					btnPrev.css({backgroundImage: "url(" + config.imagesFolder + config.btnPrevStr + ".gif)"}).css({cursor: "pointer"});				}								btnNext.css({backgroundImage: "url(" + config.imagesFolder + config.btnNextStr + ".gif)"}).css({cursor: "pointer"});			}		});				// Content Swap Function		function createSwapFunctionality()		{						var currentPosition = 0;			var position = 0;			var lastItem = $(config.itemClass + ":first-child");						var itemWidth = $(config.swapHolderItemClass + ":first-child").outerWidth(true);			var itemHeight = $(config.swapHolderItemClass + ":first-child").outerHeight(true);						var i = 0;			var len_i = $(config.itemClass).length;			for (i; i < len_i; i++)			{				var featuredItem = $(config.itemClass)[i];								$(featuredItem).css({cursor: 'pointer'});				$('a', featuredItem).removeAttr("href").addClass('nolink');								$(featuredItem).attr({rel: i});								$(featuredItem).mouseover(function()				{					$(this).addClass('hover');				}).mouseout(function()				{					$(this).removeClass('hover');				}).click(function()				{					if ($(this).attr('rel') != position)					{						$(this).addClass('selected');						lastItem.removeClass('selected');												lastItem = $(this);																		if (config.direction == "hor")						{							var imageSlidePos = $(this).attr('rel') * itemWidth;						}						else if (config.direction == "vert")						{							var imageSlidePos = $(this).attr('rel') * itemHeight;						}												position = $(this).attr('rel');						var time = position - currentPosition;												if (time < 0) { time *= -1; }																		if (config.direction == "hor")						{							$(config.swapHolder).animate({left: '-' + imageSlidePos}, 350 * time);						}						else if (config.direction == "vert")						{							$(config.swapHolder).animate({top: '-' + imageSlidePos}, 350 * time);						}												currentPosition = position;					}					return false;				});			}		}				// Check Maximum Value to set appropriate state on buttons		function checkMaxValue(num, maxnum)		{			if (num == maxnum)			{				return true;			}		}		// Check Minimum Value to set appropriate state on buttons		function checkMinValue(num, minnum)		{			if (num == minnum)			{				return true;			}		}	};})(jQuery);