function gallery(out,a,m,s){
	if(document.getElementById){
		this.out=out;
		this.links=a;
		a=this.links.getElementsByTagName('a');
		var c=0;
		this.c=false;
		this.seq='';
		this.i=[];
		this.h=false;
		this.nh=false;
		this.fliph=false;
		this.ind=0;
		if(a){
			var r=false,rx=/=(\d*)/,o=this;
			for(x=0,ct=a.length;x<ct;x++){
				r=rx.exec(a[x].href);
				a[x]._i=r[1];
				a[x].onclick=function(){
					return o.show(this,0);
				}
				this.i[x]=r[1];
				this.seq+=r[1]+',';
				if(a[x].className=='c'){
					c=r[1];
					this.c=a[x];
				}
			}
		}
		this.loading=!s;
		this.region=new region(this.out,'i'+c,64,m);
		this.flashing=s;
		this.links.style.display=(s?'none':'block');
		if(this.flashing){
			var obj=this;
			this.nh=setTimeout(function(){
				obj.nh=false;
				if(obj.flashing){
					obj.shownext();
				}
			},600);
		}
	}
}
gallery.prototype={
showtext:function(t){
	var n=this.region.getnext(false,false);
	this.seq='';
	if(n){
		n.innerHTML=t;
		this.region.flip();
	}
	this.links.style.display='none';
},
show:function(e,t){
	var n=this.region.getnext('i'+e._i,this.loading);
	if(n){
		var obj=this;
		if(this.c){
			this.c.className='';
		}
		this.c=e;
		if(typeof(e.blur)!='undefined'){
			e.blur();
			this.c.className='c';
		}
		while(n.childNodes[0]){
			n.removeChild(n.childNodes[0]);
		}
		var img=new Image();
		n.appendChild(img);
		if(typeof(img.complete)!='undefined'){
			this.region.ct=t>0?0:1;
			if(t>0){
				this.fliph=setTimeout(function(){
					obj.fliph=false;
					obj.region.ct++;
					if(obj.region.ct==2&&obj.flashing) {
						obj.region.flip();
						obj.nh=setTimeout(function(){
							obj.nh=false;
							if(obj.flashing){
								obj.shownext();
							}
						},600);
					}
				},t);
			}
			img.onload=function(){
				obj.region.ct++;
				if(obj.region.ct==2) {
					obj.region.flip();
					if(obj.flashing) {
						obj.nh=setTimeout(function(){
							obj.nh=false;
							if(obj.flashing){
								obj.shownext();
							}
						},600);
					}
				}
			}
			img.src='/ll.nb?id='+e._i;
		}else{
			img.src='/ll.nb?id='+e._i;
			this.fliph=setTimeout(function(){
				obj.fliph=false;
				n.flip();
				if(obj.flashing) {
					obj.nh=setTimeout(function(){
						obj.nh=false;
						if(obj.flashing){
							obj.shownext();
						}
					},600);
				}
			},t);
		}
	}
	return false;
},
shownext:function(){
	this.ind++;
	if(this.ind>=this.i.length){
		this.ind=0;
	}
	var pseu=new Object();
	pseu._i=this.i[this.ind];
	this.show(pseu,4000);
},
loadimages:function(i){
	var x,ct,seq='';
	for(x=0,ct=i.length;x<ct;x++){
		seq+=i[x]+',';
	}
	this.i=i;
	if(seq=='' || seq!=this.seq){
		if(this.nh) clearTimeout(this.nh);
		if(this.fliph) clearTimeout(this.fliph);
		this.seq=seq;
		while(this.links.childNodes[0]){
			this.links.removeChild(this.links.childNodes[0]);
		}
		ct=i.length;
		this.c=false;
		var o=this;
		if(ct>1){
			var a,s;
			this.links.appendChild(document.createTextNode('gallery '));
			s=document.createElement('span');
			this.ind=0;
			for(x=0;x<ct;x++){
				a=document.createElement('a');
				a.appendChild(document.createTextNode(x+1));
				a.href='#';
				a._i=i[x];
				a.onclick=function(){
					return o.show(this,0);
				}
				if(x==0){
					this.show(a,0);
					a.className='c';
					this.c=a;
				}else{
					s.appendChild(document.createTextNode(' · '));//u+b7&#183;
				}
				s.appendChild(a);
			}
			this.links.appendChild(s);
		}else{
			var c=0;
			if(ct==1){
				c=i[0];
			}
			var n=this.region.getnext(c>0?'i'+c:false,true);
			if(n){
				while(n.childNodes[0]){
					n.removeChild(n.childNodes[0]);
				}
				if(c){
					var img=new Image();
					n.appendChild(img);
					if(typeof(img.complete)!='undefined'){
						img.onload=function(){
							o.region.flip();
						}
						img.src='/ll.nb?id='+c;
					}else{
						img.src='/ll.nb?id='+c;
						n.flip();
					}
				}else{
					this.region.flip();
				}
			}
		}
	}
},
flash:function(s){
	this.flashing=s;
	this.links.style.display=(s?'none':'block');
	this.loading=!s;
}
}
