function constExpression(x) {
   return x;
}

function simplifyCSSExpression() {
   try {
      var ss,sl, rs, rl;
      ss = document.styleSheets;
      sl = ss.length;

      for (var i = 0; i < sl; i++) {
         simplifyCSSBlock(ss[i]);
      }
   }
   catch (exc) {
      // alert("Got an error while processing css. The page should still work but might be a bit slower");
      //throw exc;
   }
}

function simplifyCSSBlock(ss) {
   var rs, rl;

   for (var i = 0; i < ss.imports.length; i++)
      simplifyCSSBlock(ss.imports[i]);

   if (ss.cssText.indexOf("expression(constExpression(") == -1)
      return;

   rs = ss.rules;
   rl = rs.length;
   for (var j = 0; j < rl; j++)
      simplifyCSSRule(rs[j]);

}

function simplifyCSSRule(r) {
   var str = r.style.cssText;
   var str2 = str;
   var lastStr;
   do {
      lastStr = str2;
      str2 = simplifyCSSRuleHelper(lastStr);
   } while (str2 != lastStr)

   if (str2 != str)
      r.style.cssText = str2;
}

function simplifyCSSRuleHelper(str) {
   var i, i2;
   i = str.indexOf("expression(constExpression(");
   if (i == -1) return str;
   i2 = str.indexOf("))", i);
   var hd = str.substring(0, i);
   var tl = str.substring(i2 + 2);
   var exp = str.substring(i + 27, i2);
   var val = eval(exp)
   return hd + val + tl;
}

if (/msie/i.test(navigator.userAgent) && window.attachEvent != null) {
   window.attachEvent("onload", function () {
      simplifyCSSExpression();
   });
}
//<script>
/*
 * This script was created by Erik Arvidsson (erik@eae.net)
 * for WebFX (http://webfx.eae.net)
 * Copyright 2001
 * 
 * For usage see license at http://webfx.eae.net/license.html	
 *
 * Created:		2001-01-12
 * Updates:		2001-11-20	Added hover mode support and removed Opera focus hacks
 *				2001-12-20	Added auto positioning and some properties to support this
 *				2002-08-13	toString used ' for attributes. Changed to " to allow in args
 */
 
// check browsers
var ua = navigator.userAgent;
var opera = /opera [56789]|opera\/[56789]/i.test(ua);
var ie = !opera && /MSIE/.test(ua);
var ie50 = ie && /MSIE 5\.[01234]/.test(ua);
var ie6 = ie && /MSIE [6789]/.test(ua);
var ieBox = ie && (document.compatMode == null || document.compatMode != "CSS1Compat");
var moz = !opera && /gecko/i.test(ua);
var nn6 = !opera && /netscape.*6\./i.test(ua);
// define the default values
webfxMenuDefaultWidth			= 120;

webfxMenuDefaultBorderLeft		= 1;
webfxMenuDefaultBorderRight		= 1;
webfxMenuDefaultBorderTop		= 1;
webfxMenuDefaultBorderBottom	= 1;
webfxMenuDefaultPaddingLeft		= 1;
webfxMenuDefaultPaddingRight	= 1;
webfxMenuDefaultPaddingTop		= 1;
webfxMenuDefaultPaddingBottom	= 1;

webfxMenuDefaultShadowLeft		= 0;
webfxMenuDefaultShadowRight		= ie && !ie50 && /win32/i.test(navigator.platform) ? 4 :0;
webfxMenuDefaultShadowTop		= 0;
webfxMenuDefaultShadowBottom	= ie && !ie50 && /win32/i.test(navigator.platform) ? 4 : 0;

webfxMenuItemDefaultHeight		= 18;
webfxMenuItemDefaultText		= "Untitled";
webfxMenuItemDefaultHref		= "javascript:void(0)";

webfxMenuSeparatorDefaultHeight	= 6;

webfxMenuDefaultEmptyText		= "Empty";

webfxMenuDefaultUseAutoPosition	= nn6 ? false : true;

// other global constants
webfxMenuImagePath				= "";

webfxMenuUseHover				= opera ? true : false;
webfxMenuHideTime				= 500;
webfxMenuShowTime				= 200;

