/*
   tooltip library UOCG/RK
   version 3.3
   See http://www.nicon.nl/nice/tooltip3.html for instruction and changelog
*/

/* possible attributes:
   ---------------------
   tt         = "[any value]"  => activates tooltip for element xyz
   ttxt       = "[string]"     => tooltip text is attribute value
                                  (don't forget escaping '|")
   ttxtid     = "[string]"     => tooltip text from (hidden) div/span
                                  element with id=value of this attribute
   ttxtjs     = "[string]"     => tooltip text from jsTxt collection
   ttxtjsfn   = "[string]"     => tooltip text from any javascript function
                                  collection
   ttxtURL    = "[string URL]" => load tooltip text from any URL in the
                                  current domain
   ttc        = "[string]"     => cursor type for this element
                                  (de facto shown w/tooltip)
   ttw        = "[integer]     => tooltip width
   ttUseStyle = "[string]"     => use classname for text pointed at
   ttNoOpa    = "[any value]"  => no opacity in this tooltip
   ttnodelay  = "[any value]"  => no delay in this tooltip
   ttHeader   = "[string]"     => use attribute value for tooltip header
   ttStatic   = "[any value]"  => close tooltip on click, no mousemove
   ttHover    = "[string:color]=> color effect on hover on innertext
   ttPersist  = "[any value]"  => tooltips stays active, even with bUseTt=false
   ttDescend  = "[any value]"  => move tt attributes to most inner element
*/

//-------------------------------------------------------------------------------
// In INITS you can edit the necessary settings of this script
// Edit your text-collection between {} after 'allTxt =' here like this:
// [textlabel1]:'[yourtext1]',
// [textlabel2]:'[yourtext1]',
// ...
// [textlabelx]:'[yourtextx]
// call your text from this collection by using the attribute ttxtJs
// like this: ttxtJs="[textlabelx]"
//-------------------------------------------------------------------------------
function INITS()
{
 with (this) {
  //set Language (currently: dutch (NL) or english (EN))
  Language         = 'NL';
  //hide overlapping select elements in IE<7
  hideSelects      = true;
  //use iFrame to hide overlapping select elements w/IE<7 (not implemented yet)
  useIeSelectHack  = false;
  //time (seconds) to delay tooltip visibility
  delayValue       = 0.15;
  //default opacity of a tooltip
  Opacity          = 0.95;
  //minimum tooltip width
  MinimumWidth     = 75;
  //maximum tooltip width
  MaximumWidth     = parseInt(getWinDim()[0]/4,10)
  //version info
  ttversion        = '3.90 (2006/12/23)';
  //you can declare allTxt items in a separate script,
  //see tooltipexample2.js, function loadExample
  allTxt           = {};
  //initialize language items
  LN               = setLanguage(self.Language);
  //get tooltip styles
  ttStyles         = getTtStyles();
  //use backgroundimage for closebox in static tooltips
  ttCloseBoxImg    = '/rgoc-intranet/pic/closebttn.png';
  //if no associated classes are found in the css of the calling document
  //these defaultstyles are applied
  //sTtStyle: tooltipcontainer.
  //          Associated defaultClass expected: .tooltip
  //sTtHeadStyle: tooltipheader.
  //              Associated defaultClass expected: .tooltipHeader
  //sTtParStyle: tooltip text paragraph.
  //             Associated defaultClass expected: .tooltipParagraph
  tooltipStyles    =
    {sTtStyle: self.ttStyles.tooltip ||
         'position:absolute;border:1px solid #fc890e;top:0;\
 	      left:0;width:auto;height:auto;visibility:visible;\
	      text-align:left;background: #FFFFE0;color:#000066;\
    	  z-index:1;font-size:0.9em;font-family:Arial,Helvetica,Verdana',
     sTtHeadStyle: self.ttStyles.tooltipHeader ||
        'position:relative;;border-bottom:2px solid #fc890e;background-color:\
	      #fea444;padding:1px 5px 1px 5px;color:#FFFFE0;font-weight:600;\
        text-align:center;font-size:85%',
     sTtParStyle: self.ttStyles.tooltipParagraph ||
         'position:relative;margin:0;padding:5px;font-size:85%;\
          font-family:Helvetica,Arial,Verdana;background:transparent;',
     sTtIEStyle:'border:none;position:absolute;top:0;left:0;height:0;\
	     width:0;z-index:0;margin:0;padding:0;visibility:hidden'},
  //set text collection load method
  loadAllTxt         = loadDocumentTexts
 }
  return self;
}

//-----------------------------------------------------------------//
//-----------------DO NOT EDIT BELOW THIS LINE---------------------//
//-----------------------------------------------------------------//

//check if there is already a pageloader in place
 if(!window.pageLoad)
   genLoad()

//define onload handler
   w.pageLoad.loaders.ttload = function(){
  //warn in case of opera or IE<6
    if (w.opera || navigator.appVersion.match(/msie 5/i) ||
        navigator.appVersion.match(/msie 4/i))
         return NoDice();
    return ( //check availability of necessary DOM
            (doc.getElementById && doc.createElement)
            || doc.all || document.layers || doc.frames
           )
            ? pageLoader() : NoDice();
   }

/* some handy object extensions */
//check if a number value lies between to other values, 
//not considering the start/end values themselves
Number.prototype.between = function()
 { return this>arguments[0]&&this<arguments[1]||false }

//iterates trough an array and applies method [iterate] on
//every element
Array.prototype.eachEl = function(iterate)
                {if (!iterate) return;
                 var i=0
                 do {
                   iterate(this[i]);
                    i++;
                 } while (i<this.length)
                }

//return max value for numeric array (strong typing forced)
Array.prototype.max =
 function(x) {
    var i=this.length,j=0;
     if (i==0)
       return
     do {
      if (parseInt(this[i]) && j < parseInt(this[i]))
       j = parseInt(this[i])
     }  while (--i);
    return j
 }

//removes an element from a array
Array.prototype.remove =
 function(xy) {
    var i=this.length,a_=new Array();
     if (i==0)
       return

    for(var x=0;x<this.length;x++)
      if (xy != this[x])
       a_.push(this[x])

     do{
       this.pop()
     } while (this.length>0);

     for(var x=0;x<a_.length;x++)
       this[x] = a_[x];

    return this
 };

