//dim appIcon as string ="http://icons3.iconfinder.netdna-cdn.com/data/icons/humano2/72x72/actions/gtk-media-record.png"

// ACHTUNG: neuer Server! Teamwiki.net
 
// alert("scriptLib01.js")

 window.globStartTime1a=new Date()
 window.globSkipAllIni=false



/* lib-1: global, allgemein, total abgespekt, z.B. ohne domWindow */

/*
 * ==================================================================
 * innerhalb der libs 1-4 sollten KEINE weiteren scriptAufrufe versteckelt werden.
 * Geladen wird nur noch innerhalb Lib-1 und Lib-4, die direkt eingemischt werden.
 * ==================================================================
 */


// Dieses Script wird bei jeder Seite im TeamWiki geladen

// alert("_globalHeader ... START")

//-->
//-->Ä N D E R U N G E N(log)
  
  

// 21.05.2007 es: editCurDoc hat jetzt einen optionalen Parameter "optFilespec"
// ... ich habe den doppelten Code beseitigt
// ... die von dir im modul "userToolbarMain" auskommentierte Teile habe ich hier wieder eingefügt
// ??? warum hattest du die auskommentiert

// [_] bla bla



//-->
//-->I N I - 1 
  


tWiki_loadScriptOnDemand=function(scriptFileSpec) {
  var req = document.createElement("SCRIPT");
  document.body.appendChild(req);
  req.src = scriptFileSpec;
}

window.tWiki_loadCSSFile=function(styleFileSpec) {
  var headID = document.getElementsByTagName("head")[0];         
  var cssNode = document.createElement('link');
  cssNode.type = 'text/css';
  cssNode.rel = 'stylesheet';
  cssNode.href = styleFileSpec;
  cssNode.media = 'screen';
  headID.appendChild(cssNode);
}

window.refreshDisplayHack=function(dummy){
}//endFunction


if (!window.globDomWindowZIndex) window.globDomWindowZIndex=20000
if (!globDomWindowZIndex) globDomWindowZIndex=20000
if (!window.ttt)window.ttt={}
if (!ttt.traceCounter)ttt.traceCounter=0
  
var LF=String.fromCharCode(10)
if (!window.teamWikiGlobPara) window.teamWikiGlobPara={};


window.executeOnIniComplete= new Array()
executeOnIniComplete[executeOnIniComplete.length]='set_login_form_keydown_events();';


window.onDialogContextMenu=function(e){
}//endFunction


window.formatPrefix=function(string, fillChars, digitCount){
  var x=fillChars
  x=x+x+x+x; x=x+x+x+x; x=x+x+x+x; x=x+x+x+x;  
  string=x+string.toString()
  var lg=string.length
  var out=string.substr(lg-digitCount)
  return out  
}//endFunction 
  

window.wDesk_syntaxCheckDone= function() {
  if(!window.teamWikiGlobalPara)window.teamWikiGlobalPara={}
  var infoRef=findById("webEditor_info")
  if (!infoRef)return
  
  infoRef.style.textDecoration=""
  infoRef.style.backgroundColor="transparent"
  if (teamWikiGlobalPara.skipFormLoad==true){
    if(teamWikiGlobalPara.reload==1){
      wDesk_reloadPage()
    }
  }
  teamWikiGlobalPara.skipFormLoad=false
}//endFunction


window.surfPilot_onPageLoadDone=function(){
  // alert("surfPilot_onPageLoadDone")  
  // window.setTimeout('quickNav_show(13);', 555);
  window.setTimeout('quickNav_createSurfPilot();', 666);
}//endFunction



//-->
//-->I N I - 2: trace - - - - - - - - - -



window.trace=function(para1,para2){
}          //dummy  ...an dieser Stelle noch nicht verfuegbar
window.printLine=function(){
}          //dummy  ...an dieseer Stelle noch nicht verfuegbar





//-->
//-->
//-->L I B: dom - - - - - - - - -

function getInnerWidth(win) {
  if( typeof( window.innerWidth ) == 'number' ) {
    return window.innerWidth;
  } else {  
    return document.documentElement.clientWidth
  }
}//endFunction

function getInnerHeight(win) {
  if( typeof( window.innerHeight ) == 'number' ) {
    return window.innerHeight;
  } else {  
    return document.documentElement.clientHeight
  }
}//endFunction




window.findById=function(id){
  if (document.getElementById) return document.getElementById(id); 
  if (document.all) return document.all(id);
  return null
}//endFunction



window.appendNode=function(node,newNode){
  var nextSibling=node.nextSibling
  var parentNode=node.parentNode  
  if (!nextSibling)alert("appendNode: ...Fehler nextSibling")
  parentNode.insertBefore(newNode,nextSibling)
}//endFunction


window.removeElement=function(node){
  if(node){
    var ref=node.parentNode.removeChild(node)
    return ref
  }
  return null
}//endFunction


