function LGalleryFrame(id, dir, title, width, height){
	this.id = id;
	this.frame = document.createElement('div');
	this.frame.style.display  = "none";
	this.frame.style.width = width+"px";
	this.frame.style.height = height+"px";
	this.dir = dir;
	this.drawed = false
	this.title = title;
	this.imageHolders = new Array();
	
	this.setController = function(aController) {
		this.controller = aController;
	}
	
	this.getWidth = function() {
		return parseInt(this.frame.style.width.substr(0,this.frame.style.width.length-2));
	}
	
	this.getHeight = function() {
		return parseInt(this.frame.style.height.substr(0,this.frame.style.height.length-2));
	}
	
	this.setBackGroundColor = function (color) {
		this.frame.style.backgroundColor = color;
	}
	
	this.controller = new LGHorisontalDragScrollController(this);
	
	//képeklista betöltése
	this.XMLHttpObj = GetXmlHttpObject();
	
	this.imageListResponsed = function(){
		if (this.XMLHttpObj.readyState==4 || this.XMLHttpObj.readyState=="complete"){ 
			if (this.XMLHttpObj.responseText!=''){
				var fileNames = new Array();
				fileNames = this.XMLHttpObj.responseText.split('\n');
				for (n=0;n<fileNames.length-1;n++){
					this.imageHolders.push(new LGImageHolder(fileNames[n],this,getIHName(fileNames[n]), this.dir+"/scroll/"+fileNames[n], "LGBigPicViewer.openImage('"+this.dir+"/portre/"+fileNames[n]+"');" ));
				}
				this.controller.start();
			}
			this.imageHolders.length;
		}
	}
	var _this = this;
	this.XMLHttpObj.onreadystatechange = function() {_this.imageListResponsed()};
	
	this.reLoadImageList = function() {
		var url=this.dir+'/scroll/imgList.php';
		url=url+"?sid="+Math.random();
		this.XMLHttpObj.open('POST',url);
		this.XMLHttpObj.send(null);
	}
	
	//inicializálás közben betőltődik
	
	this.setAllImageHolderInactive = function(){
		for(n=0;n<this.imageHolders.length;n++){
			this.imageHolders[n].active = false;
		}
	}
	
	_this = this;
	document.onmouseup = function (event){
		_this.setAllImageHolderInactive();
		_this.controller.freeRunStart(event);
	}
	
	this.open = function(){
		this.reLoadImageList();
		this.frame.style.display = "block";
		document.getElementById(id).appendChild(this.frame);
	}
	
	this.close = function(){
		this.frame.style.display = "none";
	}
}
