/*
*  Der in diesem Dokument vorhandene Quelltext ist geistiges Eigentum der
*  Mediaserve GmbH (www.mediaserve.de) bzw. wurde ausschliesslich fuer die
*  Verwendung in dieser Website lizenziert. Kein Teil davon darf ohne
*  ausdrueckliche und schriftliche Genehmigung der Mediaserve GmbH
*  verbreitet, verarbeitet oder in anderen, fremden Projekten eingesetzt
*  werden.
*/


	// Oeffnet ein Dokument in einem neuen Fenster (PopUp)
	function showWindow(winURL, winName, winBreite, winHoehe, winParam_Center, winParam_Menu, winParam_Toolbar, winParam_Scrollbars) {
		var wndAddon = '';

		if ( (winParam_Center) && (document.all || document.layers) ) {
			var w = screen.availWidth;
			var h = screen.availHeight;

			var leftPos = (w - winBreite) / 2;
			var topPos = (h - winHoehe) / 2;

			var wndAddon = ',top=' + topPos + ', left=' + leftPos
		}

		winParam_Center = (winParam_Center == true) ? 1 : 0 ;
		winParam_Menu = (winParam_Menu == true) ? 1 : 0 ;
		winParam_Toolbar = (winParam_Toolbar == true) ? 1 : 0 ;
		winParam_Scrollbars = (winParam_Scrollbars == true) ? 1 : 0 ;

		var winParam = 'toolbar=' + winParam_Toolbar + ',location=0,directories=0,menubar=' + winParam_Menu + ',scrollbars=' + winParam_Scrollbars + ',status=0,target=_blank,width=' + winBreite + ',height=' + winHoehe + wndAddon;
		var winObj = open(winURL, winName, winParam);
		winObj.focus();
		return winObj;
	}


	// Laedt das angegebene Dokument nach Bestaetigung durch den Benutzer
	function loadDocumentConfirm(url, question) {

		var ret_val = false;


		if ( self.confirm(question) ) {

			if  ( self.parent.frames.length != 0 ) {
				parent.location.href = url;
			}
			else {
				document.location.href = url;
			}

			ret_val = true;

		}


		return ret_val;

	}


	// Laedt das angegebene Dokument
	function loadDocument(url) {
		document.location.href = url;
	}


	// Laedt das angegebene Dokument
	function loadURI(uri) {

		var url = document.location.protocol + '//' + document.location.hostname + document.location.port + uri;
		document.location.href = url;

	}


	// Benutzer fragen (ok/abbruch) u. Resultat zurueckgeben
	function userConfirm(question) {

		if ( window.confirm(question) ) {
			return true;
		}
		else {
			return false;
		}

	}


	// Cursor in Formularfeld positionieren
	function cmsFormSetCursor(form_name, form_field_name) {

		if (
			( form_field_name != '' ) &&
			( document.getElementById(form_field_name) != null )
		) {
			document.getElementById(form_field_name).focus();
		}

	}



	// Do nothing
	function cmsVoid() {
		// ...
	}


	function cmsAddOnLoad(func) {

		var oldonload = window.onload;

		if ( typeof window.onload != 'function' ) {
			window.onload = func;
		}
		else {
			window.onload = function() {
				oldonload();
				func();
			}

		}

	}


	function adjustContentSize(id) {

		var e = document.getElementById(id);
		var NS = ( ! document.all ) ? true : false; 

		var innerWidth = ( NS ) ? window.innerWidth:document.body.clientWidth; 
		var innerHeight = ( NS ) ? window.innerHeight:document.body.clientHeight; 

		innerWidth = e.width - innerWidth; 
		innerHeight = e.height - innerHeight; 

		window.resizeBy(innerWidth, innerHeight); 
		windowCenter();
		self.focus(); 


		return true;

	}


	function windowCenter() {

        var w, h, fixedW, fixedH, diffW, diffH;


        if ( document.documentElement && document.body.clientHeight==0 ) {
        	    // Catches IE6 and FF in DOCMODE
                fixedW = document.documentElement.clientWidth;
                fixedH = document.documentElement.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.documentElement.clientWidth;
                diffH = fixedH - document.documentElement.clientHeight;
                w = fixedW + diffW + 16; // Vert Scrollbar Always On in DOCMODE.
                h = fixedH + diffH;
                if (w >= screen.availWidth) h += 16;
        } else if (document.all) {
                fixedW = document.body.clientWidth;
                fixedH = document.body.clientHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - document.body.clientWidth;
                diffH = fixedH - document.body.clientHeight;
                w = fixedW + diffW;
                h = fixedH + diffH;
                if (h >= screen.availHeight) w += 16;
                if (w >= screen.availWidth)  h += 16;
        } else {
                fixedW = window.innerWidth;
                fixedH = window.innerHeight;
                window.resizeTo(fixedW, fixedH);
                diffW = fixedW - window.innerWidth;
                diffH = fixedH - window.innerHeight;
                w = fixedW + diffW;
                h = fixedH + diffH;
                if (w >= screen.availWidth)  h += 16;
                if (h >= screen.availHeight) w += 16;
        }


        w = Math.min(w,screen.availWidth);
        h = Math.min(h,screen.availHeight);
        window.resizeTo(w,h);
        window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);

	}


	function resizeWindowByPicture() { 

		var arrTemp = self.location.href.split("?");
		var picUrl = ( arrTemp.length > 0 ) ? arrTemp[1] : "";
		var NS = ( navigator.appName == "Netscape" ) ? true : false;

		iWidth = (NS) ? window.innerWidth : document.body.clientWidth; 
		iHeight = (NS) ? window.innerHeight : document.body.clientHeight; 

		iWidth = document.images[0].width - iWidth; 
		iHeight = document.images[0].height - iHeight; 

		window.resizeBy(iWidth, iHeight); 
		self.focus(); 

	}


	function cmsMailDecode(s) {

		var n = 0;
		var r = "";


		for ( var i=0; i < s.length; i++ ) {

			n = s.charCodeAt(i);

			if ( n >= 8364 ) {
				n = 128;
			}

			r += String.fromCharCode(n - 3);

		}


		return r;

	}


	function cmsMailDecodeLink(s) { 

		location.href = cmsMailDecode(s);

	}