window.getElementsByClass=function(node,searchClass,tag) {
  var classElements = new Array();
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("b"+searchClass+"b");
  for (i = 0, j = 0; i < elsLen; i++) {
    if ( pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}


//--> ...

window.findParentNodeByTagName=function(startNode, findTagName){
  findTagName = findTagName.toLowerCase()
  if(!startNode) return false
  var el=startNode
  var tagName=""
  while(el.nodeName != 'BODY') {
    tagName= el.tagName ;
    if (tagName.toLowerCase()== findTagName){
      return el
    }
    el = el.parentNode;
  }
  return false
}//endFunction




window.findParentNodeByClassName=function(startNode, findClassName,partial){
  return findParentNodeByClass(startNode, findClassName,partial)
}//endFunction


window.findParentNodeByClass=function(startNode, findClassName,partial){
  findClassName = findClassName.toLowerCase()
  if(!startNode) return false
  var el=startNode
  var className=""
  while(el.nodeName != 'BODY') {
    if(el.className){ 
      className= el.className.toLowerCase() ;
      if (className == findClassName){
        return el
      }
      if (partial==true){
        if (className.indexOf(findClassName)>-1){
          return el
        }
      }
    }
    el = el.parentNode;
    if(!el) return false
  }
  return false
}//endFunction



window.findAttribute=function(startNode, findAttributeName){
  var el = findElementByAttribute(startNode, findAttributeName)
  if (el) return el.getAttribute(findAttributeName) ;
  return false
}//endFunction


window.findElementByAttribute=function(startNode, findAttributeName){
  if(!startNode) return false
  if(!findAttributeName) return false
  var el=startNode
  var getValue=""
  while(el) {
    getValue = el.getAttribute(findAttributeName) ;
    //alert(el.nodeName+"<-->"+el.id)
    //alert(getValue+"<--")
    if (getValue){
      return el
    }
    if(el.nodeName == 'BODY')return false;
    el = el.parentNode;
  }
  return false
}//endFunction



window.findChildByClass = function(startNode,childClassName,partial){
  // alert("findChildByClass(...globalHeader)")
  if(startNode != null){
    var children = startNode.getElementsByTagName("*")
    var e = null;
    var findChild=childClassName.toLowerCase();
    //trace("toLowerCase...",findChild);
    for (var t=0; t<children.length; t++){
      var c = children[t];
            //trace ("erg--->",c.className+"<--");
      var className=c.className.toLowerCase()
      if(className == findChild){
                  // trace ("FOUND:--->",c.className+"<--");
        return c;
      }
      if (partial==true){
        if (className.indexOf(findChild)>-1){
          return c
        }
      }

    }
    // trace("NOT FOUND(findTiddlerChildByClassName)",childName);
  }
  return null
}//endFunction


 window.findAllChildsByClass = function(startNode,childName,partial,firstChildsOnly,includeContainer){
    var fChildsOnly=false
    var inclContainer=false
    if (firstChildsOnly==true) fChildsOnly=true
    if (includeContainer==true) inclContainer=true
    if(startNode!= null){
      var ELEMENTS = new Array();
      var children = startNode.getElementsByTagName("*")
      var e = null;
      var findChild=childName.toLowerCase();
      if (includeContainer){
        if (startNode.className.toLowerCase()==findChild) ELEMENTS[ELEMENTS.length]=startNode
      }
      
      //trace("toLowerCase...",findChild);
      if (partial==true){
      for (var t=0; t<children.length; t++){
        var c = children[t];
        //trace ("erg--->",c.className+"<--");
        var cName=c.className.toLowerCase()
        if(cName.indexOf(findChild)>-1){
          //trace ("FOUND:--->",c.className+"<--");
          if (firstChildsOnly) {
            if (c.parentNode==startNode){
              ELEMENTS[ELEMENTS.length] = c;
            }
          }else{
            ELEMENTS[ELEMENTS.length] = c;
          }
        }
      }//endFor
      return  ELEMENTS
      }
      
      for (var t=0; t<children.length; t++){
        var c = children[t];
        //trace ("erg--->",c.className+"<--");
        if(c.className.toLowerCase() == findChild){
          //trace ("FOUND:--->",c.className+"<--");
          if (firstChildsOnly){
            if (c.parentNode==startNode){
              ELEMENTS[ELEMENTS.length] = c;
            }
          }else{
            ELEMENTS[ELEMENTS.length] = c;
          }
        }
      }//endFor
    
    //trace("NOT FOUND(findTiddlerChildByClassName)",childName);
    return ELEMENTS
    }
  }//endFunction



function addEvent(obj, type, fn) {
  if(!obj) return;
  if (obj.addEventListener)
    obj.addEventListener( type, fn, false );
  else if (obj.attachEvent) {
    obj["e"+type+fn] = fn;
    obj[type+fn] = function() { obj["e"+type+fn]( window.event ); } //@@-
    obj.attachEvent( "on"+type, obj[type+fn] );
  }
}//endFunction


window.processed=function(e) { 
  cancelEvent(e)
  return false; 
}//endFunction


window.cancelEvent=function(e) {
  if(!e) var e = window.event;
 
  //e.cancelBubble is supported by IE - this will kill the bubbling process.
  e.cancelBubble = true;
  e.returnValue = false;

  //e.stopPropagation works only in Firefox.
  if (e.stopPropagation) {
    e.stopPropagation();
    e.preventDefault();
  }
  return false;
}//endFunction


window.resolveTarget=function(e){
  if (!e)e=window.event
  var obj;
  if (e.target) {obj = e.target;return(obj);}
  else if (e.srcElement) obj = e.srcElement;
  if (obj.nodeType == 3) // defeat Safari bug
    obj = obj.parentNode;
  return(obj);
}//endFunction

function getMousePosition(e) {
  var posx = 0; var posy = 0;
  if (!e) var e = window.event;
    if (e.pageX || e.pageY){
      posx = e.pageX; posy = e.pageY;
    }
  else if (e.clientX || e.clientY){
    posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
    posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;
  }
  return {x:posx,y:posy}
}//endFunction


window.findElementPos=function(obj){
  var QQ={x:0,y:0};
  while (obj.offsetParent){
    QQ.y += obj.offsetTop;
    QQ.y -= obj.scrollTop;
    QQ.x += obj.offsetLeft;
    QQ.x -= obj.scrollLeft;
    obj = obj.offsetParent;
  }
  return QQ;
}//endFunction


window.tWiki_getText=function(el){
  if(!el) return ""
  var txt=el.data
  if (!txt) {
    var el2=el.firstChild
    txt=tWiki_getText(el2)
  }
  return txt
}//endFunction


function addClass(e,theClass)
{
	var currClass = e.className.split(" ");
	if(currClass.indexOf(theClass) == -1)
		e.className += " " + theClass;
}//endFunction

function removeClass(e,theClass)
{
	var currClass = e.className.split(" ");
	var i = currClass.indexOf(theClass);
	while(i != -1)
		{
		currClass.splice(i,1);
		i = currClass.indexOf(theClass);
		}
	e.className = currClass.join(" ");
}//endFunction

function hasClass(e,theClass)
{
	if(e.className)
		{
		if(e.className.split(" ").indexOf(theClass) != -1)
			return true;
		}
	return false;
}//endFunction


//-->
//-->L I B: andere - - - - - - - - -

window.wDesk_getCookie=function(NameOfCookie, defaultValue){
  if (document.cookie.length > 0){
    begin = document.cookie.indexOf(NameOfCookie+"=");
    if (begin != -1){
      begin += NameOfCookie.length+1;
      end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
      return unescape(document.cookie.substring(begin, end)); 
    }
    return defaultValue
  }
  return defaultValue
}//endFunction



window.wDesk_setCookie=function(NameOfCookie, value, expiredays){
  wDesk_setCookie33(NameOfCookie, value, expiredays * 24 * 3600 * 1000);
}//endFunction


window.wDesk_setCookie33=function(NameOfCookie, value, expiresec){
  var ExpireDate = new Date ();
  ExpireDate.setTime(ExpireDate.getTime() + (expiresec * 1000));
  document.cookie = NameOfCookie + "=" + escape(value) +
 ((expiresec == null) ? "" : "; expires=" + ExpireDate.toGMTString() + "; domain=teamwiki.net; path=/;");
}//endFunction


window.wDesk_delCookie=function(NameOfCookie){
  if (wDesk_getCookie(NameOfCookie))
    document.cookie = NameOfCookie + "=" +"; expires=Thu, 01-Jan-70 00:00:01 GMT; domain=teamwiki.net; path=/"
}//endFunction

window.wDesk_toggleCookie=function(NameOfCookie){
  if (wDesk_getCookie(NameOfCookie) == 'true') {
    wDesk_delCookie(NameOfCookie);
  } else {
    wDesk_setCookie(NameOfCookie, 'true', 333);
  }
}//endFunction


window.wDesk_getServerCookie=function(NameOfServerCookie){
  var value=teamWikiGlobalPara.userSettings[NameOfServerCookie]
  return value
}//endFunction
  
  
  
window.wDesk_setServerCookie=function(NameOfServerCookie, value){
  // format=empty -- Rückgabe leer
  // format=js -- ruft jsRequest_serverCookieSaved mit allen akt. Servercookies als para auf
  // var url="http://teamwiki.de/twiki/savesetting.php?set["+NameOfServerCookie+"]="+value
  var url="/php/set_servercookie.php?format=empty&set["+NameOfServerCookie+"]="+value;
  tWiki_loadScriptOnDemand(url);
}//endFunction






// ACHTUNG: please don't remove "+"
window.specialUnmask=function(x){
  if(x=="" || !x)return "";
  // please don't remove "+"
  var cc = String.fromCharCode, rr = replaceAll;
  x=rr(x,"{_!"+"ZS-_}", LF)
  x=rr(x,"{_!"+"SL-_}", "/")
  x=rr(x,"{_!"+"TAB-_}","t")
  x=rr(x,"{_!"+"BSL-_}", cc(92))
  x=rr(x,"{_!"+"APO-_}",'"')
  x=rr(x,"{_!"+"GF-_}", "'")
  x=rr(x,"{_!"+"au-_}", cc(228))
  x=rr(x,"{_!"+"ou-_}", cc(246))
  x=rr(x,"{_!"+"uu-_}", cc(252))
  x=rr(x,"{_!"+"AU-_}", cc(196))
  x=rr(x,"{_!"+"OU-_}", cc(214))
  x=rr(x,"{_!"+"UU-_}", cc(220))
  x=rr(x,"{_!"+"SZ-_}", cc(223))
  x=rr(x,"{_!"+"AMP-_}",cc(38))
  return x;
}//endFunction

function specialMask(x) {
  var cc = String.fromCharCode, rr = replaceAll;
  x = rr(x, "\r\n", "\n");       // Windows-ZS zu Unix-ZS
  x = rr(x, "\n", "{_"+"!ZS-_}");   // ZS = ZeilenSchaltung (=Neue Zeile)
  x = rr(x, "\t", "{_"+"!TAB-_}");  // TAB = TABulator
  x = rr(x, "/", "{_"+"!SL-_}");    // SL = SLash
  x = rr(x, cc(92), "{_"+"!BSL-_}");  // BSL = BackSLash
  x = rr(x, '"', '{_'+'!APO-_}');   // APO = Apostroph
  x = rr(x, "'", '{_"+"!GF-_}');    // GF = Gaensefuesschen
  x = rr(x, cc(228), "{_"+"!au-_}");
  x = rr(x, cc(246), "{_"+"!ou-_}");
  x = rr(x, cc(252), "{_"+"!uu-_}");
  x = rr(x, cc(196), "{_"+"!AU-_}");
  x = rr(x, cc(214), "{_"+"!OU-_}");
  x = rr(x, cc(220), "{_"+"!UU-_}");
  x = rr(x, cc(223), "{_"+"!SZ-_}");
  x = rr(x, cc(38), "{_"+"!AMP-_}");
  return x;
}

window.jsRequest_decode=function(x){
  return specialUnmask(x)
}//endFunction  



window.replaceAll=function(oldStr,findStr,repStr,maxCount) {
  if (!oldStr || oldStr=="")return ""
  var srchNdx = 0;
  var newStr = "";
  var loopCounter=1
  if (!maxCount) maxCount=9999999;
  while (oldStr.indexOf(findStr,srchNdx) != -1){ 
    newStr += oldStr.substring(srchNdx,oldStr.indexOf(findStr,srchNdx));
    newStr += repStr;
    srchNdx = (oldStr.indexOf(findStr,srchNdx) + findStr.length);
    loopCounter=loopCounter+1;
    if(loopCounter>maxCount) break
  }
  newStr += oldStr.substring(srchNdx,oldStr.length);
  return newStr;
}//endFunction
window.str_repeat = function(str,num) {
  return new Array(isNaN(num)? 1 : num*1 + 1).join(str);
}



String.prototype.trim = function() {
  return this.replace(/^s+/, '').replace(/s+$/, '');;
}//endFunction

window.playMySound=function(soundFileName){
  //more details: http://www.phon.ucl.ac.uk/home/mark/audio/play.htm
  var d=document
  var url="http://es.teamwiki.net/docs/attn.wav"
  if (soundFileName){
    if (soundFileName.indexOf("/") > -1)
      url=soundFileName
    else
      // url="http://es.php-sandbox.de/sound/"+soundFileName
      url="http://es.teamwiki.net/docs/attn.wav"
  }
  var id="my_Hidden_playMySound_Sound_Player"
  var el = findById(id)
  //alert(el)
  if (el) removeElement(el)

  el = d.createElement("span"); el.id=id
  var ss=el.style
  ss.left="-1111px"
  el.innerHTML="<embed src='"+url+"' hidden=true autostart=true loop=false>"
  var container=document.body
  container.appendChild(el);
  // alert("OK")
}//endFunction
function S4() {
   return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
function guid() {
   return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}


//-->
//-->L I B: jsRequest - - - - - - - -
//-->TEST-timestamp

  var timeStamp = new Date()
  timeStamp=timeStamp.getTime()
  wDesk_setCookie("timeStampLastClick2", timeStamp, 1)





window.tWiki_downloadInnerHtml = function(targetId,fileSpec) {
  // alert("tWiki_downloadUserToolBar")
  var target=findById(targetId)
  target.innerHTML=""
  var url = "http://teamwiki.de/_twiki/teamwiki.service.php?cmd=get_file";
  url = url + "&_filespec=" +fileSpec
  url = url + "&targetId=" + targetId
  url = url + "&jscallback=" + "jsRequest_insertInnerHTML";
  jsRequest_callService(url);
  //alert("tWiki_downloadUserToolBar OK ")
}//endFunction



function jsRequest_callService(url, url2) {
  // alert("AA1 jsRequest_callService: "+url)
  //wDesk_dumpUrl(url)
  var req = document.createElement("SCRIPT");
  if (url2) url += "?" + url2;
  req.src = url;
  document.body.appendChild(req);
  // document.body.removeChild(req);
  
}//endFunction


function jsRequest_handleCallback(HEADER, CONTENT) {
  // alert("jsRequest: ")
  var destFuncName=HEADER.p_destFuncName
  
  // alert("jsRequest: "+destFuncName)
  if(destFuncName){
    var debug=twiki_dumpObj2(HEADER)
    // alert(debug)
    destFuncName="jsRequest_"+destFuncName
    var destFunc=eval(destFuncName)
    destFunc(HEADER, CONTENT)
    //alert("OK ???")
  }else{
    alert("jsRequest_handleCallback: destFuncName >"+destFuncName+"< not found !")
  }
}//endFunction






//-->
//--> j s R E Q U E S T 



window.jsRequest_insertInnerHTML=function(HEADER, CONTENT) {
  jsRequest_insertToElement(HEADER, CONTENT)
}//endFunction

window.jsRequest_insertToElement=function(HEADER, CONTENT){
  
  // alert("aaaaaaaaa jsRequest_insertToElement: "+HEADER.p_targetId)
  if (HEADER["infoMessage"] != "") alert(HEADER["infoMessage"]);
  var targetId=HEADER.p_targetId
  
  var content=specialUnmask(CONTENT.content)
  var dest =findById(targetId); 
  var type=dest.type
  if (type=="textarea"){
    dest.value=content
    return
  }
  dest.value=""
  var place=dest // ob das funktioniert ???
  dest.innerHTML=content
  var checkPos=0
  while (checkPos > -1){
    var startPos=content.indexOf("<script>",checkPos)
    if (startPos >-1){
      checkPos=startPos+2
      var endPos=content.indexOf("</script>",checkPos)
      if (endPos > -1) {
        checkPos=endPos+2
        // var scriptData=content.substr(startPos+8,endPos-startPos-8)
        var scriptData=content.substring(startPos+8,endPos)
        // alert("-->"+scriptData+"<--")
        try{
          // alert(startPos+"  "+endPos+" "+targetId+" =TARGET / scriptData(trace): "+scriptData)
          eval(scriptData)
        }catch(ex){
          var line="============================================="  //@@-
          alert(targetId+" =TARGET / ERROR in UserToolbar:"+LF+line+LF+LF+ex+LF+LF+line)}
      }else{
        checkPos=-1
      }
    }else{
      checkPos=-1 
    }
    checkPos=-1 
  }//endWhile
}//endFunction


window.twiki_dumpObj2=function(DATA){
  var TEMP=DATA
  var OUT=new Array()
  if(!TEMP.length){
    TEMP=new Array()
    TEMP[TEMP.length]=DATA
  } 
  var max =TEMP.length
  for (var i = 0; i < max; i++){
    var ITEM=TEMP[i]
    OUT[OUT.length]=LF+"____________________: ITEM-NR: "+i
    for(var obj in ITEM) {
      var obj2=formatPrefix(obj, "_", 20)
      var element = ITEM[obj];
      // element=replaceAll(element,"{_"+"!LF-"+"_}",LF)
      OUT[OUT.length]=obj2+": "+element+"<--"
    }
  }
  var RESULT=OUT.join(LF)
  RESULT=replaceAll(RESULT,"{_"+"!ZS-"+"_}",LF)
  return RESULT
}//endFunction



//-->
//-->
//-->E V E N T S . . . 


window.onMouseMove=function(e){
  var useQuickNav=wDesk_getCookie("check_useQuickNav")
  var useQuickMenue=wDesk_getCookie("check_useQuickMenue")
  var quickMenueFix=wDesk_getCookie("check_quickMenueFix")
  // trace("onMouseMove",useQuickNav)
  if(!e) e=window.event;
  var target=resolveTarget(e)
  
  var MOUSE=getMousePosition(e)
  var xx=MOUSE.x; var yy=MOUSE.y
  //trace("onMouseMove): "+xx,yy)

  // if (useQuickNav != "TRUE") return
  var action=""  
  var action2="" 
 
  // alert("useQuickMenue",useQuickMenue) 
  // alert("quickMenueFix ",quickMenueFix ) 
  if (useQuickMenue == "TRUE" && quickMenueFix != "TRUE") {
    var quickMenue=findById("quickMenue")
    if (yy<100){
      // action2="show"
      if(quickMenue)quickMenue.style.display="block"
    }  
    if (yy>150) {
      //action2="hide"  
      if(quickMenue)quickMenue.style.display="none"
    }
  }
  if (yy<100) action="show"  
  if (xx>200) action=""
  if (xx>350) {
    var popsel_fix=wDesk_getCookie("check_popsel_fix")
    // trace("popsel_fix", popsel_fix)
    if (popsel_fix != "TRUE") action="hide"
  }
  // if (yy>350) action="hide"
  if (action=="") return
  var quickNav= findById("quickNav")
  var popselBar=findById("popselBar")
  // trace("onMouseMove): "+action,popselBar)
  // trace("onMouseMove): "+yy,quickNav)

  if(action=="show"){
    if (useQuickNav != "TRUE") return
    if(popselBar)popselBar.style.display="block"
    if(quickNav)quickNav.style.display="block"
    if(quickNav)quickNav.className="quickNav"
    if(popselBar)popselBar.className="popselBar"
  }else{
    if(popselBar)popselBar.style.display="none"
    if(quickNav)quickNav.style.display="none"
    if(quickNav)quickNav.className="quickNav_hidden"
    if(popselBar)popselBar.className="popselBar_hidden"
  }
  // trace("OK ???",popselBar.visibility)
}//endFunction

//   document.onkeydown = function(e){
//   if(!e) e=window.event;
//   // alert(e.ctrlKey)
//   if(e.ctrlKey && e.shiftKey) {
//      window.globSkipAllIni=true
//      // alert("skipAll") 
//   }
//   keyboardMonitor("onkeydown", e);
// }//endFunction


// document.onkeyup = function(e){
//   if(!e) e=window.event;
//   keyboardMonitor("onkeyup", e);
// }//endFunction


// function keyboardMonitor(eventname, e) {
//   var target = resolveTarget(e);
//   var div = findById("twMicroDebugMonitor");
//   if(div)div.innerHTML =e.keyCode+" "+target.tagName+" ["+eventname+"]";
//   printLine(1,e.keyCode,target.tagName)
//   var key=e.keyCode
//   if (key==27||key==112||key==113||key==114||key==115||  key==115  ||key==117||key==118||key==119||key==121){
//     // alert("treffer")
//     cancelEvent(e)
//   }
//   //es:meinKeyboardHook -- > finger weg ;-)
//   try{eval("globKeyboardHook_"+key+"(e)")}catch(ex){}
//   
//   if(eventname != "onkeydown") return
//   switch(key) {
//     case 121:
//       loadHelp();
//       break;
//     case 123:
//       if (pinboardKeyHandler)pinboardKeyHandler(e);
//       break;
//   }
//   return false  
// }//endFunction







window.onContainerDummyClick=function(e){
  if(!e)e=window.event
  var controlKey=e.ctrlKey
  var shiftKey=e.shiftKey
  if (controlKey==true || shiftKey==true ){
    cancelEvent(e)
    return false
  }
}//endFunction



window.onContainerMouseUp=function(e){
  if(!e)e=window.event
  var target=resolveTarget(e)
      printLine(7, "onContainerMouseUp" , target)
 

 var timeStamp = new Date()
  timeStamp=timeStamp.getTime()
  // alert(timeStamp)
  wDesk_setCookie("timeStampLastClick", timeStamp, 1)
  
  domWindow_bringToFront(target) //NEU

  var MOUSE=getMousePosition(e)
  var xx=MOUSE.x; var yy=MOUSE.y
  trace("MOUSE-POS(onContainerMouseUp): "+xx,yy)
  var action="hide"  
  var action="noAction"  
  if (e.ctrlKey==true){
    // alert("e.ctrlKey==true")
    window.glob_editorPara={}
    var q = window.glob_editorPara
    q.filetype="page"
    q.id      =""
    q.user    =""
    q.file    =""
    q.url     =target.href
    // alert(q.url)
    // window.glob_fileSpecForEditor="bankeinzugsdiskette.html"
    // window.glob_userForEditor="es"
    
    showEditor()
    return
    
    // alert("contol...")
    if (xx<240) action="show"
    if (xx>270) action="hide"
    if (yy<85){
      twEdit_hideEditor()
      tWiki_hideBrowser()
      action="hide" 
    }
  }
  if (xx<240 && yy<85)action="noAction"
  var tagName=target.tagName
  trace("tagName",tagName+"<==")
  if (tagName=="TEXTAREA")action="noAction" // "hide"
  if (tagName=="A")action="noAction"
  trace("action",action)
  var hotLinksExpanded=findById("hotLinksExpanded")
  if(hotLinksExpanded){
    if (hotLinksExpanded.style.display != "none" ){
      if (action=="hide") hotLinksExpanded.style.display="none"
    }else{
      if (action=="show") hotLinksExpanded.style.display="block"
    }
  }else{
    if (action=="show"){
      
      // alert("onContainerMouseUp: action==show")
      quickNav_create(true)
      var hotLinksExpanded=findById("hotLinksExpanded")
      hotLinksExpanded.style.display="block"
    }
  }
  var id=target.id
  // trace("onContainerMouseUp - A2",id )
  return true

}//endFunction
  
window.onContainerMouseClick=function(e){
  
  if(!e)e=window.event
  var target=resolveTarget(e)
  printLine(5, "onContainerMouseClick 949" , "??? ")
  // return
  
  // alert(window.parent)
  // alert(window.parent.location)
  // var loc1 = window.location
  // var loc2 = window.parent.location
  // alert("-->"+loc1+"<--"+"-->"+loc2+"<--")
  // alert("-->"+loc2+"<--")
  var url=target.href
  // alert(url.substr(0, 10))
   // if (window.parent.iBrowser && url.substr(0, 10) != "javascript") {
   //   e.cancelBubble=true; 
   //   if (e.stopPropagation)e.stopPropagation();
    //  e.cancelDefault = true;
    //  printLine(1, "defaultBrowser_inline" ,"url ???")
    //  var url=target.href
   //   printLine(2, "defaultBrowser_inline" ,url)
   //   if(url) window.parent.iBrowser(url + "?view=1")
  //    return false
  //  }  
  
  var id=target.id
  if (e.button==2)return true
  
  // trace("onContainerMouseClick - A3",id )
  printLine(13, "onContainerMouseClick" ,window.skipNextMouseClick)
  
  var navIBrowser = findParentNodeByClassName(target, "defaultBrowser_inline",true)
  if (navIBrowser){
    e.cancelBubble=true; 
    if (e.stopPropagation)e.stopPropagation();
    e.cancelDefault = true;
    printLine(1, "defaultBrowser_inline" ,"url ???")
    var url=target.href
    printLine(2, "defaultBrowser_inline" ,url)
    if(url) iBrowser(url)
    return false
  }
  
  
  // window.skipNextMouseClick=true  //TEST
  
  if(window.skipNextMouseClick==true){
    window.skipNextMouseClick=false
    e.cancelBubble=true; 
    if (e.stopPropagation)e.stopPropagation();
    e.cancelDefault = true;
    printLine(14, "onContainerMouseClick" ,"CANCEL - OK")
    return false
  }
  printLine(14, "onContainerMouseClick" ,"CANCEL - XXX")
  return true

}//endFunction


window.onclick=onContainerMouseClick


window.onContainerMouseDown=function(e){


  return true
}//endFunction

window.iBrowser=function(url){
  wDesk_navigateDefaultBrowser(url)
}//endFunction

window.checkIsCurUrl=function(url){
  if(!url) return false
  if (url.trim()=="") return false
  url=String(url)
  var abPos=url.indexOf("?")
  if (abPos>-1)url=url.substr(0,abPos)
  var abPos=url.indexOf("#")
  if (abPos>-1)url=url.substr(0,abPos)
  var curUrl=String(window.location.href)
  // alert(curUrl)
  var RESULT =false 
  if(curUrl && url != ""){
    var abPos= curUrl.indexOf(url)
    if (abPos>-1)RESULT=true
  }
  return RESULT
}//endFunction





window.wDesk_navigateDefaultBrowser=function(url){
  // alert("defaultBrowser: "+url)
  // return;    //spendiert von Max  // du alles kaputt-Macher
  
  
  // alert(window.parent.myParentFlag)
  // alert(window.location)
  // alert(window.parent.location)
  // if (window.parent.location !=window.location){
  //   alert("FOUND")
  //   parent.wDesk_navigateDefaultBrowser(url)
  //   return
  // }
  
  if(!window.teamWikiGlobalPara) window.teamWikiGlobalPara = {}
  var id="domDialog_defaultBrowser"
  var defaultBrowser=findById(id)
  // alert(defaultBrowser)
  if (!defaultBrowser){ 
    if(url)teamWikiGlobalPara.navigateIBrowser=url
    // wDesk_createDefaultBrowser()
    tWiki_showBrowser(url)
    return
  }
  defaultBrowser.style.visibility="visible"  
  domWindow_bringToFront(defaultBrowser)
  // defaultBrowser.style.top="11px"
  //alert(defaultBrowser.style.top)
  
  // if (!url)url=teamWikiGlobalPara.navigateIBrowser
  if (!url)url=""
  var iFrame=findById("wDesk_defaultBrowser")
  iFrame.src=url
  var urlBar=findById("inlineBrowser_url")
  urlBar.value=url
  
}//endFunction




window.tWiki_showBrowser=function(url) {
  var browser=findById("domDialog_defaultBrowser")
  if (browser){
    browser.style.visibility="visible"
    domWindow_bringToFront(browser)
    return
  }
  teamWikiGlobalPara.navigateIBrowser=url

  // alert("tWiki_showEditor")
  // unsafeWindow.tWiki_loadScriptOnDemand("http://teamwiki.de/static/js/global_ini.js")
  // tWiki_loadScriptOnDemand("http://teamwiki.de/static/js/twiki_ibrowser2.js")
    window.setTimeout('tWiki_loadScriptOnDemand("http://teamwiki.de/static/js/twiki_ibrowser.js")',22)
  // tWiki_loadScriptOnDemand("http://teamwiki.de/static/js/twiki_ibrowser.js")
}//endFunction


window.tWiki_hideBrowser=function() {
  var browser=findById("domDialog_defaultBrowser")
  if (browser){
    browser.style.visibility="hidden"    
    browser.style.top="-3333px"
    return true
  }
  return false
}//endFunction



window.winOnContextMenuDummy=function(e){
  //alert("window.winOnContextMenu")
  if(!e)e=window.event
  trace("winOnContextMenuDummy",e.button)
  e.cancelBubble=true; 
  if (e.stopPropagation)e.stopPropagation();
  // toggleDomWindowState(e); 
  return false; 
}//endFunction





//-->
//-->P S E U D O - C H E C K B O X


window.tWiki_pseudoCheckboxIni=function(id,bgColor){
  var testMode=wDesk_getCookie(id)
  var el=findById(id)
  if(!el){
    alert("ERR in 'tWiki_pseudoCheckboxIni': "+id) // ??? wann passiert das ...
    return
  }
  // alert(el)
  if(bgColor)el.setAttribute("useHighlight",bgColor)
  // if(funcName)el.setAttribute("action1",funcName)
  if (testMode=="TRUE" || testMode=="1"){
    tWiki_togglePseudoCheckbox(el,true,true)
    wDesk_setCookie(id, "TRUE", 9999)
  }
}//endFunction


window.tWiki_checkPseudoCheckbox=function(id){
  var el=findById(id)
  alert(id)
  var label=el.data
  alert(label)
  var isChecked1=label.indexOf("[x]")
  var isChecked2=label.indexOf("[ x ]")
  var state="FALSE"
  if(isChecked1 > -1 || isChecked2 > -1) state="TRUE"
  tWiki_togglePseudoCheckbox(el.target)
}//endFunction


window.tWiki_togglePseudoCheckbox = function(target,unknown,ini) {
  //alert("tWiki_togglePseudoCheckbox")
  if (!target)return
  var id=target.id 
  var el=target.firstChild
  var label=el.data
  var useHighlight=target.getAttribute("useHighlight")
  // alert(label)
  var check1="[x]";check2="[_]"
  if (label.indexOf("[ x ]")> -1  || label.indexOf("[ _ ]")> -1  ){check1="[ x ]";check2="[ _ ]"}
  // trace("check-aa",label.indexOf("[ x ]"))
  //trace("check-bb",label.indexOf("[ _ ]"))
  // trace(id,check1)
  // trace(id,check2)
  var isChecked=label.indexOf(check1)
  // alert(isChecked)
  var onTrace=check1
  if (isChecked > -1){
    var mode="FALSE"
    var mode2="0"
    onTrace=check2
    label=replaceAll(label,check1,check2);
    if (useHighlight)target.style.backgroundColor="transparent"
  } else {
    var mode="TRUE"
    var mode2="1"
    label=replaceAll(label,check2,check1);
    if (useHighlight)target.style.backgroundColor=useHighlight
  }
  el.data=label
  trace(id,onTrace)
  // alert(id)
  var checkboxMode=target.getAttribute("checkboxMode")
  if (checkboxMode=="NULL-EINS"){
    wDesk_setCookie(id, mode2, 1)
  }else{
    wDesk_setCookie(id, mode, 1)
  }
  tWiki_pseudoCheckboxCallBack(mode,target,ini)
}//endFunction



window.tWiki_getPseudoCheckboxState = function(id) {
  var cookie=wDesk_getCookie(id)
  var state=false
  if (cookie=="TRUE") state=true
  if (cookie=="1") state=true
  return state
}//endFunction
  

window.tWiki_pseudoCheckboxCallBack=function(state,target,ini){
  // alert("tWiki_pseudoCheckboxCallBack")
  var funcName=target.getAttribute("action1")  
  // alert("funcName")
  // alert(funcName)
  if(funcName && funcName != 'undefined'){
    try{
      // alert("funcRef="+funcName)
      eval("var funcRef="+funcName)
      funcRef(state,target,ini)
    }catch(ex){}
  }else{
    // alert("id: "+target.id)
    try{
      eval("var funcRef=func_"+target.id)
      // alert(funcRef)
      funcRef(state,target,ini)
    }catch(ex){}
  }
  // var testMode=wDesk_getCookie("wEdit-testMode")
  // alert(testMode)
}//endFunction


window.func_check_useInlineBrowser=function(stat){
  // alert("check_useInlineBrowser: "+stat)
}//endFunction


//--> D O M - W I N D O W  - - - - - - - - - 

// hier kommen noch circa 6500 her
  
//-->
//-->D O M - D R A G  - - - - - - - - - 

//ACHTUNG: iBrowser hat noch einen falschen prog-Aufrauf drinnen
window.onTitleBarClick=function(lastMouseX,lastMouseY,root,nix1,nix2,e,dragStart){
  window.onDomWindowTitleBarClick(lastMouseX,lastMouseY,root,nix1,nix2,e,dragStart)
}//endFunction



window.onDomWindowTitleBarClick=function(lastMouseX,lastMouseY,root,nix1,nix2,e,dragStart){
  var target=root; if(!target){
    target=findParentNodeByClass(lastMouseX.target)
    // alert(root)
    // target=findParentNodeByClass(lastMouseX.target, "domDialog",false) // ...dann ists ein event
    // alert(target.className)
  }
  domWindow_bringToFront(target)
  return
  
  if(!window.globDomWindowZIndex)window.globDomWindowZIndex=20000
  if (dragStart=="dragStart" || dragStart==null){
    globDomWindowZIndex=globDomWindowZIndex+1
    target.style.zIndex=globDomWindowZIndex
  }
  // printLine(1, "onTitleBarClick",globDomWindowZIndex) // ... = mouseDown
  // printLine(2, "onTitleBarClick",dragStart) // ... = mouseDown
  // printLine(7, "onTitleBarClick",lastMouseX) // ... = mouseDown
  // printLine(8, "onTitleBarClick",target) // ... = mouseDown
}//endFunction
 
window.domWindow_bringToFront=function(anyChild){
  if(!anyChild)return
  domWindow=findParentNodeByClass(anyChild, "domDialog",true)  
  if (domWindow==false)return
  if(!window.globDomWindowZIndex)window.globDomWindowZIndex=20000
  if(!window.globDomWindowLastSelWindow) window.globDomWindowLastSelWindow=null
  if(domWindow==globDomWindowLastSelWindow)return
  globDomWindowZIndex=globDomWindowZIndex+1
   domWindow.style.zIndex=globDomWindowZIndex


}//endFunction
   
  //TYPE=SCRIPT//...SCRIPT/TODO/CSS/HTML/
  // alert(111)
  // **************************************************
  // * dom-drag.js
  // * 09.25.2001
  // * www.youngpup.net
  // **************************************************
  // * 10.28.2001 - fixed minor bug where events
  // * sometimes fired off the handle, not the root.
  // **************************************************/
 
  window.Drag2=null
  if(!window.globScriptVar)window.globScriptVar={}
  
  //alert(222)
  window.Drag2 = {
    obj : null,
    init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper,callBackXY,callBackOnMouse) {
    o.onmousedown = Drag2.start;
  
    o.hmode = bSwapHorzRef ? false : true ;
    o.vmode = bSwapVertRef ? false : true ;
  
    o.root = oRoot && oRoot != null ? oRoot : o ;
  
    if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px";
    if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px";
    if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px";
    if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";
  
    o.minX = typeof minX != 'undefined' ? minX : null;
    o.minY = typeof minY != 'undefined' ? minY : null;
    o.maxX = typeof maxX != 'undefined' ? maxX : null;
    o.maxY = typeof maxY != 'undefined' ? maxY : null;
  
    o.xMapper = fXMapper ? fXMapper : null;
    o.yMapper = fYMapper ? fYMapper : null;
    o.callBackXY=callBackXY ? callBackXY : null;
    o.callBackOnMouse=callBackXY ? callBackXY : null;
  
    o.root.onDragStart = new Function();
    o.root.onDragEnd = new Function();
    o.root.onDrag = new Function();
    },
  
  
  
  
    start : function(e) {
    if(!e)e=window.event    
    if (window.glob_pinboardSkipDragDrop==true){  // für links, damit die clickbar sind
      window.glob_pinboardSkipDragDrop=false
      return
    }
    var target=resolveTarget(e)
    if (target.getAttribute("dragDropControl")=="noMove")  return // NEU es
    
    if (e.ctrlKey || e.shiftKey ){
      // return
    }
   if (e.button==2){
      // return
    }
    var o = Drag2.obj = this;
    window.globDragDropObject=o
    var glob=window.globScriptVar
    glob.curWindowResizerObj=o
    glob.curWindowResizerState="START"
    // trace("<<<<--->>>>> drag2-startClass",o.className)
    // trace("<<<<--->>>>> drag2-startID",o.id)
    e = Drag2.fixE(e);
    var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
    var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
    o.root.onDragStart(x, y);
    o.dragCounter=5
    o.dragNextTimerEvent=new Date()
    o.lastMouseX = e.clientX;
    o.lastMouseY = e.clientY;
    o.startPosX = x - e.clientX;
    o.startPosY = y - e.clientY;
    o.startX=x
    o.startY=y
    o.clientX=e.clientX
    o.clientY=e.clientY
    o.lastNX=0
    o.lastNY=0
  
    if (o.hmode) {
      if (o.minX != null) o.minMouseX = e.clientX - x + o.minX;
      if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX;
    } else {
      if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
      if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
    }
  
    if (o.vmode) {
      if (o.minY != null) o.minMouseY = e.clientY - y + o.minY;
      if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY;
    } else {
      if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
      if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
    }
  
    // alert("document.onmousemove -- OK")
    document.onmousemove = Drag2.drag;
    document.onmouseup = Drag2.end;
    // onIconSelect(o.className) //ACHTUNG: zur zeit f�r createIconBar belegt !!!
    //if(o.callBackOnMouse) o.callBackOnMouse(o.lastMouseX,o.lastMouseY,o.root,o.className,o.id,e,"dragStart")
    if(o.callBackOnMouse) o.callBackOnMouse(o.lastMouseX,o.lastMouseY,o.root,null,null,e,"dragStart")
    //???    
    //???   
    e.cancelBubble; if (e.stopPropagation) e.stopPropagation()
    
    // ....Irrläufer ???: glob_pinboardSkipDragDrop
    return false
    return ;
    },
  
  
  
    drag : function(e){
    e = Drag2.fixE(e);
    var o = Drag2.obj;
  
    var ey = e.clientY;
    var ex = e.clientX;
    
    
    
    
    // trace("scriptLib01-ex", ex)
    // trace("scriptLib01-ey", ey)
    
    
    
    
    var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom);
    var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
    var nx, ny;
  
    if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
    if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
    if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
    if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);
  
    nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
    ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));
  
    //if (o.xMapper) nx = o.xMapper(x,y,o.root,o.className,o.id,e,"xMapper")
    if (o.xMapper) nx = o.xMapper(x,nx,ex,o.lastMouseX,o.startPosX)
    //else if (o.yMapper) ny = o.yMapper(y,y,o.root,o.className,o.id,e,"yMapper")
    if (o.yMapper) ny = o.yMapper(y,ny,ey,o.lastMouseY,o.startPosY)
    
  
    Drag2.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
    Drag2.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
    
    
    // trace("Drag2.obj.root.style.left",Drag2.obj.root.style.left )
    // trace("Drag2.obj.root.style.top",Drag2.obj.root.style.top )
    
    
    Drag2.obj.lastMouseX = ex;
    Drag2.obj.lastMouseY = ey;
  
    Drag2.obj.root.onDrag(nx, ny);
    o.nx=nx
    o.ny=ny
    o.e=e // ?? ist das zul�ssig ???: nein
    o.eType=e.type
    o.button=e.button
    o.altKey=e.altKey
    o.ctrlKey=e.ctrlKey 
    o.shiftKey=e.shiftKey 
    //es...
    e.cancelBubble; if (e.stopPropagation) e.stopPropagation()
    var glob=window.globScriptVar
    if (glob.curWindowResizerState=="START"){
      glob.curWindowResizerState="DRAG"
    }
  
      if(o.callBackXY) {
        o.callBackXY(o.nx,o.ny,o.root,o.className,o.id,e ,"mouseMove")
        // o.callBackXY(o.nx,o.ny,o.root,o.className,o.id,e ,"mouseMove")
      }
  
    // trace("333a style.left",Drag2.obj.root.style.left )
    // trace("333b style.top",Drag2.obj.root.style.top )
    
 
    refreshDisplayHack(ny)
    return false;
    },
  
  
  
  
  
  
  
    end : function(e){
    e = Drag2.fixE(e);
    var o = Drag2.obj;
    var glob=window.globScriptVar
    glob.curWindowResizerState="END"
    //alert("dragEnd!!!")
    
    // var o = document.onmousemove = null;
    document.onmousemove = null;
    document.onmouseup = null;
    e.cancelBubble; if (e.stopPropagation) e.stopPropagation()
    Drag2.obj.root.onDragEnd(parseInt(Drag2.obj.root.style[Drag2.obj.hmode ? "left" : "right"]), 
      parseInt(Drag2.obj.root.style[Drag2.obj.vmode ? "top" : "bottom"]));
    if(o.callBackOnMouse) o.callBackOnMouse(o.lastMouseX,o.lastMouseY,o.root,o.className,o.id,e,"dragEnd")
    //// if(o.callBackOnMouse) o.callBackOnMouse(o.lastMouseX,o.lastMouseY,o.root,null,null,e.type,"dragEnd")
    if(o.callBackXY) {
      //o.callBackXY(nx,ny,o.root,o.className,o.id,e.type,"mouseMove")
    }
  
    // onDomWinPosChanged_B("demo_pointer")
    
    var el=findById("captureIbrowserEvents")
    if(el)removeElement(el)
    
    var o = null;
    Drag2.obj = null;
          return false
    },
    fixE : function(e){
    if (typeof e == 'undefined') e = window.event;
    if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
    if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
    return e;
    }
  
  };