/* --------------------CORE functions------------------ */
  function pageLoader()
  {
   //GLOBALndCONST
    w[ settings = new INITS(),
       jsTxt    = settings.allTxt,
       Element  = new Element(),          //element protoypes
       Position = new Position(),         //positioning prototypes
       Event    = new Event(),            //DOM events lib
       bUseTt   = true,                   //use tooltips y/n
       bIE      = doc.all && !w.opera||false,
       IE7      = navigator.appVersion.match(/msie 7/i),
       bSelects = bIE&&!IE7&&
                  doc.getElementsByTagName('select').length>0 || false,
       errTxt   = function(){
                     return buildStr('<span style="color:red">',
                                      String(arguments[0]),'</span>')},
       openBox  = {},
       aBoxList = [],
       giZ      = giDefaultZ = 25,        //zIndex counter (need this for nesting)
       ttAttr   = buildStr('tt,ttxt,ttxtid,ttxtjs,ttxtjsfn,ttnestparent,ttbgc,',
                           'ttxturl,ttc,ttw,ttusestyle,ttnoopa,ttnodelay,ttnobreak,',
                           'ttheader,ttstatic,tthover,ttpersist,ttdescend').split(/,/),
       motherOfAllTips = new Tooltip(),
       baseTip         = motherOfAllTips.create()
     ];

    //closeboxtag for static tts
    if (settings.ttCloseBoxImg!='')
      settings.ttCloseBoxImg = buildStr(';background-image:url(',
                                                settings.ttCloseBoxImg,
                                                ');background-position:',
                                                'center right;background-repeat:',
                                                'no-repeat;')
    else
      settings.ttCloseBoxImg = '';


    ttAddLoaders();                       //Load tooltips where applicable

    //prevent memory leaks in IE
 //   Event.observe(w, 'unload', Event.unloadCache, false);
      Event.observe(w, 'unload', ttRemoveHandlers, false);
    //signal everything ok, prevents premature errors onload
    w.bLoad = true;
   }

 //recursively hide all tooltips
 //this could be uses in an AJAX-application where
 //the click handler precedes a mouseout
  function ttHideAll()
  {
    var aIn = !arguments[0]?doc.childNodes:
                             arguments[0].childNodes,
         aNw = [], i=aIn.length-1;
     do
     {
        if (aIn[i].childNodes&&aIn[i].childNodes.length>0)
         ttHideAll(aIn[i]);
        if (aIn[i].hideInfo &&aIn[i].bShow){
          aIn[i].hideInfo();
      }
     } while (i-- && i>-1)
  }

 function ttAdTxtsFromId()
 {
   var aIn = doc.getElementsByTagName('*'),i=aIn.length;
   do {
     var tid = getAttrValue(aIn[i],'ttxtid');
     if (tid){
       var sTxt = $(tid).innerHTML;
       settings.allTxt[tid] = sTxt;
       aIn[i].removeAttribute('ttxtid',2); //'2'=>case insensitive
       aIn[i].setAttribute('ttxtjs',tid);
       doc.body.removeChild($(tid));
     }
   } while(i-- && i>=0)
 }

 //add all neceserry properties/methods to tt-elements
 //can recieve an element as argument. Default searches
 //the whole document
   function ttAddLoaders()
   {
     if (arguments[1])
      ttRemoveHandlers(arguments[0]);

     var aIn = !arguments[0]?doc.getElementsByTagName('*'):
                             arguments[0].getElementsByTagName('*'),
         aNw = [],
         i=aIn.length-1,
         bWait = arguments[2];
      if(i>=0)
       do { var x=aIn[i];
        if (
            getAttrValue(x,'tt') &&
            (!getAttrValue(x,'ttdone') || arguments[1])
           )
          addHandlers(x);
     } while(i--)

    //if you dynamically update content from hidden divs
    //surround those divs with a div with id 'content_ids'.
    //IE erronuosly ads handlers to all divs even if they
    //have display:none set. Needs a different approach,
    //because you want to preserve the tt elements
    if ($('content_ids')&&!arguments[0])
     ttRemoveTT($('content_ids'))
  }

 //recursively remove handlers from a static tooltip
 //this should prevent orphaned handlers
   function ttRemoveTT()
   {
     var oEl = arguments[0],
         aIn = !oEl?doc.childNodes:
                    oEl.childNodes,
         aNw = [],
         i   = aIn.length-1;
     if (i>=0)
     do {
        var x = aIn[i]
        if (x.childNodes && x.childNodes.length>0)
         ttRemoveTT(x);
        if (x.hideInfo) {
         if (x.opaNode && $(x.opaNode))
          $(x.opaNode).parentNode.removeChild($(x.opaNode));
         if(x.ttBox)
          x.ttBox.parentNode.removeChild(x.ttBox);
         //remove all pointers to props/meths
         with(x) {
           ttBox       = ttBox.originator =
           getIEFrame  = reSize           =
           rePos       = showInfo         =
           hideInfo    = bHover           =
           runJs       = rePos            =
           reSize      = mover            =
           klik        = onmouseover      =
           doHover     = unHover          =
           onmouseout  = bShow            = null;
        }
       }
     } while (i--)
   }

 //recursively remove handlers from a static tooltip
 //this should prevent orphaned handlers
   function ttRemoveHandlers()
   {
     var oEl = arguments[0],
         aIn = !oEl?doc.childNodes:
                    oEl.childNodes,
         aNw = [],
         i   = aIn.length-1;

     if (i>=0){
     do {
        var x = aIn[i];
        if (x.childNodes && x.childNodes.length>0)
         ttRemoveHandlers(x);

        if (x.hideInfo) {
         if (x.opaNode && $(x.opaNode))
          $(x.opaNode).parentNode.removeChild($(x.opaNode));
         try{x.hideInfo()}
         catch(e){}
         if(x.ttBox){
          x.ttBox.handleIE   =
          x.ttBox.originator = null;
          try {x.ttBox.parentNode.removeChild(x.ttBox);}
          catch(e){x.ttBox=null}
         }
          with(x) {
           ttBox       =
           getIEFrame  = reSize           =
           rePos       = showInfo         =
           hideInfo    = bHover           =
           runJs       = rePos            =
           reSize      = mover            =
           klik        = onmouseover      =
           doHover     = unHover          =
           onmouseout  = bShow            = null;
         }
         oEl = null;
       }
     } while (i-- && i>=0)
    }
    return
   }

//add styling
   function addTtStyle(oObj,sStyle)
   {
      if(oObj && oObj.style)
       if (!doc.styleSheets)
         oObj.style = sStyle;
      else
       oObj.style.cssText = sStyle;
   }

function findInnerMost()
{ var els = arguments[0].getElementsByTagName('*');
  if (els.length>0)
   return els[els.length-1];
}

