(function($){
	var style = '<style>';
	style += '#filmstrip {clear:both; height:93px; background:transparent url(/img/film_bg.jpg) repeat-x scroll 0 0; width:650px; }';
	style += '#filmstrip a, #filmstrip a:visited { color:rgb(0, 0, 204); float:left; display:block; width:80px; text-align:center; margin-top:1px; padding:10px 9px; height:84px; }';
	style += '#filmstrip div.clip {height:91px; overflow:hidden; position:relative; z-index:2; float:left; width:592px; }';
	style += '#filmstrip a span { display:block; }';
	style += '#filmstrip a span img { border:1px solid #ccc; margin-bottom:7px; }';
	style += '#filmstrip a.selected, #filmstrip a:visited.selected { color:#000; text-decoration:none; background:#FFF; font-weight:bold; width:78px; border-left:1px solid #ccc; border-right:1px solid #ccc; }';
	style += '#filmstrip a:hover { background:#FFFFFF; }';
	style += '#filmstrip a#leftarrow { width:29px; background:url(/img/arrow_left.jpg) top left; margin:0; padding:0; height:92px; }';
	style += '#filmstrip a#rightarrow { width:29px; background:url(/img/arrow_right.jpg) top left; margin:0; padding:0; height:92px; float:left; }';
	style += '#filmstrip a#leftarrow.on, #filmstrip a#rightarrow.on { background-position:-29px; cursor:pointer; }';
	style += '#filmstrip a#leftarrow.on:hover, #filmstrip a#rightarrow.on:hover { background-position:-58px; }';
	style += '#thumblist {left:0;position:absolute; z-index:1; line-height:1.1em;}';
	style += '</style>';
	$(style).appendTo('body');
	$.fn.thumbList = function(options){
		//设计选项默认值
		var defaults = {
		    stepLength:100,   //单位
			containSize:9,//盒子大小
		    selectedClass:"selected",
			leftMove:null,    //
			rightMove:null
		};
	 
		var opts = $.extend(defaults, options);
	 
		//动画处理      
		var $this = $(this);
		$this.each(function(){
			$(this).click(function(){
				var src = this.href;
				var name = $(this).attr('title');
				$.weeboxs.open('<div id="loading" class="dialog-loading"></div><img style="display:none" src="">', {width:220, height:150, title:name, showButton:false, onopen:function(box){					
					box.find('img').load(function(){
						box.find('#loading').remove();
						var width = box.find('img').width();
						var height = box.find('img').height();
						if (width>600) {
							box.find('img').width(600);
							box.find('img').height(600/width*height);
						}
						if (width<300) {
							box.find('img').width(300);
							box.find('img').height(300/width*height);
						}
						if (height>400) {
							box.find('img').height(400);
							box.find('img').width(400/height*width);
						}
						if (height<200) {
							box.find('img').height(200);
							box.find('img').width(200/height*width);
						}
						box.find('img').show();
						box.dh.width(box.find('img').width()+22);
						box.dc.height(box.find('img').height());
						box.setCenterPosition();
					});
					box.find('img').attr('src', src);
				}});
				return false;
			})
		})	

		if(opts.leftMove)
		{
			$(opts.leftMove).click(function(){
				moveLeft();
			})
		}

		if(opts.rightMove)
		{
			$(opts.rightMove).click(function(){
				moveRight();
			})
		}

	  	//向左侧移动
	  	moveLeft = function() {
	  		if($this.parent().css("left")=="0px") return;
	  		$this.parent().animate({"left": "+="+opts.stepLength+"px"}, "slow");
	  	};

	  	//向右侧移动
	  	moveRight = function() {
	  		if($this.parent().css("left")=="-"+($this.length-(opts.containSize-1)/2)*100+"px") return;
	  		$this.parent().animate({"left": "-="+opts.stepLength+"px"}, "slow");
	  	};
   	}
})(jQuery)