//-->


window.twiki_toggleDevTools=function(){
  var el=findById("domDialog_devTools")
  if(el){
    var ss=el.style
    if (ss.display=="none"){
      ss.display=""
    }else{
      ss.display="none"
    }
  }else{
    tWiki_loadScriptOnDemand("http://teamwiki.de/static/js/dev_tools.js") 
  }
}//endFunction


window.twiki_toggleMicroIde=function(){
  var el=findById("rendarMain")
  if(el){
    twiki_toggleMicroIde2()
  }else{
    tWiki_loadScriptOnDemand("http://teamwiki.de/static/js/web_ide.js") 
  }
}//endFunction

window.twiki_toggleMicroDomViewer=function(){
  var el=findById("domDialog_domViewer2007")
  if(el){
    var ss=el.style
    if (ss.display=="none"){
      ss.display=""
    }else{
      ss.display="none"
    }
  }else{
    tWiki_loadScriptOnDemand('http://teamwiki.de/static/js/html_domViewer.js')
    window.setTimeout("tWiki_loadScriptOnDemand('http://teamwiki.de/static/js/html_domViewer.js')",1555)    
  }
}//endFunction



//-->
//--> C B B custom border


/*
cbb function by Roger Johansson, http://www.456bereastreet.com/
*/
var cbb = {
    init : function() {
    // Check that the browser supports the DOM methods used
        if (!document.getElementById || !document.createElement || !document.appendChild) return false;
        var oElement, oOuter, oI1, oI2, tempId;
    // Find all elements with a class name of cbb
    // 
        var arrElements = document.getElementsByTagName('*');
        var oRegExp = new RegExp("(^|\\s)cbb(\\s|$)");
        for (var i=0; i<arrElements.length; i++) {
  
    // Save the original outer element for later
            oElement = arrElements[i];
            cbb.createCustomBorderBox(oElement,oRegExp)
         }
    },
    
    createCustomBorderBox : function(oElement) {
         var oRegExp = new RegExp("(^|\\s)cbb(\\s|$)");
         if (oRegExp.test(oElement.className)) {
                //     Create a new element and give it the original element's class name(s) while replacing 'cbb' with 'cb'
                oOuter = document.createElement('div');
                oOuter.className = oElement.className.replace(oRegExp, '$1cb$2');
                // Give the new div the original element's id if it has one
                if (oElement.getAttribute("id")) {
                    tempId = oElement.id;
                    oElement.removeAttribute('id');
                    oOuter.setAttribute('id', '');
                    oOuter.id = tempId;
                }
                // Change the original element's class name and replace it with the new div
                oElement.className = 'i3';oElement.id = 'innerBorderWin';
                oElement.parentNode.replaceChild(oOuter, oElement);
                // Create two new div elements and insert them into the outermost div
                oI1 = document.createElement('div');
                oI1.className = 'i1';
                oOuter.appendChild(oI1);
                oI2 = document.createElement('div');
                oI2.className = 'i2';
                oI1.appendChild(oI2);
                // Insert the original element
                oI2.appendChild(oElement);
                // Insert the top and bottom divs
                cbb.insertTop(oOuter);
                cbb.insertBottom(oOuter);
            }
   
    },
    
    insertTop : function(obj) {
        var oOuter, oInner;
    // Create the two div elements needed for the top of the box
        oOuter=document.createElement("div");
        oOuter.className="bt"; // The outer div needs a class name
        oInner=document.createElement("div");
        oOuter.appendChild(oInner);
        obj.insertBefore(oOuter,obj.firstChild);
    },
    insertBottom : function(obj) {
        var oOuter, oInner;
    // Create the two div elements needed for the bottom of the box
        oOuter=document.createElement("div");
        oOuter.className="bb"; // The outer div needs a class name
        oInner=document.createElement("div");
        oOuter.appendChild(oInner);
        obj.appendChild(oOuter);
    },
    // addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
    addEvent : function(obj, type, fn) {
        if (obj.addEventListener)
            obj.addEventListener(type, fn, false);
        else if (obj.attachEvent) {
            obj["e"+type+fn] = fn;
            obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
            obj.attachEvent("on"+type, obj[type+fn]);
        }
    }
};

