/**
 * @author demon
 * @time 2011.06.28
 * @作用域：打折网首页第一屏  左右切换的效果
 */
$.fn.scrollfocus = function (options) {
	var opts= {
		imgbox:"",
		pre:"",
		next:""
	}
	$.extend(opts, options);
	var _this=$(this);
	var imgbox=_this.find(opts.imgbox);
	var pre=_this.find(opts.pre);
	var next=_this.find(opts.next);
	var width=imgbox.children().width();
	var length=imgbox.children().length;
	var index=0;
	imgbox.css({
		"position":"relative",
		"width":width*length
	})
	pre.click( function() {
		if(index>=length-1) {
			index=0;
		} else {
			index++;
		}
		action(index)
	})
	next.click( function() {
		if(index<=0) {
			index=length-1
		} else {
			index--;
		}
		action(index)

	})
	function action(index) {
		imgbox.animate({
			"left":-width*index
		},500)
	}

}
