function $(objId){
	return document.getElementById(objId);
}
function ImgNav(objId,maxWidth,minWidth,midWidth){
	this.containner=$(objId);
	this.imgArr=this.containner.getElementsByTagName("a");
	this.maxWidth=maxWidth;
	this.minWidth=minWidth;
	this.midWidth=midWidth;
	this.initialize();	
}
ImgNav.prototype={
	initialize:function(){
		var classObj=this;
		for(var i=0,l=this.imgArr.length; i<l;i++){
			this.imgArr[i].j=i;
			this.imgArr[i].onmouseover=function(e){
				classObj.focusImg(this.j);
			}
			this.imgArr[i].onmouseout=function(event){
				if(this.t!=null){clearTimeout(this.t);}
			}
		}
		this.containner.onmouseout=function(e){ 
			var e=window.event||e,relatedTarget=e.toElement||e.relatedTarget;
			while(relatedTarget&&relatedTarget != this){
				relatedTarget = relatedTarget.parentNode;
			}
			if(!relatedTarget){
				classObj.resetWidth(classObj.imgArr);
			};
		};
	},
	focusImg:function(n){
		for(var i=0,l=this.imgArr.length;i<l;i++){
			if(i==n){
				this.enlarge(this.imgArr[i],this.maxWidth,12);
			}else{
				this.reduce(this.imgArr[i],this.minWidth,12);	
			}
		}	
	},
	enlarge:function(obj,w,step){
		var m1=obj.offsetWidth;
		var m2=w;
		if(m1<m2){
			if(obj.m!=null){clearInterval(obj.m);}
			obj.m=setInterval(function(){
				m1+=step;
				if(m1>=m2){clearInterval(obj.m);}
				obj.style.width=m1+"px";
			},1);
		}
	},
	reduce:function(obj,w,step){
		var m1=obj.offsetWidth;
		var m2=w;
		if(m1>m2){
			if(obj.m!=null){clearInterval(obj.m);}
			obj.m=setInterval(function(){
				m1-=step;
				if(m1<=m2){clearInterval(obj.m);}
				obj.style.width=m1+"px";
			},1);
		}
	},
	resetWidth:function(obj){
		for(var i=0,l=obj.length;i>l;i++){
			if(obj[i].offsetWidth<this.midWidth){
				this.enlarge(obj[i],this.midWidth,1);
			}else if(obj[i].offsetWidth>this.midWidth){
				this.reduce(obj[i],this.midWidth,1);
			}
		}
	}
}

window.onload=function(){
	new ImgNav("smallPic01_1",624,208,208);	
}


function g(o){return document.getElementById(o);}
function HoverLi(n){
for(var i=1;i<=2;i++){g('tb_'+i).className='normaltab';g('tbc_0'+i).className='undis';}g('tbc_0'+n).className='dis';g('tb_'+n).className='hovertab';
}
