var imageUploader = function(id,processUrl){

	this.refreshList = function(){
		if (!myConn) alert("XMLHTTP not available.");		
		var obj = this;
		myConn.connect(this.processUrl, "GET", "list=1", function(oXML){
			var list = obj.imageList;
			list.innerHTML = oXML.responseText;
			var imgs = list.getElementsByTagName('img');
			for(var i=0;i<imgs.length;i++){
				imgs[i].alt = 'Click To Select';
				imgs[i].onclick = function(){
					obj.onImageClick(this);
				};
			}
		});
	};
	
	this.onImageClick = function(img){
		alert(img.src+' selected');
	};
	
	this.showHide = function(){
		this.container.style.display = (this.container.style.display == 'none' ? '' : 'none');
	};
	
	this.processUrl = processUrl || 'process.php';

	alert('load image uploader');
	this.container = document.getElementById(id);
	this.formFrame = getElementsByClass('formContainer',this.container,'iframe')[0];
	this.formFrame.src = this.processUrl;
	this.imageList = getElementsByClass('imageImportList',this.container,'div')[0];
}