// ΓΐΛΕΠΕί
gallery = {
	width: 	0,
	init: 	function() {
					if (document.getElementById('photo-parent')) {
						setInterval('gallery.check()', 1);
						th = document.getElementById('photo-parent').getElementsByTagName('th');
						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++) th.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; (th.item(i)); i=i+count) {	
						myHeight = 0;	
						tdHeight = 0;
						for (var o = 0; (th.item(i+o) && o < count); o++) {
							if (th.item(i+o).offsetHeight > myHeight) { myHeight = th.item(i+o).offsetHeight; }
							if (td.item(i+o).offsetHeight > tdHeight) { tdHeight = td.item(i+o).offsetHeight; }
						}
						for (var o = 0; (th.item(i+o) && o < count); o++) {
							th.item(i+o).style.height = myHeight + 3 + 'px';
							td.item(i+o).style.height = tdHeight + 3 + 'px';
						}
					}
					document.getElementById('photo-parent').style.visibility = 'visible';
				}
}

function init() { gallery.init(); }

if (document.loaded) init();