//constructor tooltipcontainer
   function Tooltip()
   {
    if (!this._ttok){
     Tooltip.prototype.create = function() {
     //all browsers
      var oI1 = doc.createElement('div');
      addTtStyle(oI1,settings.tooltipStyles.sTtStyle);
      oI1.id = "MotherIsHere";
      //obligatory style properties (overrule css defs)
      with (oI1.style) {
       position   = 'absolute';
       padding    =
       margin     =
       width      =
       height     =
       left       =
       top        = 0;
       zIndex     = giDefaultZ;
       visibility = 'hidden';
       overflow   = 'hidden';
      }
      doc.body.appendChild(oI1);
      this.MotherTip = oI1;
    };

    Tooltip.prototype.clone = function(bOpaque)
    { var cloneTip = this.MotherTip.cloneNode(true),ttid=buildStr('ttInfo_',KeyGen(5));
      cloneTip.id=ttid;
      openBox[cloneTip.id]=false;
      aBoxList.push(cloneTip.id);
      cloneTip.handleIE = handleIE;

      with(cloneTip.style){
       if (!bOpaque)
        if (settings.delayValue>0&&settings.Opacity.between(0,1)&&!bIE)
         opacity='0.1';
        else if (settings.Opacity.between(0,1))
         opacity=settings.Opacity;
        else if (bIE && !IE7 && settings.Opacity.between(0,1) && !bOpaque)
         filter='progid:DXImageTransform.Microsoft.Alpha(opacity='
                 +(settings.Opacity*100)+')';
       }
       doc.body.appendChild(cloneTip);
       return cloneTip
    }
   }
   this._ttok=true;
 }

/* adding the mouseover/out/move handlers here for relevant elements */
/* >2006/11/15: triggered from new function ttAddLoaders              */
   function addHandlers()
   {

    if (!arguments[0])
     return 0;

    var x = arguments[0];
    if (!x)
      return 0;

        //serialize attributes
        var tta = serializeTtAttr(x);

        //browser needs unique id per tooltip
        if (!x.id)
          x.id = buildStr('tt_',KeyGen(4));

        //=>styling: ttUseStyle no value=default or class is value
        var StyleIt = tta.ttusestyle,
            sCursor = tta.ttc;

        StyleIt?Element.addClassName(x,typeof StyleIt=='string'?StyleIt:ttDefSt)
                   :void(0);

        if (x.style)
         if (sCursor)
            x.style.cursor = (String(sCursor).match(/pointer/i)&&bIE)
                             ? 'hand' : sCursor;

        //descend to innermost element (can do better?)
        if (x.childNodes && (x.childNodes.length>0 &&
            tta.ttdescend)) {
           var innerEl = findInnerMost(x);
           if (innerEl){
            moveAttributes(x,innerEl);
            x = innerEl;
           }
         }

        //=>end styling. Add props, methods and handlers
        x.bHover           = getAttrValue(x,'ttHover');
        x.ttBox            = motherOfAllTips.clone(tta.ttnoopa);
        x.ttBox.originator = x;
        x.getIEFrame       = IEFrame;
        x.reSize           = reSize;
        x.rePos            = rePos;
        x.showInfo         = showInfo;
        x.hideInfo         = hideInfo;
        x.bShow            = false;

        x.onclick ? x.oldCl = x.onclick : x.oldCl = function(){return 0};
        x.onmouseover ? x.oldMO = x.onmouseover : x.oldMO = function(){return 0};
        x.onmouseout  ? x.oldMOO = x.onmouseout  : x.oldMOO = function(){return 0};

        //timer if applic. Needs work yet
        if (settings.delayValue>0 && !tta.ttnodelay &&
           !bIE && !IE7 && !tta.ttnoopa){
         x.showTimed = function(){
           clearTimeout(0);
           var oInf = this.ttBox;
           Element.show(oInf);

         if ( settings.delayValue>0 && !getAttrValue(this,'ttNoDelay'))
            setTimeout(function(){
                oInf.style.opacity = settings.Opacity||'1.0';
               },settings.delayValue*1000)
         }
        }
        else if (!bIE && !tta.ttnoopa)
          x.ttBox.style.opacity = settings.Opacity||'1.0'
        else if (!IE7  && !tta.ttnoopa)
          x.ttBox.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='
                               +(settings.Opacity*100)+')';

        if (tta.ttnoopa)
         x.ttBox.style.opacity = '1.0'

        //(un)hover methods
        if (x.bHover){
            x.doHover=function(e){
             var hover=getAttrValue(this,'ttHover');
             this.oldColor   = this.style.color||'';
             this.style.color=hover||'';
            }
            x.unHover = function(e){
             this.style.color=this.oldColor||''};
        }

        //if ttxt from function, add function as private method
        if (tta.ttxtjsfn || tta.ttxtajax){
          var fn = tta.ttxtjsfn;
          try {x.runJs = eval(fn)}
          catch(e) {x.runJs=function(){
            return errTxt(buildStr(fn,': ',settings.LN.JsFnNoSuchFunction))}
          };
        }

        if (!tta.ttstatic){
         x.onmouseover = function(e){this.oldMO?this.oldMO():void(0);this.showInfo(e)};
         x.mover       = function(e){this.oldMO?this.oldMO():void(0);this.showInfo(e)};
        }
        else {
         if (!x.title)
          x.title=settings.LN.ClickToOpenBox;
          x.onclick = function(e){
            if (!e) e=this.event||w.event;
            this.oldCl?this.oldCl():void(0);
            if (!this.fixTop){
             this.fixTop=Event.pointerY(e)+2;
             this.fixLeft=Event.pointerX(e)+5;}
             this.bHover?this.unHover():void(0);
            this.showInfo(e);
            this.reSize(this.fixTop,this.fixLeft);
            };
         //=>x.klik: store handler for textchange (w/nwTxt)
          x.klik=function(e){this.bShow=false;
                             this.showInfo(e,'dummy',1);
                             this.bHover?this.unHover():void(0);
                             this.reSize(this.fixTop,this.fixLeft);};
                             this.oldCl?this.oldCl():void(0);
        }

        if (!tta.ttstatic)
           x.onmouseout = function(e){
              this.oldMOO();
              this.bHover?this.unHover():void(0);
              this.hideInfo()
              };
        else  {
           x.onmouseover = function(){this.oldMO?this.oldMO():void(0);this.bHover?this.doHover():void(0)};
           x.onmouseout  = function(e){this.oldMOO?this.oldMOO():void(0);this.bHover?this.unHover():void(0);
                                        this.bShow=false;};
        }

        if (!tta.ttstatic)
          x.onmousemove = function(e){this.rePos(e)};
        x.ttdone = true;
   }

  //IE6: check if tt overlaps select
  //params: [array:select element dimensions],
  //        [array:tooltip dimensions],
  function checkOverlap()
  {
    var points = arguments[0],quadr=arguments[1],hor=arguments[2]||null;
     return ((points[0]>quadr[0]&&points[0]<quadr[2])||
            (points[2]>quadr[0]&&points[2]<quadr[2])) &&
            ((points[1]>quadr[1]&&points[1]<quadr[3])||
            (points[3]>quadr[1]&&points[3]<quadr[3]))
  }

  //only used as method in IE<7, check overlap select elements
  //and hide select element if so
  function handleIE()
  {
    var aSelects = doc.getElementsByTagName('select'),i=0,
        aCurrBoxDimensions=arguments[0];
    do {
         var posSelects = Position.cumulativeOffset(aSelects[i]);
         posSelects[2]=posSelects[0]+aSelects[i].offsetWidth;
         posSelects[3]=posSelects[1]+aSelects[i].offsetHeight;
          if(checkOverlap(posSelects,aCurrBoxDimensions)){
           aSelects[i].style.visibility='hidden';
           openBox[this.id] = true;
          }
          else {
           aSelects[i].style.visibility = 'visible';
          }
         i++;
       } while(aSelects[i])
  }

 //set all hidden selects back to visible.
 function selectsBack()
 {
   var aSelects = doc.getElementsByTagName('select'),i=0;
   do
   {
      aSelects[i].style.visibility='visible'
      i++;
   } while(i<aSelects.length)
 }

 function serializeTtAttr()
 {
  var oEl = arguments[0];i=ttAttr.length,ttRet={};
  if (!oEl)
    return

  do {
      ttRet[ttAttr[i]] = getAttrValue(oEl,String(ttAttr[i]))||null
  } while (--i)

   return ttRet
 }

