// **********************************************************
// **
// **           RESIZE BACKGROUND FONCTION
// **
// **********************************************************
NS4 = (document.layers);
    IE4 = (document.all);
    
    scaleWidth = true;
    scaleHeight = true;
   imSRC800 ="images/background800.jpg";
   imSRC1024 = "images/background1024.jpg";
   imSRC1280 = "images/background1280.jpg";



    if (NS4) window.onload = setResize;

    function setResize(){
        setTimeout("window.onresize=reDo;",500);
    }

    function reDo(){
        window.location.reload()
    }

    if (IE4) window.onresize = reDoIE;

    function reDoIE(){
		
        imBG.width = document.body.clientWidth;
        imBG.height = document.body.clientHeight;
    }

    function makeIm() {
    
      winWid = (NS4) ? innerWidth : document.body.clientWidth;
      winHgt = (NS4) ? innerHeight : document.body.clientHeight;


if (document.body.clientWidth <= 1280) imSRC = imSRC1280;
if (document.body.clientWidth <= 1024) imSRC = imSRC1024;
if (document.body.clientWidth <= 800) imSRC = imSRC800;
    
	imStr = "<DIV ID=elBGim"
      + " STYLE='position:absolute;left:0;top:0;z-index:-1'>"
      + "<IMG NAME='imBG' BORDER=0 SRC=" + imSRC;

     // imStr = "<DIV ID=elBGim"
    //  + " STYLE='position:absolute;left:0;top:0;z-index:-1'>"
    //  + "<IMG NAME='imBG' BORDER=0 SRC=" + imSRC;
    //  if (scaleWidth) imStr += " WIDTH=" + winWid;
    //  if (scaleHeight) imStr += " HEIGHT=" + winHgt;
    //  imStr += "></DIV>";
    
      document.write(imStr);
    
    }


// *** COMMON CROSS-BROWSER COMPATIBILITY CODE ***


// If combining with my other scripts, you might want to edit this section to remove
// duplicate functions to reduce size. It's not totally necessary, though, these functions
// should be clever enough to manage double-ups on their own.

var isDOM=document.getElementById?1:0;
var isIE=document.all?1:0;
var isNS4=navigator.appName=='Netscape'&&!isDOM?1:0;
var isIE4=isIE&&!isDOM?1:0;
var isOp=window.opera?1:0;
var isWin=navigator.platform.indexOf('Win')!=-1?1:0;
var isDyn=isDOM||isIE||isNS4;


function getRef(id, par)
{
 par=!par?document:(par.navigator?par.document:par);
 return isIE ? par.all[id] :
  (isDOM ? (par.getElementById?par:par.ownerDocument).getElementById(id) :
  (isNS4 ? par.layers[id] : null));
}

function getSty(id, par)
{
 var r=getRef(id, par);
 return r?(isNS4?r:r.style):null;
}

if (!window.LayerObj) var LayerObj = new Function('id', 'par',
 'this.ref=getRef(id, par); this.sty=getSty(id, par); return this');
function getLyr(id, par) { return new LayerObj(id, par) }

function LyrFn(fn, fc)
{
 LayerObj.prototype[fn] = new Function('var a=arguments,p=a[0],px=isNS4||isOp?0:"px"; ' +
  'with (this) { '+fc+' }');
}
LyrFn('x','if (!isNaN(p)) sty.left=p+px; else return parseInt(sty.left)');
LyrFn('y','if (!isNaN(p)) sty.top=p+px; else return parseInt(sty.top)');
LyrFn('w','if (p) (isNS4?sty.clip:sty).width=p+px; ' +
 'else return (isNS4?ref.document.width:ref.offsetWidth)');
LyrFn('h','if (p) (isNS4?sty.clip:sty).height=p+px; ' +
 'else return (isNS4?ref.document.height:ref.offsetHeight)');
LyrFn('vis','sty.visibility=p');
LyrFn('clip','if (isNS4) with(sty.clip){left=a[0];top=a[1];right=a[2];bottom=a[3]} ' +
 'else sty.clip="rect("+a[1]+"px "+a[2]+"px "+a[3]+"px "+a[0]+"px)" ');
LyrFn('bgColor','if (isNS4) sty.bgColor=p?p:null; ' +
 'else sty.background=p?p:"transparent"');
LyrFn('bgImage','if (isNS4) sty.background.src=p?p:null; ' +
 'else sty.background=p?"url("+p+")":"transparent"');
LyrFn('write','if (isNS4) with (ref.document){write(p);close()} else ref.innerHTML=p');
LyrFn('alpha','var f=ref.filters,d=(p==null); if (f) {' +
 'if (!d&&sty.filter.indexOf("alpha")==-1) sty.filter+=" alpha(opacity="+p+")"; ' +
 'else if (f.length&&f.alpha) with(f.alpha){if(d)enabled=false;else{opacity=p;enabled=true}} }' +
 'else if (isDOM) sty.MozOpacity=d?"":p+"%"');


function setLyr(lVis, docW, par)
{
 if (!setLyr.seq) setLyr.seq=0;
 if (!docW) docW=0;
 var obj = (!par ? (isNS4 ? window : document.body) :
  (!isNS4 && par.navigator ? par.document.body : par));
 var IA='insertAdjacentHTML', AC='appendChild', newID='_js_layer_'+setLyr.seq++;

 if (obj[IA]) obj[IA]('beforeEnd', '<div id="'+newID+'" style="position:absolute"></div>');
 else if (obj[AC])
 {
  var newL=document.createElement('div');
  obj[AC](newL); newL.id=newID; newL.style.position='absolute';
 }
 else if (isNS4)
 {
  var newL=new Layer(docW, obj);
  newID=newL.id;
 }

 var lObj=getLyr(newID, par);
 with (lObj) if (ref) { vis(lVis); x(0); y(0); sty.width=docW+(isNS4?0:'px') }
 return lObj;
}

var CSSmode=document.compatMode;
CSSmode=(CSSmode&&CSSmode.indexOf('CSS')!=-1)||isDOM&&!isIE||isOp?1:0;

if (!window.page) var page = { win: window, minW: 0, minH: 0, MS: isIE&&!isOp,
 db: CSSmode?'documentElement':'body' }

page.winW=function()
 { with (this) return Math.max(minW, MS?win.document[db].clientWidth:win.innerWidth) }
page.winH=function()
 { with (this) return Math.max(minH, MS?win.document[db].clientHeight:win.innerHeight) }
page.scrollX=function()
 { with (this) return MS?win.document[db].scrollLeft:win.pageXOffset }
page.scrollY=function()
 { with (this) return MS?win.document[db].scrollTop:win.pageYOffset }




// *** LOAD FILES INTO DIV FUNCTIONS ***


function scrLoad(fName) { with (this)
{
 if (!fName || !loaded || !isDyn) return;

 // Set this as the currently loading file, and fire the 'onbeforeload' event.
 loadingFile = fName;
 if (onbeforeload) onbeforeload();

 // History -- if we're moving to a new location, add it to the history.
 if (loadingFile != history[histPos])
 {
  histPos++;
  history[histPos] = loadingFile;
  history.length = histPos + 1;
 }

 // Trigger a file load in IE/NS6, that calls the 'fileLoaded()' function when complete.
 if (isIE || isDOM) with (bufRef.document)
 {
  // Nest an Iframe with an onload handler.
  write('<html><body onload="parent.' + myName + '.fileLoaded()">' +
   '<iframe name="nestBuf" src="' + fName + '"></iframe></body></html>');
  close();
  // In early versions of NS6, the nested IFrame is not invoked nor is the onload event fired.
  // So we set the regular frame's location and give it 5 secs to load.
  // Do the same for IE4 on the Macintosh which is a pathetic excuse for a browser.
  if (!bufRef.nestBuf || (isIE4 && !isWin))
  {
   bufRef.location.href = fName;
   setTimeout(myName + '.fileLoaded()', 5000);
  }
 }
 else if (isNS4)
 {
  // Delay load if another file is loading concurrently...
  if (window.ns4LayerLoading)
  {
   setTimeout(myName + '.load("' + fName + '")', 100);
   return;
  }
  window.ns4LayerLoading = true;

  // On load, clear loading flag and scroll to top.
  div.ref.onload = new Function(myName + '.fileLoaded()');
  // Netscape's load(URL, width) method...
  div.ref.load(fName, cWidth);
 }
}}