var webFXMenuHandler = {
	idCounter		:	0,
	idPrefix		:	"webfx-menu-object-",
	all				:	{},
	getId			:	function () { return this.idPrefix + this.idCounter++; },
	overMenuItem	:	function (oItem) {
		if (this.showTimeout != null)
			window.clearTimeout(this.showTimeout);
		if (this.hideTimeout != null)
			window.clearTimeout(this.hideTimeout);
		var jsItem = this.all[oItem.id];
		if (webfxMenuShowTime <= 0)
			this._over(jsItem);
		else
			//this.showTimeout = window.setTimeout(function () { webFXMenuHandler._over(jsItem) ; }, webfxMenuShowTime);
			// I hate IE5.0 because the piece of shit crashes when using setTimeout with a function object
			this.showTimeout = window.setTimeout("webFXMenuHandler._over(webFXMenuHandler.all['" + jsItem.id + "'])", webfxMenuShowTime);
	},
	outMenuItem	:	function (oItem) {
		if (this.showTimeout != null)
			window.clearTimeout(this.showTimeout);
		if (this.hideTimeout != null)
			window.clearTimeout(this.hideTimeout);
		var jsItem = this.all[oItem.id];
		if (webfxMenuHideTime <= 0)
			this._out(jsItem);
		else
			//this.hideTimeout = window.setTimeout(function () { webFXMenuHandler._out(jsItem) ; }, webfxMenuHideTime);
			this.hideTimeout = window.setTimeout("webFXMenuHandler._out(webFXMenuHandler.all['" + jsItem.id + "'])", webfxMenuHideTime);
	},
	blurMenu		:	function (oMenuItem) {
		window.setTimeout("webFXMenuHandler.all[\"" + oMenuItem.id + "\"].subMenu.hide();", webfxMenuHideTime);
	},
	_over	:	function (jsItem) {
		if (jsItem.subMenu) {
			jsItem.parentMenu.hideAllSubs();
			jsItem.subMenu.show();
		}
		else
			jsItem.parentMenu.hideAllSubs();
	},
	_out	:	function (jsItem) {
		// find top most menu
		var root = jsItem;
		var m;
		if (root instanceof WebFXMenuButton)
			m = root.subMenu;
		else {
			m = jsItem.parentMenu;
			while (m.parentMenu != null && !(m.parentMenu instanceof WebFXMenuBar))
				m = m.parentMenu;
		}
		if (m != null)	
			m.hide();	
	},
	hideMenu	:	function (menu) {
		if (this.showTimeout != null)
			window.clearTimeout(this.showTimeout);
		if (this.hideTimeout != null)
			window.clearTimeout(this.hideTimeout);

		this.hideTimeout = window.setTimeout("webFXMenuHandler.all['" + menu.id + "'].hide()", webfxMenuHideTime);
	},
	showMenu	:	function (menu, src, dir) {
		if (this.showTimeout != null)
			window.clearTimeout(this.showTimeout);
		if (this.hideTimeout != null)
			window.clearTimeout(this.hideTimeout);
		if (arguments.length < 3)
			dir = "vertical";
		
		menu.show(src, dir);
	}
};

function WebFXMenu() {
	this._menuItems	= [];
	this._subMenus	= [];
	this.id			= webFXMenuHandler.getId();
	this.top		= 0;
	this.left		= 0;
	this.shown		= false;
	this.parentMenu	= null;
	webFXMenuHandler.all[this.id] = this;
}

WebFXMenu.prototype.width			= webfxMenuDefaultWidth;
WebFXMenu.prototype.emptyText		= webfxMenuDefaultEmptyText;
WebFXMenu.prototype.useAutoPosition	= webfxMenuDefaultUseAutoPosition;

WebFXMenu.prototype.borderLeft		= webfxMenuDefaultBorderLeft;
WebFXMenu.prototype.borderRight		= webfxMenuDefaultBorderRight;
WebFXMenu.prototype.borderTop		= webfxMenuDefaultBorderTop;
WebFXMenu.prototype.borderBottom	= webfxMenuDefaultBorderBottom;

WebFXMenu.prototype.paddingLeft		= webfxMenuDefaultPaddingLeft;
WebFXMenu.prototype.paddingRight	= webfxMenuDefaultPaddingRight;
WebFXMenu.prototype.paddingTop		= webfxMenuDefaultPaddingTop;
WebFXMenu.prototype.paddingBottom	= webfxMenuDefaultPaddingBottom;

WebFXMenu.prototype.shadowLeft		= webfxMenuDefaultShadowLeft;
WebFXMenu.prototype.shadowRight		= webfxMenuDefaultShadowRight;
WebFXMenu.prototype.shadowTop		= webfxMenuDefaultShadowTop;
WebFXMenu.prototype.shadowBottom	= webfxMenuDefaultShadowBottom;

