/**********************************
*
*    author       : teresa 2011-01-14 11:35:34
*    discription  : flash
*    params       : time : 
					params : 需要改变样式的objects
*
***********************************/
	
	
//init object film2
var film2 = {
	index2 : 0,	
	init :  function(time,obj,params,classname){
		//
		film2.params = params.split(',');
		film2.len = $(obj).length;
		film2.classname = classname;
		film2.time = time;
		film2.obj = obj;
		//init 
		film2.move();
		//when mouseover images stop & mouseout restart.
		film2.mouseaction(obj);

		//mouseover tabs stop .	
		for(j=0;j<film2.params.length;j++){
			//
			film2.mousestop(film2.params[j]);
		}		
	},
	move : function(){
		//
		film2.start = setInterval("film2.round()",film2.time);
		
	},
	stop : function(){
		film2.start = clearInterval(film2.start);
	},
	round : function(){
		if(film2.index2 == film2.len - 1){
			film2.index2 = 0;
		}else {
			film2.index2 += 1;
		}
		film2.event();
	},
	event : function(){

		if(film2.len <= 1) return;
		else {
			// show or hide
			$(film2.obj).hide().eq(film2.index2).fadeIn(500);
			// add class
			for(i=0;i<film2.params.length;i++){
				$(film2.params[i]).removeClass(film2.classname).eq(film2.index2).addClass(film2.classname);
			}
		}		
	},
	mousestop : function(o){
		$(o).mouseover(function(){			
			//stop
			film2.stop();
			//show relative section
			film2.index2 = $(this).index(o);
			film2.event();
		}).mouseout(function(){
			film2.move();
		})
	},
	mouseaction : function(o){
		$(o).mouseover(function(e){
			if(isMouseLeaveOrEnter(e,this)){
				//lg('over');
				film2.stop();
			}		
			
		}).mouseout(function(e){
			if(isMouseLeaveOrEnter(e,this)){
				//lg('out');
				film2.move();
			}
			
		})	
	}
}

	






