//dim appIcon as string ="http://icons3.iconfinder.netdna-cdn.com/data/icons/humano2/128x128/actions/stock_new-window.png"

// http://icons3.iconfinder.netdna-cdn.com/data/icons/humano2/128x128/actions/gtk-media-stop.png
// http://icons3.iconfinder.netdna-cdn.com/data/icons/humano2/128x128/actions/gtk-media-pause.png
// http://icons3.iconfinder.netdna-cdn.com/data/icons/humano2/128x128/actions/insert-object.png
// http://icons3.iconfinder.netdna-cdn.com/data/icons/humano2/128x128/actions/gtk-leave-fullscreen.png
// http://icons3.iconfinder.netdna-cdn.com/data/icons/humano2/128x128/actions/gtk-leave-fullscreen.png

// http://icons3.iconfinder.netdna-cdn.com/data/icons/humano2/128x128/apps/view-calendar-list.png
// http://icons3.iconfinder.netdna-cdn.com/data/icons/humano2/128x128/apps/vive.png

// http://icons3.iconfinder.netdna-cdn.com/data/icons/humano2/128x128/apps/gnome-window-manager.png
// http://icons3.iconfinder.netdna-cdn.com/data/icons/humano2/128x128/actions/stock_new-window.png
// http://icons3.iconfinder.netdna-cdn.com/data/icons/humano2/128x128/apps/xaralx.png


// alert(111)

//domWin2

// alert("domWin2: startLoad...")


// http://www.allcrunchy.com/Web_Stuff/Gradient_Generator/?color1=D6D6D6&color2=A5A5A5&gradientHeight=22&gradType=sinusoidal
// http://www.allcrunchy.com/Web_Stuff/Gradient_Generator/?color1=5D87F3&color2=335BBF&gradientHeight=24&gradType=sinusoidal

//-->  
//-->G L O B A L - S Y S T E M 

if (!window.glob) window.glob=new Object
if (!window.globScriptVar) window.globScriptVar=new Object
if (!window.globZOrder) window.globZOrder=20000
if( !window.globDomWindowZIndex) window.globDomWindowZIndex=20000

if (!window.domWindowDATA)window.domWindowDATA = new Array();
if (!window.domWindowPARA)window.domWindowPARA = new Array();

// if (!window.glob_pinboardSkipDragDrop)window.glob_pinboardSkipDragDrop = false;

  
//-->GLOBAL
window.iScript=new Object
window.iScript.sysEvents=new Object
window.iScript.sysEvents.skipBringToFront=false
window.iScript.popupMan= new Array()
  
  
  
  
//-->SYSTEM
  


window.findById=function(id){
  if (document.getElementById) return document.getElementById(id); 
  if (document.all) return document.all(id);
  return null
}//endFunction


window.traceDummy=function(para1,para2){
  //...
}//endFunction
if (!window.trace)window.trace=traceDummy 



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.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


window.removeElement=function(node){
  if(node){
    var ref=node.parentNode.removeChild(node)
    return ref
  }
  return null
}//endFunction



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.findParentNodeByClassName=function(startNode, findClassName,partial){
  return findParentNodeByClass(startNode, findClassName,partial)
}//endFunction