cbb.addEvent(window, 'load', cbb.init);



//-->
//-->q u i c k T O U R 


window.esTrim2=function(curLine){
  // curLine=curLine+" "  // ???
  var checkChar=""
  for (var i = 0; i < curLine.length; i++) {
    checkChar=curLine.substr(i,1);
    if (checkChar!=" " && checkChar!=String.fromCharCode(9)){
      var foundPos=i;
      break;
    }
  }
  curLine=curLine.substr(foundPos)+" "
  for (var i = curLine.length-1; i > 0; i--) {
    checkChar=curLine.substr(i,1);
    // alert("-->"+checkChar+"<--")
    if (checkChar!=" " && checkChar!=String.fromCharCode(9)){
      foundPos=(i);
      //trace("==>autoIndentKeyDown 444",foundPos, ".sys_tText");
      // ??? !!! --> irrl?ufer ???break;createGlobFunctionList(tagNames)
      break;
    }
  }
  // alert(foundPos)
  curLine=curLine.substr(0,(foundPos+1))
  // alert("-->"+curLine+"<--")
  return curLine
}//endFunction


window.getQuickTourData=function() {
  var LF=String.fromCharCode(10);
  var q = new Array() 
  q[q.length]=''
  q[q.length]=' | <b>Wichtige Befehle</b>::#wichtige_befehle '
  q[q.length]=' | | QuickTour verwenden '
  q[q.length]=' | | System-Menü'
  q[q.length]=' | | einloggen / ausloggen::#einloggen-ausloggen '
  q[q.length]=' | | Seite bearbeiten '
  q[q.length]=' | | Menü bearbeiten '
  q[q.length]=' | | Passwort ändern::#passwort-aendern2 '
 
  
  
  q[q.length]=' | <b>Seiten-Befehle</b>::#seiten-befehle '
  // q[q.length]=' | | Seite bearbeiten::#seite-bearbeiten2 '
  q[q.length]=' | | Seitenberechtigung '
  q[q.length]=' | | Seiten umbenennen::#Dateien-umbenennen '
  q[q.length]=' | | Neue Seite anlegen::#neue-seite-anlegen2  '
  q[q.length]=' | | Seite löschen '
  q[q.length]=' | | Menü bearbeiten::#menue-bearbeiten2 '

  q[q.length]=' | <b>Editor</b> (Seite bearbeiten)::#editor '
  q[q.length]=' | | Editor starten::#seite_bearbeiten3 '
  // q[q.length]='//  | | Texteingabe '
  q[q.length]=' | | Überschriften::#ueberschriften '
  // q[q.length]=' | | Vorschau '
  // q[q.length]=' | | FormatBar '
  q[q.length]=' | | Schrift-Attribute '
  q[q.length]=' | | Tabellen '
  q[q.length]=' | | Bilder einfügen::#bilder-einfuegen'
  q[q.length]=' | | Links einfügen::#links-einfuegen'
  q[q.length]=' | | Tags '
  // q[q.length]=' | | Sidebar::Sidebar ??? '
  q[q.length]=' | | Makros ??? '
  // q[q.length]='//  | | ColorBoxen (CSS-Templates) '
  q[q.length]=' | | neue Seite anlegen '
  
  q[q.length]=' | <b>Menü</b> (Navigation)::#menue '
  q[q.length]=' | | Menü bearbeiten::#menue-bearbeiten'
  // q[q.length]='//  | | Menü-Ebenen '
  q[q.length]=' | | Menü-Bilder::#menue-bilder'
  
  
  q[q.length]=' | <b>Privat-Bereich</b>::#private-einstellungen '
  q[q.length]=' | | Lese- und Schreib-Rechte '
  q[q.length]=' | | Wiki-Einstellungen '
  q[q.length]=' | | Eigene Dateien '
  q[q.length]=' | | Mitglied in Teams werden '
  q[q.length]=' | | Kontakte verwalten '
  q[q.length]=' | | Design anpassen '
  q[q.length]=' | | Passwort ändern::#passwort-aendern2'
 
  q[q.length]=' | <b>Tools</b>::#tools '
  // q[q.length]=' | | BefehlsBar '
  q[q.length]=' | | SystemMenü::#systemmenue '
  q[q.length]=' | | qMenü (Bookmarks)::#qmenue-bookmarks'
  q[q.length]=' | | Kommentare verwalten '
  q[q.length]=' | | Blog '
  q[q.length]=' | | wikiMail '
  q[q.length]=' | | Buschtrommel '
  // q[q.length]=' | | Infozentrale '
  // q[q.length]=' | | Diagramme '
  
  q[q.length]=' | <b>Info-Zentrale</b>::#Infozentrale '
  q[q.length]=' | | Widget hinzufügen::#widget-hinzufuegen '
  q[q.length]=' | | Anzeige-Typen '
  q[q.length]=' | | Teamwiki-News '
  q[q.length]=' | | Eigenen Seiten anzeigen '
  q[q.length]=' | | Frende Seiten anzeigen '
  q[q.length]=' | | RSS einbinden '
  q[q.length]=' | | Google-Widgets '
  q[q.length]=' | | Seiten-Verwaltung(tabBar)::#seiten-verwaltung-tabbar '
   
  q[q.length]=' | <b>Experten-Modus</b>::#experten-modus '
  q[q.length]=' | | html, css, javascript, php '
  
  return q
}//endFunction

