/***********************
 * aus config30.js ... *
 ***********************/

var undefined, ENV, Local = new Object(), _SELF = this;

if(typeof SymRealWinOpen != 'undefined') window.open = SymRealWinOpen;

ENV = {
  app : new Object()
}

Local.ConfApi = new Object();

function noop() {
}

function rtnFalse() {
  return false;
}

function notUndef(obj) {
  return typeof obj != "undefined";
}

// neu:
if(!document.getElementById && document.all){
  document.getElementById = function(id){
    return document.all[id] || null;
  }
}

window.getElementById = document.getElementById;

function canScroll(win) {
  if(!win) win = self;
  if(win.scrollbars && win.scrollbars.visible != undefined )
    return win.scrollbars.visible;
  // bezieht sich auf seitlichen Scrollbar ...
  if(document.body && typeof document.body.scroll == "string"
     && document.body.scroll.length)
    return (("yes,auto").indexOf(win.document.body.scroll) > -1);
  if(document.body.offsetWidth && document.body.clientWidth)
    return (Math.abs(win.document.body.offsetWidth - win.document.body.clientWidth) > 6);
  if(win.innerWidth && document.body.clientWidth)
    return (Math.abs(win.innerWidth - win.document.body.clientWidth) > 6);
  return true; // : im "Zweifelsfall"
}

function bodyClientSize() {
  if (true && document.body) return document.body.clientWidth != undefined;
  return false;
}

function getDocumentHeight(win) {
  var doc, EA = ENV.app;
  if(!win) win = self;
  doc = win.document;
  if( ! (EA.msie && EA.verNum < 6) && doc.documentElement && doc.documentElement.scrollHeight)
    return Math.max(doc.documentElement.scrollHeight,getWindowHeight(win));
  if(doc.body && doc.body.scrollHeight)
    return Math.max(doc.body.scrollHeight,getWindowHeight(win));
  if(doc.height)
    return Math.max(doc.height,getWindowHeight(win));
  return 0;
}

function getWindowWidth(win) {
  if(!win) win = self;
  var doc = win.document;
  if (doc.documentElement && doc.documentElement.clientWidth) return doc.documentElement.clientWidth;
  if (win.innerWidth) {
    if(canScroll(win))
      return (bodyClientSize() && doc.body.clientWidth!=win.innerWidth) ?
        doc.body.clientWidth : win.innerWidth-16;
    return win.innerWidth;
  }
  if (doc.body.clientWidth) return doc.body.clientWidth;
  if (doc.body.offsetWidth)
    return doc.body.offsetWidth - (win.canScroll()?16:0);
  return -1; // = nicht gefunden
}

function getWindowHeight(win) {
  if(!win) win = self;
  var doc = win.document, EA = ENV.app;
  if (EA.opera && win.innerHeight) return win.innerHeight;
  if (EA.msie && EA.verNum < 6) return doc.body.clientHeight;
  if (doc.documentElement) return doc.documentElement.clientHeight;
  if (win.innerHeight) return win.innerHeight; // beruecksichtigt keine Scrollbars
  if (doc.body.clientHeight) return doc.body.clientHeight;
  if (doc.body.offsetHeight)
    return doc.body.offsetHeight - (win.canScroll()?16:0);
  return -1; // = nicht gefunden
}


String.prototype.trim = function() {
  return this.replace(/^\s*/,"").replace(/\s*$/,"");
}

// Browsererkennung ...

ENV.oldMsieBoxMod = false;

EA = ENV.app;

EA.ie4 = document.all ? true : false;
EA.nn4 = document.layers ? true : false;

EA.w3c = (document.getElementById && document.documentElement) ? true : false;
EA.w3cL2 = (EA.w3c && document.createRange && document.addEventListener) ? true : false;

EA.gecko  = navigator.product ? navigator.product.search("Gecko") >= 0 : false;
EA.gecko14comp = (EA.w3cL2 && notUndef(document.designMode) && document.execCommand) ? true : false;
EA.gecko14 = EA.gecko && EA.gecko14comp;

// AppleWebKit:
EA.safari = navigator.userAgent.indexOf("AppleWebKit") >= 0;
EA.safariNative = navigator.userAgent.indexOf("Safari") >= 0;

// KHTML-Engines:
EA.konqNative = navigator.appName == "Konqueror";
EA.konq = EA.konqNative || EA.safari;
EA.khtml = !EA.gecko && (navigator.product ? navigator.product.search("khtml") >= 0 : EA.konq);

EA.opera = navigator.userAgent.indexOf("Opera") >= 0;