function scrFileLoaded() { with (this)
{
 // Stop dragging any scroller while we switch files.
 activeScr = null;

 // Clear the loading flag for NS4, clear to load another file!
 if (isNS4) window.ns4LayerLoading = false;

 // In IE or NS6, shift the contents of the IFrame buffer into the DIV.
 // Note this is still an extension of the NS6 kludge, not using the nested IFrame.
 if ((isDOM || isIE) && loadingFile)
 {
  var bufDoc = bufRef.nestBuf ? bufRef.nestBuf.document : bufRef.document;
  if (bufDoc && bufDoc.body) div.ref.innerHTML = bufDoc.body.innerHTML;
  bufRef.location.replace('about:blank');
 }

 // Set the loaded file as the one we've just loaded.
 loadedFile = loadingFile;

 // Scroll back to top... the short delay helps IE4, giving it some time to render
 // the new document to calculate its height. Also fire the 'onload' event.
 setTimeout('with(' + myName + ') { scrollTo(0); if (onload) onload() }', 1);
}}


// History loading function -- cycles through history[] array.
function scrGo(dir) { with (this)
{
 histPos += dir;
 if (histPos < 0) { histPos = 0; return }
 if (histPos >= history.length) { histPos = history.length - 1; return }
 load(history[histPos]);
}}



// *** DIV SCROLLING FUNCTIONS ***


function scrScrollTo(pos, isStick) { with (this)
{
 if (!isDyn || !loaded) return;

 // Record new top value as scroller object property.
 cTop = pos;

 // If this isn't a sticky scroll, set the target position to the current position.
 // Otherwise whenever you click the arrows, the scroller slides back again...
 if (!isStick) stickTop = cTop;

 // Height of div, plus padding - update here as it may change often.
 divHeight = div.h() + padTop + padBot;
 // Stops 'divide by zero'
 if (divHeight == 0) divHeight = 1;

 // Should we check if we're scrolling out of range? If so, return to top/bottom.
 if (checkBounds)
 {
  if (cTop + cHeight > divHeight) cTop = divHeight - cHeight;
  if (cTop < 0) cTop = 0;
 }

 // Move div up/down... 'scrolling' div, and reclip as we do so.
 div.y(eval(divs[0].y) - cTop + padTop);
 div.clip(0, cTop - padTop, cWidth, cTop - padTop + cHeight);


 // Define its height as the percentage of the clipping height vs div height.
 // Best to set it here as divHeight may change as images load etc.
 thmHeight = Math.ceil(barHeight * (cHeight / divHeight));

 // Minimum and maximum heights for thumb...
 if (thmHeight < minThmHeight) thmHeight = minThmHeight;
 if (thmHeight > barHeight) thmHeight = barHeight;

 // Assign the thumb its calculated height if we're not sticky-scrolling.
 thm.h(thmHeight);

 // Now is a good time to fire the 'onscroll' event if it exists.
 if (onscroll) onscroll();

 // Adjust scrollbar thumb position only if we're not dragging / sticky-scrolling.
 if (activeScr || isStick) return;

 // What fraction is the div of its total scrolling range? 0=top, 1=bottom.
 var fracDivDown = (cTop / (divHeight - cHeight));
 // Now, multiply that by the available space to move and assign its top.
 thm.y(bar.y() + fracDivDown * (barHeight - thmHeight));
}}


function scrScrollBy(amount) { with (this)
{
 // Scroll to the old location plus however much we're scrolling by.
 scrollTo(cTop + amount);
}}


function scrSetScroll(newSpeed, steps) { with (this)
{
 if (!loaded) return;

 // Alter scroller velocity in steps to the new speed, set timer interval.
 stepsLeft = steps;

 // Clear the timer here -- so sticky scrolling or another setScroll() stops.
 if (timer) clearInterval(timer);
 timer = setInterval('with (' + myName + ') { ' +
  'if (stepsLeft > 0) { ySpeed += ' + ((newSpeed-ySpeed)/steps) + '; stepsLeft-- } ' +
  'else if (parseInt(ySpeed)==0) {clearInterval(timer);timer=null} scrollBy(ySpeed) }', 50);
}}



// *** SCROLL THUMB DRAGGING EVENT HANDLERS ***


function scrThumbDown(evt) { with (this)
{
 // Find the correct event object.
 var evt = evt?evt:window.event;

 // Set the global variable pointing to the active scroller - this scroller object.
 activeScr = this;

 // Offset of mouse cursor within the scrollbar...
 dragOffset = (isNS4 ? evt.layerY : page.scrollY() + evt.clientY - thm.y());

 // Fire the 'onthumbdown' event if it exists.
 if (onthumbdown) onthumbdown();

 // Clear either the sticky scroll or setScroll() interval, to be reset on mousemove.
 if (timer) clearInterval(timer);
 timer = null;

 return false;
}}


function scrThumbMove(evt)
{
 var evt = evt?evt:window.event;

 // Either return true if no scroller is being dragged (so selections work), or if
 // it's NS4 just route the event...
 if (!activeScr) return true;
 else with (activeScr)
 {
  // If it's not scrollable, quit.
  if ((cTop + cHeight > divHeight) || (thmHeight == barHeight)) return true;

  // Calculate the new position of the thumb within the scrollbar (0 = at the top).
  var thmTop = (isNS4 ? evt.pageY : page.scrollY() + evt.clientY) - dragOffset - bar.y();
 
  // Test if the thumb is out of range, if so, bring it back, then assign its position.
  if (thmTop < 0) thmTop = 0;
  if (thmTop + thmHeight > barHeight) thmTop = barHeight - thmHeight;
  thm.y(bar.y() + thmTop);

  // Set the new position as the target top value for the sticky scroll routine.
  stickTop = (divHeight - cHeight) * (thmTop / (barHeight - thmHeight));
  
  // If sticky scrolling is off, scroll now, otherwise set interval as needed.
  if (stick == 1) scrollTo(stickTop);
  else if (!timer) timer = setInterval(myName + '.stickScroll()', 40);

  return false;
 }
}


function scrStickScroll() { with (this)
{
 // If we're way off, scroll by the stickiness factor in the correct direction.
 if (Math.abs(cTop - stickTop) > 1)
 {
  cTop += (stickTop - cTop) * stick;
  scrollTo(cTop, true);
 }
 else if (cTop != stickTop)
 {
  // Otherwise if there's only 1px to go, scroll to the exact point, and call it done.
  cTop = stickTop;
  scrollTo(cTop, true);
 }
}}


function scrThumbUp(evt)
{
 // Fire the 'onthumbup' event if it exists.
 // N.B. Leave the sticky-scroll interval active.
 if (activeScr) with (activeScr) if (onthumbup) onthumbup();

 // Clear the active scroller global variable.
 activeScr = null;
}



// *** SCROLLBAR BACKGROUND CLICK EVENT HANDLER ***


function scrBarClick(evt) { with (this)
{
 // Get the correct event object, and retrieve the click position.
 var evt = evt?evt:window.event;

 clickPos = isNS4 ? evt.pageY : page.scrollY() + evt.clientY;

 // Page up, or page down?
 if (clickPos < thm.y()) scrollBy(0 - cHeight);
 if (clickPos > (thm.y() + thmHeight)) scrollBy(cHeight);

 if (isNS4) return document.routeEvent(evt);
}}



// *** LAYOUT HANDLER FOR WINDOW RESIZE ETC ***


