function GalleryController(){

	this.thumbCnt=$("thumb_selector");
	this.imgCnt=$("cnt_images");
	this.selectedIndexIm=null;
	
	this.onLoadComplete=function(){
		this.initializeGallery()
		this.selectImage(11);
	}
	this.initializeGallery=function(){
		var ul=document.createElement("ul");
		ul.id=this.thumbCnt.id+"_ul";
		$("cnt_image").style.width="419px";
		$("cnt_image").style.height="315px";
		for (var i=11;i<=46;i++){
			//lImgs[i].style.display="none";
			//var lImgIn=lImgs[i].getElementsByTagName("img");
			var li=document.createElement("li");
			var a=document.createElement("a");
			a.href="javascript:;";
			Event.observe(a,"click",this.selectItem.bindAsEventListener({pScope:this,pId:i}));
			var img=document.createElement("img");
			
			img.style.width="49px";
			img.style.height="36px";
			
			Event.observe(img,"mouseover",this.hoverItem.bindAsEventListener({pScope:this,pObj:img,pId:i}));
			Event.observe(img,"mouseout",this.unHoverItem.bindAsEventListener({pScope:this,pObj:img,pId:i}));
			
			imPath="../images/gallery/tn_bn/";
			imFileName=i+".jpg"
			img.src=imPath+imFileName;
			img.alt=" ";
			a.appendChild(img);
			li.appendChild(a); 
			ul.appendChild(li);
		}
		this.thumbCnt.appendChild(ul);
	}
	this.selectItem=function(e){
		lScope=this.pScope;
		lId=this.pId;
		lScope.selectImage(lId);
	}
	this.hoverItem=function(e){
		lObj=this.pObj;
		lObj.src=lObj.src.replace("/tn_bn/","/tn/");

	}
	this.unHoverItem=function(e){
		lObj=this.pObj;
		lObj.src=lObj.src.replace("/tn/","/tn_bn/");
	}
	this.selectImage=function(n){
		var imPath="../images/gallery/original/";
		var imFileName=n+".jpg";
		setTimeout("controller.mostrarImagen('"+imPath+imFileName+"')",1);
	}
	
	this.mostrarImagen=function(pStr) {
		$('cnt_image').src=pStr;
	}
	
}

var controller=new GalleryController();
controller.onLoadComplete();