WebFXMenu.prototype.add = function (menuItem) {
	this._menuItems[this._menuItems.length] = menuItem;
	if (menuItem.subMenu) {
		this._subMenus[this._subMenus.length] = menuItem.subMenu;
		menuItem.subMenu.parentMenu = this;
	}
	
	menuItem.parentMenu = this;
};

WebFXMenu.prototype.show = function (relObj, sDir) {
	if (this.useAutoPosition)
		this.position(relObj, sDir);
	
	var divElement = document.getElementById(this.id);
	divElement.style.left = opera ? this.left : this.left + "px";
	divElement.style.top = opera ? this.top : this.top + "px";
	divElement.style.visibility = "visible";
	this.shown = true;
	if (this.parentMenu)
		this.parentMenu.show();
};

WebFXMenu.prototype.hide = function () {
	this.hideAllSubs();
	var divElement = document.getElementById(this.id);
	divElement.style.visibility = "hidden";
	this.shown = false;
};

WebFXMenu.prototype.hideAllSubs = function () {
	for (var i = 0; i < this._subMenus.length; i++) {
		if (this._subMenus[i].shown)
			this._subMenus[i].hide();
	}
};
WebFXMenu.prototype.toString = function () {
	var top = this.top + this.borderTop + this.paddingTop;
	var str = "<div id='" + this.id + "' class='webfx-menu' style='" + 
	"width:" + (!ieBox  ?
		this.width - this.borderLeft - this.paddingLeft - this.borderRight - this.paddingRight  : 
		this.width) + "px;" +
	(this.useAutoPosition ?
		"left:" + this.left + "px;" + "top:" + this.top + "px;" :
		"") +
	(ie50 ? "filter: none;" : "") +
	"'>";
	
	if (this._menuItems.length == 0) {
		str +=	"<span class='webfx-menu-empty'>" + this.emptyText + "</span>";
	}
	else {	
		// loop through all menuItems
		for (var i = 0; i < this._menuItems.length; i++) {
			var mi = this._menuItems[i];
			str += mi;
			if (!this.useAutoPosition) {
				if (mi.subMenu && !mi.subMenu.useAutoPosition)
					mi.subMenu.top = top - mi.subMenu.borderTop - mi.subMenu.paddingTop;
				top += mi.height;
			}
		}

	}
	
	str += "</div>";

	for (var i = 0; i < this._subMenus.length; i++) {
		this._subMenus[i].left = this.left + this.width - this._subMenus[i].borderLeft;
		str += this._subMenus[i];
	}
	
	return str;
};
// WebFXMenu.prototype.position defined later
function WebFXMenuItem(sText, sHref, sToolTip, oSubMenu) {
	this.text = sText || webfxMenuItemDefaultText;
	this.href = (sHref == null || sHref == "") ? webfxMenuItemDefaultHref : sHref;
	this.subMenu = oSubMenu;
	if (oSubMenu)
		oSubMenu.parentMenuItem = this;
	this.toolTip = sToolTip;
	this.id = webFXMenuHandler.getId();
	webFXMenuHandler.all[this.id] = this;
};
WebFXMenuItem.prototype.height = webfxMenuItemDefaultHeight;
WebFXMenuItem.prototype.toString = function () {
	return	"<a" +
			" id='" + this.id + "'" +
			" href=\"" + this.href + "\"" +
			(this.toolTip ? " title=\"" + this.toolTip + "\"" : "") +
			" onmouseover='webFXMenuHandler.overMenuItem(this)'" +
			(webfxMenuUseHover ? " onmouseout='webFXMenuHandler.outMenuItem(this)'" : "") +
			(this.subMenu ? " unselectable='on' tabindex='-1'" : "") +
			">" +
			(this.subMenu ? "<img class='arrow' src=\"" + webfxMenuImagePath + "arrow.right.png\">" : "") +
			this.text + 
			"</a>";
};


function WebFXMenuSeparator() {
	this.id = webFXMenuHandler.getId();
	webFXMenuHandler.all[this.id] = this;
};
WebFXMenuSeparator.prototype.height = webfxMenuSeparatorDefaultHeight;
WebFXMenuSeparator.prototype.toString = function () {
	return	"<div" +
			" id='" + this.id + "'" +
			(webfxMenuUseHover ? 
			" onmouseover='webFXMenuHandler.overMenuItem(this)'" +
			" onmouseout='webFXMenuHandler.outMenuItem(this)'"
			:
			"") +
			"></div>"
};