function scrLayout() { with (this)
{
 if (!isDyn || !loaded) return;

 // Loop through divs array, positioning/sizing controls.
 for (var i = 0; i < divs.length; i++) with (divs[i].lyr)
 {
  // Don't let the width and height get below 0.
  x(eval(divs[i].x)); w(Math.max(0,eval(divs[i].w)));
  // Only set Y and height if it's not the scrolling content div.
  if (i) { y(eval(divs[i].y)); h(Math.max(0,eval(divs[i].h))) }
 }

 // Bar height and clipping dimensions, accessed often so stored as object properties.
 barHeight = eval(divs[1].h);
 cWidth = eval(divs[0].w);
 cHeight = eval(divs[0].h);

 // Might as well fire the onlayout event if it exists.
 if (onlayout) onlayout();

 // Now, display it using updated variables...
 scrollBy(0);
}}


// *** ON LOAD: CAPTURE EVENTS & MISC. SETUP ***


function scrSetup(defaultFile) { with (this)
{
 if (!isDyn) return;

 // Get layer objects for all the divs passed to the function somehow...
 for (var i = 0; i < divs.length; i++)
  divs[i].lyr = getLyr(divs[i].id, eval(divs[i].par));
  
 // These get accessed so often we might as well get some short references.
 div = divs[0].lyr;
 bar = divs[1].lyr;
 thm = divs[2].lyr;

 // Buffer frame for IE/NS6 -- same as scroller name, plus 'Buf'.
 // NS6 has troubles with the frames array and iframes, so use a workaround.
 if (!isNS4) bufRef = eval('window.' + myName + 'Buf');

 // Set up event capturing for NS4.
 if (isNS4)
 {
  bar.ref.captureEvents(Event.CLICK);
  thm.ref.captureEvents(Event.MOUSEDOWN);
 }

 // Pass these events to this scroller.
 bar.ref.onclick = new Function('evt', 'return ' + myName + '.barClick(evt)');
 thm.ref.onmousedown = new Function('evt', 'return ' + myName + '.thumbDown(evt)');
 
 // For IE4+/NS6, create a new function that stops selections being made when dragging.
 var noSel = new Function('if (activeScr) return false');
 if (isIE) document.onselectstart = noSel;
 else if (isDOM) document.onselect = noSel;


 // It's now ready to go, call resize function to set the positions and variables...
 loaded = true;
 layout();
 // Now is a good time to fire the 'onsetup' event, it's ready to load...
 if (onsetup) onsetup();

 // Get the name of the file to be loaded from a URL query string...
 var fileName = ''
 // Get the string after the question mark.
 var URL = location.search.substring(1);
 if (URL)
 {
  // Split it into an array of scroller/filename pairs.
  URL = URL.split('&');
  // Search through that array looking for this scroller name.
  for (var i = 0; i < URL.length; i++)
   if (URL[i].split('=')[0] == myName) fileName = unescape(URL[i].split('=')[1]);
 }

 // If a filename has been detected, load it.
 if (fileName) load(fileName)

 // Else load default file (if we're passed one) or scroll existing content without loading.
 else if (defaultFile) load(defaultFile);
 else fileLoaded();
}}


// ****************************************************
// **
// **     SCROLLER OBJECT CONSTRUCTOR FUNCTIONS 
// **
// ****************************************************

// This takes arrays of data and names and assigns the values to a specified object.
function addProps(obj, data, names, addNull)
{
 for (var i = 0; i < names.length; i++) if(i < data.length || addNull) obj[names[i]] = data[i];
}


// Main object of which instances are created.
function DHTMLScroller()
{
 // Only the first is actually passed to the function, the rest are just added as 'undefined'.
 var names = ['myName', 'bufRef', 'div', 'bar', 'thm', 'loaded', 'timer',
 'divHeight', 'thmHeight', 'barHeight', 'cHeight', 'cWidth', 'dragOffset',
 'onbeforeload', 'onload', 'onscroll', 'onsetup', 'onlayout', 'onthumbdown', 'onthumbup'];
 addProps(this, arguments, names, true);

 // The top clipping position by default is zero -- the top of the file.
 this.cTop = 0;

 // The file(s) currently loading and displayed in the scroller,
 this.loadingFile = '';
 this.loadedFile = '';

 // Scroller history setup -- an array of data and current position.
 this.history = new Array();
 this.histPos = -1;

 // Array of objects to move when the window is resized (e.g. scrollbar, arrows).
 this.divs = new Array();
 
 // Minimum height of scrollbar thumb - defaults to 20, set to something else if you want.
 this.minThmHeight = 20;
 // Padding at the top and bottom -- set these manually if you want.
 this.padTop = 0;
 this.padBot = 0;
 // Whether or not to allow scrolling out of the normal region.
 this.checkBounds = true;

 // Current speed of the scroller, and the steps left to reach that speed.
 this.ySpeed = this.stepsLeft = 0;

 // The 'stickiness' of the scroller, 1 means perfect scrolling, decimals = floating.
 this.stick = 1;
 // Target point to which we scroll, and a timer variable managing sticky scroll.
 this.stickTop = 0;

 // Methods - bound to functions above.
 this.load = scrLoad;
 this.fileLoaded = scrFileLoaded;
 this.go = scrGo;
 this.scrollTo = scrScrollTo;
 this.scrollBy = scrScrollBy;
 this.setScroll = scrSetScroll;
 this.thumbDown = scrThumbDown;
 // The other thumb functions are global, associated with document.onevent.
 // They rely on the 'activeScr' global variable to tell them which scroller is being dragged.
 this.stickScroll = scrStickScroll;
 this.barClick = scrBarClick;
 this.setup = scrSetup;
 this.layout = scrLayout;
}

// The 'ScrDiv' object contains the data structure for the scroller divs.
function ScrDiv()
{
 addProps(this, arguments, ['id','x','y','w','h','par','lyr'], true);
}

// One global variable that points to the scroller currently being dragged.
var activeScr = null;



// *** MOUSE EVENT CONTROL FUNCTIONS ***


// Most of these are passed the relevant 'menu Name' and 'item Number'.
// The 'with (this)' means it uses the properties and functions of the current menu object.
function popOver(mN, iN) { with (this)
{
 // Cancel any pending menu hides from a previous mouseout.
 clearTimeout(hideTimer);
 // Set the 'over' variables to point to this item.
 overM = mN;
 overI = iN;
 // Call the 'onMouseOver' event if it exists, and the item number is 1 or more.
 if (iN && this.onmouseover) onmouseover(mN, iN);


 // Remember what was lit last time, and compute a new hierarchy.
 litOld = litNow;
 litNow = new Array();
 var litM = mN, litI = iN;
 while(1)
 {
  litNow[litM] = litI;
  // If we've reached the top of the hierarchy, exit loop.
  if (litM == 'root') break;
  // Otherwise repeat with this menu's parent.
  litI = menu[litM][0].parentItem;
  litM = menu[litM][0].parentMenu;
 }

 // If the two arrays are the same, return... no use hiding/lighting otherwise.
 var same = true;
 for (var z in menu) if (litNow[z] != litOld[z]) same = false;
 if (same) return;

 // If this is a different menu, clear another pending show.
 clearTimeout(showTimer);



 // Cycle through menu array, lighting and hiding menus as necessary.
 for (thisM in menu) with (menu[thisM][0])
 {
  // Doesn't exist yet? Keep rollin'...
  if (!lyr) continue;

  // The number of this menu's item that is to be lit, undefined if none.
  litI = litNow[thisM];
  oldI = litOld[thisM];

  // If it's lit now and wasn't before, highlight...
  if (litI && (litI != oldI)) changeCol(thisM, litI, true);

  // If another item was lit but isn't now, dim the old item.
  if (oldI && (oldI != litI)) changeCol(thisM, oldI, false);

  // Make sure if it's lit, it's shown, and set the visNow flag.
  if (litI && !visNow && (thisM != 'root'))
  {
   showMenu(thisM);
   visNow = true;
  }

  // If this menu has no items from the current hierarchy in it, and is currently
  // onscreen, call the hide function.
  if (isNaN(litI) && visNow)
  {
   hideMenu(thisM);
   visNow = false;
  }
 }


 // Get target menu to show - if we've got one, position & show it.
 // If this menu is set to show submenus on click, skip this.
 nextMenu = '';
 if ((menu[mN][iN].type == 'sm:') && !menu[mN][0].subsOnClick)
 {
  // The target menu and the layer object of the current menu itself (not this item).
  var targ = menu[mN][iN].href, lyrM = menu[mN][0].lyr;

// EXTRA CODE - Uncomment these lines to enable dynamic create-as-needed menu support,
// where you can create only the root menu on page load and others when you point at them.
// I would recommend using this for single-frame menus only, and changing the "Events"
// section of the code to call pMenu.update(false, 'root') on page load for all browsers
// and disabling "fast" inline creation mode. Bear in mind this won't work in Opera 5/6.

//if (!menu[targ][0].lyr) update(false, targ);
//if (!menu[targ][0].lyr) return;

  // Either show immediately or after a delay if set by passing it to the position and show functions.
  // Set nextMenu to the impending show, so the popOut() function knows when not to cancel it.
  var showStr = 'with ('+myName+') { menu.'+targ+'[0].visNow = true; ' +
   'position("'+targ+'"); showMenu("'+targ+'") }';
  nextMenu = targ;
  if (showDelay) showTimer = setTimeout(showStr, showDelay);
  else eval(showStr);
 }
}}


