function imageBox(){

Object.extend(boxObject,{

	imageBegin:(function(imageLoad){
		this.open();
		this.loading();
		imageLoad = false;
		this.image = new Image();
		this.arrayitize('src', 'title', 'alt',null, 'painting,aspect');
		if(this.array[this.number][2] == 'fill')
			this.imageCheck();
		else
			this.image.onload = (function(){ this.imageStart() }).bind(this);
		this.image.src = this.array[this.number][3]
		}).bind(boxObject),
		
	imageCheck:function(){
		if(this.image.width <= 0) return setTimeout((function(){this.imageCheck()}).bind(this),250);
		this.imageStart();
		},
		
	imageStart:function(){
		this.contentHTML = '<img src='+this.image.src+' />';
		this.contentProtected = true;
		
		this.resize = 'aspect';
			this.resizeMax = [this.image.width, this.image.height];
			this.resizeMin = [500, 500];
			this.resizeAnimate = true;
			
		this.type = this.array[this.number][1];
		this.title = this.array[this.number][0];
		
		this.onLoaded = (function(){ this.handleResize();this.setContent();this.infoParser(this.array[this.number][4])}).bind(this);
		this.onShowControls = (function(){this.info();}).bind(this);
		this.loaded();
		}

 });
boxObject.plugin('IMG', boxObject.imageBegin)
}

document.observe('dom:loaded', function(){ setTimeout(function(){imageBox()},0) })

function aimageBox(){

Object.extend(boxObject,{

	aimageBegin:(function(imageLoad){this.event.stop();
		if(this.element.href.endsWith('.jpeg') || this.element.href.endsWith('.jpg') || this.element.href.endsWith('.png') || this.element.down('img') ) this.imageBegin();
		}).bind(boxObject)

 });
boxObject.plugin('A', boxObject.aimageBegin);
}

document.observe('dom:loaded', function(){ setTimeout(function(){aimageBox()},0) })
