// photo.js

window.currentImages = new Array();

var myimage;

function clearallimg() {
	var i;
	for( i in window.currentImages ) {
		window.currentImages[i].destroy();
	}
}

function destroy() {
	$(this.img).remove();
	$(this.frame_div).remove();
	$(this.frame_td).remove();
	$(this.spacer_div).remove();
	$(this.spacer_td).remove();
}

function addimg() {
	$(this.spacer_td).append( this.spacer_div );
	$('#mainrow').append( this.spacer_td );

	$(this.a).append( this.img );
	$(this.frame_div).append( this.a );
	$(this.frame_td).append( this.frame_div );
	$('#mainrow').append( this.frame_td );

	window.currentImages.push( this );
}

function photobox( id, name, src, src2, width, height ) {
	this.id = id;
	this.spacer_td = document.createElement( 'td' );

	this.spacer_div = document.createElement( 'div' );
	$(this.spacer_div).css('width','20px');
	$(this.spacer_div).html('&nbsp;');

	this.frame_td = document.createElement( 'td' );

	this.frame_div = document.createElement( 'div' );
	$(this.frame_div).attr('class','frame');

	this.img = document.createElement( 'img' );
	$(this.img).attr('src',src);
	$(this.img).attr('alt',name);
	$(this.img).attr('width',width);
	$(this.img).attr('height',height);

	this.a = document.createElement( 'a' );
	$(this.a).attr('href',src2);
	$(this.a).attr('title',name);
	$(this.a).attr('target','_blank');
	//$(this.a).click( function() { return false; } );

	this.add = addimg;
	this.destroy = destroy;
}