function popOut(mN, iN) { with (this)
{
 // Sometimes, across frames, overs and outs can get confused.
 // So, return if we're exiting an item we have yet to enter...
 if ((mN != overM) || (iN != overI)) return;

 // Evaluate the onmouseout event, if any.
 if (this.onmouseout) onmouseout(mN, iN);

 var thisI = menu[mN][iN];

 // Stop showing another menu if this item isn't pointing to the same one.
 if (thisI.href != nextMenu)
 {
  clearTimeout(showTimer);
  nextMenu = '';
 }

 // Hide all menus rapidly (if it's a root menu item without a popout) or as specified.
 // Remember that the timeout is cancelled by another instance of the over function.
 // Calling 'over("root", 0)' hides all menus but the root menu, and highlights no items.
 // If hideDelay equals zero the menus are never hidden.
 if (hideDelay)
 {
  var delay = ((mN == 'root') && (thisI.type != 'sm:')) ? 50 : hideDelay;
  hideTimer = setTimeout(myName + '.over("root", 0)', delay);
 }

 // Clear the 'over' variables.
 overM = 'root';
 overI = 0;
}}


function popClick(mN, iN) { with (this)
{
 // Evaluate the onclick event, if any.
 if (this.onclick) onclick(mN, iN);

 var thisI = menu[mN][iN], hideM = true;

 with (thisI) switch (type)
 {
  // Targeting another popout? Either activate show-on-click or skip to the end.
  case 'sm:':
  {
   if (menu[overM][0].subsOnClick)
   {
    menu[href][0].visNow = true;
    position(href);
    showMenu(href);
    hideM = false;
   }
   break;
  }
  // A JavaScript function? Eval() it and break out of switch.
  case 'js:': { eval(href); break }
  // Otherwise, point to the window if nothing else and navigate.
  case '': type = 'window';
  default: if (href) eval(type + '.location.href = "' + href + '"');
 }

 // Hide all menus if we're supposed to.
 if (hideM) over('root', 0);
}}


function popChangeCol(mN, iN, isOver) { with (this.menu[mN][iN])
{
 if (!lyr || !lyr.ref) return;

 // Pick a new background colour, and decide on whether it's an image (contains a period?).
 var col = isOver?overCol:outCol;
 var bgFn = (col.indexOf('.')==-1) ? 'bgColor' : 'bgImage';
 // Then we do it before or after the text/border change due to Netscape bugs.
 if (isNS4) lyr[bgFn](col);

 // Test for CSS text/border style changes, we can skip them if not needed.
 // In Netscape 4, rewrite layer contents if required (causes a little flickering)...
 // Otherwise manipulate the DOM tree for IE/NS6+ (faster than rewriting contents).
 if ((overClass != outClass) || (outBorder != overBorder)) with (lyr)
 {
  if (isNS4) write(this.getHTML(mN, iN, isOver));
  else
  {
   ref.className = (isOver ? overBorder : outBorder);
   var chl = (isDOM ? ref.childNodes : ref.children)
   if (chl) for (var i = 0; i < chl.length; i++) chl[i].className = isOver?overClass:outClass;
  }
 }

 if (!isNS4) lyr[bgFn](col);

 // Alpha filtering activated? Might as well set that then too...
 // Weirdly it has to be done after the border change, another random Mozilla bug...
 if (outAlpha != overAlpha) lyr.alpha(isOver ? overAlpha : outAlpha);
}}


function popPosition(posMN) { with (this)
{
 // Pass a menu name to position, or nothing to position all menus.
 for (mN in menu)
 {
  if (posMN && (posMN != mN)) continue;
  with (menu[mN][0])
  {
   // If the menu hasn't been created or is not set to be visible, loop.
   if (!lyr || !lyr.ref || !visNow) continue;

   // Set up some variables and the initial calculated positions.
   var pM, pI, newX = eval(offX), newY = eval(offY);
   // Find its parent menu references, if it's not the topmost root menu.
   if (mN != 'root')
   {
    pM = menu[parentMenu];
    pI = pM[parentItem].lyr;
    // Having no parent item is a bad thing, especially in cross-frame code.
    if (!pI) continue;
   }

   // Find parent window for correct page object, or this window if not.
   var eP = eval(par);
   var pW = (eP && eP.navigator ? eP : window);

   // Find proper numerical values for the current window position + edges, so menus
   // don't make a beeline for the upper-left corner of the page.
   with (pW.page) var sX=scrollX(), wX=sX+winW(), sY=scrollY(), wY=winH()+sY;
   wX = isNaN(wX)||!wX ? 9999 : wX;
   wY = isNaN(wY)||!wY ? 9999 : wY;

   // Relatively positioned submenus? Add parent menu/item position & check screen edges.
   if (pM && typeof(offX)=='number') newX = Math.max(sX,
    Math.min(newX+pM[0].lyr.x()+pI.x(), wX-menuW-(isIE?5:20)));
   if (pM && typeof(offY)=='number') newY = Math.max(sY,
    Math.min(newY+pM[0].lyr.y()+pI.y(), wY-menuH-(isIE?5:20)));

   // Assign the final calculated positions.
   lyr.x(newX);
   lyr.y(newY);
  }
 }
}}




// ****************************************************
// **  
// **        MENU OBJECT CONSTRUCTION FUNCTIONS     ***
// **
// ****************************************************

// This takes arrays of data and names and assigns the values to a specified object.
function addProps(obj, data, names, addNull)
{
 for (var i = 0; i < names.length; i++) if(i < data.length || addNull) obj[names[i]] = data[i];
}

function ItemStyle()
{
 // Like the other constructors, this passes a list of property names that correspond to the list
 // of arguments.
 var names = ['len', 'spacing', 'popInd', 'popPos', 'pad', 'outCol', 'overCol', 'outClass',
  'overClass', 'outBorder', 'overBorder', 'outAlpha', 'overAlpha', 'normCursor', 'nullCursor'];
 addProps(this, arguments, names, true);
}

function popStartMenu(mName) { with (this)
{
 // Create a new array within the menu object if none exists already, and a new menu object within.
 if (!menu[mName]) { menu[mName] = new Array(); menu[mName][0] = new Object(); }

 // Clean out existing items in this menu in case of a menu update.
 // actMenu is a reference to this menu for addItem() function later, while the local variable
 // aM is a quick reference to the current menu descriptor -- array index 0, 1+ are items.
 actMenu = menu[mName];
 aM = actMenu[0];
 actMenu.length = 1;

 // Not all of these are actually passed to the constructor -- the last few are null.
 // N.B: I pass 'isVert' twice so the first parameter (the menu name) is overwritten & ignored.
 var names = ['isVert', 'isVert', 'offX','offY', 'width', 'itemSty', 'par',
  'parentMenu', 'parentItem', 'visNow', 'oncreate', 'subsOnClick'];
 addProps(aM, arguments, names, true);

 // extraHTML is a string added to menu layers for things like dropshadows, backgrounds etc.
 aM.extraHTML = '';
 // Set the menu dimensions to zero initially. Also these are used to position items.
 aM.menuW = aM.menuH = 0;

 // Reuse old layers if we can, no use creating new ones every time the menus refresh.
 if (!aM.lyr) aM.lyr = null;
 
 // Assign a default oncreate event to the root menu to show it.
 if (mName == 'root') menu.root[0].oncreate = new Function('this.visNow=true; ' +
  myName + '.position("root"); this.lyr.vis("visible")');
}}