/* build the tooltip & show it */
   function showInfo(evt)
   {
      if (this.bShow && this.klik && !arguments[2]){
         return this.hideInfo();
       }
        if(!bLoad
           || (!bUseTt && !getAttrValue(this,'ttpersist'))
           || this.bShow) {
          return 0;
       }
       !evt?evt=w.event:void(0);
       doBlur(); //check this!

       var   iMinW        = settings.MinimumWidth,
             iMaxW        = settings.MaximumWidth,
             tta          = serializeTtAttr(this),
             oInf         = this.ttBox||$(this.ttBoxId),
             iW           = tta.ttw || iMinW,
             iH,
             innerTxtId  = oInf.id,
             iFixedWidth = getAttrValue(this,'ttw'),
             noOpa       = tta.ttnoopa,
             isNested    = tta.ttnestparent
             ttHeadVal   = tta.ttheader ||
                           (tta.ttuseinner?this.innerHTML:null),
             ttBackGr    = tta.ttbgc,
             aTxtAttr    = [tta.ttxt,
                           $(tta.ttxtid),
                           tta.ttxtjs,
                           tta.ttxtjsfn,
                           tta.ttxturl,
                           tta.ttxtajax];
       if (isNested) {
        var nodex = $(isNested);
        if (!nodex.oldmouseover)
          nodex.oldmouseover = nodex.onmouseover;
        nodex.onmouseover=null;
        nodex.hideInfo();
       }

        if(ttBackGr)
          oInf.style.background=ttBackGr;

      //insert text (from id or attribute, if neither return error message)
        var sTxt =
          aTxtAttr[0] ? aTxtAttr[0] || errTxt(settings.LN.TextAttributeEmpty) :
          aTxtAttr[1] ? aTxtAttr[1].innerHTML || errTxt(settings.LN.TextIdNotFound) :
          aTxtAttr[2] ? jsTxt[aTxtAttr[2]] || errTxt(settings.LN.JsTextNotInCollection) :
          aTxtAttr[3]|| aTxtAttr[5] ? this.runJs() :  errTxt(settings.LN.TextAttributeError);

        if (aTxtAttr[4]){
          return loadFromURL(aTxtAttr[4],this)
        }

      if (!sTxt)
       sTxt = errTxt(settings.LN.TextAttributeEmpty)

      //textlenght and static tooltip header
        var LenTst = sTxt.replace(/\n/g,' '),
            iTestLength = (LenTst.split(/[a-zA-Z]/)).length,
            isStatic=tta.ttstatic,
            isStaticTitle = isStatic?'" onClick="this.parentNode.originator.hideInfo()"':'"';


      //add hovereffect if applicable
        if (this.bHover)
           this.doHover()

      //textbox in ttbox (as defined per css)
      //the ONLY way to keep the boxwidth within normal proportions in IE and to keep
      //the box from flickering with tooltips over the tooltipbox (nested) is to define
      //a table. Yeah! Right! Please MS, do NOT roll out IE7.
        sTxt = bIE? buildStr('<table cellpadding=0 cellspacing=0 align="center">',
                        '<td id="','_parTxt',innerTxtId,'" style="',
                        settings.tooltipStyles.sTtParStyle,'">',
                        sTxt,'</td></table>')
                  : buildStr('<div id="','_parTxt',innerTxtId,
                        '" style="',settings.tooltipStyles.sTtParStyle,'">',
                        sTxt,'</div>');

      //set header if applicable
        if(isStatic)
         ttHeadVal = buildStr('<div id="','_subhead',innerTxtId,
                              '" style="margin:0;font-weight:600;"',
                              ' tt=1 ttxtjsfn="getCloseMssg"',
                              'ttbgc="#FFF" ttc="pointer">',
                              (isStatic&&!ttHeadVal?settings.LN.CloseBoxMessage:ttHeadVal),
                             '&nbsp;</div>');
        if (ttHeadVal || isStatic)
          sTxt = buildStr('<div id="','_header',innerTxtId,
                          '" style="',
                           isStatic?settings.ttCloseBoxImg:'',
                           settings.tooltipStyles.sTtHeadStyle,
                           isStaticTitle,'>',
                           ttHeadVal,'</div>',sTxt);

      //replace breaks with html if applicable
        if (!tta.ttnobreak)
         sTxt = sTxt.replace(/\n/g,'<br>');

      //text/headers etc are injected here (innerHTML is fastest)
        oInf.innerHTML = sTxt.replace(/_head_/i,ttHeadVal);

       with($('_parTxt'+innerTxtId).style) {
        position='relative';
        width='auto';
       }

       //box size properties
       with(oInf.style){
        position = 'absolute';
        width=height='auto';

        var iNowWidth =  bIE?$('_parTxt'+innerTxtId).offsetWidth:oInf.offsetWidth;
        iWidth = !iFixedWidth?
                     iNowWidth<iMinW?
                                 iMinW
                                   :iNowWidth<iMaxW?
                                      iNowWidth
                                       :iMaxW
                           :iFixedWidth;

         if (iWidth && iTestLength>=5 && !iFixedWidth)
            width = iWidth+'px';
         else if (iFixedWidth)
            width = buildStr(iFixedWidth,'px');
         else
            width = 'auto';
       }

       if ($('_subhead'+innerTxtId) && bIE)
        $('_subhead'+innerTxtId).style.width='100%'

       if (this.showTimed){
         this.showTimed();
       }
       else
         Element.show(oInf)


    if (this.klik){
       ttAddLoaders(this.ttBox,1);
   }

   //create a new node for IE7, to keep cleartype font in tooltip
   //chapter XX in (IF IE THEN MISERY)
     if (!this.opaNode && !noOpa)
      if (IE7 && settings.Opacity.between(0,1)) {
       var opaNode =oInf.cloneNode(false); //shallow clone
       opaNode.id = 'ttIE7_'+KeyGen(4);
       addTtStyle(opaNode,settings.tooltipStyles.sTtStyle);
       opaNode.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='
                            +(settings.Opacity*100)+')';
       if (ttBackGr)
        opaNode.style.backgroundColor = ttBackGr;

        with (oInf.style){
         backgroundColor='transparent';
         border = 'none';
        }

       doc.body.appendChild(opaNode);
       opaNode.style.zIndex = parseInt(oInf.style.zIndex)-1;
       this.opaNode=opaNode.id;
       giZ++
    }

  // remember the state
     this.bShow=true;


  //static tooltips need no mousemove repositioning,
  //are resized instead
       if (!this.klik)
        this.rePos(evt);
       else
       this.reSize(this.fixTop,this.fixLeft)
 }

  //used in rePos method
   function findPos(max,curr,h)
   {
     do
        curr--;
     while (curr+h>=max)
     return curr;
   }