function WebFXMenuBar() {
	this._parentConstructor = WebFXMenu;
	this._parentConstructor();
}
WebFXMenuBar.prototype = new WebFXMenu;
WebFXMenuBar.prototype.toString = function () {
	var str = "<div id='" + this.id + "' class='webfx-menu-bar'>";
	
	// loop through all menuButtons
	for (var i = 0; i < this._menuItems.length; i++)
		str += this._menuItems[i];
	
	str += "</div>";

	for (var i = 0; i < this._subMenus.length; i++)
		str += this._subMenus[i];
	
	return str;
};

function WebFXMenuButton(sText, sHref, sToolTip, oSubMenu) {
	this._parentConstructor = WebFXMenuItem;
	this._parentConstructor(sText, sHref, sToolTip, oSubMenu);
}
WebFXMenuButton.prototype = new WebFXMenuItem;
WebFXMenuButton.prototype.toString = function () {
	return	"<a" +
			" id='" + this.id + "'" +
			" href='" + this.href + "'" +
			(this.toolTip ? " title='" + this.toolTip + "'" : "") +
			(webfxMenuUseHover ?
				(" onmouseover='webFXMenuHandler.overMenuItem(this)'" +
				" onmouseout='webFXMenuHandler.outMenuItem(this)'") :
				(
					" onfocus='webFXMenuHandler.overMenuItem(this)'" +
					(this.subMenu ?
						" onblur='webFXMenuHandler.blurMenu(this)'" :
						""
					)
				)) +
			">" +
			this.text + 
			(this.subMenu ? " <img class='arrow' src='" + webfxMenuImagePath + "arrow.down.png' align='absmiddle'>" : "") +				
			"</a>";
};


/* Position functions */

function getInnerLeft(el) {
	if (el == null) return 0;
	if (ieBox && el == document.body || !ieBox && el == document.documentElement) return 0;
	return getLeft(el) + getBorderLeft(el);
}

function getLeft(el) {
	if (el == null) return 0;
	return el.offsetLeft + getInnerLeft(el.offsetParent);
}

function getInnerTop(el) {
	if (el == null) return 0;
	if (ieBox && el == document.body || !ieBox && el == document.documentElement) return 0;
	return getTop(el) + getBorderTop(el);
}

function getTop(el) {
	if (el == null) return 0;
	return el.offsetTop + getInnerTop(el.offsetParent);
}

function getBorderLeft(el) {
	return ie ?
		el.clientLeft :
		parseInt(window.getComputedStyle(el, null).getPropertyValue("border-left-width"));
}

function getBorderTop(el) {
	return ie ?
		el.clientTop :
		parseInt(window.getComputedStyle(el, null).getPropertyValue("border-top-width"));
}

function opera_getLeft(el) {
	if (el == null) return 0;
	return el.offsetLeft + opera_getLeft(el.offsetParent);
}

function opera_getTop(el) {
	if (el == null) return 0;
	return el.offsetTop + opera_getTop(el.offsetParent);
}

function getOuterRect(el) {
	return {
		left:	(opera ? opera_getLeft(el) : getLeft(el)),
		top:	(opera ? opera_getTop(el) : getTop(el)),
		width:	el.offsetWidth,
		height:	el.offsetHeight
	};
}

// mozilla bug! scrollbars not included in innerWidth/height
function getDocumentRect(el) {
	return {
		left:	0,
		top:	0,
		width:	(ie ?
					(ieBox ? document.body.clientWidth : document.documentElement.clientWidth) :
					window.innerWidth
				),
		height:	(ie ?
					(ieBox ? document.body.clientHeight : document.documentElement.clientHeight) :
					window.innerHeight
				)
	};
}

function getScrollPos(el) {
	return {
		left:	(ie ?
					(ieBox ? document.body.scrollLeft : document.documentElement.scrollLeft) :
					window.pageXOffset
				),
		top:	(ie ?
					(ieBox ? document.body.scrollTop : document.documentElement.scrollTop) :
					window.pageYOffset
				)
	};
}

/* end position functions */

