var Main = Class.create({
	initialize: function () {},
	
	/**
	 * Richtet das Login-Panel aus
	 */
	alignLoginPanel: function () {
		var login_table = $('login_table');
		var ids         = [
			'info_td',
			'lookup_td',
			'project_td',
			'partners_td',
			'eastin_td'
		];
		var td = null;
		
		ids.each(function (id) {
			if (null != $(id) && undefined != $(id)) {
				td = $(id);
			}
		});
		
		if (null != td) {
			
			/**
			 * Das Login-Panel steht "außen vor", wird also bei der Darstellung
			 * der enthaltenden Tabellenspalte nicht berücksichtigt. Sind die In-
			 * halte der enthaltenden Tabellenspalte allerdings so zahlreicht, dass
			 * deren Gesamthöhe so hoch ist, dass sie das Login-Panel nicht mehr
			 * aufnehmen können, würde dieses überhalb der sonstigen Inhalte ange-
			 * zeigt.
			 *
			 * Deshalb wird hier berechnet, ob das Login-Panel überhaupt noch in
			 * die enthaltende Tabellenspalte passen würde. Wenn nein, wird die Hö-
			 * he der Spalte so weit erhöht, dass das Login-Panel wieder hinein-
			 * passt.
			 */
			if ((td.getHeight() - $(td.id + '_table').getHeight() - 20) <= login_table.getHeight()) {
				td.setStyle({
					height : (td.getHeight() + (login_table.getHeight() - (td.getHeight() - $(td.id + '_table').getHeight())) + 30) + 'px'
				});
			}
			
			var marginTop   = td.getHeight()
								 - login_table.getHeight()
								 - $(td.id + '_table').getHeight()
								 - 10;
			
			var marginLeft = (td.getWidth() - login_table.getWidth()) / 2;
			
			login_table.setStyle({
				'marginLeft' : marginLeft + 'px',
				'marginTop'  : marginTop + 'px'
			});
			
			login_table.appear({
				duration : 0//0.25
			});
		}
	}
});
var main = new Main;

window.onload = function () {
	
	main.alignLoginPanel();
	
}