/* determine position and reposition. Mousemove handler. If
   the box exceeds the window dimensions it is shifted to a
   visible place (up or left) */
   function rePos(evt)
   {
     if (!bUseTt && !getAttrValue(this,'ttpersist'))
       return
     !evt ? evt = this.event||w.event : void(0);
     var oObj = this;

     var aDim = getWinDim(),oInf=this.ttBox,
          iST = (w.pageYOffset
                || doc.documentElement.scrollTop
                || doc.body.scrollTop)-22,
          iSL = (w.pageXOffset
                || doc.documentElement.scrollLeft
                || doc.body.scrollLeft)-22,
           iT = Event.pointerY(evt)+5+oInf.offsetHeight<aDim[1]
                ? Event.pointerY(evt)+5
                : (findPos(iST+aDim[1],Event.pointerY(evt),oInf.offsetHeight));

     oInf.style.top  = buildStr(iT,'px');

     oInf.style.left = Event.pointerX(evt)+oInf.offsetWidth+15<=aDim[0]-22
                          ? buildStr((Event.pointerX(evt)+15),'px')
                          : (Event.pointerX(evt)-(oInf.offsetWidth+15))<0 ?
                            '15px':(Event.pointerX(evt)-oInf.offsetWidth)+'px';

     if (oInf.offsetHeight>=(aDim[1]-25)){
       oInf.style.height = buildStr((aDim[1]-25),'px');
       oInf.style.top="5px";
     }

    if(bSelects){
      var oInfDimensions = Position.cumulativeOffset(oInf);
          oInfDimensions[2] = oInfDimensions[0]+oInf.offsetWidth;
          oInfDimensions[3] = oInfDimensions[1]+oInf.offsetHeight;
      if(settings.hideSelects && !checkHiddenSelects(oInf.id))
       oInf.handleIE(oInfDimensions);
    }

   //ie7 opacity box (IF IE THEN MISERY)
    if (this.opaNode)
      reposOpaNode(oInf,this.opaNode)
  }

  //IE7 reposition the transparent box behind the text
  //used in resize/repos. (IF IE THEN MISERY)
  function reposOpaNode()
  {  var oNode = $(arguments[1]),oInf=arguments[0];
       oInf.style.backgroundColor='transparent';
       oInf.style.zIndex = giZ+1;
       with (oNode.style) {
        visibility = 'visible';
        position   = 'absolute';
        top        = oInf.offsetTop+'px';
        left       = oInf.offsetLeft+'px';
        width      = oInf.offsetWidth+'px';
        height     = oInf.offsetHeight+'px';
        zIndex     =  (parseInt(oInf.style.zIndex))-1;
     }
  }


  //check if any tooltip triggered select elements hiding
  function checkHiddenSelects()
  {
    if (arguments[0])
     for (var id in openBox)
       if (openBox[id] && id != arguments[0])
         return true
     else if (!arguments[0])
      for (var id in openBox)
        if (openBox[id])
         return true

     return false
  }

  //resize (static tooltips)
  //to do: determine position/keep in viewport
  function reSize()
  { if (!bUseTt&& !getAttrValue(this,'ttpersist'))
       return
    var oInf=this.ttBox
        aDim = getWinDim(),
        aInfDim = Position.cumulativeOffset(oInf),
        currentTop=arguments[0]||oInf.fixTop,
        currentLeft=arguments[1]||oInf.fixLeft||20,
        scrTop = w.pageYOffset
                || doc.documentElement.scrollTop
                || doc.body.scrollTop;
//currentTop+
    if (oInf.offsetHeight>=scrTop+aDim[1]){
       //!!aanpassen!!
       if (currentTop<scrTop)
        oInf.style.height = buildStr( ((aDim[1]+scrTop)-aInfDim[1])-(25+currentTop),'px');
       currentTop = (aDim[1]+scrTop)-(oInf.offsetHeight+25);
       oInf.style.overflow = 'auto';
     }

    piep([oInf.offsetHeight,scrTop+aDim[1],currentTop<scrTop]);
    oInf.style.top=buildStr(currentTop,'px');
    oInf.style.left=buildStr(currentLeft,'px');

    //(IF IE THEN MISERY)
    //ie7 opacity box
     if (this.opaNode)
       reposOpaNode(oInf,this.opaNode)

    //(IF IE THEN MISERY)
    //IE6 trigger hiding select elements if applicable
     if (bSelects){
      var oInfDimensions = Position.cumulativeOffset(oInf);
             oInfDimensions[2] = oInfDimensions[0]+oInf.offsetWidth;
             oInfDimensions[3] = oInfDimensions[1]+oInf.offsetHeight;
        if(settings.hideSelects&&!checkHiddenSelects(oInf.id))
         oInf.handleIE(oInfDimensions);
     }
  }

  //hide tooltip
   function hideInfo(){
     var oInf = this.ttBox;
     if (!oInf)
       return true

  //clean up handlers within static tt
     if (this.klik){
       ttRemoveHandlers(oInf);
     }

     this.bShow=false;

      if (settings.hideSelects &&
          bSelects &&
          !checkHiddenSelects(oInf.id))
       selectsBack()

      openBox[oInf.id]=false;

      oInf.innerHTML = '';
      with(oInf.style) {
       overflow = 'hidden';
       height = 'auto';
       width = 'auto';
       top = 0;
       zIndex = giDefaultZ;
       visibility='hidden';
       if ( !bIE && settings.Opacity.between(0,1) &&
            settings.delayValue>0 &&
            !getAttrValue(oInf.originator,'ttnoDelay') &&
            !getAttrValue(oInf.originator,'ttNoOpa') )
          opacity='0.1';
       else if (!bIE && !getAttrValue(oInf.originator,'ttNoOpa'))
         opacity=settings.Opacity;
      }

     //(IF IE THEN MISERY)
     //Hide IE7 opacity box
       if (this.opaNode && $(this.opaNode)){
        with ($(this.opaNode).style) {
         overflow = 'hidden';
         height = 'auto';
         width = 'auto';
         top = 0;
         zIndex = giDefaultZ;
         visibility='hidden';
        }
       }

     //reset mouseover for parent (w/nested tt)
      if(getAttrValue(this,'ttNestParent')){
        var nodex = $(getAttrValue(this,'ttNestParent'));
        nodex.onmouseover = nodex.oldmouseover||null;
      }
   }