WebFXMenu.prototype.position = function (relEl, sDir) {
	var dir = sDir;
	// find parent item rectangle, piRect
	var piRect;
	if (!relEl) {
		var pi = this.parentMenuItem;
		if (!this.parentMenuItem)
			return;
		
		relEl = document.getElementById(pi.id);
		if (dir == null)
			dir = pi instanceof WebFXMenuButton ? "vertical" : "horizontal";
		
		piRect = getOuterRect(relEl);
	}
	else if (relEl.left != null && relEl.top != null && relEl.width != null && relEl.height != null) {	// got a rect
		piRect = relEl;
	}
	else
		piRect = getOuterRect(relEl);
	
	var menuEl = document.getElementById(this.id);
	var menuRect = getOuterRect(menuEl);
	var docRect = getDocumentRect();
	var scrollPos = getScrollPos();
	var pMenu = this.parentMenu;
	
	if (dir == "vertical") {
		if (piRect.left + menuRect.width - scrollPos.left <= docRect.width)
			this.left = piRect.left;
		else if (docRect.width >= menuRect.width)
			this.left = docRect.width + scrollPos.left - menuRect.width;
		else
			this.left = scrollPos.left;
			
		if (piRect.top + piRect.height + menuRect.height <= docRect.height + scrollPos.top)
			this.top = piRect.top + piRect.height;
		else if (piRect.top - menuRect.height >= scrollPos.top)
			this.top = piRect.top - menuRect.height;
		else if (docRect.height >= menuRect.height)
			this.top = docRect.height + scrollPos.top - menuRect.height;
		else
			this.top = scrollPos.top;
	}
	else {
		if (piRect.top + menuRect.height - this.borderTop - this.paddingTop <= docRect.height + scrollPos.top)
			this.top = piRect.top - this.borderTop - this.paddingTop;
		else if (piRect.top + piRect.height - menuRect.height + this.borderTop + this.paddingTop >= 0)
			this.top = piRect.top + piRect.height - menuRect.height + this.borderBottom + this.paddingBottom + this.shadowBottom;
		else if (docRect.height >= menuRect.height)
			this.top = docRect.height + scrollPos.top - menuRect.height;
		else
			this.top = scrollPos.top;

		var pMenuPaddingLeft = pMenu ? pMenu.paddingLeft : 0;
		var pMenuBorderLeft = pMenu ? pMenu.borderLeft : 0;
		var pMenuPaddingRight = pMenu ? pMenu.paddingRight : 0;
		var pMenuBorderRight = pMenu ? pMenu.borderRight : 0;
		
		if (piRect.left + piRect.width + menuRect.width + pMenuPaddingRight +
			pMenuBorderRight - this.borderLeft + this.shadowRight <= docRect.width + scrollPos.left)
			this.left = piRect.left + piRect.width + pMenuPaddingRight + pMenuBorderRight - this.borderLeft;
		else if (piRect.left - menuRect.width - pMenuPaddingLeft - pMenuBorderLeft + this.borderRight + this.shadowRight >= 0)
			this.left = piRect.left - menuRect.width - pMenuPaddingLeft - pMenuBorderLeft + this.borderRight + this.shadowRight;
		else if (docRect.width >= menuRect.width)
			this.left = docRect.width  + scrollPos.left - menuRect.width;
		else
			this.left = scrollPos.left;
	}
};
/**
* Standard JavaScript library Contwise 2
* Copyright General Solutions Steiner GmbH & F.Falkner
*
/******************************************************************
Original Code from
© 2001 Struppi
Mail: struebig@gmx.net
URL: http://home.arcor.de/struebig/computer/javascript
Modified 2004 by Florian Falkner
*/
var default_bgColor = '#EAEAEA';
var default_width = 400;
var default_height = 200;
var rahmen_w = 20;
var rahmen_h = 100;

//New Version start
function showBild(link, title, descr)
{
    // Das Fenster öffnen
    isLoad = false;

    if(!showFenster || showFenster.closed) showFenster = popUp("", "NEW_WIN", default_width, default_height);
    
  
    showFenster.document.open();
    showFenster.document.write(getHTML(link,title,descr));
    showFenster.document.close();
    showFenster.focus();
    return false;
}

function fitWin(i, win)
{
    if(isLoad == true) return;
    isLoad = true;

    var w = i.width;
    var h = i.height;

    if(w < 100) w = 150;
    if(h < 100) h = 100;

    var size = getWinSize(win);

    win.resizeBy((w - size.w + rahmen_w), (h - size.h + rahmen_h) );
    
    win.focus();
}

function popUp(url, fname, w, h)
{
    var tmp = new Array();
    tmp[tmp.length] = 'resizable=yes';
    tmp[tmp.length] = 'scrollbars=yes';
    if(w) tmp[tmp.length] = 'width=' + w;
    if(h) tmp[tmp.length] = 'height=' + h;
    var string = tmp.join(",");
    return window.open(url, fname, string);
}