window.quickTour_getIndentLevel=function(line) {
  var lineParts=line.split("|")
  return lineParts.length-1;
}

window.quickTour_createIndex=function() {
  // findById("quickTourWindow").style.display="none"
  var q=getQuickTourData()
  window.quickIndexData=q
  var out = new Array()
  out[out.length]=""
  for (var i = 1; i < q.length; i++) {
    var item = q[i]
    var indent = quickTour_getIndentLevel(item)
    if (indent == 2){
       //normaler Link -- ACHTUNG: lokale Schleife wegen ULs - verändertes i wird zurückgegeben
       i = quickTour_createListItems(out, q, i)
      
       i = window.quickTour_createListItems2(out, q, i)
    }else{
      // zwischenüberschrift
       i = window.quickTour_createListItems2(out, q, i)
   }
  }
  var el=findById("quickTourIndex")
  el.innerHTML=out.join(String.fromCharCode(10))
}//endFunction


window.quickTour_navDelta=function(delta){
  var curIndex=wDesk_getCookie("qTourIndex")
  if (!curIndex)curIndex=0
  curIndex=parseInt(curIndex)
  var newIndex=(curIndex+delta)
  if (newIndex<0) newIndex=0
  if ((newIndex +1) > window.quickIndexData.length) newIndex=0
  onQuickTourClick(newIndex)

}//endFunction