/* ------------------------------ FORMS specific ------------------------ */
/* steals focus from current input element if necessary. To prevent cursor
   bleed through tt !TO DO: return focus to current input element
   needs more work (remember the currently focused input element)
*/
function doBlur()
{ var oInputs = doc.getElementsByTagName('input');
  if (oInputs.length<1) return;
   for (var i=0;i<oInputs.length;i++)
     oInputs[i].blur();
}

/* ------------------------------GENERIC functions----------------------- */
/* converts arguments object to real array */
 function argsAsArray(oArgs)
 { var aA = [],i=0;

   do {
    aA.push(oArgs[i]);
    i++
   } while (i<oArgs.length)
   return aA;
 }

/* for debug */
   function piep()
   { var args = arguments.length>2 ? argsAsArray(arguments).join(',')
                                   : arguments[0]||'no dice';

     var sT = String(args) || 'piep';
                    if (args)
                      arguments[2] || arguments.length<2 ? window.defaultStatus=sT
                                   : window.defaultStatus=sT;
                    else
                      alert(!sT ? 'PIEP dus': sT);
   }


/* gets the value of any attribute of any element
   this facilitates the use of non default attributes */
   function getAttrValue()
   {
    var theObj= !(typeof arguments[0]).match(/obje/i) ? $(arguments[0]) : arguments[0];
    if (!theObj)
	 return false;
    if (theObj[arguments[1]])
       return theObj[arguments[1]];
    if (theObj.attributes && theObj.attributes.getNamedItem)
       return theObj.attributes.getNamedItem(arguments[1]) ?
               String(theObj.attributes.getNamedItem(arguments[1]).value)
               || true : false;
     else if (theObj.getAttribute) {
       return theObj.getAttribute(arguments[1])  ?
               String(theObj.getAttribute(arguments[1])) :
               false;
     }
    return false;
   }

function moveAttributes(elfrom,elto)
{ var attr = elfrom.attributes;
  if (attr.length<1 || !elfrom || !elto)
    return 0;
   for (var i=0;i<attr.length;i++)
    if (String(attr[i].nodeName).match(/^tt/i))
     elto.setAttribute(attr[i].nodeName,attr[i].nodeValue);
   var attr = elto.attributes;
   if (attr)
   for (var i=0;i<attr.length;i++)
    if (attr[i]&&String(attr[i].nodeName).match(/^tt/i))
     elfrom.removeAttribute(attr[i].nodeName,2);
}

function getWinDim() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth
             || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth
             || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
 return [myWidth,myHeight];
}

/* obsolete for now, retrieves css style rule with name [sName] */
function getIEInfoStyle(sName)
{    if (!sName) return '';
     sName = sName.toLowerCase();
     var oIGetStyle = doc.styleSheets[0].rules,
         sInfoStyle = '';
     for (var i=0;i<oIGetStyle.length;i++)
       if (oIGetStyle.item(i).selectorText.toLowerCase() == sName)
        sInfoStyle = oIGetStyle.item(i).style.cssText.replace(/\n/g,'');
     return sInfoStyle;
}

/* returns element or array of elements
   (replaces document.getElementById) */
function $()
{ var a=arguments;
  a.length<1?_$():void(0);
  if (a.length==1)
    return doc.getElementById(a[0] || a[0] || null);

  var els = [];
   for (var i=0;i<a.length;i++)
    els.push(doc.getElementById(a[i]) || a[i] || null);
  return els;
}

/* empty function (may be used in timeouts)*/
function _$()
{  return true; }

/* from prototypes, w/adjustments
   syntax style is json */

/* Added element functionallity */
function Element() {return {
  //added hide/show: visibility
  hide: function() { //hides given element(s)
    for (var i = 0; i < arguments.length; i++) {
     if (arguments[i]){
      var element = $(arguments[i])||$(arguments[i].id);
      if (element){
         element.style.visibility = 'hidden';
      }
    }
  }
},

  show: function() { //shows given element(s)
    for (var i = 0; i < arguments.length; i++) {
      var element = $(arguments[i]) || $(arguments[i].id);
      if (!element) //(fallback gracefully)
        return piep ('Element.show: element not found=>'+arguments[i].id);
	  if (navigator.appVersion.match(/safari/i)){
        element.style.display = 'inline-block';
        element.style.clip = 'auto';}
      else  {
         element.style.visibility= 'visible';
      }
    }
  },

  showSafariBlock: function() { //Safari, older versions
    for (var i = 0; i < arguments.length; i++) {
      var element = $(arguments[i]) || $(arguments[i].id);
      element.style.display = 'inline-block';
    }
  },
  //assign or add classname to element
  addClassName: function(element, className) {
    if (!(element = $(element) || $(element.id))) return;
    element.className=buildStr(element.className,' ',className);return;
  }
 };
} //Element[end]

