jQuery.fn.slideView = function(settings) {
	settings = jQuery.extend({easeFunc: "easeOutCubic",easeTime: 450}, settings);
	var currentIndex = 0;
	var maskPosition = -1; // 0 = left, 1 = right
	return this.each(function(){
		var container = $(this);
		var imageWidth = container.find("img").width();
		var imageHeight = container.find("img").height();
		var imageCount = container.find("li").size();
		var totalWidth = imageWidth * imageCount;
		container.find("ul").css("width" , totalWidth);
		container.css("width" , imageWidth);
		container.css("height" , imageHeight);
		if (imageCount == 0) 
			return;
			
		$(".slideViewStat").text("[ 1 / " + imageCount +" ]");

		mask = jQuery("<div id=\"slideViewMask\">");
		mask.width(imageWidth/2).height(imageHeight).css({'background-color':'#fff','opacity':0.2,'position':'absolute', 'top':0}).hide();
		$(this).append(mask);
		mask.click(function(arg){
			var nextPosition = 0;
			var nextIndex = 0;
			
			if (maskPosition == 1){
				if (currentIndex < imageCount-1) {
					currentIndex++;
					nextIndex = currentIndex + 1;
					nextPosition = -(imageWidth * currentIndex);
				}
				else {
					return;
				}
			}
			else {
				if (currentIndex > 0) {
					nextIndex = currentIndex;
					currentIndex--;
					nextPosition = -(imageWidth * (nextIndex - 1));
				}
				else {
					return;
				}
			}
			container.find("ul").animate({ left: nextPosition}, settings.easeTime, settings.easeFunc);
			$(".slideViewStat").text("[ " + nextIndex + " / " + imageCount +" ]");
			
		});
			
		$(this).find("img").mousemove(function(arg){
			if (arg.pageX - $(this).parent().parent().parent()[0].offsetLeft < imageWidth / 2) {
				mask.css("left", 0).show();
				maskPosition = 0;
			} else {
				mask.css("left", imageWidth /2).show();
				maskPosition = 1;
			}
		});
		
		mask.mouseout(function(arg){
			mask.hide();
		});
		
  });	
};