window.onQuickTourClick=function(index){
  
  // alert("onQuickTourClick -->"+index+"<--")

  wDesk_setCookie("qTourIndex", index, 999)
  var el=findById("quickTourHeader").innerHTML="Q U I C K - T O U R   ("+index+")"

  var item = window.quickIndexData[index]
  var lineParts=item.split("|")
  item = lineParts[lineParts.length - 1];
  
  var treffPos=item.indexOf("::#")
  if (treffPos>-1) {
    title=item.substring(0,treffPos) 
      //@es: Schlaumeier -- erst den Item verändern und dann auf den alten Inhalt zugreifen wollen ...
    item=item.substr(treffPos+3)
  }else{
    title=item
  }

  item=esTrim2(item)
  
  // alert("item 1: -->"+item+"<--")
  item=makefilename(item)
  // alert("item 2: -->"+item+"<--")
   
  var url=item + ".html" + "?view=3&comments=0"
  var el=findById("curUrl"); if(el)el.innerHTML=url
  
  // var el=findById("quickTourHeader").innerHTML=url
  
  var iframe=findById("quickTourIframe")
  var indexDiv=findById("quickTourIndex")
  var titleDiv=findById("quickTourTitle")
  if (index>0){
    // navIframe
    // alert("...url")
    // url="http://help.teamwiki.net/"+url
    url="http://_sys_template.teamwiki.net/"+url    
    // alert(url)
    var el=findById("curUrl"); if(el)el.innerHTML=url
    titleDiv.innerHTML=title
    iframe.style.display="block"
    indexDiv.style.display="none"
    iframe.src=url
  }else{
    // show Übersicht
    titleDiv.innerHTML="Ü b e r s i c h t"
    quickTour_createIndex()
    iframe.style.display="none"
    indexDiv.style.display="block"
 }

}//endFunction