function popAddItem() { with (this) with (actMenu[0])
{
 // 'with' the current menu object and active menu descriptor object from startMenu().

 // Add these properties onto a new 'active Item' at the end of the active menu.
 var aI = actMenu[actMenu.length] = new Object();

 // Add function parameters to object. Again, the last few are undefined, set later.
 var names = ['text', 'href', 'type', 'itemSty', 'len', 'spacing', 'popInd', 'popPos',
  'pad', 'outCol', 'overCol', 'outClass', 'overClass', 'outBorder', 'overBorder',
  'outAlpha', 'overAlpha', 'normCursor', 'nullCursor',
  'iX', 'iY', 'iW', 'iH', 'lyr'];
 addProps(aI, arguments, names, true);

 // Find an applicable itemSty -- either passed to this item or the menu[0] object.
 var iSty = (arguments[3] ? arguments[3] : actMenu[0].itemSty);
 // Loop through its properties, add them if they don't already exist (overridden e.g. length).
 for (prop in iSty) if (aI[prop]+'' == 'undefined') aI[prop] = iSty[prop];

 // In NS4, since borders are assigned to the contents rather than the layer, increase padding.
 if (aI.outBorder)
 {
  if (isNS4) aI.pad++;
 }

 // The actual dimensions of the items, store here as properties so they can be accessed later.
 aI.iW = (isVert ? width : aI.len);
 aI.iH = (isVert ? aI.len : width);

 // The spacing of the previous menu item in this menu, if relevant.
 var lastGap = (actMenu.length > 2) ? actMenu[actMenu.length - 2].spacing : 0;

 // 'spc' is the amount we subtract from this item's position so borders overlap a little.
 // Of course we don't do it to the first item.
 var spc = ((actMenu.length > 2) && aI.outBorder ? 1 : 0);

 // We position this item at the end of the current menu's dimensions,
 // and then increase the menu dimensions by the size of this item.
 if (isVert)
 {
  menuH += lastGap - spc;
  aI.iX = 0; aI.iY = menuH;
  menuW = width; menuH += aI.iH;
 }
 else
 {
  menuW += lastGap - spc;
  aI.iX = menuW; aI.iY = 0;
  menuW += aI.iW; menuH = width;
 }

 // When we are running in proper 'CSS1Compat' mode, borders affect widths differently, so we
 // subtract some pixels here to go with the old 'loose' specification. Swap this around if you
 // want your documents to conform with the new specs.
 if (aI.outBorder && CSSmode)
 {
  aI.iW -= 2;
  aI.iH -= 2;
 }
}}



// *** MAIN MENU CREATION/UPDATE FUNCTIONS ***


// Returns the inner HTML of an item, used for menu generation, and highlights in NS4.
function popGetHTML(mN, iN, isOver) { with (this)
{
 var itemStr = '';
 with (menu[mN][iN])
 {
  var textClass = (isOver ? overClass : outClass);

  // If we're supposed to add a popout indicator, add it before text so it appears below in NS4.
  if ((type == 'sm:') && popInd)
  {
   if (isNS4) itemStr += '<layer class="' + textClass + '" left="'+ ((popPos+iW)%iW) +
    '" top="' + pad + '" height="' + (iH-2*pad) + '">' + popInd + '</layer>';
   else itemStr += '<div class="' + textClass + '" style="position: absolute; left: ' +
    ((popPos+iW)%iW) + 'px; top: ' + pad + 'px; height: ' + (iH-2*pad) + 'px">' + popInd + '</div>';
  }

  // For NS4, if a border is assigned, add a spacer to push border out to layer edges.
  // Add a link both to generate an onClick event and to stop the ugly I-beam text cursor appearing.
  if (isNS4) itemStr += (outBorder ? '<span class="' + (isOver?overBorder:outBorder) +
   '"><spacer type="block" width="' + (iW-8) + '" height="' + (iH-8) + '"></span>' : '') +
   '<layer left="' + pad + '" top="' + pad + '" width="' + (iW-2*pad) + '" height="' +
   (iH-2*pad) + '"><a class="' + textClass + '" href="#" ' +
   'onClick="return false" onMouseOver="status=\'\'; ' + myName + '.over(\'' + mN + '\',' +
   iN + '); return true">' + text + '</a></layer>';

  // IE4+/NS6 is an awful lot easier to work with sometimes.
  else itemStr += '<div class="' + textClass + '" style="position: absolute; left: ' + pad +
   'px; top: ' + pad + 'px; width: ' + (iW-2*pad) + 'px; height: ' + (iH-2*pad) + 'px">' +
   text + '</div>';
 }
 return itemStr;
}}


// The main menu creation/update routine. The first parameter is 'true' if you want the script
// to use document.write() to create the menus. Second parameter is optionally the name of one
// menu only to update rather then create all menus.
function popUpdate(docWrite, upMN) { with (this)
{
 // 'isDyn' (set at the very top of the script) signifies a DHTML-capable browser.
 if (!isDyn) return;

 // Loop through menus, using properties of menu description object (array index 0)...
 for (mN in menu) with (menu[mN][0])
 {
  // If we're updating one specific menu, only run the code for that.
  if (upMN && (upMN != mN)) continue;

  // Variable for holding HTML for items.
  var str = '';

  // Remember, items start from 1 in the array (0 is menu object itself, above).
  // Also use properties of each item nested in the other with() for construction.
  for (var iN = 1; iN < menu[mN].length; iN++) with (menu[mN][iN])
  {
   // An ID for divs/layers contained within the menu.
   var itemID = myName + '_' + mN + '_' + iN;

   // Now is a good time to assign another menu's parent to this if we've got a popout item.
   var targM = menu[href];
   if (targM && (type == 'sm:'))
   {
    targM[0].parentMenu = mN;
    targM[0].parentItem = iN;
   }

   // Have we been given a background image? It'll have a period in its name if so...
   var isImg = (outCol.indexOf('.') != -1) ? true : false;

   // NS6 uses a different cursor name for the 'hand' cursor than IE.
   if (!isIE && normCursor=='hand') normCursor = 'pointer';

   // Create a div or layer text string with appropriate styles/properties.
   // OK, OK, I know this is a little obtuse in syntax, but it's small...
   // At the end we set the alpha transparency (if specified) and the mouse cursor.
   if (isDOM || isIE4)
   {
    str += '<div id="' + itemID + '" ' + (outBorder ? 'class="'+outBorder+'" ' : '') +
     'style="position: absolute; left: ' + iX + 'px; top: ' + iY + 'px; width: ' + iW +
     'px; height: ' + iH + 'px; z-index: 1000; background: ' + (isImg?'url('+outCol+')':outCol) +
     ((typeof(outAlpha)=='number') ? '; filter: alpha(opacity='+ outAlpha + '); -moz-opacity: ' +
      (outAlpha/100) : '') +
     '; cursor: ' + ((type!='sm:' && href) ? normCursor : nullCursor) + '" ';
   }
   else if (isNS4)
   {
    // NS4's borders must be assigned within the layer so they stay when content is replaced.
    str += '<layer id="' + itemID + '" left="' + iX + '" top="' + iY + '" width="' +
     iW + '" height="' + iH + '" z-index="1000" ' +
     (outCol ? (isImg ? 'background="' : 'bgcolor="') + outCol + '" ' : '');
   }

   // Add mouseover and click handlers, contents, and finish div/layer.
   var evtMN = '(\'' + mN + '\',' + iN + ')"';
   str += 'onMouseOver="' + myName + '.over' + evtMN +
     ' onMouseOut="' + myName + '.out' + evtMN +
     ' onClick="' + myName + '.click' + evtMN + '>' +
     getHTML(mN, iN, false) + (isNS4 ? '</layer>' : '</div>');

  // End loop through items and with(menu[mN][iN]).
  }


  // The parent frame for this menu, if any.
  var eP = eval(par);


  // Do not ask me why Opera makes me set a timeout now rather than later, or in fact have
  // to set a timeout at all to get references to the divs we are about to create.
  // But, it makes the cross-frame version of the script actually work, so there's a benefit.
  setTimeout(myName + '.setupRef(' + docWrite + ', "' + mN + '")', 50);

  // Initial menu visibility, hidden unless tweaked otherwise.
  var mVis = visNow ? 'visible' : 'hidden';

  // For Fast creation mode (default for IE, NS6, Opera), write the menus to the document now.
  // I'm adding a bit to the widths for safety as borders are different across browsers.
  if (docWrite)
  {
   // Find the right target frame.
   var targFr = (eP && eP.navigator ? eP : window);
   targFr.document.write('<div id="' + myName + '_' + mN + '_Div" style="position: absolute; ' +
    'visibility: ' + mVis + '; left: 0px; top: 0px; width: ' + (menuW+2) + 'px; height: ' +
    (menuH+2) + 'px; z-index: 1000">' + str + extraHTML + '</div>');
  }
  else
  {
   // Create a new layer/div object dynamically using my setLyr() function above.
   // If we've got a layer created already, there's no use creating another!.
   // In IE4, we must shrink the menus to stop them sizing to the full body size -- thanks
   // to Jeff Blum and Paul Maden for debugging this for me :). If the layer has been created,
   // we've got to set a timeout to fix up IE4 again for some obscure reason.
   if (!lyr || !lyr.ref) lyr = setLyr(mVis, menuW, eP);
   else if (isIE4) setTimeout(myName + '.menu.' + mN + '[0].lyr.sty.width=' + (menuW+2), 50);

   // Give it a high Z-index, and write its content.
   with (lyr) { sty.zIndex = 1000; write(str + extraHTML) }
  }

 // End loop through menus and with (menu[mN][0]).
 }
}}


