gallery = {
	width: 	0,
	init: 	function() {
					if (document.getElementById('photo-parent')) {
						setInterval('gallery.check()', 1);
						td = document.getElementById('photo-parent').getElementsByTagName('td');
						table = document.getElementById('photo-parent').getElementsByTagName('table');
						count = 0;
						row = false;
					}
				},
	check: 	function() {
					if (document.body.clientWidth != gallery.width) {
						gallery.width = document.body.clientWidth;
						gallery.inline();
					}
				},
	inline: 	function() {
					document.getElementById('photo-parent').style.visibility = 'hidden';

					for (var i = 0; (table.item(i)); i++) td.item(i).style.height = 'auto';
					for (var i = 1; (table.item(i)); i++) if ((row == false) && (table.item(i).offsetTop == table.item(i-1).offsetTop)) count++; else row = true;
					count++;

					for (var i = 0; (td.item(i)); i=i+count) {	
						myHeight = 0;	
						for (var o = 0; (td.item(i+o) && o < count); o++) if (td.item(i+o).offsetHeight > myHeight) myHeight = td.item(i+o).offsetHeight;
						for (var o = 0; (td.item(i+o) && o < count); o++) td.item(i+o).style.height = myHeight + 5 + 'px';
					}
					document.getElementById('photo-parent').style.visibility = 'visible';
				}
}


function init() {
	gallery.init();
}