function getHTML(src, title, descr) {
    var body = (window.opera || document.layers) ? false : true;
    if(!title) title = 'Bild / Picture';
    var bgcolor = default_bgColor;
    descr = descr || "";
    var text ="";
    text+= '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">\n'
    + '<HTML>\n<HEAD>\n'
    + '<TITLE>' + title + '</TITLE>\n'
    + '<STYLE type="text/css">\n'
     + 'body{margin:0;padding:0;overflow:hidden;\n' + 'background-color:' + bgcolor + ';}\n'
    + '#img{\nposition:absolute;top:0;left:0;margin:0;padding:0;overflow:hidden;\n}\n'
    + '</STYLE>\n'
    + '</HEAD>\n'
    + '<body onload="var img = new Image();'
    + 'img.onload = function(){opener.fitWin(this, window);};'
    + 'img.src = \'' + src +'\';img.vspace=6;">'
    + '<center><div align="center"><br><a href="javascript:self.close()" title="Zum Schließen ins Bild klicken."><img border=0 src="' + src + '" alt="' + title + '"' + '></a></div>'
    + '<div align=center><font face="Verdana,Arial,Helvetica,sans-serif" size=1>' + descr + '</font></div>'
    + '\n</body>\n</html>\n'
    ;
    return text;
}

function getWinSize(win)
{
    if(!win) win = window;
    var pos = {w:0,h:0};
    if(typeof win.innerWidth != 'undefined')
    {
        pos = { w: win.innerWidth, h: win.innerHeight};
    }
    else
    {
         var obj = checkIE(win);

         pos.w = parseInt(obj.clientWidth);
         pos.h = parseInt(obj.clientHeight);
    }
    return pos;
}

function checkIE(win)
{
    if(!win) win = window;
    return (win.document.compatMode && win.document.compatMode == "CSS1Compat") ?
    win.document.documentElement : win.document.body;
}
var showFenster = null;
//end

/**
------------------------------------------------------------------------------------------------
Start of Standardlibrary copyrighted by G & S GmbH & F.Falkner
------------------------------------------------------------------------------------------------
**/
function oWin(path,name,height,width,posX,posY) {
   var winName = name || "CONTWISE_OUT_WIN";
   var winHeight = height || 487;
   var winWidth = width || 480;
   var left,top;
   if (!posX && !posY) {
    left = (screen.width) ? (screen.width-winHeight)/2 : 20;
    top = (screen.height) ? (screen.height-winWidth)/2 : 20;
   }
   else {
     left = posX;
     top = posY;
   }
   var settings ='height='+winHeight+',width='+winWidth+',top='+top+',left='+left+',scrollbars=yes,resizable=yes'
   win = window.open(path,name,settings)
   win.focus();
   return win;
}

var WARN_CATEGORY_NOT_FOUND = true;
var DEFAULT_PARENT_NAME = "diverses";

function writeParents(val,tree,link,style,sep) {
   if (!tree) tree = catTree;
   var curNode;
   curNode = catTree.getNode(val,"ukatnr");
   if (!curNode) {
      if (WARN_CATEGORY_NOT_FOUND) {
         alert("Node "+val+" not found!");
         return;
      }
      else {
         window.document.write(DEFAULT_PARENT_NAME);
      }
   }

// alert(curNode.userObject.name);
   var catString = "";
   if (!style) style = "cat-link";  
   if (!sep) sep = " / ";
   while (curNode.parent) {
      if (!curNode.userObject) continue;
      var tmp = catString;
      if (link)
         catString="<a href='"+curNode.userObject.script+"?ukatnr="+curNode.userObject.ukatnr+"' class='"+style+"'>"+curNode.userObject.name+"</a>";
      else
         catString=curNode.userObject.name;
      if (tmp) catString = catString+sep+tmp;
         curNode = curNode.parent;
   }
   window.document.write(catString);
}

function replaceForUrl (text) {
	text = text.toLowerCase();
	text=text.replace(/ /g, "_");
	text=text.replace(/,/g, "");
	text=text.replace(/\u00fc/g, "ue");
	text=text.replace(/\u00f6/g, "oe");
	text=text.replace(/\u00e4/g, "ae");
	text=text.replace(/\u00df/g, "ss");
	text=text.replace(/[^a-zA-Z 0-9_]+/g,'');
	return text;
}

function searchFriendlyUrl (name, ukatnr, artnr) {
	return replaceForUrl(name) + "," + ukatnr + (artnr ? "," + artnr : "") + ".html";
}



