(function(jQuery) {
jQuery.fn.daMove1 = function(para) {
	para = jQuery.extend({
        type:"left",
		num:1,
		left:false,
		right:false,
		move:false,
		speed:600
    }, para || {});
    var o = jQuery(this);
	var star = 0;
	var moveX = 0;
	var end = para.num;
	var ow = o.width();
	var oh = o.height();
	var co = o.children();
	var len = co.length;
	var oHtml = o.html();
	o.empty();
	o.css({
		"position":"relative"
	});
	o.append("<div class='daMove1BigBox'></div>");
	var bigBox = jQuery(".daMove1BigBox");
	bigBox.css({
		"width":"auto",
		"height":"auto",
		"position":"absolute",
		"left":"0px",
		"top":"0px"
	});
	
	var count = Math.ceil(len/para.num);
	
	for(var i=0;i<count;i++){
		bigBox.append("<div index="+i+" class='daMove1Box'></div>");
		jQuery(".jqToolsIcon").append("<img class='jpiconImages' index="+i+" src='./images/2/jp1.jpg' />");
	}
	
	jQuery(".jpiconImages").first().attr("src","./images/2/jp2.jpg");
	jQuery(".jpiconImages").hover(
		function(){
			jQuery(".jpiconImages").attr("src","./images/2/jp1.jpg");
			jQuery(this).attr("src","./images/2/jp2.jpg");
		},
		function(){
		}
	);
	var box = jQuery(".daMove1Box");
	box.css({
		"width":ow,
		"height":oh,
		"float":"left",
		"display":"inline"
	});
	box.each(function(i){
		jQuery(this).css({
			"z-index":i
		});
		jQuery(this).append(co.slice(star,end));
		star = star+para.num;
		end = end +para.num;
		;
	});
	if(para.left && para.right){
		var left = jQuery(para.left);
		var right = jQuery(para.right);
	}else{
		alert("±êÇ©Î´¶¨Òå");
		return false;
	}
	if(!para.move){
		moveX = ow;
	}else{
		moveX = para.move;
	}
	left.css({
		"cursor":"pointer"
	});
	right.css({
		"cursor":"pointer"
	});
	if(para.type == "left"){
		bigBox.css({
			"width":ow*count,
			"height":oh
		});
	}
	
	jQuery(".jpiconImages").click(function(){
		if(bigBox.is(":animated")){
			return false;
		}
		bigBox.animate({
			"left":-602*parseInt(jQuery(this).attr("index"))+"px"
		},para.speed);
	});
	
	
	left.bind("click",function(){
		if(bigBox.is(":animated")){
			return false;
		}
		if(parseInt(bigBox.css("left"))>-ow*(count-1)){
			bigBox.animate({
				"left":"-="+moveX+"px"
			},para.speed);
		}else{
			return false;
		}
	});
	right.bind("click",function(){
		if(bigBox.is(":animated")){
			return false;
		}
		if(parseInt(bigBox.css("left"))<0){
			bigBox.animate({
				"left":"+="+moveX+"px"
			},para.speed);
		}else{
			return false;
		}
	});
	
	

	
};
})(jQuery);