window.findParentNodeByClass=function(startNode, findClassName,partial){
  if(!findClassName) return false
  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



function getMousePosition(e) {
  var posx = 0; var posy = 0;
  if (!e) e = window.event;
  if (!e)   return {x:100,y:200} 
  
    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.setStyle=function(object,styleText) { 
  if( object.style.setAttribute ) { 
    object.style.setAttribute("cssText", styleText ); 
  } else { 
    object.setAttribute("style", styleText ); 
  } 
}//endFunction




  
window.winFindByClassName=function(el, className) {
  var i, tmp;
  if(!el) return null
  if (el.className == className)
    return el;

  // Search (recursiv !) for a descendant element assigned the given class.
  for (i = 0; i < el.childNodes.length; i++) {
    tmp = winFindByClassName(el.childNodes[i], className);
    if (tmp != null)
      return tmp;
  }
  return null;
}//endFunction
  



//-->
//--> M E T A 



//--> ...FensterÜbersicht

// Klassen / IDs (domWindow)
// - tiddler                "tiddler" + title         ... nur ein Anker, keine Anzeige-Funktion
// - window                  domWindowX||TITLE||      ... äußerer Rahmen dient zum resizen
// - innerDiv"               innerDiv||TITLE||"'      ... Rahmen und bgcolor(padding) optional

// - closeIcon               ...an titelBar verankern ???
// - titleBar
// - titleBarText            SPAN: kann man den zentrieren ???
// - domWindowToolbar

// - clientAreaBackground    ... wird gebraucht beim scrollen für Hintergrund bei padding oben/unten
// - clientArea              ... der bekommt die scrollbars, wenn inhalt größer ist
// - viewer                  ... SPAN:






//--> ... domWindow-T Y P E N

// - default:         einfache
// - iFrame:          wie default, aber contentBereich = iFrame (...mit iFrameAktivator ???)
// - toolWindow:      toolbar, sideBar1, sidebar2, resizer, statbar
// - defaultBrowser:  toolwindow mit iFrame
// ??? toolWindow2:   wie toolwindow, aber mit tabInterface


//--> ...N E X T 

// [_] 
// [_] ...hörner: screenshots
// [_] kl: cdProduktion
// [_] 
// [_] 
// [_] id und title trennen
// [_] 
// [_] Positionsangaben: default, para, auswerten
// [_] 
// [_] defaultColors: rahmen, titelbar, fensterhintergrund
// [_] 
// [_] globWinData... 
// [_] 
// [_] in fremder umgebung laufen lassen: findById, ...was noch
// [_] 
// [_] CSS-injektion ???
// [_] 
// [_] 
// [_] 
// [_] 
// [_] 
// [_] 
// [_] 
// [_] 



//-->
//--> T E S T


window.xxx=function(DATA) {  // defaultFenster ... kommentar wird abgeschnitten //!!!
  alert("window.xxx=function(DATA)")
  alert(DATA.title)
}//endFunction



window.test1=function(e, el) {  // defaultFenster ... kommentar wird abgeschnitten
  // alert("window.test1=func tion() 11111111")
  // alert(e)
  // alert(el)

  // var xPos="444"+"!"+"55"+"!"+"333"+"!"+"888"  //left top width height 
  // wDesk_setCookie("dwPos_"+"bookmarkMenuDiv", xPos, 30)
  // var winPosData = winPos.split("!")
  // var left=winPosData[0]
  // var top=winPosData[1]
  // var width=winPosData[2]
  // var height=winPosData[3]
  
  
  
  // var POS=findElementPos(el)
  var POS=getMousePosition(e)
  // alert(POS.x)
  // alert(el.offsetWidth )
  var q=new Object
  q.id     ="test1"
  q.title  ="meinTitel"
  q.left   =POS.x+el.offsetWidth+11
  q.top    =POS.y
  q.width  =200
  q.height =100
  q.onresize = xxx
  // ...zentriert
  // ...showHidden
  var hwnd=domWin_create(q)   // ...domWindow erzeugen
  // alert("window.test1=func tion() 22222222222")
  
  // alert(hwnd.title.value)
  hwnd.title.innerHTML="neuer Fenstertitel"
  hwnd.innerDiv.style.borderColor="#eee"
  hwnd.innerDiv.style.borderWidth="1px"
  hwnd.titleBar.background=' #ffffff url(http://www.allcrunchy.com/Web_Stuff/Gradient_Generator/images/D6D6D6A5A5A522sinusoidal.png) repeat-x right top;'

}//endFunction



window.test2=function(e, el) {
  // alert(el.offsetWidth )
  var q=new Object
  q.id="meinTitel2"
  q.title=""
  q.left=0
  q.top=300
  q.width=400
  q.height=200
  // var POS=findElementPos(el)
  var POS=getMousePosition(e)
  q.left   =POS.x - 30 // +el.offsetWidth+11
  q.top    =POS.y+el.offsetHeight
  
  var hwnd=domWin_create(q)   // ...domWindow erzeugen
  
  hwnd.title.value="TEST TEST TEST "
  // hwnd.innerDiv.style.borderWidth="0px"
  // hwnd.innerDiv.style.borderColor="#28489A"
  // hwnd.innerDiv.style.borderStyle="solid"
  hwnd.innerDiv.style.borderColor="#eee"
  hwnd.innerDiv.style.borderWidth="1px"
  hwnd.background.style.backgroundColor="#efefef"
  hwnd.clientArea.style.color="#000"
  // hwnd.titleBar.background=' #ffffff url(http://www.allcrunchy.com/Web_Stuff/Gradient_Generator/images/D6D6D6A5A5A522sinusoidal.png) repeat-x right top;'
}//endFunction

window.test3=function() {
  var q=new Object
  var id="test3"
  q.id=id
  q.title=""
  q.left=55
  q.top=111
  q.width=1100
  q.height=666
  
  var hwnd=domWin_create(q)   // ...domWindow erzeugen
  
  hwnd.title.value="TEST TEST TEST "
  hwnd.innerDiv.style.borderWidth="2px"
  hwnd.innerDiv.style.borderColor="#28489A"
  hwnd.innerDiv.style.borderStyle="solid"
  hwnd.background.style.backgroundColor="#efefef"
  hwnd.clientArea.style.padding="0px"
  var LF=String.fromCharCode(10); var q=''
  q+=LF+'<iframe id="myIframe__||ID||_" style="width:100%; height:600px; border-width:0px; position: relative; '
  q+=LF+'      left:0px; top:0px;  margin:0px; padding:0px ; " '  //position:absolute;
  q+=LF+'      src="http://secure.teamwiki.net/mydocs2?view=mini" '
  q+=LF+'     > '
  q+=LF+'</iframe> '
  q=replaceAll(q, '_|APO|_', '"')
  q=replaceAll(q, '_||ID||_', id)
  // alert(q)
  hwnd.viewer.innerHTML=q
  // alert("-->"+id+"<--")
  onDomWinResize(id)
}//endFunction

window.test5=function(e, el){
  var q=new Object
  var id="test5"
  q.title  ="meinTitel"
  // alert(e)
  // alert(el)
  q.width  =200
  q.height =300
  if (e){ 
    // var POS=findElementPos(el)
    var POS=getMousePosition(e)
    // alert(POS.y)
    // alert(el.offsetWidth )
    q.left   =0+ POS.x-el.offsetWidth-0
    q.top    =0+POS.y - el.offsetHeight - q.height -15
    // alert(q.top)
  }else{
    q.left   =0
    q.top    =0
  }      
  // q.left   =0
  // q.top    =0

    // q.onresize = xxx
  q.id=id
  q.title=""
  q.tuttifrutti=false
  var hwnd=domWin_create(q)   // ...domWindow erzeugen
  hwnd.titleBar.style.display="none"
  hwnd.title.innerHTML="neuer Fenstertitel"
  
  hwnd.closeIcon.style.display="none"
  hwnd.menueBar.style.display="block"
  
  hwnd.outerDiv.style.borderColor="#bbb"
  hwnd.outerDiv.style.borderStyle="solid"
  hwnd.outerDiv.style.MozBorderRadius=0
  hwnd.outerDiv.style.borderWidth="0px"
  hwnd.outerDiv.style.padding="0px"
  // hwnd.outerDiv.style.paddingTop="0px"

  hwnd.innerDiv.style.borderColor="#bbb"
  hwnd.innerDiv.style.borderStyle="solid"
  hwnd.innerDiv.style.MozBorderRadius=0
  hwnd.innerDiv.style.borderWidth="2px"
  // hwnd.innerDiv.style.padding="0px"
  // hwnd.innerDiv.style.paddingTop="0px"
  // hwnd.innerDiv.style.margin="0px"

  
  // hwnd.background.padding="0px"
  // hwnd.background.paddingTop="0px"
  hwnd.background.style.backgroundColor="#efefef"
  hwnd.background.style.color="#000"
  // hwnd.background.style.margin="0px"

  
  // hwnd.clientArea.style.borderWidth="0px"
  // hwnd.clientArea.style.padding="0px"
  // hwnd.clientArea.style.paddingTop="0px"
  // hwnd.viewer.style.margin="0px"
  
  onDomWinResize(id)
}//endFunction





//-->
//-->S O N D E R: url, webEditor, ...



window.showUrlPopup=function(url,title,id,width,height) { 
  // alert(url)
  var q=new Object
  if(!id)id="defaultIFrame"
  if(!title)title="inlineBrowser"
  q.id=id;
  q.title=title;
  q.width=999;   if(width) q.width=width;
  q.height=666;  if(height) q.height=height;
  q.left= Math.floor(getInnerWidth()/2  - width/2);         // ...center fehlt noch
  q.top = Math.floor(getInnerHeight()/2 - height/2);
  if (width && height) q.tuttifrutti = false;
  
  var hwnd=domWin_create(q)   // ...domWindow erzeugen
  
  hwnd.innerDiv.style.borderWidth="2px"
  hwnd.innerDiv.style.borderColor="#efefef"
  hwnd.innerDiv.style.borderStyle="solid"
  hwnd.background.style.backgroundColor="#efefef"
  hwnd.clientArea.style.padding="0px"
  
  var LF=String.fromCharCode(10); var q=''
  q+=LF+'<iframe id="myIframe__||ID||_" style="width:100%; height:600px; border-width:0px; position: relative; '
  q+=LF+'      left:0px; top:0px;  margin:0px; padding:0px ; background-color:#fff; " '  //position:absolute;
  q+=LF+'      src="_||URL||_" '
  q+=LF+'     > '
  q+=LF+'</iframe> '
  q=replaceAll(q, '_|APO|_', '"')
  q=replaceAll(q, '_||ID||_', id)
  q=replaceAll(q, '_||URL||_', url)
  // alert(q)
  hwnd.viewer.innerHTML=q
  // alert("-->"+id+"<--")
  onDomWinResize(id)
  
}//endFunction


//--> ...
window.webEditor_onResize=function(id) {
  // alert(id)
  var win = window.domWindowPARA[id]

}//endFunction

window.webEditor_onResize2=function(id) {
  // alert("webEditor_onResize2: "+id)
  printLine(7,"webEditor_onResize2","-->"+id+"<--")
  
  var PARA = window.domWindowPARA[id]
  printLine(10,"innerDiv",PARA.innerDiv)
  var height=parseInt(PARA.clientArea.style.height)
  printLine(8,"HÖHE",height)
  var statBar=PARA.statBar
  printLine(9,"STAT-BAR",statBar)
  statBar.style.top=(height-105)+"px"
}//endFunction




window.test4=function() {
  var q=new Object
  var id="editor"
  q.id=id
  q.title="webEditor"
  q.left=300
  q.top=444
  q.width=600
  q.height=400
  q.onresize=webEditor_onResize
  q.onresize2=webEditor_onResize2
  
  var DATA=domWin_create(q)   // ...domWindow erzeugen
  
  // DATA.title.value="TEST TEST TEST "
  DATA.innerDiv.style.borderColor="#28489A"
  DATA.innerDiv.style.borderColor="#ccc"
  DATA.innerDiv.style.borderWidth="2px"
  DATA.innerDiv.style.borderStyle="solid"
  
  DATA.background.style.backgroundColor="#fff"
  DATA.background.style.backgroundColor="#efefef"
  DATA.background.style.paddingTop="0px"
  DATA.background.style.marginTop="0px"
  // DATA.clientAreaBackground.style.backgroundColor="#efefef"
  DATA.clientArea.style.padding="0px"
  DATA.clientArea.style.background="#fff"
  
  var template=getTemplate_webEditor(DATA)
  // alert(q)
  DATA.viewer.innerHTML=template
  DATA.captionBar   =findById("editorCaptionBar_"+id)
  DATA.toolBarRight =findById("editorToolBarRight_"+id)
  DATA.statBar      =findById("editorStatBar_"+id)
  DATA.okIcon       =findById("editorOkIcon_"+id)
  // alert("-->"+id+"<--")
  onDomWinResize(id)
}//endFunction



window.getTemplate_webEditor=function(PARA){
  var LF=String.fromCharCode(10); var q=''

  
  //--> CSS  
  q+=LF+'<html><style> '
  q+=LF+' '
  q+=LF+' '
  q+=LF+'#tabs6 { '
  q+=LF+'  float:left; '
  q+=LF+'  width:100%; '
  q+=LF+'  background:#efefef; '
  q+=LF+'  font-size:93%; '
  q+=LF+'  line-height:normal; '
  q+=LF+'  border-bottom:1px solid #666; '
  q+=LF+'} '
  q+=LF+'#tabs6 ul { '
  q+=LF+'  margin:0; '
  q+=LF+'  padding:10px 10px 0 50px; '
  q+=LF+'  list-style:none; '
  q+=LF+'} '
  q+=LF+'#tabs6 li { '
  q+=LF+'  display:inline; '
  q+=LF+'  margin:0; '
  q+=LF+'  padding:0; '
  q+=LF+'} '
  q+=LF+'#tabs6 a { '
  q+=LF+'  float:left; '
  q+=LF+'  background:url("http://help.teamwiki.net/docs/img/tableft6.gif") no-repeat left top; '
  q+=LF+'  margin:0; '
  q+=LF+'  padding:0 0 0 4px; '
  q+=LF+'  text-decoration:none; '
  q+=LF+'} '
  q+=LF+'#tabs6 a span { '
  q+=LF+'  float:left; '
  q+=LF+'  display:block; '
  q+=LF+'  background:url("http://help.teamwiki.net/docs/img/tabright6.gif") no-repeat right top; '
  q+=LF+'  padding:5px 15px 4px 6px; '
  q+=LF+'  color:#FFF; '
  q+=LF+'} '
  q+=LF+'/* Commented Backslash Hack hides rule from IE5-Mac \*/ '
  q+=LF+'#tabs6 a span {float:none;} '
  q+=LF+'/* End IE5-Mac hack */ '
  q+=LF+'#tabs6 a:hover span { '
  q+=LF+'  color:#FFF; '
  q+=LF+'} '
  q+=LF+'#tabs6 a:hover { '
  q+=LF+'  background-position:0% -42px; '
  q+=LF+'} '
  q+=LF+'#tabs6 a:hover span { '
  q+=LF+'  background-position:100% -42px; '
  q+=LF+'} '
  q+=LF+' '
  q+=LF+'#tabs6 #current a { '
  q+=LF+'  background-position:0% -42px; '
  q+=LF+'} '
  q+=LF+'#tabs6 #current a span { '
  q+=LF+'  background-position:100% -42px; '
  q+=LF+'} '
  q+=LF+' '

  // http://dabuttonfactory.com/b?t=O%20K&f=sans-serif-Bold&ts=17&tc=3028c700&tshs=1&tshc=ffffff00&it=png&c=5&bgt=gradient&bgc=c7c8cf&ebgc=e9ecf2&be=on&bs=1&bc=c5c5c7&shs=1&shc=7e89c7&sho=se&w=150&h=35

  q+=LF+'.myButton {'
  q+=LF+'   display: -moz-inline-stack; '
  q+=LF+'   display: inline-block; '
  q+=LF+'   width: 150px; '
  q+=LF+'   height: 35px; '
  q+=LF+'   background: url("http://dabuttonfactory.com/b?t=O%20K&f=sans-serif-Bold&ts=17&tc=3028c700&tshs=1&tshc=ffffff00&it=png&c=5&bgt=gradient&bgc=e9ecf2&ebgc=c7c8cf&be=on&bs=1&bc=c5c5c7&shs=1&shc=7e89c7&sho=se&w=150&h=35") no-repeat; '
  // q+=LF+'   background: url("http://dabuttonfactory.com/b?t=O%20K&f=sans-serif-Bold&ts=17&tc=3028c700&tshs=1&tshc=ffffff00&it=png&c=5&bgt=unicolored&bgc=efefef&be=on&bs=1&bc=c5c5c7&shs=1&shc=7e89c7&sho=se&w=150&h=35") no-repeat; '
  // q+=LF+'   background: url("http://dabuttonfactory.com/b?t=O%20K&f=sans-serif-Bold&ts=17&tc=3028c700&tshs=1&tshc=ffffff00&it=png&c=5&bgt=gradient&bgc=e9ecf2&ebgc=c7c8cf&be=on&bs=1&bc=c5c5c7&shs=1&shc=7e89c7&sho=se&w=150&h=35") no-repeat; '
  q+=LF+'   line-height: 35px; '
  q+=LF+'   vertical-align: text-middle; '
  q+=LF+'   text-align: center; '
  q+=LF+'   color: #302857 !important; ' // c7
  q+=LF+'   font-family: sans-serif; '
  q+=LF+'   font-size: 17px; '
  q+=LF+'   font-weight: bold; '
  q+=LF+'   font-style: normal; '
  q+=LF+'   text-shadow: #ffffff 1px 1px 0; '
  q+=LF+'} '
  q+=LF+'.myButton:hover {'
  // q+=LF+'   background: url("http://dabuttonfactory.com/b?t=O%20K&f=sans-serif-Bold&ts=17&tc=3028c700&tshs=1&tshc=ffffff00&it=png&c=5&bgt=gradient&bgc=e9ecf2&ebgc=c7c8cf&be=on&bs=1&bc=c5c5c7&shs=1&shc=7e89c7&sho=se&w=150&h=35") no-repeat; '
  q+=LF+'   background: url("http://dabuttonfactory.com/b?t=O%20K&f=sans-serif-Bold&ts=17&tc=3028c700&tshs=1&tshc=ffffff00&it=png&c=5&bgt=gradient&bgc=c7c8cf&ebgc=e9ecf2&be=on&bs=1&bc=c5c5c7&shs=1&shc=7e89c7&sho=se&w=150&h=35") no-repeat; '
  q+=LF+'   text-decoration:none; '
  q+=LF+'} '
  q+=LF+'.myButton > span { '
  q+=LF+'   display: -moz-inline-block; '
  q+=LF+'} '
  q+=LF+' '

  q+=LF+'</style> '
  q+=LF+' '

  
//-->HTML  
  q+=LF+' '
  q+=LF+'<div id="editorCaptionBar_||ID||" '
  q+=LF+' style=" text-align:center;  padding-top:4px; font-size:24px; font-weight:bold; color:#777; '
  q+=LF+' height:25px; '
  q+=LF+'  background:#efefef; '
  q+=LF+' '
  q+=LF+' "> Seiten-Überschrift...'
  q+=LF+'</div> '
  q+=LF+' '
  q+=LF+'<div id="editorToolBarRight_||ID||"  style="position:absolute;  top:58px; left:72%; width:25%; text-align:right;background:#efefef; "> '
  q+=LF+' <a href="#" onclick="showPageProperties()" style="padding-right:0px; padding-top:0px; "> Optionen</a> '
  q+=LF+' '
  q+=LF+' <img src="http://static.teamwiki.net/img/icons/nuvola/22x22/help.png" '  //http://twhobbycoder.gmxhome.de/icons/media-recordMidi.png
  q+=LF+' alt="-x-" onClick="showQuickTour();"  '
  q+=LF+' style="position:relative; top:5px; padding-left:15px; padding-top:0px; "> </img> '
  q+=LF+'</div> '
  q+=LF+' '
  q+=LF+' '
  q+=LF+'<div id="tabs6"> '
  q+=LF+'  <ul> '
  q+=LF+'    <li id="current"><a href="curPage"><span>Aktuelle Seite</span></a></li> '
  q+=LF+'    <li>             <a href="menue.html"><span>Menü</span></a></li> '
  q+=LF+'    <li>             <a href="Services.html"><span>Bookmarks</span></a></li> '
  q+=LF+'  </ul> '
  q+=LF+'</div> '
  q+=LF+' '
  q+=LF+' '
  q+=LF+''
  q+=LF+'<div id="editorStatBar_||ID||" '
  q+=LF+' style=" '  // text-align:center;  padding-top:4px; font-size:24px; font-weight:bold; color:#777; '
  q+=LF+' position:relative; top:400px; height:75px; padding-left:20px; '
  q+=LF+'  background:#efefef; '
  q+=LF+'  border-top:1px solid #666; '
  q+=LF+' '
  q+=LF+' ">'
  q+=LF+' <a class="myButton" href="#" onclick="alert(123)" style="position:relative;top:-10px; ">'
  q+=LF+'  <img src="http://cdn.iconfinder.net/data/icons/gnomeicontheme/24x24/actions/stock_save.png" '
  q+=LF+'  style="position:relative; top:5px; left:-25px"> </img> '
  q+=LF+'  O K </a>  '
  q+=LF+' '
  q+=LF+' <a class="myButton" href="#" onclick="alert(123)" style="position:relative;top:-10px; ">'
  q+=LF+'  <img id="editorOkIcon_||ID||" src="http://cdn.iconfinder.net/data/icons/musthave/24/Delete.png" '
  q+=LF+'  style="position:relative; top:5px; left:-5px"> </img> '
  q+=LF+'  Abbrechen</a>  '
  q+=LF+' '
  q+=LF+'</div> '
  q+=LF+' '
  q+=LF+' '
  q+=LF+' '
  q=replaceAll(q, '_|APO|_', '"')
  // alert("replace: "+PARA["id"]+"<--")
  q=replaceAll(q, '||ID||', PARA["id"])
return q
}//endFunction

// alert(222)

//-->
//-->D O M - W I N - 2  -------------------------





window.closeThisTiddler=function(el){
  //WIRD AUFGERUFEN BEI CLICK AUF SCHLIESSEN-ICON
  
  
  //-->... überarbeiten  //!!!
  // alert("closeThisTiddler-111");
  var startNode=el;
  var tiddler
  tiddler=findParentNodeByClassName(startNode, "tiddler", true)
  if (tiddler){
    var PARA = window.domWindowPARA[tiddler.id.slice(7)]
    if (PARA.hideOnClose) {
        //alert("hideOnClose")
        PARA.outerDiv.style.display="none"
    } else {
      removeElement(tiddler)  // <-----------
    }
    return
  }
  // alert("closeThisTiddler-222");
  if (tiddler==false){
    tiddler=findParentNodeByClassName(startNode, "tiddler isTag")
  }
  if (tiddler==false){
    tiddler=findParentNodeByClassName(startNode, "tiddler selected")
  }
  if (tiddler==false){
    tiddler=findParentNodeByClassName(startNode, "tiddler isTag selected")
  }
  if (tiddler==false){
    tiddler=findParentNodeByClassName(startNode, "tiddler missing")
  }
  if (tiddler==false){
    tiddler=findParentNodeByClassName(startNode, "tiddler missing selected")
  }
  // alert("OK ???")
  // alert("closeThisTiddler: "+tiddler.id)
  closeTiddler(tiddler.id.slice(7))
  //alert("closeThisTiddler-777");
}//endFunction
  
   
window.closeTiddler=function(title){
  // alert("close---Tiddler-111 "+title);
  try{
    var tiddler = findById("tiddler" + title);
    if (!tiddler) return
    
    
    var template=tiddler.getAttribute("template")
    if (template=="EditTemplate") {
      cancelEditMode(title)
      return
    }
    
    // alert("-->"+template+"<--")
    trace ("closeTiddler: ", title);
    story.closeTiddler (title)
    if (isIE == false){
      try{TaskBarItemRemove(title)}catch(ex){};
    }
  }catch(ex){}
}//endFunction
  


//--> ...

window.domWin_create=function(DATA){
  // alert("domWin_create: 1111111111")
  
  var PARA=domWin_getDefaultPara(DATA)   // ACHTUNG: PARA ist identisch mit DATA
                                         // ... incl. Cookie für winPos auslesen  
  
  // domWindow.style.width = width+"px";
  // domWindow.style.top = top+"px";
  // domWindow.style.left = left+"px";
  // width=width-50

  var myId=PARA["id"]
  var title=PARA["title"]
  trace ("domWin_create...", title);
  
  var glob=window.globScriptVar
  glob.skipTaskBarHighlight=false
  
  //--> getTemplate, appendChild...
  var template=domWin_getWindowTemplate(PARA)
  var newDiv=document.createElement("DIV")
  newDiv.id="tiddler" + myId
  newDiv.className = "tiddler"
  newDiv.innerHTML=template
  newDiv.setAttribute("dblclickaction", "skipEditMe")
  newDiv.setAttribute("myId", myId)
  document.body.appendChild(newDiv) 
  var ss=newDiv.style
  ss.position="absolute"
  ss.zIndex=30000
  ss.left="0px"                        // ...noch irgendwie unsichtbar machen
  ss.top="0px"
  ss.width="5px"
  ss.height="5px"
  ss.padding="0px"
  ss.border="1px solid #00f"
  ss.border.width="1px"

 
  //--> E L - R E F
  PARA.outerDiv=findById("domWindowX"+myId)
  PARA.innerDiv=findById("innerDiv_"+myId)

  PARA.closeIcon=findById("closeIcon_"+myId)
  PARA.titleBar=findById("titleBar_"+myId)
  PARA.titleText=findById("titlebarText_"+myId)
  PARA.menueBar=findById("menueBar_"+myId)
  PARA.background=findById("clientAreaBackground_"+myId)
  PARA.clientArea=findById("clientArea_"+myId)
  PARA.viewer=findById("viewer_"+myId)
  PARA.domWinTiddler=newDiv
  window.domWindowPARA[myId]=PARA 
  
  //--> menüItemDrag
  // init(o,         oRoot, minX,  maxX,  minY,  maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper,callBackXY,callBackOnMouse)
  Drag2.init(PARA.menueBar , PARA.outerDiv, null , null , null , null , null , null , null , null ,   onMenuItemCallBackXY ,onMenuItemCallBackOnMouse)

  
  //--> C S S - Style-Selector(fehlt noch)
  var CSS = domWin_getWindowDefaultStyle()
  // var CSS = domWin_getWindowDefaultStyle2()
  
  if (PARA.top<0)PARA.top=0
  if (PARA.left<0)PARA.left=0
  
  var style=CSS.outerDiv
  style=replaceAll(style, '||LEFT||',PARA["left"])
  style=replaceAll(style, '||TOP||',PARA["top"])
  style=replaceAll(style, '||WIDTH||',PARA["width"])
  // alert(style)
  setStyle(PARA.outerDiv, style)

  style=CSS.innerDiv
  // alert(style)
  setStyle(PARA.innerDiv, style)
  
  style=CSS.titleBar
  // alert(style)
  setStyle(PARA.titleBar, style)
  
  // style=replaceAll(style, '||HEIGHT||',PARA["height"])
  
  
  
  //--> win Init
  var id="domWindowX"+myId
  var domWindow=winInit(myId,title);         // run initialization code
  
  var wList=domWindowDATA[myId]
  wList.domWindow=domWindow
  wList.title=title

  //--> hide Window for ini...???  
  domWindow.style.visibility="hidden"
  var ss=wList.titleBar.style 
  ss.backgroundColor="#2D9AE2" //" //"#4E71A3"
  ss.color="#FFFFFF"//"#DDDDDD" 
  var clientArea=wList.clientArea;
  var TAB = String.fromCharCode(9);

  //--> resize(default)
  var titleBar=wList.titleBar
  var titleBarHeight=parseInt(titleBar.style.height);
      
  // clientArea.style.height = (height-titleBarHeight)+"px";
  // if (browser.isIE) clientArea.style.width = (width+36)+"px";               // ...der spinnt sonst (...wieder einmal !!!)
  if (browser.isIE) clientArea.style.width = (PARA["width"]-14)+"px";               // ...der spinnt sonst (...wieder einmal !!!)

  // wList.titleBarText.style.width=width+"px";
  
  domWindowDATA[myId].open();

  //--> wList ??? 
  var wList=getDomWindowList(myId)
  var domWindow=wList.domWindow

  
  //--> zIndex
  domWindow.style.zIndex = domWin_incrementZIndex() // (window.globZOrder++);

  
  //alert("createTiddler: DONE")
  trace("domWin_create: DONE", title)

  return PARA
}//endFunction


window.domWin_incrementZIndex=function(){
   if  (window.globZOrder>window.globDomWindowZIndex) {
     var newIndex=window.globZOrder+1
   }else{
     var newIndex=window.globDomWindowZIndex+1
   }
   window.globDomWindowZIndex=newIndex
   window.globZOrder=newIndex
   return newIndex
}//endFunction


//-->
//-->TEMPLATES - Main, Toolwindow



window.domWin_getDefaultPara=function(DATA){
  var OUT=new Object
  var p=""
  p="id";        if(!DATA[p]) DATA[p]="ID_XXX"; 
  p="title";     if(!DATA[p]) DATA[p]=DATA["id"]; 

  var winPos=""
  if(window.wDesk_getCookie)winPos=wDesk_getCookie("dwPos_"+DATA["id"], "")
  if (winPos != "" && DATA.tuttifrutti !== false){
    var winPosData = winPos.split("!")
    var left   =parseInt(winPosData[0])
    var top    =parseInt(winPosData[1])
    var width  =parseInt(winPosData[2])
    var height =parseInt(winPosData[3])
    
    var winSize=size()
    var winHeight=winSize.height
    var winWidth =winSize.width
    var resetPos=false
    
    if  (top < 0 || top>winHeight-50)           resetPos=true
    if  (left+width < 100 || left>winWidth-100) resetPos=true
    
    if  (resetPos==true){
      left=200
      top=200
    }
    
    DATA["left"]   =left
    DATA["top"]    =top
    DATA["width"]  =width
    DATA["height"] =height
  }else{
    p="left";      if(!DATA[p]) DATA[p]=200; 
    p="top";       if(!DATA[p]) DATA[p]=200; 
    p="width";     if(!DATA[p]) DATA[p]=200; 
    p="height";    if(!DATA[p]) DATA[p]=300; 
  }
  return DATA
}//endFunction




window.domWin_getWindowDefaultStyle=function(){
  var QQ=new Object
  var LF=String.fromCharCode(10); 
  var q=''                    // outerDiv
  q+=LF+' left:||LEFT||px; '
  q+=LF+' top:||TOP||px; '
  q+=LF+' width:||WIDTH||px;  '
  q+=LF+' position:absolute; '
  // q+=LF+' position:fixed; '
  q+=LF+' position:absolute; '
  q+=LF+' background: #EEEEFF; '
  q+=LF+' background: #eee; '
  q+=LF+' background-color:#fff; '
  q+=LF+' border: 10px solid #f00; '
  q+=LF+' border: 3px outset #999; '
  q+=LF+'-moz-border-radius: 7px 7px; '
  q+=LF+' padding:0px; '
  QQ.outerDiv=q
  
  q=''                       // innerDiv
  q+=LF+' border: 1px solid #fff; '
  q+=LF+' border: 2px solid #2D9AE2; '
  q+=LF+' border: 1px inset #ccc; '
  q+=LF+' -moz-border-radius: 5px 5px; '
  q+=LF+' margin:0px; '
  q+=LF+' background-color:#eaeaea; '
  QQ.innerDiv=q

  q=''                       // titleBar
  q+=LF+' height:18px; '
  q+=LF+' background:#4E71A3; '
  q+=LF+' cursor:move; '
  q+=LF+' -moz-border-radius: 4px 4px 0px 0px ; '
  // q+=LF+' -moz-border-radius: 4px 4px 4px 4px ; '
  q+=LF+' margin-right:0px;  '
  q+=LF+' background-color: #aaa;   '
  q+=LF+' background-image:url();  '
  q+=LF+' background-repeat:repeat-x;   '
  q+=LF+' background-position:top;   '
  QQ.titleBar=q
  
  return QQ
}//endFunction


window.domWin_getWindowDefaultStyle2=function(){
  var QQ=new Object
  var LF=String.fromCharCode(10); 
  var q=''                    // outerDiv
  q+=LF+' left:||LEFT||px; '
  q+=LF+' top:||TOP||px; '
  q+=LF+' width:||WIDTH||px;  '
  q+=LF+' position:absolute; '
  // q+=LF+' position:fixed; '
  q+=LF+' background: #EEEEFF; '
  q+=LF+' background: #eee; '
  q+=LF+' background-color:#fff; '
  q+=LF+' border: 10px solid #f00; '
  q+=LF+' border: 3px outset #999; '
  // q+=LF+'-moz-border-radius: 7px 7px; '
  q+=LF+' padding:0px; '
  QQ.outerDiv=q
  
  q=''                       // innerDiv
  q+=LF+' border: 1px solid #fff; '
  q+=LF+' border: 2px solid #2D9AE2; '
  q+=LF+' border: 1px inset #aaa; '
  // q+=LF+' -moz-border-radius: 5px 5px; '
  q+=LF+' margin:0px; '
  q+=LF+' background-color:#eaeaea; '
  QQ.innerDiv=q

  q=''                       // titleBar
  q+=LF+' height:18px; '
  q+=LF+' background:#4E71A3; '
  q+=LF+' background: #ffffff url(http://www.allcrunchy.com/Web_Stuff/Gradient_Generator/images/5D87F3335BBF22sinusoidal.png) repeat-x right top; '
  q+=LF+' cursor:move; '
  // q+=LF+' -moz-border-radius: 4px 4px 0px 0px ; '
  q+=LF+' margin-right:0px  '
  QQ.titleBar=q
  
  return QQ
}//endFunction









//--> ...


window.domWin_getWindowTemplate=function(PARA){
  var LF=String.fromCharCode(10); var q=''
  q+=LF+'<div class="window" macro="getID" id="domWindowX||ID||"  myId="||ID||" > '
  q+=LF+'  '
  q+=LF+'<div class="innerDiv"  id="innerDiv_||ID||" > '
  q+=LF+'  '

  
  
  //--> titelBar

  // q+=LF+' <input type="Checkbox" name="" value="v" style=" position: absolute; top:2px;left:20px;"> '
  // q+=LF+' <input type="Checkbox" name="" value="v" style=" position: absolute; top:2px;left:36px;"> '
  q+=LF+' '
  q+=LF+' <img src="http://mw.teamwiki.net/docs/img/win-icons/ACCICONS_138-16.png" '
  q+=LF+' alt="-*-" ondblClick="closeThisTiddler(this)"  id="appIcon_||ID||"'
  q+=LF+' style=" position:absolute; top:3px;left:6px;" /> '
  q+=LF+' '
  q+=LF+' <img src="http://mw.teamwiki.net/docs/img/closebtn.png" ' //http://es.teamwiki.net/docs/icons/media-recordMidi.png //http://twhobbycoder.gmxhome.de/icons/media-recordMidi.png
  q+=LF+' alt="-x-" onClick="closeThisTiddler(this)"  id="closeIcon_||ID||"'
  q+=LF+' style=" position:absolute; top:4px;right:4px;" /> '
  q+=LF+' '
  q+=LF+' <div class="titleBar"  id="titleBar_||ID||"   myId="||ID||" onDblClick="onDomWinTitleBarDblClick(event)" >  '

  q+=LF+' <span class="titleBarText" id="titlebarText_||ID||"   myId="||ID||"  style="margin-left:24px; "  '
  q+=LF+' >||TITLE|| </span> '

  q+=LF+' <span class="domWindowToolbar" style="font-size: 6pt; width:70px; display:none; "  '  //display:none;
  q+=LF+' macro="toolbar dwCollapsExpand +editTiddler closeTiddler "> '
  q+=LF+' [_] top '
  q+=LF+' </span> '
  q+=LF+' </div> '
  q+=LF+' '

  q+=LF+' <div class="menueBar"  id="menueBar_||ID||"   myId="||ID||"  '
  q+=LF+' style=" '
  q+=LF+' background: #555; color:#bbb;  '
  q+=LF+' '
  q+=LF+' display:none; '
  q+=LF+' ">...menueBar</div> '
  q+=LF+' '
  
  //--> ClientArea
  q+=LF+' '
  q+=LF+' <div class="clientAreaBackground" id="clientAreaBackground_||ID||" style="  ' // width:100%; '
  q+=LF+'      margin: 0px 0px 0px 0px;  '
  q+=LF+'      padding: 3px 0px 2px 0px;  '
  q+=LF+'      background: #222;  '
  // q+=LF+'      color: #0f0;  '
  q+=LF+'    "> '
  q+=LF+' '

  q+=LF+' '
  q+=LF+' <div class="clientArea" id="clientArea_||ID||" style="  '
  q+=LF+'      height:||HEIGHT||px;  '
  q+=LF+'      border-width: 0px; ' 
  q+=LF+'      overflow: auto;    '
  q+=LF+'      padding: 0px 3px 0px 9px;  '
  q+=LF+'      background: transparent;  '
  // q+=LF+'      color: #efefef;  '
  q+=LF+'        '
  q+=LF+'    "> '
  q+=LF+' <div class="viewer" id="viewer_||ID||" '
  q+=LF+' macro="view text wikified" style=" background:transparent;" > '
  q+=LF+' '

  // Lorem ipsum 
  q+=LF+' <br><span><button onclick="test3()"> test-3</button></span><br><span><button onclick="test1()"> test-1</button></span><br><span><button onclick="test2()"> test-2</button></span><br>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.'
  q+=LF+' '
  q+=LF+' '
  q+=LF+' </div> '    // Viewer  
  q+=LF+' '
  q+=LF+' '
  q+=LF+'   </div> '  // clientArea
  q+=LF+'  </div> '   // clientAreaBackground
  q+=LF+' '
  q+=LF+' </div> '    // innerDiv
  q+=LF+'</div> '     // window
  q+=LF+' '
  q+=LF+' '

  
  
  //--> style ??? soll das hier bleiben ???
  q+=LF+'<style> '
  q+=LF+' '
  q+=LF+' '
  q+=LF+'.tiddler { '
  q+=LF+' padding: 1em 1em 0em 1em; '
  q+=LF+'} '
  q+=LF+' '
  q+=LF+'.window { '
  q+=LF+' background-color: #c0c0c0; '
  q+=LF+' background-color: #FFFFFF; '
  q+=LF+' border-color: #f0f0f0 #606060 #404040 #d0d0d0; '
  q+=LF+' border-color: #f0f0f0 #999999 #888888 #d0d0d0; '
  q+=LF+' border-style: solid; '
  q+=LF+' border-width: 2px; '
  q+=LF+' border-width: 2px; '
  q+=LF+' margin: 0px; '
  q+=LF+' padding: 2px; '
  q+=LF+' position: absolute; '
  q+=LF+' text-align: left; '
  q+=LF+' visibility: hidden; '
  q+=LF+'} '
  q+=LF+' '
  q+=LF+' '
  q+=LF+'.toolbar { '
  q+=LF+' text-align: right; '
  // q+=LF+' font-size: .9em; '
  q+=LF+' visibility: hidden; '
  q+=LF+' } '
  q+=LF+' '
  q+=LF+' .domWindowToolbar {'
  q+=LF+' font-family: "MS Sans Serif", "Arial", "Helvetica", sans-serif; '
  q+=LF+' font-size: 10pt; '
  q+=LF+' font-weight: 200; '
  q+=LF+' }'
  q+=LF+' '
  q+=LF+'.titleBar { '
  q+=LF+' background-color: #008080; '
  q+=LF+' background-color: #0000DD; '
  q+=LF+' background-color: #61c5cf; '
  q+=LF+' background-color: #cad7e6; '
  q+=LF+' background:#B8E6F4;  '
  q+=LF+' cursor: default; '
  q+=LF+' color: #000000; '
  q+=LF+' margin: 0px; '
  q+=LF+' padding: 0px; '
  // q+=LF+' padding: 2px 2px 2px .5em; '
  q+=LF+' text-align: right; '
  q+=LF+' white-space: nowrap; '
  q+=LF+' } '
  q+=LF+' '
  q+=LF+'.titleBarText { '
  q+=LF+' float: left; '
  q+=LF+' overflow: hidden; '
  q+=LF+' text-align: left; '
  q+=LF+' padding-top: 2px; '
  q+=LF+' font-family: "MS Sans Serif", "Arial", "Helvetica", sans-serif; '
  q+=LF+' font-size: 8pt; '
  q+=LF+' font-weight: bold; '
  q+=LF+'} '
  q+=LF+' '
  q+=LF+'.selected .toolbar { '
  q+=LF+' visibility: visible; '
  q+=LF+'} '
  q+=LF+' '
  
  
  //--> Style: displayArea / clientArea
  q+=LF+'#displayArea { '
  q+=LF+' margin: 1em 17em 0em 14em; '
  q+=LF+'} '
  q+=LF+' '
  q+=LF+' '
  q+=LF+'.clientArea { '
  q+=LF+' background-color: #ffffff; '
  q+=LF+' border-color: #f0f0f0 #999999 #888888 #d0d0d0; '
  q+=LF+' border-color: #999999 #f0f0f0 #d0d0d0 #888888; '
  q+=LF+' border-style: solid; '
  q+=LF+' border-width: 2px; '
  //q+=LF+' color: #000000; '
  q+=LF+' font-family: "Arial", "Helvetica", sans-serif; '
  q+=LF+' font-size: 10pt; '
  q+=LF+' margin: 2px 0px 0px 0px; '
  q+=LF+' overflow: auto; '
  q+=LF+' padding: 0px; '
  q+=LF+' padding-left: .5em; '
  q+=LF+' padding-right: .3em; '
  q+=LF+'} '
  q+=LF+' '
  q+=LF+'.__viewer { '
  q+=LF+' line-height: 1.4em; '
  q+=LF+' padding-top: 0.5em; '
  q+=LF+'} '
  q+=LF+' '
  q+=LF+' </style>'
  q+=LF+' '
  q+=LF+' '
  q+=LF+' '
  q+=LF+' '
  q=replaceAll(q, '_|APO|_', '"')
  q=replaceAll(q, '||ID||',PARA["id"])
  q=replaceAll(q, '||TITLE||',PARA["title"])
  q=replaceAll(q, '||LEFT||',PARA["left"])
  q=replaceAll(q, '||TOP||',PARA["top"])
  q=replaceAll(q, '||WIDTH||',PARA["width"])
  q=replaceAll(q, '||HEIGHT||',PARA["height"])
  return q    
}//endFunction


 
  






//-->
//-->R E S I Z E 





window.onMenuItemCallBackXY=function(lastMouseX, lastMouseY, root, className,id , e, mouseState) {
  if (mouseState=="dragEnd") {
    
      
      //  alert("dragEnd 1111")
    
    return
    
    // glob_pinboardSkipDragDrop=false // ... Gefahr vorüber

    printLine (1,"lastMouseX",lastMouseX)
    printLine (2,"lastMouseY",lastMouseY)
    printLine (3,"mouseState",mouseState)
    sendMesOnMouseUp(id)
    return
    var newX=Math.ceil(lastMouseX/10)*10
    root.style.left=newX+"px"
    dumpFromId(id)
    // alert(root.className)
  }
return
  
  
  
  // var memoContainer=findParentNodeByClass(memoItem, "memoItemOuterDiv", true) 
  // var id=memoContainer.getAttribute("memoItemId")
  // var id=root.getAttribute("memoItemId")

  var memoContainer=findChildByClass(root,"memoItemOuterDiv",true)
  var id= memoContainer.getAttribute("memoItemId")
  if (mouseState=="dragStart") {
    glob_pinboardSkipDragDrop=true // ... damit der ie nicht das rubberband aktiviert 
    var DATA=memoData_get(id)
    trace("onMemoItemCallBackXY","111")
    pinboard_removeAllSelected()
    pinboard_setCurItem(id)
    trace("onMemoItemCallBackXY","222")
  
    domWindow_bringToFront(root)
    trace("onMemoItemCallBackXY","333")

    root.style.zIndex=memoItem_zIndexHandler(id, DATA[mmmZIndex])
    dumpFromId(id)
    // alert(root.className)

    trace("onMemoItemCallBackXY", "dragStart")
    trace("maus", e.button)
    var iconContainer=findById("contextMenueContainer")
    var iconSubContainer=findById("contextMenueIcons")
    var ss=iconContainer.style
    if (e.button==2 && window.globSkipContextHandler==false)  { 
      // alert("e.button==2")
      var iconBar=findById("pinboard_miniIconBar")
      iconSubContainer.innerHTML=iconBar.innerHTML
      ss.display="block"        
      // if (ss.display=="block"){
      //   ss.display="none"
      // }else{ 
      //   ss.display="block"        
      //   ss.padding="2px" 
      // }
   }else{
     window.globSkipContextHandler=false
     pinboard_miniIconBar_hide()
   }
   // var newTop=10+parseInt(DATA[mmmYPos])+parseInt(DATA[mmmDeltaY])
   var newTop=-60+parseInt(DATA[mmmYPos])// +parseInt(DATA[mmmDeltaY])
   var newLeft=parseInt(DATA[mmmXPos])
   // alert(newTop)
   ss.top=newTop+"px"
   ss.left=newLeft+"px"
   //alert("...kontextmenü: "+iconBar.innerHTML)
   return
  }
  
  memoData_setValue(id, mmmXPos, lastMouseX)
  memoData_setValue(id, mmmYPos, lastMouseY)
  dumpFromId(id)

  printLine (1,"lastMouseX",lastMouseX)
  printLine (2,"lastMouseY",lastMouseY)
  printLine (3,"mouseState",mouseState)

  var offSetX=findPosX2(root)
  var offSetY=findPosY2(root)
  printLine (4,"offSetX",offSetX)
  printLine (5,"offSetY",offSetY)

}//endFunction




window.onMenuItemCallBackOnMouse=function(nx,ny,root,className,id, e ,mouseState){
  if (mouseState=="dragEnd") {
    alert("dragEnd 2222")
   
    return
  }
}//endFunction  




//--> ...

window.onDomWinPosChanged=function(event,eventType){
  trace("onDomWinPosChanged",eventType)
  // return
  
  if(!event)event=window.event
  var target= window.lastDomWindowTargetElement // ... notwendig wegen iFrameProtector
  var domWindow=findParentNodeByClassName(target, "window")
  // alert(domWindow)
  var myId=domWindow.getAttribute("myId")
 
  var win = window.domWindowPARA[myId]
  

  if (eventType=="RESIZE") {
    win.isFullscreenMode=false
      
      
  //   // alert("onDomWinPosChanged: " + myId+"<--")
  //   var win = window.domWindowPARA[myId]
  //   // alert(window.domWindowPARA[myId].onresize2)
  //   if (window.domWindowPARA[myId].onresize2) onDomWinResize(myId)
  //   return
  }
  onDomWinResize(myId)   // dragEnd, moveEnd
}//endFunction  
 

window.onDomWinResize=function(myId){
  var win = window.domWindowPARA[myId]
  var outerDiv   = findById("domWindowX"+myId)
  var clientArea = findById("clientArea_"+myId)
  var ss=outerDiv.style
  var left=parseInt(ss.left)
  var top=parseInt(ss.top)
  var width=parseInt(ss.width)
  
  ss=clientArea.style
  var height=parseInt(ss.height)
  var winPos=left+"!"+top+"!"+width+"!"+height

  // skip, falls tuttiFrutti
  
  var isFullscreenMode=true
  
  var win = window.domWindowPARA[myId]
  // if (win.tuttiFrutti==false || win.isFullscreenMode==true ) {
  if (win.isFullscreenMode==true ) {
    //...keine cookies speichern
  }else{
    // ...save cookies
    if(window.wDesk_setCookie)wDesk_setCookie("dwPos_"+myId, winPos, 30)
  }
  
  
  // alert(id)
  var iFrame = findById("myIframe_"+myId)
  // alert(iFrame)
  if(iFrame){
    ss=iFrame.style
    ss.height=(height-4)+"px"
  }
  
  // alert(window.domWindowPARA[id].onresize)
  var callBack= window.domWindowPARA[myId].onresize
  if (callBack){
    callBack(myId)  
  }
  var callBack2= window.domWindowPARA[myId].onresize2
  if (callBack2 && callBack2 != callBack){
    callBack2(myId)  
  }

}//endFunction
  

  
  
  

 
//--> ...

   
  
  
window.clientAreaGetHeight=function(title){ //as integer [height=]
  var tiddler=findTiddler(title)
  var clientArea=findChildByClass(tiddler,"clientArea")
  var ss=clientArea.style
  var height=parseInt(ss.height)
  return height
}//endFunction


window.clientAreaGetWidth=function(title){ //R: as integer [width=]; as String
  var tiddler=findTiddler(title)
  var clientArea=findChildByClass(tiddler,"window")
  var ss=clientArea.style
  var width=parseInt(ss.width)
  return width
}//endFunction
  


  
//-->
//--> W I N D O W - I N I
  
//***********************************************
// Do not remove this notice.
//
// Copyright 2001 by Mike Hall.
// See http://www.brainjar.com for terms of use.
//************************************************

//================================================
// Initialization code.
//=================================================
  
  
window.winInitMain=function() {
  
  window.winCtrl = new Object();
  winCtrl.maxzIndex = 32299;
  // winCtrl.resizeCornerSize = 25;
  winCtrl.resizeCornerSize = 25;
  // winCtrl.minimizedTextWidth = 55; //= 100;
  winCtrl.minimizedTextWidth = 70; //= 100;
  winCtrl.inactiveFrameBackgroundColor = "#c0c0c0";
  winCtrl.inactiveFrameBackgroundColor = "#f00";
  winCtrl.inactiveFrameBorderColor = "#f0f0f0 #505050 #404040 #e0e0e0";
  winCtrl.inactiveTitleBarColor = '#cbcbcb url("http://es.teamwiki.net/docs/img/backgrounds/inactiveTitleBarBg.png") repeat-x right top';//"#BBBBBB";
  winCtrl.inactiveTitleTextColor = "#555555";
  winCtrl.inactiveClientAreaBorderColor = "#404040 #e0e0e0 #f0f0f0 #505050";
  winCtrl.inactiveClientAreaScrollbarColor = "";
  winCtrl.inMoveDrag = false;
  winCtrl.inResizeDrag = false;
  
  
  var el = findById("iFrameProtector")
  if (!el){
    el=document.createElement("DIV")
    el.id="iFrameProtector"
    el.setAttribute("dblclickaction", "skipEditMe")
    el.innerHTML="ACHTUNG: iFrameProtector"
    var ss=el.style
    ss.backgroundColor="transparent"
    ss.position="fixed"
    ss.border="2px solid #ddd"
    ss.top="0px"
    ss.left="0px"
    ss.width="100%"
    ss.height="100%"

    // ss.backgroundColor="#bbb"
    ss.width="100%"
    ss.height="100%"

    // ss.height="100px"
    ss.display="none"
    ss.zIndex=32222
    document.body.appendChild(el) 
    el.onclick=hideIFrameProtector
  }
  trace("winInitMain")
  
}//endFunction
  
window.hideIFrameProtector=function(e) {
  var el=findById("iFrameProtector")
   if(el) el.style.display="none"
}//endFunction

window.showIFrameProtector=function(e) {
  // return
  var el=findById("iFrameProtector")
  if(el) el.style.display="block"
}//endFunction

  
window.iFrameEventProtector_hide=function(){
  // return
  var elx=findById("iFrameEventProtector")
  if (elx)removeElement(elx)
}//endFunction
  
 
window.iFrameEventProtector_show=function(){
  var elx=findById("iFrameEventProtector")
  removeElement(elx)
  var el=document.createElement("div")
  el.id="iFrameEventProtector"
  var ss=el.style
  ss.left="0px"
  ss.top="0px"
  ss.width="99%"
  ss.height="97%"
  ss.position="absolute"
  ss.backgroundColor="transparent"
  ss.border="1px #ff0000 solid"
  ss.zIndex=32333
  el.onclick=iFrameEventProtector_hide
  var parent=findById("contentWrapper")
  parent.appendChild(el)
}//endFunction
  

  
// Initialize windows and build list.
  
window.winInit=function(id,title) {
  var winRef = document.getElementById("domWindowX"+id);
  var winRef = document.getElementById("domWindowX"+id);
  trace("winRef(winInit 000)", winRef.id)
  trace("winRef(winInit 111)", winRef.title)
  if (winRef.className == "window"){
    trace("winRef(winInit222)", "==INI-DONE==")
    
    // var newEl= new Window(winRef,id)
    var newEl= new Window(winRef,title, id)
    
    // ???
    winCtrl.inResizeDrag = false;
    winCtrl.inMoveDrag = false;

    window.domWindowDATA[id] = newEl;
  } 
  // trace("########window.winInit-OK-2)",title)
  return winRef
}//endFunction




//=============================================================================
//--> ... Utility functions:
//=============================================================================


window.getDomWindowList=function(title){
  var wList=domWindowDATA[title]
  return wList
}//endFunction


  
  
// Determine browser and version.

window.BrowserObj=function() {
  // alert("BrowserObj")
  var ua, s, i;
  window.isIE=false
  this.isIE = false; // Internet Explorer
  this.isNS = false; // Netscape
  this.isOPERA = false; // Netscape
  this.version = null;

  // Default geändert (es)
  this.isNS = true;
  this.version = 6.1;

  ua = navigator.userAgent;
  // prompt(ua,ua)


  s = "MSIE";
  
  
  
  
  if ((i = ua.indexOf(s)) >= 0) {
    window.isIE=true
    this.isIE = true;
    this.isNS = false
    this.version = parseFloat(ua.substr(i + s.length));
    //alert("isIE: "+isIE)
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
  s = "Opera";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
   this.isOPERA = true; //wird gebraucht für: offsetX /clientX
    return;
  }
  
  // alert(this.isIE)
  
  
}//endFunction
window.browser = new BrowserObj();
  
  // alert(browser.isIE) 
  // alert(browser.isNS) 
  
  
  
//-->
//--> W I N D O W - O B J E C T  

  
//=============================================
// Window Object
//==============================================

window.Window=function(el,title,id) {

  var i, mapList, mapName;

  // Get window components.
  this.frame = el;
  this.title=title
  this.id=id

  this.titleBar = winFindByClassName(el, "titleBar");
  
  // alert(this.titleBar.id)
  this.captionBar= winFindByClassName(el, "caption")
  this.titleBarText = winFindByClassName(el, "titleBarText");
  this.titleBarButtons = winFindByClassName(el, "titleBarButtons");
  this.clientArea = winFindByClassName(el, "clientArea");

  // var title=el.id.substr(10)
  //alert("title !!!: "+title)
  //? // Find matching button image map.
  //? mapName = this.titleBarButtons.useMap.substr(1);
  //? mapList = document.getElementsByTagName("MAP");
  //? for (i = 0; i < mapList.length; i++)
  //? if (mapList[i].name == mapName)
  //? this.titleBarMap = mapList[i];

  // Save colors.
  this.activeFrameBackgroundColor = this.frame.style.backgroundColor;
  this.activeFrameBorderColor = this.frame.style.borderColor;
  this.activeTitleBarColor = '#ffffff url(http://es.teamwiki.net/docs/img/backgrounds/activeTitleBarBg.png) repeat-x right top;'//"#28489A"//"#2D9AE2" // "#5F88B3"//"#2D9AE2" //this.titleBar.style.backgroundColor;
  this.activeTitleTextColor = "#FFFFFF" //this.titleBar.style.color;
  this.activeClientAreaBorderColor = this.clientArea.style.borderColor;
  if (browser.isIE)
    this.activeClientAreaScrollbarColor = this.clientArea.style.scrollbarBaseColor;

  // Save images.
  //? this.activeButtonsImage = this.titleBarButtons.src;
  //? this.inactiveButtonsImage = this.titleBarButtons.longDesc;

  // Set flags.
  this.isOpen = false;
  this.isMinimized = false;
  this.hideOnClose = false;//...mw

  // Set methods.
  this.open = winOpen;
  //this.close = winClose;
  this.close = winCloseXX;

  this.minimize = winMinimize;
  this.restore = winRestore;
  this.makeActive = winMakeActive;

  // Set up event handling.
  this.frame.parentWindow = this;
  this.frame.onmousemove = winResizeCursorSet;
  this.frame.onmouseout = winResizeCursorRestore;
  
  this.frame.onmousedown = winResizeDragStart;
  this.frame.onmouseup = hideIFrameProtector;


  this.titleBar.parentWindow = this;
  this.titleBar.onmousedown = winMoveDragStart;
  this.titleBar.oncontextmenu = winOnContextMenu;
  this.titleBar.onmouseup = hideIFrameProtector;
  if (this.captionBar){
    this.captionBar.parentWindow=this
    this.captionBar.onmousedown = winMoveDragStart;
    this.captionBar.oncontextmenu = winOnContextMenu;
  }

  this.clientArea.parentWindow = this;
  
  this.clientArea.onmousedown = winClientAreaClick;
  // this.clientArea.onmouseup = winClientAreaClick;
  
  
  // this.clientArea.onmouseup = hideIFrameProtector;

  //? for (i = 0; i < this.titleBarMap.childNodes.length; i++)
  //? if (this.titleBarMap.childNodes[i].tagName == "AREA")
  //? this.titleBarMap.childNodes[i].parentWindow = this;


  // Calculate the minimum width and height values for resizing and fix any initial display problems.
  var initLt, initWd, w, dw;

  // Save the inital frame width and position, then reposition the window.
  initLt = this.frame.style.left;
  initWd = parseInt(this.frame.style.width);
  this.frame.style.left = -this.titleBarText.offsetWidth + "px";

  // For IE, start calculating the value to use when setting the client area width based on the frame width.
  if (browser.isIE) {
    this.titleBarText.style.display = "none";
    w = this.clientArea.offsetWidth;
    this.widthDiff = this.frame.offsetWidth - w;
    this.clientArea.style.width = w + "px";
    dw = this.clientArea.offsetWidth - w;
    w -= dw; 
    this.widthDiff += dw;
    this.titleBarText.style.display = "";
  }

  // Find the difference between the frame's style and offset widths. 
  // For IE, adjust the client area/frame width difference accordingly.
  w = this.frame.offsetWidth;
  this.frame.style.width = w + "px";
  dw = this.frame.offsetWidth - w;
  w -= dw; 
  this.frame.style.width = w + "px";
  if (browser.isIE)
    this.widthDiff -= dw;

  // Find the minimum width for resize.
  this.isOpen = true; // Flag as open so minimize call will work.
  this.minimize();

  // Get the minimum width.
  if (browser.isNS && browser.version >= 1.2)
    // For later versions of Gecko.
    this.minimumWidth = this.frame.offsetWidth;
  else
    // For all others.
    this.minimumWidth = this.frame.offsetWidth - dw;
    this.minimumWidth = 110

  // Find the frame width at which or below the title bar text will need to be clipped.
  this.titleBarText.style.width = "";
  this.clipTextMinimumWidth = this.frame.offsetWidth - dw;

  // Set the minimum height.
  this.minimumHeight = 1;

  // Restore window. For IE, set client area width.
  this.restore();
  this.isOpen = false; // Reset flag.
  initWd = Math.max(initWd, this.minimumWidth);
  
  // initWd=111
  // alert(this.frame.id)
  // alert(initWd)
  
  this.frame.style.width = initWd + "px";
  if (browser.isIE)
    this.clientArea.style.width = (initWd - this.widthDiff) + "px";

  // Clip the title bar text if needed.
  if (this.clipTextMinimumWidth >= this.minimumWidth)
    this.titleBarText.style.width = (winCtrl.minimizedTextWidth + initWd - this.minimumWidth) + "px";

  // Restore the window to its original position.
  this.frame.style.left = initLt;

  trace("window.Window=function", "DONE")

  //alert("winIni: OK...");
}//endFunction
  
  
  
  
  
  
  
//=============================================================================
// Window Methods
//=============================================================================

window.winOpen=function() {
  if (this.isOpen)
    return;

  // Restore the window and make it visible.
  this.makeActive();
  this.isOpen = true;
  if (this.isMinimized)
    this.restore();
  this.frame.style.visibility = "visible";
}//endFunction


window.winClose=function() {
  // Hide the window.
  this.frame.style.visibility = "hidden";
  this.isOpen = false;
}//endFunction
  
  
window.winCloseXX=function(e) {
  // Destroy the window: domWindow_...
  alert("winCloseXX");
  
  var title=this.frame.id.slice(10);
  alert (this.frame.id);
  //alert (title); 
  //this.frame.style.visibility = "hidden";
  //this.isOpen = false;
  closeTiddler(title)
  //alert("OK???")
}//endFunction

  
window.winMinimize=function() {
  /// trace("$$$$$$winMinimize",this.frame);
  // trace("$$$$$$winMinimize.id",this.frame.id);
  if (!this.isOpen || this.isMinimized)
    return;
  this.makeActive();

  // Save current frame and title bar text widths.
  this.restoreFrameWidth = this.frame.style.width;
  this.restoreTextWidth = this.titleBarText.style.width;

  // Disable client area display.
  this.clientArea.style.display = "none";

  // Minimize frame and title bar text widths.
  if (this.minimumWidth)
    this.frame.style.width = this.minimumWidth + "px";
  else
    this.frame.style.width = "";
  this.titleBarText.style.width = winCtrl.minimizedTextWidth + "px";

  this.isMinimized = true;
}//endFunction
  
  
window.winRestore=function() {
  if (!this.isOpen || !this.isMinimized)
    return;
  this.makeActive();

  // Enable client area display.
  this.clientArea.style.display = "";

  // Restore frame and title bar text widths.
  this.frame.style.width = this.restoreFrameWidth;
  this.titleBarText.style.width = this.restoreTextWidth;

  this.isMinimized = false;
}//endFunction
  
   
window.winMakeActive=function() {
  // alert("winMakeActive")
  var title=this.title
  trace("Activate!! -000- ",title)
  this.frame.style.zIndex = domWin_incrementZIndex() // (window.globZOrder++) //es... test IE
  
  // ???
  // if(window.iScript.sysEvents.skipBringToFront==true){
  //  //ist das die richtige stelle ???
  //  window.iScript.sysEvents.skipBringToFront=false
  //  return
  //}
  
  
  
  // ... scheiß ie
  var parent = this.frame.parentNode || this.frame.parent;
  parent.style.zIndex = newIndex //+deltaIndex //es... test IE
  
  if (winCtrl.active == this) return;

  trace("Activate!! -111- ",this.frame.id)
  winCtrl.inMoveDrag = false;
  winCtrl.inResizeDrag = false;


  // Inactivate the currently active window.
  if (winCtrl.active) {
    
    // alert("Inactivate the currently active window.")
    // winCtrl.active.frame.style.backgroundColor = winCtrl.inactiveFrameBackgroundColor;
    // winCtrl.active.frame.style.borderColor = winCtrl.inactiveFrameBorderColor;
    
    
   // alert(winCtrl.inactiveTitleBarColor)
    
    winCtrl.active.titleBar.style.background = winCtrl.inactiveTitleBarColor;

    winCtrl.active.titleBar.style.background = '#cbcbcb url("http://es.teamwiki.net/docs/img/backgrounds/inactiveTitleBarBg.png") repeat-x right top'
    // winCtrl.active.titleBar.style.background = "#00ff00 url() repeat-x right top;"
    // winCtrl.active.titleBar.style.backgroundImage="url(http://es.teamwiki.net/docs/img/backgrounds/inactiveTitleBarBg.png)"
    // winCtrl.active.titleBar.style.backgroundImage="http://es.teamwiki.net/docs/img/backgrounds/inactiveTitleBarBg.png"
    
    // alert(winCtrl.active.id)
    // alert(winCtrl.active.titleBar.style.background)
    
    // alert(winCtrl.active.titleBar.style.backgroundImage)

     // winCtrl.active.titleBar.style.background = '#ffffff url(http://es.teamwiki.net/docs/img/backgrounds/inactiveTitleBarBg.png) repeat-x right top;';
    winCtrl.active.titleBar.style.color = "#444"   // winCtrl.inactiveTitleTextColor;
    
    // winCtrl.active.clientArea.style.borderColor = winCtrl.inactiveClientAreaBorderColor;
    
    if (browser.isIE)
      winCtrl.active.clientArea.style.scrollbarBaseColor = winCtrl.inactiveClientAreaScrollbarColor;
    if (browser.isNS && browser.version < 6.1)
      winCtrl.active.clientArea.style.overflow = "hidden";
    // ??? if (winCtrl.active.inactiveButtonsImage)
    // ??? winCtrl.active.titleBarButtons.src = winCtrl.active.inactiveButtonsImage;
  }
  
  winCtrl.active = this;
  
  // Activate this window.
  window.globZOrder=domWin_incrementZIndex() // window.globZOrder+1
  var deltaIndex=0
  
  
  var newIndex=deltaIndex+window.globZOrder
  //alert(newIndex) 
  this.frame.parentNode.style.zIndex = newIndex //+deltaIndex //es... test IE
  
  //this.frame.style.backgroundColor = this.activeFrameBackgroundColor;
  this.frame.style.borderColor = this.activeFrameBorderColor;

  /// this.titleBar.style.backgroundColor = this.activeTitleBarColor;
  // this.titleBar.style.background = this.activeTitleBarColor;
  this.titleBar.style.backgroundImage="url(http://es.teamwiki.net/docs/img/backgrounds/activeTitleBarBg.png)"

  
  this.titleBar.style.color = this.activeTitleTextColor;
  this.clientArea.style.borderColor = this.activeClientAreaBorderColor;
  if (browser.isIE)
    this.clientArea.style.scrollbarBaseColor = this.activeClientAreaScrollbarColor;
  if (browser.isNS && browser.version < 6.1)
    this.clientArea.style.overflow = "auto";
  if (this.inactiveButtonsImage)
    this.titleBarButtons.src = this.activeButtonsImage;
  //this.frame.style.zIndex = ++winCtrl.maxzIndex;

  //alert(this.frame.style.zIndex)
  winCtrl.active = this;
  trace("Activate!!-555- ",this.frame.id)
  
}//endFunction
  


//-->
//-->WINDOW-DRAGGING / E V E N T S



//==================================
// Event handlers.
//==================================

  
window.onDomWinTitleBarDblClick=function(e){
  if(!e)e=window.event
  e.cancelBubble=true; 
  var target=resolveTarget(e)
  if (e.stopPropagation)e.stopPropagation();
  var container=findParentNodeByClass(target, "tiddler",true)
  var myId=container.getAttribute("myId")
  // alert(myId)
  // alert("onDomWinTitleBarDblClick") 
  
  var win = window.domWindowPARA[myId]
  var outerDiv   = findById("domWindowX"+myId)
  var clientArea = findById("clientArea_"+myId)
  var ss=outerDiv.style
  var sss=clientArea.style
  
  if (win.isFullscreenMode==false){
    win.isFullscreenMode=true 
    var si=size()
    var height=si.height
    var width=si.width
    ss.top="0px"
    ss.left="0px"
    ss.width=(width-25)+"px"
    sss.height=(height-55)+"px"
  }else{
    win.isFullscreenMode=false
    var winPos=""
    if(window.wDesk_getCookie)winPos=wDesk_getCookie("dwPos_"+myId, "")
    if (winPos != "" ){
      var winPosData = winPos.split("!")
      ss.left    =winPosData[0]+"px"
      ss.top     =winPosData[1]+"px"
      ss.width   =winPosData[2]+"px"
      sss.height =winPosData[3]+"px"
    }else{
      //  z.B. cookies deaktiviert ???  
      ss.left    =200+"px"
      ss.top     =200+"px"
      ss.width   =400+"px"
      sss.height =500+"px"
    }
  }
  window.onDomWinResize(myId)
  
  return
  
  var left=parseInt(ss.left)
  var top=parseInt(ss.top)
  var width=parseInt(ss.width)
  
  var sss=clientArea.style
  
  
  var height=parseInt(ss.height)
  
  
  
  var winPos=left+"!"+top+"!"+width+"!"+height

  // skip, falls tuttiFrutti
  if(window.wDesk_setCookie)wDesk_setCookie("dwPos_"+id, winPos, 30)
  
  // alert(id)
  var iFrame = findById("myIframe_"+id)
  // alert(iFrame)
  if(iFrame){
    ss=iFrame.style
    ss.height=(height-4)+"px"
  }
  
  // alert(window.domWindowPARA[id].onresize)
  var callBack= window.domWindowPARA[id].onresize
  if (callBack){
    callBack(id)  
  }
  var callBack2= window.domWindowPARA[id].onresize2
  if (callBack2 && callBack2 != callBack){
    callBack2(id)  
  }

  
  
}//endFunction


window.winClientAreaClick=function(event) {
  // ...Make this window the active one.
  trace("winClientAreaClick 111")
  winCtrl.inMoveDrag = false;
  winCtrl.inResizeDrag = false;
  this.parentWindow.makeActive();
  hideIFrameProtector()
}//endFunction


window.winOnContextMenu=function(e){
  // alert("window.winOnContextMenu")
  if(!e)e=window.event
  e.cancelBubble=true; 
  if (e.stopPropagation)e.stopPropagation();
  // toggleDomWindowState(e); 
  
  var target=resolveTarget(e)
  var myId = target.getAttribute("myId")

  var win = window.domWindowDATA[myId]
  // alert(win.isOpen)
  // alert(win.isMinimized)

  if (!win.isOpen || !win.isMinimized){
    // return;
  } else {
    win.makeActive();

    // Enable client area display.
    win.clientArea.style.display = "";

    // Restore frame and title bar text widths.
    win.frame.style.width = win.restoreFrameWidth;
    win.titleBarText.style.width = win.restoreTextWidth;
  
    win.isMinimized = false;
    return false
  }
  
  
  
  
   /// trace("$$$$$$winMinimize",this.frame);
  // trace("$$$$$$winMinimize.id",this.frame.id);
  if (!win.isOpen || win.isMinimized)
     return false;
  win.makeActive();

  // Save current frame and title bar text widths.
  win.restoreFrameWidth = win.frame.style.width;
  win.restoreTextWidth = win.titleBarText.style.width;

  // Disable client area display.
  win.clientArea.style.display = "none";

  // Minimize frame and title bar text widths.
  if (win.minimumWidth)
    win.frame.style.width = win.minimumWidth + "px";
  else
    win.frame.style.width = "";
  win.titleBarText.style.width = winCtrl.minimizedTextWidth + "px";

  win.isMinimized = true;

  return false; 
}//endFunction

    


 
window.domWindowClose=function(e){
  alert ("domWindowClose");
  alert (this);
  alert (this.frame);
  alert (this.frame.id);
  alert (this.parentWindow);
}//endFunction
  


window.toggleDomWindowState=function(event){
  winMinimize()
  var target=resolveTarget(event)
  var title=findTiddlerName(target)
  //target.parentNode.parentNode.id
  //alert ("winOnContextMenu.. title: "+title)
  
  // dWindowHide(title)
return
  var tiddler=target.parentNode.parentNode
  //tiddler.style.visibility="hidden"

  //alert(tiddler.className)
  var clientArea=findTiddlerChildByClassName(tiddler,"clientArea")
  //alert(clientArea.className)
  //alert(clientArea.style.height)
  var curHeight=clientArea.style.height
  if (curHeight>"33px"){
    clientArea.style.height=0
    
  }else{
    clientArea.style.height="750px"
  }
}//endFunction

  


//--> D R A G G I N G   
   
window.winMoveDragStart=function(event) {
  // alert("winMoveDragStart")
  if(!event)event=window.event
  var target2=resolveTarget(event)
  window.lastDomWindowTargetElement=target2   // ... notwendig wegen iFrameProtector
  // showIFrameProtector()

  
  trace("winMoveDragStart 000: ", target2)
  var target;
  var x, y;
  
  // alert(event.button)
  if (event.button==2) return                //..contextMenü
  // alert(event.button)
  
  
  if (browser.isIE){
    target = window.event.srcElement.tagName;
  // if (browser.isNS)
  }else{
    target = event.target.tagName;
    //alert(target)
  }
  if (target == "AREA")
    return;
 
  
  trace("winMoveDragStart 111: ", target)
  //alert("winMoveDragStart"+event.ctrlKey)
  if (event.ctrlKey==true){
    //alert("winMoveDragStart")
  }
  if(this.parentWindow) this.parentWindow.makeActive();

  // Get cursor offset from window frame.
  if (browser.isIE) {
    x = window.event.x;
    y = window.event.y;
  }else{
  // if (browser.isNS) {
    x = event.pageX;
    y = event.pageY;
  }
  winCtrl.xOffset = winCtrl.active.frame.offsetLeft - x;
  winCtrl.yOffset = winCtrl.active.frame.offsetTop - y;

  // Set document to capture mousemove and mouseup events.
  if (browser.isIE) {
    document.onmousemove = winMoveDragGo;
    document.onmouseup = winMoveDragStop;
  }else{
  // if (browser.isNS) {
    document.addEventListener("mousemove", winMoveDragGo, true);
    document.addEventListener("mouseup", winMoveDragStop, true);
    event.preventDefault();
  }
  winCtrl.inMoveDrag = true;
  winCtrl.inResizeDrag = false;
  
  trace("winMoveDragStart OK: ", browser.isIE)
  // alert("winMoveDragStart OK: ")
}//endFunction
  
  
  
window.winMoveDragGo=function(event) {
  if (!winCtrl.inMoveDrag) return;
  
  if (!event)event=window.event
  var x, y;
  
  showIFrameProtector()

  // alert("winMoveDragGo")
  // trace("winMoveDragGo 000", winCtrl.inMoveDrag)
  // trace("winMoveDragGo 111", winCtrl.inResizeDrag)
  // trace("winMoveDragGo 111",browser.isIE )
  // trace("winMoveDragGo 222",browser.isNS )

  // winCtrl.inResizeDrag = false;
  

  // Get cursor position.
  if (browser.isIE) {
    x = window.event.x;
    y = window.event.y;
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  } else{
  // if (browser.isNS) {
    x = event.pageX;
    y = event.pageY;
    if (event.stopPropagation) event.stopPropagation();
    event.preventDefault();
  }

  // Move window frame based on offset from cursor.
  winCtrl.active.frame.style.left = (x + winCtrl.xOffset) + "px";
  winCtrl.active.frame.style.top = (y + winCtrl.yOffset) + "px";
  return false
}//endFunction
  
  
  
window.winMoveDragStop=function(event) {
  
  trace("winMoveDragStop ", "event")

  hideIFrameProtector()
  
  winCtrl.inMoveDrag = false;
  var target=resolveTarget(event)
  
  // Remove mousemove and mouseup event captures on document.
  if (browser.isIE) {
    document.onmousemove = null;
    document.onmouseup = null;
  }else{
  // if (browser.isNS) {
    document.removeEventListener("mousemove", winMoveDragGo, true);
    document.removeEventListener("mouseup", winMoveDragStop, true);
  }
  
  var eventType="MOVE"
  onDomWinPosChanged(event,eventType)
  
}//endFunction
  
  
  

window.winResizeCursorSet=function(event) {
  var target;
  var xOff, yOff;
  // trace("AAA_parentWindow.isMinimized", this.parentWindow.isMinimized)
  // trace("BBB_winCtrl.inResizeDrag", winCtrl.inResizeDrag)
  if (this.parentWindow.isMinimized || winCtrl.inResizeDrag)
    return;

  // If not on window frame, restore cursor and exit.
  if (browser.isIE)
    target = window.event.srcElement;
  if (browser.isNS)
    target = event.target;
  if (target != this.parentWindow.frame)
    return;

  // Find resize direction.  

  if (browser.isNS) {
    xOff = event.layerX;
    yOff = event.layerY;
  }
  if (browser.isIE) {
    xOff = window.event.offsetX;
    yOff = window.event.offsetY;
  }
  if (browser.isOPERA) {   // opera machts hier wie der IE - ACH WIE SCHÖN - SCHEIß BROSER
    xOff = window.event.offsetX;
    yOff = window.event.offsetY;
  }
  
  // trace("xOff", xOff)
  // trace("yOff", yOff)
  winCtrl.resizeDirection = ""
  if (yOff <= winCtrl.resizeCornerSize)
    winCtrl.resizeDirection += "n";
  else if (yOff >= this.parentWindow.frame.offsetHeight - winCtrl.resizeCornerSize)
    winCtrl.resizeDirection += "s";
  if (xOff <= winCtrl.resizeCornerSize)
    winCtrl.resizeDirection += "w";
  else if (xOff >= this.parentWindow.frame.offsetWidth - winCtrl.resizeCornerSize)
    winCtrl.resizeDirection += "e";

  // trace("winCtrl.resizeDirection", winCtrl.resizeDirection)

  // If not on window edge, restore cursor and exit.
  if(winCtrl.resizeDirection == "") {
    this.onmouseout(event);
    return;
  }

  // Change cursor.
  if (browser.isIE)
    document.body.style.cursor = winCtrl.resizeDirection + "-resize";
  if (browser.isNS)
    this.parentWindow.frame.style.cursor = winCtrl.resizeDirection + "-resize";
}//endFunction
  
  
  
window.winResizeCursorRestore=function(event) {
  if (winCtrl.inResizeDrag)
    return;

  // Restore cursor.
  if (browser.isIE)
    document.body.style.cursor = "";
  if (browser.isNS)
    this.parentWindow.frame.style.cursor = "";
}//endFunction
  
  
  
window.winResizeDragStart=function(event) {
  // alert("winResizeDragStart=function(event)")
  if(!event)event=window.event
  var target2 =resolveTarget(event)
  window.lastDomWindowTargetElement=target2  
  
  trace("winResizeDragStart", "event")
  // showIFrameProtector()
  
  // alert("winResizeDragStart")
  if (event.button==2) return                //..contextMenü
  // alert(event.button)

  
  var target;

  // Make sure the event is on the window frame.
  if (browser.isIE)
    target = window.event.srcElement;
  if (browser.isNS)
    target = event.target;
    
  if (target != this.parentWindow.frame){
    trace("ExIT: winResizeDragStart", "!!!!!!!!!!!")
    return;
  }
  // ??? es
  winCtrl.inResizeDrag = true;
  
  
  this.parentWindow.makeActive();
  if (this.parentWindow.isMinimized){
    // alert("this.parentWindow.isMinimized")
    return;
  }
  // Save cursor position.
  
  if (browser.isIE) {
    winCtrl.xPosition = window.event.x;
    winCtrl.yPosition = window.event.y;
  }else{                                         // wo bleibt der opera ??? 
  // if (browser.isNS) {
    winCtrl.xPosition = event.pageX;
    winCtrl.yPosition = event.pageY;
  }
  
  // alert("winResizeDragStart  11111")
  
  // Save window frame position and current window size.
  winCtrl.oldLeft = parseInt(this.parentWindow.frame.style.left, 10);
  winCtrl.oldTop = parseInt(this.parentWindow.frame.style.top, 10);
  winCtrl.oldWidth = parseInt(this.parentWindow.frame.style.width, 10);
  winCtrl.oldHeight = parseInt(this.parentWindow.clientArea.style.height, 10);

  // Set document to capture mousemove and mouseup events.
  if (browser.isIE) {
    document.onmousemove = winResizeDragGo;
    document.onmouseup = winResizeDragStop;
  }else{
  // if (browser.isNS) {
    document.addEventListener("mousemove", winResizeDragGo, true);
    document.addEventListener("mouseup" , winResizeDragStop, true);
    event.preventDefault();
  }
  // alert("winResizeDragStart  222")
  
  // ??? es      winCtrl.inResizeDrag = true;
  
  // iFrameEventProtector_show()

}//endFunction
  
  
  
  
window.winResizeDragGo=function(event) {
  if (!winCtrl.inResizeDrag)
    return;

  // trace("winResizeDragGo 111", "event")
  // trace("winMoveDragGo ", event.toString)
  
  showIFrameProtector()
   
  var north, south, east, west;
  var dx, dy;
  var w, h;

  // Set direction flags based on original resize direction.
  north = false;
  south = false;
  east = false;
  west = false;
  printLine(1, "dx", dx)
  if (winCtrl.resizeDirection.charAt(0) == "n") north = true;
  if (winCtrl.resizeDirection.charAt(0) == "s") south = true;
  if (winCtrl.resizeDirection.charAt(0) == "e" || winCtrl.resizeDirection.charAt(1) == "e")
    east = true;
  if (winCtrl.resizeDirection.charAt(0) == "w" || winCtrl.resizeDirection.charAt(1) == "w")
    west = true;

  // Find change in cursor position.
  if (browser.isIE) {
    dx = window.event.x - winCtrl.xPosition;
    dy = window.event.y - winCtrl.yPosition;
    trace (window.event.x,window.event.y)
  }
  if (browser.isNS) {
    dx = event.pageX - winCtrl.xPosition;
    dy = event.pageY - winCtrl.yPosition;
  }
  
  
  
  printLine(1, dx, dy)
  // printLine(2, "dy", dy)

  // If resizing north or west, reverse corresponding amount.
  if (west)
    dx = -dx;
  if (north)
    dy = -dy;

  // Check new size.
  w = winCtrl.oldWidth + dx;
  h = winCtrl.oldHeight + dy;
  
  
  
  printLine(2, w, h)
  // printLine(4, "h", h)
  
  // ??? !!! 
  // ??? if (w <= winCtrl.active.minimumWidth) {
  // ???   w = winCtrl.active.minimumWidth;
  // ???   dx = w - winCtrl.oldWidth;
  // ??? }
  if (h <= winCtrl.active.minimumHeight) {
    h = winCtrl.active.minimumHeight;
    dy = h - winCtrl.oldHeight;
  }
  //printLine(1,dx,dy)


  // Resize the window. For IE, keep client area and frame widths in synch.
  if (east || west) {
    winCtrl.active.frame.style.width = w + "px";
    if (browser.isIE)
    // ??? !!!
      // ??? winCtrl.active.clientArea.style.width = (w - winCtrl.active.widthDiff) + "px";
      // winCtrl.active.clientArea.style.width = (w - 10) + "px";
      winCtrl.active.clientArea.style.width = (w - 14) + "px";
  }else{
     // winCtrl.active.frame.style.width = w + "px";
  }
  if (north || south)
    winCtrl.active.clientArea.style.height = h + "px";

    
  printLine(3, "east", east)
  printLine(4, "west", west)
  printLine(5, "north", north)
  printLine(6, "south", south)
    
  printLine(11, "frame.style.width", winCtrl.active.frame.style.width)
  printLine(12, "clientArea.style.height", winCtrl.active.clientArea.style.height)
    
 
  // Clip the title bar text, if necessary.
  if (east || west) {
    if (w < winCtrl.active.clipTextMinimumWidth)
      winCtrl.active.titleBarText.style.width = (winCtrl.minimizedTextWidth + w - winCtrl.active.minimumWidth) + "px";
    else
      winCtrl.active.titleBarText.style.width = "";
  }

  // For a north or west resize, move the window.
  if (west)
    winCtrl.active.frame.style.left = (winCtrl.oldLeft - dx) + "px";
  if (north)
    winCtrl.active.frame.style.top = (winCtrl.oldTop - dy) + "px";
  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
    
  var eventType="RESIZE";
  onDomWinPosChanged(event,eventType);
    
  // return // test: es...
  
  // ??? refreshDisplayHack(dx)
  var title=winCtrl.active.title
  try{
    var callBack=eval("resizeMe_"+title)
    if(callBack)callBack("","",title)
  }catch(ex){}
  trace("winResizeDragGo xxx", "event")
  
}//endFunction
  

window.winResizeDragStop=function(event) {
  
  trace("winResizeDragStop ", "event")
  hideIFrameProtector()
  
  winCtrl.inResizeDrag = false;

  // Remove mousemove and mouseup event captures on document.
  if (browser.isIE) {
    document.onmousemove = null;
    document.onmouseup = null;
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", winResizeDragGo, true);
    document.removeEventListener("mouseup" , winResizeDragStop, true);
  }
  // iFrameEventProtector_hide()
  // hideIFrameProtector
  var eventType="RESIZE";
  var eventType="dragEnd";
  onDomWinPosChanged(event,eventType);
}//endFunction
  


//-->
//-->H E L P E R 



window.size = function() {
  var w = 0;
  var h = 0;
  //IE
  if(!window.innerWidth) {
    //strict mode
    if(!(document.documentElement.clientWidth == 0))  {
      w = document.documentElement.clientWidth;
      h = document.documentElement.clientHeight;
    }
    //quirks mode
    else {
      w = document.body.clientWidth;
      h = document.body.clientHeight;
    }
  }
  //w3c
  else {
    w = window.innerWidth;
    h = window.innerHeight;
  }
  return {width:w,height:h};
}//endFunction




//-->
//-->M Ü L L - VERALTET
 
window.__winMakeActive2=function(title) {
  trace ("winMakeActive2", "Unterschied zu winMakeActive ???")
  //window.globZOrder=2000
  var tiddler=findTiddler(title)
  // alert(tiddler)
  var domWindow=findChildByClass(tiddler,"window")
  if (!domWindow) return
  // alert(domWindow.className)
  // alert(domWindow.style.zIndex)
  // alert(window.globZOrder)
  var deltaIndex=0
  var isTag=isTagged(title,"sys_topmost")
  if (isTag==true) deltaIndex=999

  var isDesktop=isTagged(title,"sys_desktop")
  if (isDesktop==true)deltaIndex=-999
  
  //alert("deltaIndex: "+deltaIndex)
  window.globZOrder = domWin_incrementZIndex() // ++
  tiddler.style.zIndex = (window.globZOrder+deltaIndex)
  domWindow.style.zIndex = (window.globZOrder+deltaIndex)
  //alert(window.globZOrder)
  // alert(domWindow.style.zIndex)
  //alert("winMakeActive2: "+title)
  window.domWindowDATA[title].makeActive();
  //alert("winMakeActive2: "+title)
  
}//endFunction
  


window.__tiddlerResizer=function(tiddler,xxx,yyy,mode){
  trace("tiddlerResizer: tiddler.Id",tiddler.id);
  var sizer=findTiddlerChildByClassName(tiddler,"sizer")
  var collabsible=findTiddlerChildByClassName(tiddler,"collapsible");
  var scrollable=findTiddlerChildByClassName(tiddler,"scrollable");
  var viewer=findTiddlerChildByClassName(tiddler,"viewer");
  var TopPosDummy=findTiddlerChildByClassName(tiddler,"scrollableTopPosDummy");
  var topPos=parseInt(TopPosDummy.style.top)
  trace("<=====> resize 111 topPos:",topPos );
  trace("<=====> resize 111b Sonder ???:",mode);
  if(mode=="sonder"){
    tiddlerResizerSonder(tiddler,sizer,collabsible,scrollable,viewer,topPos)
    return
  }//endIf
  xxx=parseInt(xxx)
  yyy=parseInt(yyy)
  
  trace("??? tiddlerResizer ohne Parameter",yyy)

  var scrollHeight=parseInt(scrollable.style.height)
  var top=yyy-scrollHeight 
  trace("===== resize 111:",yyy+" "+scrollHeight );
  scrollable.style.width=(xxx-8)+"px"
  tiddler.style.height=(scrollHeight+topPos)+"px";
  trace("===== resize 222:",xxx+" "+yyy);

  
  var xx=parseInt(tidler.style.width)
  var yy=parseInt(tidler.style.height)
  //trace("===== resize 333:",scrollTop);
  trace("===== resize 222:",xx+" "+yy);
return
  var x=parseInt(tiddler.style.left);
  var y=parseInt(tiddler.style.top);
  var xx=parseInt(tiddler.style.width);
  var yy=parseInt(tiddler.style.height);
  //tiddler.style.width=xx+'px';
  //tiddler.style.height=yy+'px';
  
  trace("tiddlerResizerPos",x+" "+y+" "+xx+" "+yy)
  trace (resizer.style.left);
return

  //tiddler.style.left=x+'px';
  //tiddler.style.top=y+'px';
  tiddler.style.width=xx+'px';
  tiddler.style.height=yy+'px';
  //scrollable.style.left=x+'px';
  //scrollable.style.top=y+'px';
  scrollable.style.width=(xx-6)+'px';
  scrollable.style.height=(yy-60)+'px';
}//endFunction
  
  
  
  
  
  
  
window.__tiddlerResizerSonder=function(tiddler,sizer,collabsible,scrollable,viewer,topPos){
  trace("ZzzzzzzzzzzzzzzzzzzzzzzZ tiddlerResizerSonder:",tiddler.id);
  var xxx=parseInt(tiddler.style.width);
  var yyy=parseInt(tiddler.style.height);
  trace("===== resize 222:",xxx+" "+yyy);
  trace("===== resize 333:",scrollable.id);
  scrollable.position="relativ"
  trace("===== resize 444position:",scrollable.position);
  trace("===== resize 555height:",scrollable.style.height);
  //scrollable.style.height=(yyy-topPos)+"px"
  //alert(111) 
  //scrollable.style.height=(xxx-topPos)+"px"
  scrollable.style.height=yyy-topPos+"px"
  //alert(222) 
return

  var top=yyy-scrollHeight 
  trace("===== resize 111:",yyy+" "+scrollHeight );
  scrollable.style.width=(xxx-8)+"px"
  tiddler.style.height=(scrollHeight+topPos)+"px";
  trace("===== resize 222:",xxx+" "+yyy);

  
  var xx=parseInt(tidler.style.width)
  var yy=parseInt(tidler.style.height)
  //trace("===== resize 333:",scrollTop);
  trace("===== resize 222:",xx+" "+yy);
}//endFunction
  

 

window.__onDomWinPosChanged_B=function(title){
return
    
    trace("onDomWinPosChanged_B: ", title)
  var tiddler=findById("tiddler" + title);
  if(!tiddler){
    trace("...hier stimmt was nicht ???: ",title); 
    return
  }
  var domWindow=winFindByClassName(tiddler , "window")
  //alert(domWindow.className)
  var clientArea = winFindByClassName(domWindow , "clientArea");
  var titleBar = winFindByClassName(domWindow , "titleBar");

  // alert("tiddler : "+tiddler.id);
  // alert("domWindow : "+domWindow.className);
  // alert("clientArea : "+clientArea.className);
  //alert("clientArea : "+titleBar.className);
  
  // alert("onDomWinPosChanged_B 000 ")
  
  
  // xxx !!!
  // var template = getTiddlerTemplate(tiddler) // getTemplate(tiddler) // ...gibt es noch nicht
  // // alert(template)
  // if (template == "EditTemplate") return // NEU...
  
  // alert("onDomWinPosChanged_B: 222 "+title)

  var winPos=""
  var tt=tiddler.style;
  var dd=domWindow.style;
  var cc=clientArea.style;
  var tb=titleBar.style;
  var height=parseInt(cc.height)+parseInt(tb.height);
  var width=parseInt(dd.width);
  var top=parseInt(dd.top);
  var left=parseInt(dd.left)

  // alert("onDomWinPosChanged_B: 333"+title)
  // alert("cc.height: "+cc.height);
  // alert("tb.height: "+tb.height);
  // alert("domWindow: "+domWindow.className);
  // alert("left: "+left);
  // alert("top: "+top);
  // alert("height: "+height);
  // alert("width: "+width);
  var TAB = String.fromCharCode(9);
  winPos=left+"!"+top+"!"+height+"!"+width;


  // alert("onDomWinPosChanged_B: 444"+winPos)
  printLine(11,"winPos-->"," "+winPos)
  // alert (title+": "+winPos);
  window.winPos=winPos; // provisorium...
  //alert("onDomWinPosChanged:2 "+eventType)

  var caption="_myWinPosData";
  trace("titleForSave",caption);
  var field=tiddler.id;
  //alert("field: "+field)
  var value=winPos;
  //trace ("-->newValue: ",textarea.value);
  // DataTiddler.setData(caption,field,value);
  
  winPosData_set(field,value)
  
  //trace ("DataTiddler.setData(...)","OK ???");
  // cc.backgroundColor="transparent";
  // cc.borderWidth="0px";
  // cc.borderStyle="dotted";
  //alert("onDomWinPosChanged:3 "+eventType)
  //alert("before")
  var eventType="gibts nicht mehr"
  
  // xxx !!!
  // // alert(template)
  // if (template == "tpl_newBrowser"){
  //   //alert("tpl_newBrowser")
  //   var iframe=findById("newBrowser_"+title)
  //   // alert (title)
  //   var ss=iframe.style
  //   var newHeight=height-50
  //   ss.height=newHeight+"px"
  //   return
  // }
  
  //alert("after")
  //alert ("myPopup2 --- OK 2 ???");
  
}//endFunction
  
  

  
//window.__onDomWinPosChanged2=function(event,eventType){ //@@-
window.__onDomWinPosChanged2=function(eventType,tiddler,domWindow,clientArea, title){ 
  return

  alert("onDomWinPosChanged2 ??? ")
  return

  // alert("ini 333")
  // alert(tiddler)
  
  if (!title){
    alert("1051 onDomWinPosChanged2: title missing")
    return
  }
  // alert("onDomWinPosChanged_B: getTiddlerTitle(tiddler)")
  // var title=getTiddlerTitle(tiddler)
  
  // alert("onDomWinPosChanged2: "+title)
  // alert(isTagged(title,"wStyle_ToolWindow")) 
  var isFound=isTagged(title,"wStyle_ToolWindow");
  var windowStyle=dWin_resolveWindowStyle(title)
  // alert("onDomWinPosChanged2: "+windowStyle)
  // if (isFound==true){
  if (windowStyle=="ToolWindow"){
    // alert("onDomWinPosChanged2 111: "+windowStyle)
    var consume=resizeClassName_toolWindow(title)
    try{
      var callBackName="resizeMe_"+title//
      callBackRef=eval(callBackName);
      if(callBackRef)callBackRef(newXX,newYY,tiddler,domWindow,clientArea)
    }catch(e){}
    return // ???
  }
  if (windowStyle=="popup"){
    // alert("onDomWinPosChanged2 111: "+windowStyle)
    var consume=resizeClassName_popup(title)
    try{
      var callBackName="resizeMe_"+title//
      callBackRef=eval(callBackName);
      if(callBackRef)callBackRef(newXX,newYY,tiddler,domWindow,clientArea)
    }catch(e){}
    return // ???
  }
  
  var tiddler
  var domWindow
  var clientArea
  var title=tiddler.id.substr(7)
  trace("onDomWinPosChanged2",title+"------------------------")
  var newXX=parseInt(domWindow.style.width)
  var newYY=parseInt(clientArea.style.height)
  // trace("onDomWinPosChanged",eventType)
  //var domWindow=event.target
  //tiddler=findParentNodeByClassName(domWindow, "tiddler selected")
  //tiddler=findParentNodeByClassName(domWindow, "tiddler selected")
  //var clientArea=findTiddlerChildByClassName(domWindow, "clientArea")
  // trace("onDomWinPosChanged(title)",title)
  // trace("onDomWinPosChanged(tiddler.id)",tiddler.id)
  // trace("onDomWinPosChanged xx ",newXX)
  // trace("onDomWinPosChanged yy ",newYY)
  
  //Umrechnung auf parentTiddler(domWindow)...Kompatibilität !!!
  //tiddler.style.height=clientArea.style.height
  //tiddler.style.width=domWindow.style.width
  //tiddler.style.visibility="hidden"
  //alert("aaa")
  try{
    var callBackName="resizeMe_"+title//
    // trace ("scriptCallBackName: ",callBackName+"(newXX,newYY,tiddler,domWindow,clientArea)")
    // trace ("para: ","(newXX,newYY,tiddler,domWindow,clientArea)")
    callBackRef=eval(callBackName);
    callBackRef(newXX,newYY,tiddler,domWindow,clientArea)
  }catch(e){
    trace("MES: ...keine resizeFunction gefunden:",e)  //@@-
  }
  // alert("onDomWinPosChanged2 xxx")
    
}//endFunction
  

 
  
 

//-->
//-->INI-2:   G L O B - I N I  ---------------------


//--> winInitMain()
  
  winInitMain()

  //--> cmdExecuteScriptAfterLoad
  // alert("cmdExecuteScriptAfterLoad")
  if (window.cmdExecuteScriptAfterLoad){
    var forExecute=window.cmdExecuteScriptAfterLoad 
    trace("forExecute",forExecute);
    window.cmdExecuteScriptAfterLoad=null
    try { eval(forExecute)
    } catch(e){alert(e)}
  }
  // alert("FERTIG")  
  
  
  
//-->
//-->E O F
  
//--> ...  
  
  