// JS function for uncrypting spam-protected emails:
// To Crypt, undo the right shift for each character by unicode character
function linkTo_UnCryptMailto(s) {
	var n=0;
	var r="";
	
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
		
		if(s.charAt(i) == '^')
			r+= '&';
		else
			r += String.fromCharCode(n-(1));
	}
	
	location.href='mailto:' + r;
}
//--------------------------------------------------------
//Class Node
function Node (parent,userObject)
	{
	this.parent=parent;
	this.index=null;
	this.userObject=userObject;
	this.collapsed = true;
	this.expanded = false;
	
	this.childNodes=new Array();
	}

Node.prototype.addNode = function (node){
	this.childNodes[this.childNodes.length] = node;
}

Node.prototype.getNode = function (criteria,optParam) {
	if (this.userObject && this.userObject.equals(criteria,optParam))
		return this;
	if (this.childNodes.length == 0)
		return false;
	else {
		for (var i=0;i<this.childNodes.length;i++) {
			var node = this.childNodes[i].getNode(criteria,optParam);
			if (node != false)
				return node;
		}
		return false;
	}	
}

Node.prototype.collapse = function(children) {
	this.expanded = false;
	if (children) {
		for (var i=0;i<this.childNodes.lenght;i++)
			this.childNodes[i].collapse(children);
	}
}

Node.prototype.expand = function(children) {
	this.expanded = true;
	if (children) {
		for (var i=0;i<this.childNodes.length;i++)
			this.childNodes[i].expand(children);
	}
}

Node.prototype.callOnUserObject = function (funcID,param) {
	this.userObject.exec(funcID,param);
	if (param["callOnChildren"]) {
		param["childCall"] = true;
		for (var i=0;i<this.childNodes.length;i++)
			this.childNodes[i].callOnUserObject(funcID,param);
	}
}

	
//--------------------------------------------------------
//Class Tree
function Tree (root) {
	this.root = root;
}

Tree.prototype.getNode = function(criteria,optParam) {
	if (this.root == null)
		return false;
	else
		return this.root.getNode(criteria,optParam);
}


//------------------------------------------------------
//Class Category
function Category(name,ukatnr,posnr,script,ordernr,type,allowed,password)
	{
	this.name=name;
	this.ukatnr=ukatnr;
	this.posnr = posnr;
	this.script=script;
	this.ordernr=new String(ordernr);
	this.type=type;
	this.allowed=allowed;
	this.password=password;
	this.oldOrdernr=null;
	this.modified = false;
	this.changes = 0;
	}

Category.prototype.equals = function (compare,optParam) {
	if (optParam)
		return this[optParam] == compare;
	else
		return (this.ordernr==compare);
}

Category.prototype.changeOrdernr = function (param)
	{
	var newOrdernr = new String(param.ordernr);
	if (!this.modified)
		this.oldOrdernr=this.ordernr;
	if (newOrdernr.length < this.ordernr.length)
		this.ordernr=newOrdernr+this.ordernr.substring(newOrdernr.length,this.ordernr.length);
	else
		this.ordernr=newOrdernr;
	this.modified = true;
	}

Category.prototype.rename = function (param) {
	var newName = param.name;
	this.name = newName;
}

Category.prototype.changePwd = function (param) {
	this.password = param.password;
	this.modified = true;
}

Category.prototype.exec = function (id,param) {
	eval("this."+id+"(param);");
}
/*
Copyright by Greuter & Steiner GmbH - F.Falkner 
Every redistribution permitted.
*/

function TreeDisplay(tree,path,menuBar,selectToplevel,searchFriendlyUrl) {
   this.tree = tree || alert("No Tree in TreeDisplay! "+tree);
   this.path = path || "";
   this.menuBar = menuBar;
   this.sel = null;
   this.forum = false;
   this.home = false,
   this.journal = false;
   if (selectToplevel)
      this.selectToplevel(selectToplevel);
   else
      this.selToplevel = null;
   this.searchFriendlyUrl = searchFriendlyUrl;
   this.initTree();
}

TreeDisplay.prototype.initTree = function() {
   var toplevel = new Array();
   var i=0;
   toplevel = this.tree.root.childNodes;
   for (i=0;i<toplevel.length;i++)
      this.addNode(toplevel[i],this.menuBar,true);
   
}