function popSetupRef(docWrite, mN) { with (this) with (menu[mN][0])
{
 // Get a reference to a div, only needed for Fast creation mode.
 if (docWrite || !lyr || !lyr.ref) lyr = getLyr(myName + '_' + mN + '_Div', eval(par));

 // Loop through menu items again to set up individual references.
 for (var i = 1; i < menu[mN].length; i++)
  menu[mN][i].lyr = getLyr(myName + '_' + mN + '_' + i, (isNS4?lyr.ref:eval(par)));

 // Call the 'oncreate' method of this menu if it exists (e.g. to show root menu).
 if (menu[mN][0].oncreate) oncreate();
}}



// *** POPUP MENU MAIN OBJECT CONSTRUCTOR ***

function PopupMenu(myName)
{
 // These are the properties of any PopupMenu objects you create.
 this.myName = myName;

 // Manage what gets lit and shown when.
 this.showTimer = 0;
 this.hideTimer = 0;
 this.showDelay = 0;
 this.hideDelay = 500;
 this.showMenu = '';

 // 'menu': the main data store, contains subarrays for each menu e.g. pMenu.menu['root'][];
 this.menu =  new Array();
 // litNow and litOld arrays control what items get lit in the hierarchy.
 this.litNow = new Array();
 this.litOld = new Array();

 // The item the mouse is currently over. Used by click processor to help NS4.
 this.overM = 'root';
 this.overI = 0;

 // The active menu, to which addItem() will assign its results.
 this.actMenu = null;

 // Functions to create and manage the menu.
 this.over = popOver;
 this.out = popOut;
 this.changeCol = popChangeCol;
 this.position = popPosition;
 this.click = popClick;
 this.startMenu = popStartMenu;
 this.addItem = popAddItem;
 this.getHTML = popGetHTML;
 this.update = popUpdate;
 this.setupRef = popSetupRef;

 // Default show and hide functions, overridden in the example script by the clipping routine.
 this.showMenu = new Function('mName', 'this.menu[mName][0].lyr.vis("visible")');
 this.hideMenu = new Function('mName', 'this.menu[mName][0].lyr.vis("hidden")');
}





// ******************************************************
// **      SCROLLER OBJECT SETUP -- START EDITING HERE, 
// **      keep reading until bottom of file 
// **
// ******************************************************

// First, you have to create one or more scroller objects, syntax:
// var name = new DHTMLScroller('name');

var mainDiv = new DHTMLScroller('mainDiv');


// Then, working with its properties, we tell it the names of the relevant divs below we want it
// to use. This is accomplished by the 'divs' array, to which we add new items like so:
//
// divs[number] = new ScrDiv('id of div below', 'x', 'y', 'width', 'height', 'parent');
//
// As you can see, the second through to fourth parameters are the positions and dimensions of the
// divs, declared here rather than as properties to the divs below. They are strings containing
// either plain numbers, or formulae using global variables or functions to calculate
// special positions, e.g. centring or sizing with the window. Pass an empty string '' to tell
// the script not to set that particular parameter.
//   The 'parent' parameter is optional. Use it if you're nesting the scroller divs within other
// divs, by passing a string that when evaluated, returns a reference to the parent layer of the
// div, e.g. 'getRef("containerDiv")', which is similar to 'document.all.containerDiv'. If you're
// just editing this template script, don't bother about it.
//   The first three divs are special -- divs[0] is the scroller area itself into which files are
// loaded, divs[1] = the scrollbar background area itself, and divs[2] = the scrollbar thumb (the
// draggable bit). Anything after that is positioned and sized by the scroller engine on window
// resize but does not have any special properties.

with (mainDiv)
{
 // This example uses my page object, included with this script. It provides two functions,
 // page.winW() and page.winH(), which return the current width and height of the window.
 // These positioning functions are useful, as although you can't create a scroller within a table
 // cell, you can set it to hover over the cell -- be inventive with the formulae you use!
 
 // This scrolls a div with an ID 'mainDivContent', which is positioned at (x=50, y=50) and is
 // most of the window wide and high. If you want to centre the div, try something like:
 // divs[0] = new ScrDiv('mainDivContent', 'page.winW()/2 - 300', 'page.winH()/2 - 200', '600', '400');
 divs[0] = new ScrDiv('mainDivContent', 'page.winW()/5', 'page.winH()/3.5', 'page.winW()-(page.winW()/5)-30', 'page.winH()-(page.winH()/3.5)');
 // Our scrollbar itself is positioned towards the right edge of the window and takes up most
 // of the page height.
 divs[1] = new ScrDiv('mainDivBar', 'page.winW() - 20', 'page.winH()/3.5', '15', 'page.winH()-(page.winH()/3.5)');
 // Don't pass Y or Height thumb settings, these are set automatically when it's dragged.
 divs[2] = new ScrDiv('mainDivThumb', 'page.winW() - 19', '', '13', '');

 // These are the up and down arrow divs, positioned on resize accordingly...
 divs[3] = new ScrDiv('mainDivUpArrows', 'page.winW() - 95', '50', '', '');
 divs[4] = new ScrDiv('mainDivDownArrows', 'page.winW() - 95', 'page.winH() - 85', '', '');
 // Add divs[5] onwards the same way, to position/show any other DIVs on load and resize.


 // Once you've done that, here's some of extra settings to further customise the script.
 // Uncomment them and tweak the numbers to see if any are useful.
 //
 // You can set scroller padding at the top and bottom of loaded files like this:
 //padTop = 100;
 //padBot = 50;
 // If your web host sticks banner ads at the top of every page you load, you could always
 // declare 'padTop' to be slightly negative... don't say you heard it from me... :)
 //
 // Perhaps try this... set to a decimal between 0 and 1 for 'sticky' scrolling mode.
 // You might was to set small values on the padding values above if you do this.
 //stick = 0.25;
 //
 // Another useful optional property is minimum thumb height. The default is:
 //minThmHeight = 20;
 //
 // The page object mentioned above can have minimum sizes set. By default, the winW() and winH()
 // functions just return the window area, but you can set minima like so:
 page.minW = 400;
 page.minH = 300;
 // I highly recommend doing this otherwise interesting crashes can result when the window sizes
 // too small and objects start to overlap and get negative heights etc.


 // Next we can assign scroller events. They are 'onbeforeload', 'onload', 'onscroll', 'onsetup',
 // 'onlayout', 'onthumbdown' and 'onthumbup'. The load events fire whenever a file is loaded into
 // the scroller, and the thumb events whenever you start or stop dragging the thumb. The scroll
 // event fires when you scroll or drag, the setup event fires when the scroller is initialised
 // but hasn't loaded its first file, and the layout event fires whenever the layout function is
 // called (on load and resize). By default, the only one you need is a function to show the
 // scroller once it's finished loading a file, and hide the 'loading' message:
 
 onload = loadFunction; 
 
 // I've also set the onlayout event to hide and show the scrollbar thumb as needed.
 onlayout = thumbVis;
}