// Gecko-Engines:
EA.moz = !EA.konq && !EA.opera && EA.w3c && EA.gecko; // auch Netsc. 6+ und Epiphany
EA.moz14 = EA.moz && EA.gecko14; // auch Netsc. 7.1 +
EA.kecko = EA.konq && EA.gecko14; // Stand Okt. 04: in Planung -> korrekt?
EA.ffx = EA.gecko14 && navigator.userAgent.indexOf("Firefox") >= 0; // dann auch EA.moz!

if(EA.gecko || EA.khtml || EA.opera) EA.ie4 = false;
else if (EA.ie4) EA.w3c = false;

EA.msie = EA.ie4;

EA.verNum = 0;
EA.revNum = -1;

EA.ie5=EA.ie5mac=EA.ie52mac=false; // Korrektur im OS-Block
EA.ie55=EA.ie6=EA.ie7=EA.ie8=EA.ie9=EA.sim_msie=false;
if (EA.ie4) {
  if (document.getElementById) EA.ie5 = true;
  tmpStr = navigator.userAgent || navigator.appVersion;
  tmpArr = tmpStr.match(/\; *MSIE *([\d\.]+) *\;/);
  if (tmpArr.length>1) EA.verNum = parseFloat(tmpArr[1]);
  else EA.verNum = EA.ie5 ? 5.0 : 4.0;
  if(EA.verNum>5.499) EA.ie55 = true;
  if(EA.verNum>5.999) {
    EA.ie6 = true;
    if(EA.verNum>6.999) EA.ie7=true;
    if(EA.verNum>7.999) EA.ie8=true;
    if(EA.verNum>8.999) EA.ie9=true;
    if(document.addEventListener) {
      EA.ie4=EA.ie5=false; // ! ab ie6 ist ie5 false !
      EA.w3c=EA.w3cL2=true;
    }
  }
}else{
  EA.sim_msie = navigator.appName.indexOf("Internet Explorer") >= 0;
  tmpArr = navigator.userAgent.match(/[ \;]+rv: ?([\d\.]*)/i);
  // EA.revNum
  if(tmpArr && tmpArr[1]) EA.revNum = parseFloat(tmpArr[1].replace(/(\.\d*)\./g,"$1"));
  if(tmpArr && tmpArr[1] && !EA.ffx) EA.verNum = EA.revNum;
  else {
    tmpStr = EA.konqNative?"Konqueror":(EA.safariNative?"Safari":(EA.safari?"AppleWebKit":(EA.ffx?"Firefox":(EA.opera?"Opera":"DUMMY"))));
    tmpRXp = new RegExp(tmpStr+"[\\ \\/]?([\\d\\.]+)","i");
    tmpArr = navigator.userAgent.match(tmpRXp);
    if(tmpArr && tmpArr[1]) {
      EA.verNum = parseFloat(tmpArr[1]);
      if(EA.safari) { //  && EA.verNum>45
        EA.revNum = EA.verNum;
        switch (Math.floor((EA.verNum-1)/100)) {
          case 0: EA.verNum = EA.verNum>=85 ? 1.0 : 0.8; break;
          case 1: case 2: EA.verNum = EA.verNum<125 ? 1.1 : 1.2; break;
          case 3: EA.verNum = 1.3; break;
          default: EA.verNum = (Math.floor((EA.verNum)/10)-21)/10; // grobe Schaetzung Feb 2006 (aktuell: Safari/417.8) [BNY]
        }
      }
    }
  }
  if(!EA.verNum) EA.verNum = parseFloat(navigator.appVersion);
}

EA.engineType = EA.gecko?"gecko":(EA.msie?"msie":(EA.khtml?"khtml":(EA.opera?"opera":(EA.w3c?"w3c":(EA.nn4?"nn4":"unknown")))));
EA.engineVersion = 1.2; // aequivalente JS-Version ...
if(EA.msie) EA.engineVersion = EA.verNum>5.499 ? 1.5 : (EA.verNum>4.999 ? 1.3 : 1.2);
if(EA.gecko) EA.engineVersion = EA.gecko14 ? 1.5 : 1.3;
if(EA.opera) EA.engineVersion = EA.verNum>7.49 ? 1.5 : (EA.verNum>5.999 ? 1.4 : 1.3);
if(EA.konqNative) EA.engineVersion = EA.verNum>3.09 ? 1.5 : 1.3;
if(EA.safari) EA.engineVersion = EA.verNum>1.19 ? 1.5 : 1.3;

if(EA.msie || (EA.opera && EA.verNum>6.99 && EA.verNum<9)) {
  if(!document.compatMode || document.compatMode=="BackCompat" || document.compatMode=="QuirksMode")
    ENV.oldMsieBoxMod = true;
    Local.oldMsieBoxMod = true;
}

function getScrollY() {
    if(typeof self.pageYOffset != "undefined") return self.pageYOffset;
    else
     {if(document.documentElement && document.documentElement.scrollTop) return document.documentElement.scrollTop;
      else if (document.body.scrollHeight) return document.body.scrollTop;
      else return 0;}
}

