var j = 0;
jQuery.fn.slider = function(settings) {
	 settings = jQuery.extend({
     easeFunc: "expoinout",
     easeTime: 750,
     toolTip: false
  }, settings);
	return this.each(function(){
		var container = jQuery(this);
		// Self-explanatory...
		container.removeClass("csw").addClass("stripViewer");
		// Get the width of a panel, set from CSS...
		var panelWidth = container.find("div.panel").width();
		// panelCount gives us a count of the panels in the container...
		var panelCount = container.find("div.panel").size();
		// Calculate the width of all the panels when lined up end-to-end...
		var stripViewerWidth = panelWidth*panelCount;
		// Use the above width to specify the CSS width for the panelContainer element...
		container.find("div.panelContainer").css("width" , stripViewerWidth);
		var currentPanel = 1;
		var cnt = - (panelWidth*currentPanel);
		
		function clickPrevious() {
			jQuery(".previous").unbind("click").bind("click",function(){
				currentPanel--;
				cnt = - (panelWidth*(currentPanel-1));
				jQuery(this).parent().find("div.panelContainer").animate({ left: cnt}, settings.easeTime, settings.easeFunc);
				if(currentPanel == 1) {
					jQuery(this).unbind("click").attr("id","disabled");
				}
				if(currentPanel != panelCount) {
					clickNext();
					jQuery(".next").removeAttr("id");
				}
			});
			if(currentPanel == 1) {
				jQuery(".previous").unbind("click").attr("id","disabled");
			}
			return false;
		}
		
		function clickNext() {
			jQuery(".next").unbind("click").bind("click",function(){
				currentPanel++;
				cnt = - (panelWidth*(currentPanel-1));
				jQuery(this).parent().find("div.panelContainer").animate({ left: cnt}, settings.easeTime, settings.easeFunc);
				if(currentPanel == panelCount) {
					jQuery(this).unbind("click").attr("id","disabled");
				}
				if(currentPanel != 1) {
					clickPrevious();
					jQuery(".previous").removeAttr("id");
				}
			});
			return false;
		}

		clickPrevious();
		clickNext();
		
		j++;
  });
};