window.quickTour_createListItems=function(out, DATA, index) {
  // normaler Link
  // ACHTUNG: lokale Schleife wegen ULs
  // verändertes i wird zurückgegeben
  out[out.length]='<ul class="qList_ul" >'
  for (var i = index; i < DATA.length; i++) {
    var item=DATA[i]
    if (quickTour_getIndentLevel(item) < 2) break
    var treffPos=item.indexOf("::#")
    if (treffPos>-1) item=item.substr(0,treffPos)

    out[out.length]='<li class="qtour_list" style="line-height:120%;" > <a tiddlylink="xxx" class="tiddlyLink" ' 
    // title="The tiddler 'Menü bearbeiten' doesn't yet exist" 
    out[out.length]='href="javascript:onQuickTourClick('+i+');">' + item.substr(5) + '</a></li>'
    // out[out.length]=''
  }
  out[out.length]="</ul>"
  // alert(out.join(String.fromCharCode(10)))
  return i
}//endFunction

window.quickTour_createListItems2=function(out, DATA, index) {
  var i=index
  // alert(DATA.length)  
 if (i+1 > DATA.length) return i
  var item=DATA[i]
  var treffPos=item.indexOf("::#")
  if (treffPos>-1) item=item.substr(0,treffPos);
   out[out.length]='<a style="color:#000000;" "href="javascript:onQuickTourClick('+i+');">'+item.substr(3)+'</a><br>'
  return i
}//endFunction



