i=0; oldId = "1"; function restore(id) { if(oldId != id) { //eval("cat"+id).src = "img_fr/cat_"+id+"_off.gif"; MM_swapImage('cat'+id, '', 'img_fr/cat_'+id+'_off.gif', 1); } } function swap(id) { if(oldId != id) { //eval("cat"+id).src = "img_fr/cat_"+id+"_on.gif"; MM_swapImage('cat'+id, '', 'img_fr/cat_'+id+'_on.gif', 1); } } function changeCat(id) { if(i==0) { mainDiv.setup(''); i=1; } mainDiv.load('inc.menu.cat.php?lg=fr&cat='+id+'&film=1016185600&'); for(i=1;i<=4;i++) { if(i == id) { MM_swapImage('cat'+id, '', 'img_fr/cat_'+id+'_on.gif', 1); } else { MM_swapImage('cat'+i , '', 'img_fr/cat_'+i+'_off.gif', 1); } } oldId = id; } function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); } MM_reloadPage(true); function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i divHeight) amount = divHeight - cBot; if ((cTop + amount) < 0) amount = 0 - cTop; // Adjust clipping values & move div up/down... 'scrolling' div. cTop += amount; cBot += amount; if (isDOM || isIE4) divSty.clip = 'rect(' + cTop + 'px ' + cWidth + 'px ' + cBot + 'px ' + 0 + 'px)'; else if (isNS4) { // NS4 bug fix, seems to be required, as sometimes these get undefined... why? // I think it's because one onMouseMove gets called before another finishes, and somehow // NS4 must lose track of its variables. if (isNaN(cTop) || isNaN(cBot) || isNaN(amount)) layout(); // Order of adjustment matters, cannot overlap opposing clips. if (cBot < divSty.clip.top) divSty.clip.top = cTop; divSty.clip.bottom = cBot; divSty.clip.top = cTop; } divSty.top = eval(divs[0][2]) - cTop; // 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 * ((cBot - cTop) / divHeight)); // Minimum and maximum heights for thumb... if (thmHeight < minThmHeight) thmHeight = minThmHeight; if (thmHeight > barHeight) thmHeight = barHeight; if (isDOM || isIE4) thmSty.height = thmHeight; else if (isNS4) thmSty.clip.height = thmHeight; // Adjust scrollbar thumb position only if we're not already dragging it. if (activeScr) return; // What fraction is the div of its total scrolling range? 0=top, 1=bottom. fracDivDown = (cTop / (divHeight - (cBot - cTop))); // Now, multiply that by the available space to move and assign its top. thmSty.top = parseInt(barSty.top) + fracDivDown * (barHeight - thmHeight); // If we're looping, set a timeout to scroll by amount again. if (loop) setTimeout(myName + '.scrollBy(' + amount + ')', loop); }} // *** SCROLL THUMB DRAGGING EVENT HANDLERS *** function scrThumbDown(evt) { // Set a variable pointing to the active scroller - this scroller object. activeScr = this; // Offset of mouse cursor within the scrollbar by browser, first IE then NS 6 then 4... if (document.all) scrOffset = event.offsetY; else scrOffset = evt.layerY; return false; } function scrThumbMove(evt) { if (isNS4) document.routeEvent(evt); // Either return true if no scroller is being dragged (so selections work), or... if (!activeScr) return true; else { with (activeScr) { // Workaround for error in NS... if (isNaN(cTop) || isNaN(cBot)) divLayout(); // If it's not scrollable, quit. if ((cBot > divHeight) || (thmHeight == barHeight)) return; if (document.all) newTop = document.body.scrollTop + event.clientY - scrOffset; else newTop = evt.pageY - scrOffset; // Test if the thumb is out of range, if so, bring it back, then assign its position. var barTop = parseInt(barSty.top); if (newTop < barTop) newTop = barTop; if (newTop + thmHeight > (barTop + barHeight)) newTop = (barTop + barHeight) - thmHeight; thmSty.top = newTop; // Fractions of total range moved by the div and scrollbar... fracDivDown = cTop / (divHeight - (cBot - cTop)); fracBarDown = (newTop - barTop) / (barHeight - thmHeight); // ... then scroll by the required difference to make up. scrollBy((fracBarDown - fracDivDown) * (divHeight - (cBot - cTop))); return false; }} } function scrThumbUp(evt) { if (isNS4) document.routeEvent(evt); activeScr = null; } // *** SCROLLBAR BACKGROUND CLICK EVENT HANDLER *** function scrBarClick(evt) { with (this) { if (isNS4) document.routeEvent(evt); if (document.all) clickPos = document.body.scrollTop + event.clientY; else clickPos = evt.pageY; // Page up, or page down? if (clickPos < parseInt(thmSty.top)) scrollBy(cTop - cBot); if (clickPos > (parseInt(thmSty.top) + thmHeight)) scrollBy(cBot - cTop); }} // *** LAYOUT HANDLER FOR WINDOW RESIZE ETC *** function scrLayout() { with (this) { if (!isDyn) return; winWidth = document.all ? document.body.clientWidth : window.innerWidth; winHeight = document.all ? document.body.clientHeight : window.innerHeight; if (isNS4 && (scrFirstWidth != winWidth)) { // Sorry folks, NS4 has major bugs resizing horizontally and must refresh... fileName = location.href; if (fileName.indexOf('?') != -1) fileName = fileName.substring(0, fileName.indexOf('?')); location.href = fileName + '?lg=fr&film=1016185600&details=1&cat=1&actu=&page=2&trombi=&loadFile=' + divRef.src; } // If it's not yet initialised, go no further. if (!loaded) return; // Minimum values for window sizes. // if (winWidth < minWinWidth) winWidth = minWinWidth; // if (winHeight < minWinHeight) winHeight = minWinHeight; // Loop through divs array, positioning/sizing controls. for (count = 0; count < divs.length; count++) { var tmpObj = getSty(divs[count][0]); if (divs[count][1]) tmpObj.left = eval(divs[count][1]); if (divs[count][2]) tmpObj.top = eval(divs[count][2]); if (divs[count][3]) { var tmpW = eval(divs[count][3]); isNS4 ? tmpObj.clip.width = tmpW : tmpObj.width = tmpW; } // Don't set the height of the first scrolling div, we have to pick this up later. if (divs[count][4] && count != 0) { var tmpH = eval(divs[count][4]); isNS4 ? tmpObj.clip.height = tmpH : tmpObj.height = tmpH; } } // Set the top, bottom & width clip variables. if ((isDOM || isIE4) && !cTop) cTop = 0; // This will fix 'undefined' errors in NS. if (isNS4) cTop = divSty.clip.top; // Bar height and clipping parameters, stored here as accessed often. Set width on-the-fly. barHeight = eval(divs[1][4]); cBot = cTop + eval(divs[0][4]); cWidth = eval(divs[0][3]); if (isDOM || isIE4) divSty.width = cWidth; // Now, display it using updated variables... scrollBy(0); }} // *** ON LOAD: CAPTURE EVENTS & MISC. SETUP *** function scrSetup(defaultFile) { with (this) { //alert('un setup'); if (!isDyn) return; // References to document objects' properties, stored in scroller object. divRef = getRef(divs[0][0]); divSty = getSty(divs[0][0]); barSty = getSty(divs[1][0]); thmSty = getSty(divs[2][0]); // Convert these ID's to references now document has loaded. loadSty = getSty(loadSty); // NS6 has troubles with the frames array and iframes, so use a workaround. bufRef = eval('window.' + bufRef); // Other variables - references to bar and thumb divs, only used locally. barRef = getRef(divs[1][0]); thmRef = getRef(divs[2][0]); if (isNS4) { barRef.captureEvents(Event.CLICK); thmRef.captureEvents(Event.MOUSEDOWN); document.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP); } // Pass events to specific scrollers. barRef.onclick = new Function('evt', 'return ' + myName + '.barClick(evt)'); thmRef.onmousedown = new Function('evt', 'return ' + myName + '.thumbDown(evt)'); // The mouseMove and mouseUp events are global. document.onmousemove = scrThumbMove; document.onmouseup = scrThumbUp; // For IE4+/NS6, create a new function that stops selections being made when dragging. if (document.all) document.onselectstart = new Function('if (activeScr) return false'); else if (isDOM) document.onselect = new Function('if (activeScr) return false'); // It's now ready to go, call resize function to set the positions and variables... loaded = true; layout(); // Get the name of the file to be loaded from a CGI query string... fileName = ''; if (location.href.indexOf('?') != -1) fileName = location.href.substring(location.href.lastIndexOf('=') + 1); // Contains string '.htm'...? (can be '.html' file of course) if (fileName.indexOf('.htm') != -1) load(fileName) // Else load default file (if we're passed one) or scroll existing content without loading. else if (defaultFile) load(defaultFile); else fileLoaded(); }} // Main object of which instances are created. function DHTMLScroller(myName, bufferID, loadMess) { // Some references to objects that are referred to repeatedly for speed. this.divRef = null; this.divSty = null; this.barSty = null; this.thmSty = null; // Array of objects to move when the window is resized (e.g. scrollbar, arrows). this.divs = new Array(); // Store the ID's of these objects here for now. Convert to references later... this.loadSty = loadMess; this.bufRef = bufferID; // Properties. this.myName = myName; this.loaded = false; // A non-zero value for loop will cause a scrollBy call to repeat after that many milliseconds. this.loop = 0; // Minimum height of scrollbar thumb - defaults to 20, set to something else if you want. this.minThmHeight = 20; this.divHeight = 0; this.barHeight = 0; this.thmHeight = 0; this.cTop = 0; this.cBot = 0; this.cWidth = 0; // Methods - bind to functions above. this.load = scrLoad; this.checkBuffer = scrCheckBuffer; this.fileLoaded = scrFileLoaded; this.scrollBy = scrScrollBy; this.thumbDown = scrThumbDown; this.barClick = scrBarClick; this.setup = scrSetup; this.layout = scrLayout; } // *** GLOBAL VARIABLES - START EDITING HERE *** // Some global variables for the scroller code - scrFirstWidth is only for NS4 resize bug. var activeScr = null, scrOffset = 0, winWidth, winHeight, scrFirstWidth = window.innerWidth; // You must declare all scrollers, timeouts as global variables as well. var mainDiv; // Minimum window sizes - script will use these if actual sizes are too low. var minWinWidth = 500, minWinHeight = 300; // *** SCROLLER OBJECT SETUP ***. // name = new DHTMLScroller('name', 'iframe buffer id', 'loading message id'); mainDiv = new DHTMLScroller('mainDiv', 'bufferFrame', 'loadMess'); larg = screen.availWidth; if(larg < 900) { with (mainDiv) { divs[0] = new Array('mainContentDiv', '460', '150', '340', '500'); divs[1] = new Array('scrollBar', '-50', '165', '5', '300'); divs[2] = new Array('scrollThumb', '-50', '165', '5', ''); divs[3] = new Array('upArrows', '-50', '148', '', ''); divs[4] = new Array('downArrows', '-50', '450', '', ''); divs[4] = new Array('retourFiche', '500', '600', '', ''); } } else { with (mainDiv) { divs[0] = new Array('mainContentDiv', '500', '150', '500', '330'); divs[1] = new Array('scrollBar', '1006', '165', '5', '300'); divs[2] = new Array('scrollThumb', '1006', '165', '5', ''); divs[3] = new Array('upArrows', '1004', '148', '', ''); divs[4] = new Array('downArrows', '1004', '450', '', ''); } } var mainDiv2; mainDiv2 = new DHTMLScroller('mainDiv2', 'bufferFrame2', 'loadMess2'); with (mainDiv2) { // divs[number] = new Array('id of div below', 'x', 'y', 'width', 'height'); // Dimensions are evaluable strings so they can include variables. Null strings are skipped. // Div 0 is the main scroller, 1=Bar, 2=Thumb. divs[0] = new Array('mainContentDiv2', '5', '150', '390', '400'); divs[1] = new Array('scrollBar2', '390', '165', '5', '370'); divs[2] = new Array('scrollThumb2', '390', '165', '5', ''); // Anything past that is not special, just moved/sized with the window. Add extra divs! divs[3] = new Array('upArrows2', '388', '148', '', ''); divs[4] = new Array('downArrows2', '388', '525', '', ''); }