function ScrollImg(container,bigContainer)
	{
		_me=this;
		this.ge=function(o)
		{
			 return typeof(o)!="string"?o:document.getElementById(o);
		}
		this.container=this.ge(container);
		this.bigContainer=this.ge(bigContainer);
		this.imgList=[];
		this.spanClass='';
		this.selectedSpanClass='';
		this.pageIndex=1;
		this.pageSize=7;
		this.totalPage=1;
		this.currentPageIndex=1;
		this.selectedImgID='';

		this.bnt1;
		this.bnt2;

		this.init=function(n)
		{
			this.selectedImgID=n;
			var index=0;
			for(var i=0;i<this.imgList.length;i++)
			{
				var tmp=this.imgList[i];
				if(tmp.id==n)
				{
					index=i;
					
					var next=this.bigContainer.getElementsByTagName("img");
					
				    if(i!=this.imgList.length-1)
				    {
                        var nextIndex=i+1;
                        if(next.length>0)
                        {
                            next[0].onclick=this.imgClick(nextIndex);
                            next[0].style.cursor="pointer";
                        }
                        this.bigContainer.onclick=this.imgClick(nextIndex);
                        this.bigContainer.style.cursor="pointer";
				    }
					
					break;
				}
			}
			var pageIndex=Math.floor(index/this.pageSize);
			pageIndex+=1;

			this.totalPage=Math.floor((this.imgList.length+this.pageSize-1)/this.pageSize);
			if(this.totalPage==0)this.totalPage=1;	
			
			this.goPage(pageIndex);
		}

		this.goPage=function(index)
		{
			if(index<1 || index>this.totalPage)
				return;

			while(this.container.firstChild)
				this.container.removeChild(this.container.firstChild);

			this.currentPageIndex=index;
			var lowerBoundIndex=0,upperBoundIndex=0;
			lowerBoundIndex=this.pageSize*(this.currentPageIndex-1);
			upperBoundIndex=lowerBoundIndex+this.pageSize;
			for(var i=lowerBoundIndex;i<upperBoundIndex;i++)
			{
				if(i>=this.imgList.length)break;
				var tmp=this.imgList[i];
				var node=this.createNode(tmp);
				if(tmp.id==this.selectedImgID)
					node.className=this.selectedSpanClass;
				node.firstChild.onclick=this.imgClick(i);
				node.onclick=this.imgClick(i);
				this.container.appendChild(node);
			}
		}
		
		this.imgClick=function(i)
		{
		    return function()
		    {
		        location=_me.imgList[i].bigSrc;
		    }
		}
		
		this.previousPage=function()
		{
			var pIndex=this.currentPageIndex-1;
			this.goPage(pIndex);
		}

		this.nextPage=function()
		{
			var pIndex=this.currentPageIndex+1;
			this.goPage(pIndex);
		}

		this.createNode=function(info)
		{
			var span=document.createElement("span");
			span.className=this.spanClass;
			span.style.cursor="pointer";
			img=document.createElement("img");
			img.id=info.id;
			img.src=info.miniSrc;
			img.style.cursor="pointer";
			span.appendChild(img);

			return span;
		}

		this.bindButton=function(pre,next)
		{
			this.bnt1=this.ge(pre);
			this.bnt2=this.ge(next);
			if(this.bnt1 && this.bnt2)
			{
				this.bnt1.onclick=function(){_me.previousPage()};
				this.bnt2.onclick=function(){_me.nextPage()};
			}
		}
	}