window.quickTour_htmlTemplate=function() {
  var LF=String.fromCharCode(10); var q=''
  q+=LF+'  '
  // q+=LF+'<div id="quickTourWindow" style="position:absolute; left:+280px; Top:11px;  z-index:30000; "> '
  q+=LF+'<div class="cbb" id="quickTourBorderWindow" style=" width:240px; height:700px;  margin:0; padding:0; " > '
  q+=LF+'<div style="float:right; background-color:#335CA1; color:#fff; padding-top:2px; "  onclick="quickTour_hide()">[ X ]&nbsp;</div> '
  q+=LF+'<div id="quickTourHeader" style=" cursor:move; background-color:#335CA1; color:#fff; padding:3px 12px; "  '
  q+=LF+'        > &nbsp;&nbsp;Q U I C K - T O U R </div> '
  q+=LF+'  <div id="innerWindow" style="padding:10px;  margin-top:7px;"> '
  q+=LF+'    '
  q+=LF+'  <img onclick="quickTour_navDelta(-1);"  '
  q+=LF+'    src="http://static.teamwiki.net/img/icons/crystalp/24x24/actions/previous.png" '
  q+=LF+'    style="float:left; height:22px;  " />  '
  q+=LF+'  <img onclick="quickTour_navDelta(+1);"  '
  q+=LF+'    src="http://static.teamwiki.net/img/icons/crystalp/24x24/actions/next.png" '
  q+=LF+'    style="float:right; height:22px; " />  '
  q+=LF+'   <div style="text-align:center; "> <a href="javascript:onQuickTourClick(0)"> Übersicht</a> </div> '
  q+=LF+' '
  q+=LF+'  <div id="quickTourTitle" class="specialHeading1" style=" '
  q+=LF+'   text-align:left;'
  // q+=LF+'   font-weight:bold;'
  q+=LF+'   font-size:11pt !important;'
  // q+=LF+'   margin:5px 0px 10px 0px; margin-top:10px;'
  q+=LF+'   margin:2px 0px 4px 0px; margin-top:10px;'
  // q+=LF+'   padding:2px 10px 2px 25px;'
  q+=LF+'   padding:2px 5px 2px 10px;'
  q+=LF+'   font-family: trebuchet ms, verdana, tahoma, arial;'
  q+=LF+'   color:whitesmoke;'
  q+=LF+'   background-color:#5C5C5C'
  q+=LF+'  "></div> '
  q+=LF+' '
  q+=LF+'  <iframe  id="quickTourIframe" src="http://_sys_template.teamwiki.net/seite_bearbeiten.html?view=tiny"  '
  q+=LF+'    style="display:none; width:105%; height:600px; border:0; margin:0; padding:0px; padding-right:5px; "></iframe> '
  q+=LF+'  <div  id="quickTourIndex"   '
  q+=LF+'    style="width:105%; height:600px; border:0; margin:0; padding0; line-height:130%; overflow-y:scroll; "></div> '
  q+=LF+'  </div> '
  // q+=LF+'  <div id="curUrl" style="margin-top:5px; background-color:#eeeeee; font:status-bar; overflow:hidden;  ">akt Url </div> '
  q+=LF+' '
  q+=LF+'</div> '
  q+=LF+'</div> '
  // q+=LF+'</div> '
  q+=LF+'  '
  q=replaceAll(q, '_|APO|_', '***')
  return q
}//endFunction


window.trim=function(zeichenkette) {
  // Erst führende, dann Abschließende Whitespaces entfernen
  // und das Ergebnis dieser Operationen zurückliefern
  return zeichenkette.replace (/^s+/, '').replace (/s+$/, '');
}//endFunction

window.quickTour_hide=function() {
  wDesk_delCookie("qTourPreload")
  findById("quickTourWindow").style.display="none"
  onWindowResize()
}//endFunction

window.showQuickTour=function() {   // NEU: jetzt als toogle
  wDesk_setCookie("qTourPreload","TRUE",333)
  var newState="block"
  var el=findById("quickTourWindow")
  if (el){
    if(el.style.display=="block") {
       quickTour_hide()
       return
    }
    // alert("showQuickTour aaaa")
    el.style.display=newState
    onWindowResize()
    onDomWindowTitleBarClick2()
    return
  }
  quickTour_preload()
  findById("quickTourWindow").style.display="block"
  onDomWindowTitleBarClick2()
  if(window.onWindowResize) onWindowResize()
  
  // alert("showQuickTour bbb")

}//endFunction

window.quickTour_createWindow=function(){
  var loc=window.location.href
  if (loc.indexOf("view=")>-1) return
  var oldTour=findById("quickTourWindow")
  if(oldTour){
   alert("FOUND")
   removeElement(oldTour)
  }
  // alert("destroyed")  
  var template=quickTour_htmlTemplate()
  var newDiv=document.createElement("DIV")
  newDiv.id="quickTourWindow"
  var ss=newDiv.style
  ss.display="none"

  newDiv.innerHTML=template
  // newDiv.style.visibility="hidden"
  // var parent=document.getElementsByTagName("html")
  var parent=document.body
  // alert(parent[0])
  parent.appendChild(newDiv)
  ss.display="none"
  
  var borderDiv=findById("quickTourBorderWindow")
  cbb.createCustomBorderBox(borderDiv)
  var winPos=wDesk_getCookie("qTourWinPos","51|202")
  var xPos=winPos.split("|")[0]
  var yPos=winPos.split("|")[1]
  // alert(xPos)
  // alert(yPos)
  ss.position="fixed" 
  ss.left=xPos
  ss.top="10px" //yPos
  ss.zIndex=30000;
  ss.textAlign="left"

  // var curIndex=wDesk_getCookie("qTourIndex")
  // alert
  // alert("quickTour_createWindow")
}//endFunction


window.quickTour_preload=function(){
  
  var width=getInnerWidth(window)
  if (width<300) return
  
  // var url=window.location.href
  // if (url.indexOf("view=")>-1) return
  var preload=wDesk_getCookie("qTourPreload")
  if (preload=="TRUE"){
    quickTour_createWindow()
    var toolBar=findById("quickTourHeader")
    var toolWin=findById("quickTourWindow")
    // Drag2.init(toolBar,toolWin,-240 ,null,-5,null,   null, null,   null, null, onDomWindowTitleBarClick2)
    // Drag2.init(toolBar,toolWin)
    Drag2.init(toolBar,toolWin,null ,null,null ,null,   null, null,   null, null, onDomWindowTitleBarClick2)
    // quickTour_createIndex()
    onDomWindowTitleBarClick2()

    findById("quickTourWindow").style.display="none"
    
    var q=getQuickTourData()
    window.quickIndexData=q
    var curIndex=wDesk_getCookie("qTourIndex")
    
    // alert("-->"+curIndex+"<--")
    onQuickTourClick(curIndex)
    // alert("quickTour_preload 111")
    // if(onWindowResize) onWindowResize()

  }else{
  }
}//endFunction



window.onDomWindowTitleBarClick2=function(){
  var toolWin=findById("quickTourWindow")
  var xPos=toolWin.style.left
  var yPos=toolWin.style.top
  var winPos=xPos+"|"+yPos
  wDesk_setCookie("qTourWinPos",winPos,333)
  
  var browser = navigator.userAgent.toLowerCase()
  var isIE = ((browser .indexOf( "msie" ) != -1) )
  // alert(isIE)
  // alert("onWindowResize")
  // alert(e)
  var height=getInnerHeight()
  yPos=parseInt(yPos)
  // alert(yPos)
  var newHeight=height-yPos-50
  // alert(newHeight)
  
  var win = findById("quickTourIndex")
  win.style.height=newHeight-100+"px"
  win.parentNode.style.height=newHeight-50+"px"
  win.parentNode.parentNode.style.height=newHeight+"px"
  win.parentNode.parentNode.parentNode.style.height=newHeight+"px"
  // var borderWindow=findById("quickTourBorderWindow")
  // borderWindow.style.height=newHeight+"px"
  // borderWindow.parentNode.style.height=newHeight+"px"
  // borderWindow.parentNode.parentNode.style.height=newHeight+"px"
  // borderWindow.parentNode.parentNode.parentNode.style.height=newHeight+"px"
  
  //var win2 =findById("innerBorderWin")
  //win2.style.height=newHeight+"px"
  
  
  var iFrame=findById("quickTourIframe")
  iFrame.style.height=(newHeight-100)+"px"
  // alert(newHeight)
  
  // var qtIndex=findById("quickTourIndex")
  // qtIndex.style.height=(newHeight-100)+"px"
  
  //  var innerWindow =findById("innerWindow") 
  // innerWindow.style.height=(newHeight-100)+"px"
  
}//endFunction

// quickTour_preload()



 // func_check_showDebugWindow("TRUE")

//-->
//-->permaEditor

window.window.permaEditor_ini=function(para1){
  var el= findById(para1)
  var filespec=el.getAttribute("filespec")
  // alert(filespec)
  el.value="ID: "+para1+LF+"filespec: "+filespec
   

}//endFunction


window.designDesignerShow=function(){
  // alert("designDesignerShow")

  var url="http://static.teamwiki.net/js/colorPicker.js"
  tWiki_loadScriptOnDemand(url)

  var url="http://static.teamwiki.net/js/designer.js"
  tWiki_loadScriptOnDemand(url)

  var url="http://static.teamwiki.net/js/colorPickerData.js"
  tWiki_loadScriptOnDemand(url)

  var url="http://static.teamwiki.net/js/colorPickerData2.js"
  tWiki_loadScriptOnDemand(url)

}//endFunction


 window.globStartTime1b=new Date()

if(wDesk_syntaxCheckDone) wDesk_syntaxCheckDone() 



// ... der gibt bei komischen Zeichensatzeinstellungen fette Fehler, deswegen ganz ans ende 
// - wer braucht den ???  ... zum Beispiel die quickTour
window.makefilename=function(x) {
  // alert("window.makefilename")
  var cc = String.fromCharCode, rr = replaceAll;
  x = x.toLowerCase()
  x = esTrim2(x)
  x = x.replace(/[^a-z\d\/äöüÄÖÜß]+/gi, "-");
  x = rr(x, cc(228), 'ae');
  x = rr(x, cc(246), 'oe');
  x = rr(x, cc(252), 'ue');
  x = rr(x, cc(196), 'ae');
  x = rr(x, cc(214), 'oe');
  x = rr(x, cc(220), 'ue');
  x = rr(x, cc(223), 'ss');
  return x
}//endFunction


 // alert("_global_header 222 : done")
 

