var DDAjaxUpdater = {

	// Absoluter Pfad auf das Dir php von Root aus
	filePath: 'fileadmin/lib/php/',
	tt: null,
	
	init: function() {
		if ($('PF')) {
			new Draggable('PF',{handle:'PFH'});
			$('PFCloseIcon').onclick = function() {
				$('PF').setStyle({display: 'none'});
			};
			new Ajax.Autocompleter('KW', 'KWChoices', this.filePath + 'get_kw_by_strg.php', {
				minChars: 1,
				paramName: 'KW',
				indicator: 'Indicator'
			});
		}

		if ($('popUp')) {
			$('popUp').setStyle({opacity: 0.95});
			new Draggable('popUp',{handle:'pUH'});
			$('pUCloseIcon').onclick = function() {
				$('popUp').setStyle({display: 'none'});
			};
		}
	},
	
	PFShow: function () {
		Effect.toggle('PF', 'appear', {
			afterFinish: function () {
				if ($('popUp')) {
					Effect.Fade('popUp');
				}
			}
		});
	},

	DShow: function (mID) {
		obj = $('mieterDetailsWrapper');
		$(obj).setStyle({display: 'none'});
		new Ajax.Updater(obj, this.filePath + 'get_mieter_plan_detail_by_id.php', {
			method: 'get',
			parameters: {mID: mID},
			onComplete: function () {
				Effect.Appear('mieterDetailsWrapper');
				//showTT($('TT'));
			}
		});
	},

	DHide: function () {
		$('mieterDetailsWrapper').update('<em>Hinweis: Bitte bewegen sie die Maus über den Etagenplan für Informationen zu einer Fläche. Bitte klicken Sie auf eine Fläche für Detailinformationen.</em>');
	}

}

tt = null;

function updateTT(e) {
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	if (tt != null) {
		tt.style.left = (x + 5) + "px";
		tt.style.top 	= (y + 5) + "px";
	}
}

function showTT(obj) {
	//alert(obj.parentNode.getElementsByTagName('DIV')[0].className);
	tt = obj;
	tt.style.display = "block";
}

function hideTT() {
	tt.style.display = "none";
	tt = null;
}

