// 22.08.2002 - added by Horst Nogajski

		/********************************************************************************
		* Browsercheck
		*   Copyright (C) 2001 http://www.dhtmlcentral/thomas_brattli.asp
		*   This script was released at DHTMLCentral.com
		*   Visit for more great scripts!
		*   This may be used and changed freely as long as this msg is intact!
		*
		*   Modified by Horst Nogajski 2002
		*********************************************************************************/
		function lib_bwcheck() {
		  this.ver=navigator.appVersion;
		  this.agent=navigator.userAgent;
		  this.dom=document.getElementById?1:0;
		  this.opera5=this.agent.indexOf("Opera 5")>-1;
		  this.opera6=this.agent.indexOf("Opera 6")>-1;
		  this.op=this.agent.indexOf("Opera")>-1;
		  this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.op)?1:0;
		  this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.op)?1:0;
		  this.ie4=(document.all && !this.dom && !this.op)?1:0;
		  this.ie=this.ie4||this.ie5||this.ie6;
		  this.mac=this.agent.indexOf("Mac")>-1;
		  this.ns6=(this.dom && parseInt(this.ver) >= 5)?1:0;
		  this.ns4=(document.layers && !this.dom)?1:0;
		  this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.opera6);
		  return this;
		}

	// initialising an Object containing ClientBrowser-Informations
	var bw = new lib_bwcheck();


		/********************************************************************************
		* lib_win()  =  Object containing some Window-Values
		*
		*   Copyright (C) 2002 Horst Nogajski
		*   http://www.nogajski.de/    or   http://horst.nogajski.de/
		*
		*   !! Needs a 'bw'-named instance of lib_bwcheck() !!
		*********************************************************************************/
		function lib_win() {
			var IW=0;	// innerWidth
			var OW=0;	// outerWidth
			var IH=0;	// innerHeight
			var OH=0;	// outerHeight
			var PosX=0;	// WindowPosition_X
			var PosY=0;	// WindowPosition_Y
			if(bw.ns4 || bw.ns6 || bw.op) {
				IW = window.innerWidth;
				IH = window.innerHeight;
				OW = window.outerWidth;
				OH = window.outerHeight;
				PosX = window.screenX;
				PosY = window.screenY;
				if (bw.op) {
					if (PosX <= 0) PosX = 50;
					if (PosY <= 0) PosY = 50;
				}
			}
			if(bw.ie) {
				IW = document.body.clientWidth;
				IH = document.body.clientHeight;
				OW = document.body.offsetWidth;
				OH = document.body.offsetHeight;
				PosX = window.screenLeft;
				PosY = window.screenTop;
			}
			if(bw.ie6 && document.compatMode=="CSS1Compat") {
				IW = document.documentElement.clientWidth;
				IH = document.documentElement.clientHeight;
				OW = document.documentElement.offsetWidth;
				OH = document.documentElement.offsetHeight;
				PosX = window.screenLeft;
				PosY = window.screenTop;
			}
			this.IW = IW;	// innerWidth
			this.OW = OW;	// outerWidth
			this.IH = IH;	// innerHeight
			this.OH = OH;	// outerHeight
			this.X = PosX;	// WindowPosition X
			this.Y = PosY;	// WindowPosition Y
			return this;
		}

		/********************************************************************************
		* getCorrection()	 = function / do it the hard way ;)
		*
		*	 Copyright (C) 2002 Horst Nogajski
		*	 http://www.nogajski.de/	or	 http://horst.nogajski.de/
		*
		*   !! Needs a 'bw'-named instance of lib_bwcheck() !!
		*   !! Needs lib_win() !!
		*   !! Needs store_Cvar_Values() !!
		*********************************************************************************/
		function getCorrection() {
			if(opener.top.safedValues==false) {
				var correction = new lib_win();
				self.resizeTo(correction.IW,correction.IH);
				self.moveTo(correction.X,correction.Y);
				var correction2 = new lib_win();
				opener.top.store_Cvar_Values(correction.IW-correction2.IW,correction.IH-correction2.IH,correction.X-correction2.X,correction.Y-correction2.Y);
				resizeWithTest(correction.IW+(opener.top.child_CW),correction.IH+(opener.top.child_CH));
				self.moveTo(correction.X+(opener.top.child_CX),correction.Y+(opener.top.child_CY));
			}
		}
		
		/***************************************************************************
		* jf added:
		* Call resizeWithTest() instead of resizeTo() if it's not guaranteed that
		* the variables are properly initialized.
		* The current window is only resized if the arguments are actual numbers.
		****************************************************************************/
		function resizeWithTest(X,Y) {
			if (!isNaN(X) & !isNaN(Y)) {
				self.resizeTo(X, Y);
			}
		}
		
		function store_Cvar_Values(W,H,X,Y) {
			// Global variables to store Correctur-Values needed for resizeing and positioning the PopupWindow
			safedValues = true;
			child_CW = W;
			child_CH = H;
			child_CX = X;
			child_CY = Y;
		}

	// sets the Variable to false by event onload of the opener.file
	safedValues=false;


		/********************************************************************************
		* center_It()  =  function centers the popup to screen
		*
		*   Copyright (C) 2002 Horst Nogajski
		*   http://www.nogajski.de/	or	http://horst.nogajski.de/
		*
		*   !! Needs a 'bw'-named instance of lib_bwcheck() !!
		*   !! Needs lib_win() !!
		*********************************************************************************/
		function center_It() {
			var PosX, PosY, scrW, scrH;
			var win = new lib_win();
			scrW = screen.width;
			scrH = screen.height;
			PosX = Math.ceil((scrW / 2) - (win.IW / 2));
			PosY = Math.ceil((scrH / 2) - (win.IH / 2));
			self.moveTo(PosX+(opener.top.child_CX),PosY+(opener.top.child_CY));
		}


		/********************************************************************************
		* place_It()  =  places popup at top-left corner of main window
		*
		*   Copyright (C) 2002 Horst Nogajski
		*   http://www.nogajski.de/	or	http://horst.nogajski.de/
		*
		*   !! Needs a 'bw'-named instance of lib_bwcheck() !!
		*   !! Needs lib_win() !!
		*   !! Needs parent_win() !!
		*********************************************************************************/
		function place_It() {
			// gets the X-Y coords of the opener-top-level-window (= first framesetwindow)
			// needs an include-link in that Document pointing to this JavaScriptfile
			mainwin = opener.top.parent_win();
			self.moveTo(mainwin.X,mainwin.Y);
		}
		function parent_win() {
			mainwin = new lib_win();
			return mainwin;
		}