// Here's the example onload function, which gets called every time the scroller loads a file
// and shows/hides the appropriate divs. Note it is a property of the scroller and hence we use
// 'with (this)' to get at its other properties. You can just leave this alone, or you can dig
// into the source code and make other functions to show/hide loading messages, light up the
// scroller thumb as it is being dragged, use the onload to build a browsable history etc...

function loadFunction() { with (this)
{
 // Hide loading message...
 getSty('loadMessage').visibility = 'hidden';
 // And show the rest of the divs apart from the scrollbar thumb (which is divs[2]).
 // You could modify this function to do the reverse on the 'onbeforeload' event perhaps...?
 for (var i = 0; i < divs.length; i++) if (i != 2) divs[i].lyr.vis('visible');
 // Now call the layout function (thumbVis) below to show/hide thumb depending on content size.
 onlayout();
}}

function thumbVis() { with (this)
{ 
 // Only show the thumb when the actual content height exceeds the clipping area.
 // If you want to, hide divs[3] onwards to hide the scrollbar and arrows as well.
 divs[1].lyr.vis(div.h() > cHeight ? 'visible' : 'hidden');
 divs[2].lyr.vis(div.h() > cHeight ? 'visible' : 'hidden');
 divs[3].lyr.vis(div.h() > cHeight ? 'visible' : 'hidden');
}}




// Capture events -- make sure you combine this with any other scripts which also capture these
// events e.g. Popup Menus. You call the .setup() function onload with the name of a default file,
// in this case its readme, but you'll probably want something like "home.html". Alternatively,
// you can pass a blank string "" to scroll the content already in the div, but you must manually
// specify a width on the div below via style="width: xyz" for Netscape 4.
// Note we also call a small 'bug check' function to stop Netscape 4 dying when you resize the
// window. Use this one in preference to the one in my Popup Menu script if you're combining them.

// window.onevent=function(){....} is essentially the same as <BODY ONEVENT="....">
// Make sure you don't assign events either way later in your page, otherwise these get overridden.



window.onload = function()
  {
   mainDiv.setup('bienvenue.htm');
   pMenu.update();
  //anotherMenu.update();
  }

var nsWinW = window.innerWidth, nsWinH = window.innerHeight, popOldOR = window.onresize;
window.onresize = function()
{
 ns4BugCheck();
 mainDiv.layout();
 if (popOldOR) popOldOR();
  if (isNS4 && (nsWinW!=innerWidth || nsWinH!=innerHeight)) history.go(0);
  pMenu.position();
  //anotherMenu.position();
}

window.onscroll = function()
{
 pMenu.position();
 //anotherMenu.position();
}

// Capture mouse movement for dragging. Combine this with other scripts if needed!
// Make sure to capture and route these events for NS4 as we should.
if (isNS4) document.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);

if (isNS4)
{
 document.captureEvents(Event.CLICK);
 document.onclick = function(evt)
 {
  with (pMenu) if (overI) click(overM, overI);
  //with (anotherMenu) if (overI) click(overM, overI);
  return document.routeEvent(evt);
 }
}

document.onmousemove = function(evt)
{
 var ret = scrThumbMove(evt);
 return (ret ? (isNS4?document.routeEvent(evt):true) : false);
}


document.onmouseup = function(evt)
{
 scrThumbUp(evt);
 if (isNS4) return document.routeEvent(evt);
}


// Activate the window.onscroll() event in non-Microsoft browsers.
if (!isIE || isOp)
{
 var nsPX=pageXOffset, nsPY=pageYOffset;
 setInterval('if (nsPX!=pageXOffset || nsPY!=pageYOffset) ' +
 '{ nsPX=pageXOffset; nsPY=pageYOffset; window.onscroll() }', 50);
}


// Check for NS4 resize, reload if that's the case and pass current loaded file as query.
var nsWinW = window.innerWidth, nsWinH = window.innerHeight;
function ns4BugCheck()
{
 if (isNS4 && (nsWinW!=innerWidth || nsWinH!=innerHeight))
 {
  // NS4 cannot handle resizes, so reload -- but use URL query mechanism to keep the loaded file.
  var fileName = location.href;

  // Trim existing URL query string out of the current location, if any.
  if (fileName.indexOf('?') != -1) fileName = fileName.substring(0, fileName.indexOf('?'));
  // If you've got multiple scrollers, add the URLs of each and separate with '&' signs.
  location.href = fileName + '?mainDiv=' + mainDiv.loadedFile;
 }
}






// *** SCROLLING BY KEYPRESS HANDLER - delete this if you want ***

// You must 'hardcode' a scroller name here, as only one can respond to keys.
function scrKeyDown(evt) { with (mainDiv)
{
 if (!loaded) return;

 // Find the correct event object and property.
 var evt = evt?evt:window.event;
 var key = evt.keyCode?evt.keyCode:(evt.charCode?evt.charCode:evt.which);

 //alert(key);
 // Depending on key press (capital || lowercase || function key), scroll div.
 // Uncomment the above 'alert(key)' line to figure out your own keycodes.
 if (key==84 || key==116 || key==36) scrollTo(0);         // 'T', 't' or 'Home'
 if (key==83 || key==115 || key==33) scrollBy(0-cHeight); // 'S', 's' or 'PgUp'
 if (key==65 || key==97  || key==38) scrollBy(-10);       // 'A', 'a' or 'Up'
 if (key==90 || key==122 || key==40) scrollBy(10);        // 'Z', 'z' or 'Down'
 if (key==88 || key==120 || key==34) scrollBy(cHeight);   // 'X', 'x' or 'PgDn'
 if (key==66 || key==98  || key==35) scrollTo(divHeight); // 'B', 'b' or 'End'
}}

// Capture key presses.
if (isIE) document.onkeydown = scrKeyDown;
else
{
 if (isNS4) document.captureEvents(Event.KEYPRESS);
 document.onkeypress = scrKeyDown;
}



// *** SCROLLING BY MOUSEWHEEL IN IE6+ *** delete if this isn't needed.

if (isIE) document.onmousewheel = function()
{
 // Just call the scrollBy methods of the appropriate scrollers.
 // You may wish to adjust the scrolling amount, just change the number.
 mainDiv.scrollBy(event.wheelDelta / -3);
 // Disable scrolling in the document, as we're handling this event.
 return false;
}




// ******************************************************
// **
// **   POPUP MENU SECTION EDITING
// **   START EDITING HERE, READ THIS SECTION CAREFULLY!
// **
// ******************************************************
//
//
// Before you start, make sure you've read the "Conditions Of Use" in this HTML document
// or on my site. Anyway, this menu script is split up into several sections. They are:
//
// (1) ITEMSTYLES - These define the colour and size of menu items. Required to run.
// (2) MENU DATA - These specify the text and links in the menu. Required to run.
// (3) MENU EFFECTS - Want to remove, or change borders, shadows and animation? Edit them here,
//     or you can delete this section entirely to remove extra effects.
// (4) EVENTS - Activate the menu(s), and choose creation mode (Dynamic / Fast) etc. I recommend
//     you read it, but you only really need to change it if you want multiple menus on one page,
//     or are trying to combine this with other JavaScripts. Required to run.
// (5) OPTIONAL CODE - Extra features like adding clicking to 'sm:' items or status messages on
//     mouseover. Animation/effects functions are here too. You can skip or delete this entirely.
// (6) FRAMESET README - If you're using a frameset, read this, it explains what you need to do.