function getScrollX() {
    if(typeof self.pageXOffset != "undefined") return self.pageXOffset;
    else
     {if(document.documentElement && document.documentElement.scrollLeft) return document.documentElement.scrollLeft;
      else if (document.body.scrollWidth) return document.body.scrollLeft;
      else return 0;}
}

function rel2absSrc(src) { // zur Zeit noch nicht name=""
  var RootPath = location.protocol+'//' + location.host;
  var ThisPath = location.href.substring(0,location.href.lastIndexOf("/"));
  if (!src) return ThisPath;
  src = src.trim();
  if (src.search(/^\w{3,5}\:\/\//) == 0) return src;
  if (src.indexOf("/")==0) return RootPath+src;
  while (src.indexOf("..") != -1) {
    ThisPath = ThisPath.substring(0,ThisPath.lastIndexOf("/"));
    src = src.substring(src.indexOf("/")+1);
  }
  if (ThisPath.length < RootPath.length) ThisPath = RootPath;
  return ThisPath+"/"+src;
}

function compareSrc(src1,src2) {
  if ((typeof src1)+(typeof src2) != "stringstring") return "error";
  src1 = rel2absSrc(src1);
  src2 = rel2absSrc(src2);
  return (src1.toLowerCase() == src2.toLowerCase()) ? "equal" : "unequal";
}

function isInList(str,list) {
  if(!str || !list) return false;
  RE = new RegExp("\\b"+str+"\\b","i");
  return list.search(RE) != -1;
}

/********************
 * aus dhtml.js ... *
 ********************/

function getHtmlElement(id) {
  if(document.getElementById) return document.getElementById(id);
  if(document.all) return document.all[id];
  return null;
}

function setSize(node,w,h) {
  if(typeof node == "string") node = document.getElementById(node);
  if(node) {
    if(typeof w == "number") node.style.width = w.toString()+"px";
    if(typeof h == "number") node.style.height = h.toString()+"px";
  }
}

function getSize(obj) {
    return [ parseInt(obj.offsetWidth.toString()) , parseInt(obj.offsetHeight.toString()) ];
}

function getPos(node){
  var vati, x=0, y=0;
  if(typeof node == "string") node = document.getElementById(node);
  if(node){
    vati = node;
    while (vati) {
      x += vati.offsetLeft; y += vati.offsetTop;
      vati = vati.offsetParent;
    }
    return [ x, y, (node.style && node.style.zIndex) ? node.style.zIndex : 0 ];
  } else return [0,0,0];
}

function setPos(node,X,Y,Z) {
  if(typeof node == "string") node = document.getElementById(node);
  if (typeof X == "number") node.style.left = X.toString()+"px";
  if (typeof Y == "number") node.style.top = Y.toString()+"px";
  if (typeof Z == "number") node.style.zIndex = Z;
}

function fixPos(div,x,y,untilFn) {
  //
  // untilFn soll true zurueckgeben, wenn interne Schleife beendet werden soll
  // innerhalb von untilFn ist this == div !
  var loopID, sx, sy, sx0, sy0, pos, EA = ENV.app;
  var sxm1, sxm2, sym1, sym2;
  function loop () { // fuer non-Gecko 1.4 ausser msie >= Ver. 7
    if(untilFn.call(div)) clearInterval(loopID);
    else {
      sxm2 = sxm1; sxm1 = sx;
      sym2 = sym1; sym1 = sy;
      sx = getScrollX();
      sy = getScrollY();
      if( sx+sy-sx0-sy0 != 0 && sx==sxm2 && sy==sym2) {
        setPos(div,sx+x,sy+y);
        sx0 = sx; sy0 = sy;
      }
    }
  }

  sx=sy=sx0=sy0=sxm1=sxm2=sym1=sym2= -999;

  if(!div) return null;
  if(!untilFn ) untilFn = rtnFalse;

  pos = getPos(div);
  if(x==null || isNaN(x)) x = pos[0] - getScrollX();
  if(y==null || isNaN(y)) y = pos[1] - getScrollY();
  if(EA.ie7 || EA.gecko14) {
    setPos(div, x, y);
    div.style.position = 'fixed';
  }
  else loopID = setInterval(loop, 80);
}

function findLastCss () {
  var arr;
  if (Local.LastCss){
    arr = document.styleSheets || document.styleSheet;
    if(arr && arr.length) Local.LastCss = arr[arr.length-1];
  }
}

function addCssRule(sel,rule) { // NOCH TESTEN - auch Subconf!
  var CSS;
  findLastCss();
  CSS = Local.LastCss;
  if (CSS) {
    if (CSS.addRule) CSS.addRule(sel,rule);
    else CSS.insertRule(sel+"{"+rule+"}",CSS.cssRules.length);
  }
}

function getStyle( el , propName ) {
  // propName in Kamel-Schreibweise (ohne Bindestriche)!
  var rtn = null;
    if (el.currentStyle)
    rtn = el.currentStyle[propName];
    else if (window.getComputedStyle) {
      propName = propName.replace(/([A-Z])/g, '-$1').toLowerCase();
    rtn = document.defaultView.getComputedStyle(el,null).getPropertyValue(propName);
  }
    return rtn;
}

/************************
 * aus htmltools.js ... *
 ************************/

function swapHTMLcode(html,directio) {
    if (typeof directio != "number")  directio=1;
    var set = [["<",">","\""],["&lt;","&gt;","&quot;"]];
    if(directio<0) {
      if (html) {
        for(var j = 0; j < set[1].length; j++) {
          html = html.replace(eval("/"+set[1][j]+"/g"),set[0][j]);
        }
        html = html.replace(eval("/&amp;/g"),"&");
    } }
    else {
      if (html) {
        html = html.replace(eval("/&/g"),"&amp;");
        for(var j = 0; j < set[0].length; j++) {
          html = html.replace(eval("/"+set[0][j]+"/g"),set[1][j]);
    } } }
    return html || "";
}

function striphtmlspecialchars(arbstrg) {
  return swapHTMLcode(arbstrg,1);
}

function htmlspecialchars(arbstrg) {
  return swapHTMLcode(arbstrg,-1);
}

function getHTML (root, outputRoot) { // statt .innerHTML
  var B = ENV.app, html = "", closed, i;
  if (root.htmlText) return root.htmlText; // Range-Objekt für MSIE BNY 7.8.3
  else if(root.cloneContents) root = root.cloneContents(); // für MOZ BNY 7.8.3
  switch (root.nodeType) {
    case 1: // Node.ELEMENT_NODE
    case 11: // Node.DOCUMENT_FRAGMENT_NODE (kenn MSIE nicht)
      if(B.msie && !B.ie6) {
        if(root.tagName == "BODY") return root.innerHTML || "";
        else return root.outerHTML || "";
      }
      if(root.nodeName == "SCRIPT" && root.innerHTML) return root.innerHTML;
      if (outputRoot) {
        closed = (!(root.hasChildNodes() || !isInList(root.tagName,"area br hr img input link parameter wbr")));
        html = "<" + root.tagName.toLowerCase();
        var attrs = root.attributes;
        for (i = 0; i < attrs.length; ++i) {
          var a = attrs.item(i);
          if (!a.specified) {
            continue;
          }
          var name = a.name.toLowerCase();
          if (name.substr(0, 4) == "_moz") {
            // Moz.-Sondertags bleiben unberücksichtigt
            continue;
          }
          var value;
          if (name != 'style') {
            value = a.value;
          } else { // MSIE listet nicht selbständig das Stilattribut auf
            value = root.style.cssText.toLowerCase();
          }
          if (value.substr(0, 4) == "_moz") {
            // Moz.-Sonderstyles bleiben unberücksichtigt
            continue;
          }
          html += " " + name + '="' + value + '"';
        }
        html += closed ? " />" : ">";
      }
      for (i = root.firstChild; i; i = i.nextSibling) {
              html += getHTML(i, true);
      }
      if (outputRoot && !closed) {
              html += "</" + root.tagName.toLowerCase() + ">";
      }
      break;
    case 3: // Node.TEXT_NODE
      if(typeof root.data != "undefined") html = striphtmlspecialchars(root.data);
      break;
    case 8: // Node.COMMENT_NODE
      if(typeof root.outerHTML != "undefined") html = root.outerHTML;
      else if(typeof root.data != "undefined") html = "<!--" + root.data + "-->";
      break;
    default:
      if (root.innerHTML) html = root.innerHTML; // patch für MSIE BNY
  }
  return html;
}

/********************
 * Sonderfunktionen *
 ********************/

function swapImgActInacOnMOver() {
  this.src = this.src.replace(/\_inact/, '_act');
}

function swapImgActInacOnMOut() {
  this.src = this.src.replace(/\_act/, '_inact');
}

function bindSwapImgActInacTo(img) {
  var n;
  if(img.nodeName.toLowerCase() == 'img' && (img.src.indexOf('_inact') != -1) ) {
    img.onmouseover = swapImgActInacOnMOver;
    img.onmouseout = swapImgActInacOnMOut;
    n = new Image();
    if(img.src.indexOf('_inact') != -1) n.src = n.src.replace(/\_inact/, '_act');
    else n.src = n.src.replace(/\_act/, '_inact');
    img.style.width = img.width+"px";
  }
}




Local.ConfApi.init = function(EVT,options) {
}

initMiniTools = initConfig = Local.ConfApi.init;

Local.ConfApi.startDocument = noop;