/* from prototypes, w/adjustments */
function Event() {return {

  element: function(event) { //retrieve eventsource
    if (event)
     return event.target || event.srcElement;
  },

  pointerX: function(event) { //retrieve horizontal position event
   if (event)
    return event.pageX || (event.clientX +
      (doc.documentElement.scrollLeft || doc.body.scrollLeft));
  },

  pointerY: function(event) { //retrieve vertical position event
    if (event)
     return event.pageY || (event.clientY +
      (doc.documentElement.scrollTop || doc.body.scrollTop));
  },

  observers: false,  //add or remove eventlisteners

  _observeAndCache: function(element, name, observer, useCapture) {
    if (!this.observers) this.observers = [];
    if (element && element.addEventListener) {
      this.observers.push([element, name, observer, useCapture]);
      element.addEventListener(name, observer, useCapture);
    } else if (element && element.attachEvent) {
      this.observers.push([element, name, observer, useCapture]);
      element.attachEvent(buildStr('on',name), observer);
    }
  },

  retrObserver: function(element,name){
    var i=0,
        element = $(element) || $(element.id || null);

    if (element)
    do {
      if (element==this.observers[i][0] &&
          name==this.observers[i][1]) {
         return this.observers[i][2];
         break
      }
      i++;
    } while (i<this.observers.length)
   return _$;
  },

  unloadCache: function() {
    if (!Event.observers) return;
    for (var i = 0; i < Event.observers.length; i++) {
      Event.stopObserving.apply(this, Event.observers[i]);
      Event.observers[i][0] = null;
    }
    Event.observers = false;
  },

  observe: function(element, name, observer, useCapture) {
    var element = $(element) || $(element.id || null);
    useCapture = useCapture || false;

    if (name == 'keypress' &&
        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
        || element.attachEvent))
      name = 'keydown';

    this._observeAndCache(element, name, observer, useCapture);
  },

  stopObserving: function(element, name, observer, useCapture) {
    var element = $(element) || $(element.id || null);
    useCapture = useCapture || false;

    if (name == 'keypress' &&
        (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
        || element.detachEvent))
      name = 'keydown';

    if (element.removeEventListener) {
      element.removeEventListener(name, observer, useCapture);
    } else if (element.detachEvent) {
      element.detachEvent(buildStr('on',name), observer);
    }
  }
 };
}; //Event [end]

/* Element Positioning */
function Position() {return {
  includeScrollOffsets: false,

  prepare: function() { //determine left position
    this.deltaX =  window.pageXOffset
                || document.documentElement.scrollLeft
                || document.body.scrollLeft
                || 0;
    this.deltaY =  window.pageYOffset //determine top position
                || document.documentElement.scrollTop
                || document.body.scrollTop
                || 0;
  },

  realOffset: function(element) { //determine real position
                                  //(not considering parent positions)
    var valueT = 0, valueL = 0;
    do {
      valueT += element.scrollTop  || 0;
      valueL += element.scrollLeft || 0;
      element = element.parentNode;
    } while (element);
    return [valueL, valueT];
  },

  cumulativeOffset: function(element) {//determine position
                                       //(considering parent positions)
    var valueT = 0, valueL = 0;
    if (!element)
     return [0,0];
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.parentElement;//element.offsetParent;
    } while (element);
    return [valueL, valueT];
  },

  positionedOffset: function(element) {
    var valueT = 0, valueL = 0;
    if (!element)
     return [0,0];
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
      if (element) {
        p = Element.getStyle(element, 'position');
        if (p == 'relative' || p == 'absolute') break;
      }
    } while (element);
    return [valueL, valueT];
  },

  offsetParent: function(element) {
    if (element.offsetParent) return element.offsetParent;
    if (element == document.body) return element;

    while ((element = element.parentNode) && element != document.body)
      if (Element.getStyle(element, 'position') != 'static')
        return element;

    return document.body;
  }
 };
}; //Position [end]

Object.extend = function(destination, source) {
  for (property in source) {
    destination[property] = source[property];
  }
  return destination;
}

/* non compatible browsers */
function NoDice()
{ var settings = new INITS();
  if (confirm(settings.LN.BrowserCompat))
    pageLoader();
  else return false;
}

//genericPageLoader: catches current window/document load handlers
//and supplies an object container to be able to add your own
//load handlers. After running this you can use window.pageLoad
//e.g. window.pageLoad.myPageHandler = [some function]
function genLoad()
{
  if (!window.w){
   w=window;
   doc=document;
   rand = Math.random;
   rnd  =Math.round; }

  if (!w.pageLoad){
   w._start = function() {
     this.loaders = new Object();
      if (!_start._init){
        var self = this;
        _start.prototype.execPageLoad =
           function() {
             { for (var fn in self.loaders) {
                if ((typeof self.loaders[fn]).match(/funct/i))
                 self.loaders[fn]();
               }
             };
        _start.prototype.guid = function() {
           var sKey = '',isKey = '',
               aRanges = new Array('50,5','65,25','65,25');
             for (var i=0;i<arguments[0];i++)
             {
               var aRange  = String(aRanges[rnd(rand()*2)]).split(',');
               isKey      += String(aRanges[rnd(rand()*2)])+',';
               sKey       += String.fromCharCode(rnd(parseInt(aRange[0])+
                                         (rand()*parseInt(aRange[1]))));
             }
           return sKey;
        }
       };
      _start._init=true;
      }
     };
    w.pageLoad = new _start();
     if (w.onload && !String(w.onload).match(/pageLoad\.exe/i))
      w.pageLoad.loaders['load'+pageLoad.guid(5)] = w.onload;
    w.onload=w.pageLoad.execPageLoad;
   }
 }

//obsolete? strip html from a text
function stripHTML(str)
{
  return (typeof str).match(/strin/)?str.replace(/(<(.+)>)/g,''):str;
}

//switch tooltip on/off
function ttActiveSwitch()
{
  if (bUseTt){
    bUseTt=false;
  }
  else {
    bUseTt=true;
  }
  //if a tooltip element is supplied per second argument
  //(with a js function as ttxt), the ttxt is refreshed
  //if you define ttxtjsfn as text attribute, this means
  //you can dynamically rerun that function after a
  //click.
  //syntax: onclick=ttActiveSwitch(this.event,this)
  if (arguments[0]&&arguments[1]&&arguments[0].showInfo){
   var evt=arguments[1]||window.event;
   arguments[0].hideInfo();
   arguments[0].showInfo(evt);
  }
  bIE?document.getElementsByTagName('body')[0].focus():arguments[0].blur();
}