// *** (1) ITEMSTYLES ***

var defOver = '#bcc5d6', defBack = '#ebeef3', deflength = 170; defHaut = 20 ;



var hBar = new ItemStyle(deflength, 1, '', 0, 0, defOver, defOver, 'highText', 'highText', '', '',
 null, null, 'hand', 'default');

// The 'sub Menu' items: 22px long, 0px spacing, a 'greater than' sign for a popout indicator
// (you may wish to use an image tag?), the popout indicator is positioned 15px from the right
// edge of the item, items have 3px padding, some colours, it uses 'lowText' as the dimmed text
// class but 'highText' when it is moused over, and 'itemBorder' as the border stylesheet class.
// No opacity is used, and they have the same cursors as the above ItemStyle.

var subM = new ItemStyle(defHaut, 0, '&gt;', -15, 3, defBack, defOver, 'lowText', 'highText',
 '', '', null, null, 'hand', 'default');

// 'subBlank' is similar, but has an 'off' border the same colour as its background so it
// appears borderless when dim, and 1px spacing between items to show the hover border.

var subBlank = new ItemStyle(defHaut, 1, '&gt;', -15, 3, defBack, defOver, 'lowText', 'highText',
 '', '', null, null, 'hand', 'default');

// The purplish 'button' style also has 1px spacing to show up the fancy border, and it has
// different colours/text and less padding. They also have translucency set -- these items
// are 80% opaque when dim and 95% when highlighted. It uses the 'crosshair' cursor for items.

var button = new ItemStyle(defHaut, 1, '&gt;', -15, 2, defBack, defOver, 'buttonText', 'buttonHover',
 'buttonBorder', 'buttonBorderOver', 80, 95, 'crosshair', 'default');






// *** (2) MENU DATA ***
//



// A PopupMenu() object must be passed its own name so it can reference itself when the menu
// is active. We also use a 'with' block to work with its properties and functions below.
var pMenu = new PopupMenu('pMenu');
with (pMenu)
{

// *** MOVE OR CENTRE THE MENU HERE ***


startMenu('root', false, 0, 'page.winH()/5', defHaut, hBar);

// The text is a space then 'File', and this item pops out the 'mFile' submenu when moused over
// as we've set 'sm:' as the action type. If you want to assign a click action (e.g. navigating to
// a file) to one of these 'sm:' items, see the 'Optional Code' section below.
addItem(' ', 'blanc', 'sm:');
addItem('Entreprise', 'entreprise', 'sm:');
addItem('Produits et Services', 'quebec', 'sm:');
addItem("International", 'intl', 'sm:');
addItem('Support', 'support', 'sm:');
addItem(' ', 'blanc', 'sm:');

// Next is an example of a Javascript function embedded in the menu, to open a new window...
// Also, note the extra optional 4th and 5th parameters -- this menu item is 80px long,
// rather than the default length from the ItemStyle.
// addItem('&nbsp; Support', 'window.open("http://www.twinhelix.com")', 'js:', hBar, 80);


startMenu('blanc', true, 0, defHaut, deflength, subM);


// This is a vertical menu positioned 0px across and defHautpx down from its trigger, and is deflengthpx wide.
startMenu('entreprise', true, 0, defHaut, deflength, subM);

// The URLs are set to # here, be sure to replace them with your path/file names or JS functions!
// Also note how all the types are '', indicating these links open in the current frame.
addItem('Profil corporatif', 'mainDiv.load("profil.htm")', 'js:');
addItem('Salle de presse', 'mainDiv.load("presse.htm")', 'js:');
addItem('Liste d\'envoi', 'window.open("http://www.infoserv.d2g.com/listecourriel/addliste.php")', 'js:');
addItem('Carrière', 'mainDiv.load("carrieres.htm")', 'js:');
addItem('Contacts', 'mainDiv.load("contacts.htm")', 'js:');


startMenu('quebec', true, 0, defHaut, deflength, subM);
// addItem('Matériel informatique', 'mainDiv.load("materielinfo.htm")', 'js:');
addItem('Gestion de parcs', 'mainDiv.load("gestionparcs.htm")', 'js:');
// addItem('Borne interactive', 'mainDiv.load("borne.htm")', 'js:');
// addItem('Mesures de secours', 'mainDiv.load("mesures_secours.htm")', 'js:');
// addItem('Câblage et fibre optique', 'mainDiv.load("cablage.htm")', 'js:');
// addItem("Solutions d'impression", 'mainDiv.load("impression.htm")', 'js:');
addItem("Service d'audit", 'mainDiv.load("audit.htm")', 'js:');
// addItem('Solutions de sécurité', 'mainDiv.load("securite.htm")', 'js:');
// addItem('Formation en entreprise', 'mainDiv.load("formation.htm")', 'js:');


startMenu('intl', true, 0, defHaut, deflength, subM);
addItem('Profil', 'mainDiv.load("intl_profil.htm")', 'js:');
addItem('Notre Mission', 'mainDiv.load("intl_mission.htm")', 'js:');
addItem("Nos Services", 'mainDiv.load("intl_services.htm")', 'js:');
addItem('Partenaires', 'mainDiv.load("intl_partenaires.htm")', 'js:');
addItem('Réalisations', 'mainDiv.load("intl_realisations.htm")', 'js:');


startMenu('support', true, 0, defHaut, deflength, subM);
// addItem('Appels de service en ligne', 'window.open("http://205.205.40.244/intranet/as")', 'js:');
addItem('Foire aux Questions', 'mainDiv.load("faq.htm")', 'js:');
addItem('Étapes de diagnostique', 'mainDiv.load("diag.htm")', 'js:');
addItem('Contactez-nous', 'mainDiv.load("contactsupport.htm")', 'js:');
addItem('Support à distance', 'mainDiv.load("epgclient.exe")', 'js:');


}


// You can create another menu object here if you want multiple menus on a page.
// Every menu object MUST have a menu named 'root' in it, as that's always visible.
// You can name the other menus in it anything you want.

//var anotherMenu = new PopupMenu('anotherMenu');
//with (anotherMenu)
//{
// startMenu('root', .....);
// ... make menus here ...
//}






// *** (5) OPTIONAL CODE ***   DELETE IF YOU'RE NOT USING THESE!


// MOUSE EVENTS:
//
// If you want, you can assign functions to handle mouse events like mouse over/out/click.
// You'll want to use these for assigning click actions to 'sm:' items or status messages etc.
// 'with (this)' means use the properties of the menu object, and it's passed the current
// menu name (mN) and item number (iN) you can use to calculate the active item.
// To uncomment and activate, delete the /* and */ at the start and end.

/*
pMenu.onclick = function(mN, iN) { with (this)
{
 // Do actions depending on the item that the mouse was over at the time of the click.
 // You may with to use nested IFs or 'switch' statements etc. if you're familiar with JS.

 if (mN == 'root')
 {
  if (iN == 1) status = 'Congratulations, you\'ve mastered clicking!';
  // Click on second item in root menu will navigate to 'edit.html'. Copy and paste this for
  // each menu item to add click actions to 'sm:' items...
  if (iN == 2) location.href = 'edit.html';
  if (iN == 3) location.href = 'help.html';
 }
}}

// Set the status message to the URL if the 'action type' is nothing, and clear on mouseout.
pMenu.onmouseover = function(mN, iN) { with (this)
{
 // By now, you either have my JS Object Browser script from my site or you need it... try
 // embedding in an IFrame and typing 'pMenu' into its Go To field to see the menu internals.
 with (menu[mN][iN]) if (!type) status = href;
}}
pMenu.onmouseout = function() { status = '' }
*/





