// #############################################################################
//  FUNCTION DEFINITIONS
// #############################################################################


	function BrowserDetect() {
		if (navigator.userAgent.match(/Mozilla.*compatible.*MSIE/i)) {
			var s = navigator.userAgent.replace(/^.*MSIE ?/i,'');
			BrowserName = "msie";
		} else {
			var s = navigator.userAgent.replace(/^[^0-9]*/,'');
			BrowserName = navigator.userAgent.replace(/\/.*$/i,'').toLowerCase();
		}
		BrowserVersion = parseFloat(s);
		if ( (BrowserName == "msie") && (BrowserVersion < 6)) {
			BoxModelBug = true;
		} else {
			BoxModelBug = false;
		}
		msie4 = false;
		if ( (BrowserName == "msie") && (BrowserVersion >= 4) ) {
			msie4 = true;
		}
		if ((BrowserName == "netscape" && BrowserVersion >= 3) || msie4 || BrowserName=="konqueror") {version = "n3";} else {version = "n2";}
	}

	BrowserDetect();

	function blurLinks() {
		if ( (BrowserName == "msie") && (BrowserVersion >= 5) ) {
			var aTags = document.getElementsByTagName("a");
			for (var i = 0; i < aTags.length; ++i) {
				aTags[i].blur();
			}
		}
	}

// #############################################################################
//  TYPO3 STANDARD FUNCTIONS
// #############################################################################


	function openPic(url,winName,winParams)	{
		var theWindow = window.open(url,winName,winParams);
		if (theWindow)	{theWindow.focus();}
	}


	function blurLink(theObject) {
		if (msie4) {theObject.blur();}
	}
	
	function UnCryptMailtoOld(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-(1));
		}
		return r;
	}
	
        function UnCryptMailto(s) {
                var n=0;
                var r="";
                var c;
                for(var i=0; i < s.length; i++) {
                        n=s.charCodeAt(i);
                        if (n>=8364) {n = 128;}
                        c = String.fromCharCode(n-(1));
                        if (c=="*") {
                                r += ":";
                        } else {
                                r += String.fromCharCode(n-(1));
                        }
                }
                return r;
        }


	function linkTo_UnCryptMailto(s) {
		location.href=UnCryptMailto(s);
	}

	function over(name,imgObj) {
		if (version == "n3" && document[name]) {document[name].src = eval(name+"_h.src");}
		else if (imgObj){imgObj.src = eval(name+"_h.src");}
	}

	function out(name,imgObj){
		if (version == "n3" && document[name]) {document[name].src = eval(name+"_n.src");}
		else if (imgObj){imgObj.src = eval(name+"_n.src");}
	}


// #############################################################################
//  WINDOW RESIZE (openPic) FUNCTION
// #############################################################################

	function resizeAvailTo(x,y) {
		/*if (navigator.appName.indexOf("Internet Explorer") != -1) {
			var dx = window.outerWidth - document.body.offsetWidth;
			var dy = window.outerHeight - document.body.offsetHeight;
		} else {
			var dx = window.outerWidth - window.innerWidth;
			var dy = window.outerHeight - window.innerHeight;
		}*/
		var dx = 30;
		var dy = 60;
		var tox;
		var toy;
		if ((x+dx) > screen.availWidth) {tox = screen.availWidth;} else {tox = x + dx};
		if ((y+dy) > screen.availHeight) {toy = screen.availHeight;} else {toy = y + dy};
		window.resizeTo(tox,toy);
		window.moveTo( Math.round((screen.availWidth - tox)/2) , Math.round((screen.availHeight - toy)/2) );
		//window.alert(x + '/' + dx + '/' + tox);
	}
	

// #############################################################################
//  BODY onLOAD / onUNLOAD
// #############################################################################

	DoPageInitExt = false;
	function PageInitStd() {
		blurLinks();
		if (DoPageInitExt) {PageInitExt();}
	}

	DoPageExitExt = false;
	function PageExitStd() {
		blurLinks();
		if (DoPageExitExt) {PageExitExt();}
	}