/*change tooltip Text*/
 function cTxt()
 {
  var sArg = arguments[0]||null,
        El = $(arguments[1])||null,
     sHead = arguments[2] || null;

  if (!El)
    return alert('no element!');

  var tta = serializeTtAttr(El)

  if (!sArg || arguments.length<2)
    return alert('(cTxt::please supply the right parameters');
   El.hideInfo();

  //remove all txt related attributes
       if (tta.ttxt)
        El.removeAttribute('ttxt',2);
  else if (tta.ttxtid)
        El.removeAttribute('ttxtid',2);
  else if (tta.ttxtjs)
        El.removeAttribute('ttxtjs',2);
  else if (tta.ttxturl)
        El.removeAttribute('ttxtUrl',2);
  else if (tta.ttxtjsfn) {
        El.removeAttribute('ttxtjsfn',2);
        El.runJs = null;
  }

  //reset ttxt attribute from first param
  if (sArg.match('^js:')) {
   var txtEl = (sArg.split(':'))[1];
   El.setAttribute('ttxtJs',txtEl);
  }
  else if (sArg.match('^jsfn:')) {
   var txtFn = (sArg.split(':'))[1];
   El.setAttribute('^ttxtjsfn',txtFn);
    try {El.runJs = eval(txtFn)}
    catch(e){El.runJs = function()
     {return errTxt(buildStr(txtFn,': ',settings.LN.JsFNNoSuchFunction))}};
  }
  else if (sArg.match('^id:')) {
   var txtEl = (sArg.split(':'))[1];
   El.setAttribute('ttxtid',txtEl);
  }
  else {
   El.setAttribute('ttxt',sArg);
  }

  //add or replace header attribute from third param
  if (sHead)
   El.setAttribute('ttHeader',sHead);

  if (El.klik)
    El.klik();
}

// random string generator
function KeyGen(iLength)
{
  var sKey='',isKey='',i=0,
      aRanges = new Array('48,9','65,25','97,25');

   //set default length (4)
    !iLength ? iLength=4:void(0)

   do
   {
     var aRange = String(aRanges[Math.round(Math.random()*2)]).split(',');
     isKey      += buildStr(String(aRanges[Math.round(Math.random()*2)]),',');
     sKey       += String.fromCharCode(Math.round(parseInt(aRange[0])+
                   (Math.random()*parseInt(aRange[1]))));
     i++;
   } while (i<iLength)
  return sKey;
}

// used in INITS
function setLanguage(lang)
{
  var lanDutch =
  { isEnglish:false,
    CloseBoxMessage:'klik om te sluiten',
    TextAttributeError:'voeg svp een tekstattribuut toe!',
    JsFnNoSuchFunction:'functie bestaat niet!',
    JsTextNotInCollection:'tTxtJs: niet in de jsTxt-verzameling gevonden!',
    TextIdNotFound:'tTxtId: element met dit id niet gevonden!',
    TextAttributeEmpty:'tTxt: geen tekst!',
    ClickToOpenBox:'Klik hier voor extra informatie',
    URLNotFound:'De URL werd niet gevonden',
    BrowserCompat:buildStr('Uw browser is mogelijk niet geschikt voor alle ',
                           'functionaliteit van deze pagina! Toch laden?\n'),
    LoadURLInNewWin:'laad deze URL in een nieuw venster'
  },
      lanEn    =
  {
    isEnglish:true,
    CloseBoxMessage:'click to close',
    TextAttributeError:'provide a text attribute to activate tooltip!',
    JsFnNoSuchFunction:'no such function!',
    JsTextNotInCollection:'tTxtJs: not found in jsTxt collection!',
    TextIdNotFound:'tTxtId: no element with this id!',
    TextAttributeEmpty:'tTxt: no text provided!',
    ClickToOpenBox:'Click here for extra information',
    URLNotFound:'The URL you supplied was not found!',
    BrowserCompat:buildStr('Your browser doesn\'t seem to fully support the ',
                           'functionallity of this page! Continue loading?'),
    LoadURLInNewWin:'load this URL in it\'s own window'
  }
  return !lang?lanEn:lang.match(/nl/i)?lanDutch:lanEn;
}

// public method used in INITS
function loadDocumentTexts()
{
  if (!arguments[0] || !String(typeof arguments[0]).match(/obj/i))
    return {};
  else
   var txtObj=arguments[0]
    for (var str in txtObj)
     this.allTxt[str]=txtObj[str];
}

//retrieve tooltip classes if applicable
   function getTtStyles()
   { if (!doc.styleSheets)
        return {}; //return empty styles object, fallback to default styles
     var Sheets=doc.styleSheets,
         ourStyles={tooltip:null,tooltipHeader:null,tooltipParagraph:null},
         bIE=doc.all && !w.opera;

     for (var x=0;x<Sheets.length;x++)
       var Rules = bIE?Sheets[x].rules:Sheets[x].cssRules;
        for (var i=0;i<Rules.length;i++)
          for(var j in Rules[i])
           if (j && j.match(/selectortext/i)&& Rules[i][j].match(/^\.tooltip/i)){
            ourStyles[Rules[i][j].replace(/^\./,'')] = Rules[i].style.cssText;
           }
     return ourStyles;
   }

//create iFrame to cover select elements (not used anymore)
function IEFrame()
{
    var oF     = doc.createElement('iframe'),
        ttieid = buildStr("ttIE",KeyGen(4));
    oF.id  = ttieid;
    oF.src = "javascript:void(0)";
    addTtStyle(oF,settings.tooltipStyles.sTtIEStyle);
    doc.body.appendChild(oF);
    return oF;
}

// load text from URL (attribute ttxtURL)
function loadFromURL(URL,oObj)
{
    if ($('URLoader'))
     doc.body.removeChild($('URLoader'))

    var oF     = doc.createElement('iframe');
    oF.src     = URL;
    oF.id      = "URLoader";

    addTtStyle(oF,settings.tooltipStyles.sTtIEStyle);

    doc.body.appendChild(oF);

    var   iid = buildStr('ttFromURL',KeyGen(4)),
          loader = function() {
          var oDoc = $('URLoader').contentDocument||w.frames['URLoader'].document,
              Src  = oDoc.location.href,
              sTxt = buildStr('[text loaded from URL: ',
                             '<a tt=1 ttxtjsfn="loadInWin" ',
                             'ttBGC="#FFF" ttHover="green" href="',
                              Src,'" target="_blank">',Src,'</a>]<br>',
                              oDoc.body.innerHTML);
          settings.allTxt[iid] = sTxt;
          return cTxt(buildStr('js:',iid),oObj.id,getAttrValue(oObj,'ttHeader'));
        };
    if (bIE){
      w.frames['URLoader'].attachEvent('onload',loader);
    }
    else
     oF.onload = loader

}

//optimized string concatenation
function buildStr()
{
  var aIM = [],i=arguments.length-1;
  do {
   var sp=String(arguments[i]);
   sp?aIM[i] = sp : void(0);
  } while (i--);
 return aIM.join('');
}

//little helpers
function getCloseMssg()
{
 return settings.LN.CloseBoxMessage;
}
