/***********************************************************
 *                                                         *
 * Projekt:             Objektorientierte Programmierung   *
 *                      um browserunabhängige Javascripte  *
 *                      einfach einsetzen zu können.       *
 *                                                         *
 * Datum beginn:        2003-09-29                         *
 * Datum Änderung:      2003-09-29                         *
 *                                                         *
 * Version:             0.0                                *
 *                                                         *
 * Beschreibung:        Ermittelt die Mausposition         *
 *                      innerhlab des Dokuments.           *
 *                                                         *
 ***********************************************************/

function MausPos() {

	// Objekt Eigenschaften, öffentlich.
	
	// Statische Eigenschaften, öffentlich.
	MausPos.browser           = new Browser();
	MausPos.x                 = 0;
	MausPos.y                 = 0;

	// Objekt Eigenschaften, privat.
	MausPos.funktion         = "";

	// Statische Eigenschaften, privat.

	// Objekt Methoden, öffentlich.

	// Statische Methoden, öffentlich.
	MausPos.toString          =	function() {

									var derString = "Ermittelt die aktuelle Mausposition.\n\n";
									derString    += "Objekt Eigenschaften: keine\n\n";
									derString    += "Statische Eigenschaften:\n";
									derString    += "object\tMausPos.browser:\t(new Browser())\n";
									derString    += "int\tMausPos.x\n";
									derString    += "int\tMausPos.y\n\n";
									derString    += "Objekt Methoden: keine\n\n";
									derString    += "Statische Methoden:\n";
									derString    += "string\tMausPos.toString(void)";

									return derString;
							    }


	// Objekt Methoden, privat.

	// Statische Methoden, privat.
	MausPos._bewegungsMelder  =	function(e) {

									if(MausPos.browser.ie 
									   &&
									   parseInt(MausPos.browser.version) > 4
									   &&
									   parseInt(MausPos.browser.version) < 6) { MausPos.x = event.x + document.body.scrollLeft; MausPos.y = event.y + document.body.scrollTop; }
									else if(MausPos.browser.ie) { MausPos.x = event.x;   MausPos.y = event.y; } 
									else if(MausPos.browser.ns || MausPos.browser.mo) { MausPos.x = e.pageX;   MausPos.y = e.pageY; }
									else if(MausPos.browser.op) { MausPos.x = e.clientX; MausPos.y = e.clientY; }

									// Die Funktion soll bei jeder Änderung der Mausposition aufgerufen werden,
									// ihr werden die beiden Parameter für die x- und y-Position übergeben.
									if(MausPos.funktion) {

										eval(MausPos.funktion + '(MausPos.x , MausPos.y);');
									}
								}

	// Konstruktor.
	if(MausPos.browser.ie) {
	
		document.onmousemove = MausPos._bewegungsMelder;
	}	
	else if(MausPos.browser.ns && parseInt(MausPos.browser.version) < 6) {

		document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove = MausPos._bewegungsMelder;
	}
	else if(MausPos.browser.ns && parseInt(MausPos.browser.version) >= 6) {

		document.addEventListener("mousemove", MausPos._bewegungsMelder, true);
	}
	else if(MausPos.browser.mo) {
		
		document.addEventListener("mousemove", MausPos._bewegungsMelder, true);
	}
	else if(MausPos.browser.op) {

		document.onmousemove = MausPos._bewegungsMelder;
	}
}
