/**
 * 图片轮播
 * 
 * @author zmx@gootop.net
 * @version
 */
var imageSc = function (target, options) {

 // 版本号
 this.version = "2011.3.27";

 var defaults = {
	 speed:1000,
	 index:5
 };

 this.options = jQuery.extend(defaults, options);

 this.tar = jQuery(target);

 var self = this;
 
 this.autoGo = null;
 
 this._create = function () {
	self.tar.find('.l_handle').mouseover(function(){
			clearInterval(self.autoGo);
			var index = jQuery(this).index();
			self.doSw(index);
	}).mouseout(function(){
		self.autoGo = setInterval(self.swTab,self.options.speed);
	});

	self.tar.find('.r_content').mouseover(function(){
		clearInterval(self.autoGo);
	}).mouseout(function(){
		self.autoGo = setInterval(self.swTab,self.options.speed);
	});
	
	self.autoGo = setInterval(self.swTab,self.options.speed);
 };
 
 this.swTab =function(){	
	curl = self.tar.find('.l_show');
	curIndex = curl.index();
	//console.log(curIndex+1);
	self.doSw(curIndex+1);
 };

 this.doSw = function(index){
	if(index == self.options.index){
		jQuery(".l_handle",self.tar).removeClass('l_show').eq(0).addClass('l_show');
		jQuery(".r_content",self.tar).hide().eq(0).show();
	}else{
		jQuery(".l_handle",self.tar).removeClass('l_show');
		jQuery(".l_handle",self.tar).eq(index).addClass('l_show');
		jQuery(".r_content",self.tar).hide().eq(index).show();
	}
 };

 
 this._create();
}; 