TreeDisplay.prototype.addNode = function(node,parentMenu,toplevel) {
   var children = new Array();
   var i=0;
   var nodeButton,nodeMenu;
   children = node.childNodes;
   var sel;
   if (this.selToplevel && (node.userObject.ukatnr == this.selToplevel.userObject.ukatnr))
      sel = true;
   else
      sel = false;
   
   var url = (this.searchFriendlyUrl ? searchFriendlyUrl(node.userObject.name,node.userObject.ukatnr) : node.userObject.script+"?ukatnr="+node.userObject.ukatnr);
   
   if (children.length>0) {
      nodeMenu = new WebFXMenu;
      for (i=0;i<children.length;i++)
         this.addNode(children[i],nodeMenu,false);
      if (toplevel) {
         nodeButton = new WebFXMenuButton(node.userObject.name,url,null,nodeMenu,sel,toplevel);
      }
      else {
         nodeButton = new WebFXMenuItem(node.userObject.name,url,null,nodeMenu,sel);
      }
   }
   else
      nodeButton = new WebFXMenuButton(node.userObject.name,url,null,null,sel,toplevel);
   parentMenu.add(nodeButton);
}

TreeDisplay.prototype.toHtml = function() {
   window.document.write(this.menuBar);
}

TreeDisplay.prototype.selectToplevel = function(ukatnr) {
   var selNode = this.tree.getNode(ukatnr,"ukatnr");
   if (!selNode) return;
   var parentNode = selNode;
   while (parentNode.parent.parent) {
      parentNode = parentNode.parent;
   }
   this.selToplevel = parentNode;
}
/*
Copyright by G & S GmbH - F.Falkner 
Every redistribution permitted.
*/

function TreeDisplayStd(tree,behaviour,renderFunc,path,indentWidth) {
	this.tree = tree;
	this.behaviour = behaviour || "EXPAND_ONE";
	this.renderFunc = renderFunc || alert("RenderFunction is missing!");
	this.path = path || "";
	this.indentWidth = indentWidth || 10;
	this.sel = null;
	this.forum = false;
	this.home = false,
	this.journal = false;
}

TreeDisplayStd.prototype.select = function(ukatnr,selParents,doUnselect) {
	var selNode = this.tree.getNode(ukatnr,"ukatnr");
	var selCat = selNode.userObject;
	if (!selNode) return;
	if (doUnselect)
		this.tree.root.collapse("COLLAPSE_CHILDREN");
	selNode.expand();
	if (selParents && selCat.ordernr.length > 5) {
		var parentNode = selNode;
		while (parentNode.parent) {
			parentNode.parent.expand();
			parentNode = parentNode.parent;
		}
	}
	this.sel = selNode;
}

TreeDisplayStd.prototype.toHtml = function() {
	var h="";

	for (var i=0;i<this.tree.root.childNodes.length;i++)
		h+=this.drawNode(this.tree.root.childNodes[i]);
	return h;
}

TreeDisplayStd.prototype.drawNode = function(node) {
	var cat = node.userObject;
	var nameSpan = (19 - cat.ordernr.length) / 2;
	
	var spacerSpan = 7-nameSpan;
	var spacerHtml="";
	spacerHtml = this.spacerHtml(spacerSpan);
	
	var isSel = false;
	if (node == this.sel)
		isSel = true;
	var h = this.renderFunc(isSel,nameSpan,spacerSpan,node);
	if (node.expanded) {
		for (var i=0;i<node.childNodes.length;i++)
			h+=this.drawNode(node.childNodes[i]);
	}
	if (this.endRenderFunc) {
		h+=this.endRenderFunc(node);
	}
	return h;
}

TreeDisplayStd.prototype.spacerHtml = function(cols) {
	if (cols == 0) return "";
	var w = this.indent*cols;
	return "<td width='"+w+"'><img src='../pics/spacer.gif' width='"+w+"' height=2></td>";
}

TreeDisplayStd.prototype.getParents = function(ukatnr) {
	var retAry = new Array();
	var selNode = this.tree.getNode(ukatnr,"ukatnr");
	if (!selNode) return retAry;
	while (selNode.parent) {
		retAry[retAry.length] = selNode;
		selNode = selNode.parent;
	}
	return retAry;
}
/*
TreeDisplay.prototype.expand = function(ukatnr) {
	var node = this.tree.getNode(ukatnr,"ukatnr");
	node.expand();
	this.redraw();
}

TreeDisplay.prototype.collapse = function(ukatnr) {
	var node = this.tree.getNode(ukatnr,"ukatnr");
	node.collapse();
	this.redraw();
}

TreeDisplay.prototype.detail = function(ukatnr) {
	var node = this.tree.getNode(ukatnr,"ukatnr");
	this.sel = node;
	var cat = node.userObject;
	contentFrame.location.href=cat.script+"?ukatnr="+cat.ukatnr+"&ukatnr="+cat.ukatnr+"&ukatname="+cat.name+"&ausgabescript="+cat.script;
	this.expand(ukatnr);
}*/	
