/* ================================================================================ * * Fonction JavaScript diverses (mais nez en moins tres utiles) * * ================================================================================ */ /* ******************************************************************************** * Tente de reconnaître le browser actuel */ function TestBrowser() { this.ver = navigator.appVersion ; this.agent = navigator.userAgent ; this.dom = 0 ; this.ie6 = 0 ; this.ie5 = 0 ; this.ie4 = 0 ; this.ie = this.ie4 || this.ie5 || this.ie6 ; this.mac = 0 ; this.ns6 = 0 ; this.ns4 = 0 ; this.opera = 0 ; this.bw = (this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera) ; // alert('dom : ' + this .dom + ' - opera : ' + this.opera + ' - ie6 : ' + this.ie6 + ' - ie5 : ' + this.ie5 + ' - ie4 : ' + this.ie4 + ' - ns6 : ' + this.ns6 + ' - ns4 : ' + this.ns4) ; return this ; } function Rediriger(entree) { if (screen.width >= 1024) { /* * Si l'ecran est en plus de 800x600 et que la page n'est pas appelee * par sa frame englobante, alors on reconstruit l'ensemble des frames * sinon, on ne reconstruit que l'ecran d'accueil */ if (parent.frames.length == 0) self.location = "index.php?Entree=" + entree ; } else { /* * Si l'ecran est de 800x600, on passe quand meme par la page * d'accueil */ if (parent.frames.length == 0) self.location = "accueil.php?Entree=" + entree ; } } /* ******************************************************************************** * Ouvre une fenêtre annexe * * URL URL complete, parametres y compris * Nom Nom interne de la fenetre * Largeur Largeur en pixels de la fenetre * Longueur Longueur en pixels de la fenetre */ function ouvrirFenetre(URL, Nom, Largeur, Hauteur) { Fenetre = window.open(URL, Nom, 'scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,titlebar=yes,width=' + Largeur + ',height=' + Hauteur) ; Fenetre.focus() ; } /* ================================================================================ * Interface 'portable' d'acces aux objets de la page et * de manipulation de leur style * * Modules d'apres ceux de Chris Nott disponibles sur http://www.dithered.com */ /* ******************************************************************************** * Retourne l'objet dont on a passe le nom. * Point de passage obligatoire avant de manipuler l'objet, les autres * fonctions utilisant ce qui est retourné ici */ function getObject (e,f) { if (document.layers) { f = (f) ? f : self ; var V = f.document.layers ; if (V[e]) return V[e] ; for (var W = 0 ; W < V.length ; ) t = getObject (e, V[W++]) ; return t ; } if (document.all) return document.all[e] ; return document.getElementById(e) ; } /* ******************************************************************************** * Dans le cas de Netscape 6, les valeurs de taille et position dans les * styles sont suivis de 'px' * Cette fonction supprime le 'px' */ function clean(Coord) { if ((Browser.ie) || (Browser.ns6)) { var Pos = Coord.indexOf('px') ; if (Pos != -1) return (Coord.substring(0, Pos)) ; else return (Coord) ; } else return (Coord) ; } /* ******************************************************************************** * Rend un objet visible */ function showObject (e) { if (document.layers) e.visibility = 'show' ; else e.style.visibility = 'visible' ; } /* ******************************************************************************** * Cache un objet */ function hideObject (e) { if (document.layers) e.visibility = 'hide' ; else e.style.visibility = 'hidden' ; } /* ******************************************************************************** * Lit l'ordre d'empilement (z-index) d'un objet */ function getZIndex (e) { if (document.layers) return (e.zIndex) ; else return (e.style.zIndex) ; } /* ******************************************************************************** * Change l'ordre d'empilement (z-index) d'un objet */ function setZIndex (e,z) { if (document.layers) e.zIndex = z ; else e.style.zIndex = z ; } /* ******************************************************************************** * Lit la position horizontale d'un objet */ function getLeft (e) { if (document.layers) return (e.left) ; else if (Browser.opera) return (e.style.pixelLeft) ; else return (clean(e.style.left) * 10 / 10) ; } /* ******************************************************************************** * Change la position horizontale d'un objet */ function setLeft (e,x) { if (document.layers) e.left = x ; else if (Browser.opera) e.style.pixelLeft = x ; else e.style.left = x + px ; } /* ******************************************************************************** * Lit la position verticale d'un objet */ function getTop (e) { if (document.layers) return (e.top) ; else if (Browser.opera) return (e.style.pixelTop) ; else return (clean(e.style.top)) ; } /* ******************************************************************************** * Change la position verticale d'un objet */ function setTop (e,y) { if (document.layers) e.top = y ; else if (Browser.opera) e.style.pixelTop = y ; else e.style.top = y + px ; } /* ******************************************************************************** * Lit la largeur d'un objet */ function getWidth (e) { if (document.layers) return (e.clip.width) ; else if (Browser.opera) return (e.style.pixelWidth) ; else return (clean(e.style.width)) ; } /* ******************************************************************************** * Change la largeur d'un objet */ function setWidth (e,w) { if (document.layers) e.clip.width = w ; else if (Browser.opera) e.style.pixelWidth = w ; else e.style.width = w + px ; } /* ******************************************************************************** * Lit la hauteur d'un objet */ function getHeight (e) { if (document.layers) return (e.clip.height) ; else if (Browser.opera) return (e.style.pixelHeight) ; else return (clean(e.style.height)) ; } /* ******************************************************************************** * Change la hauteur d'un objet */ function setHeight (e,h) { if (document.layers) e.clip.height = h ; else if (Browser.opera) e.style.pixelHeight = h ; else e.style.height = h + px ; } /* ******************************************************************************** * Change la partie visible d'un objet (rectangle de clipping) */ function setClip(e,t,r,b,x) { if (document.layers) { X = e.clip ; X.top = t ; X.right = r ; X.bottom = b ; X.left = x ; } else e.style.clip = 'rect(' + t + px + ' ' + r + px + ' ' + b + px + ' ' + x + px + ')' ; } /* ******************************************************************************** * Change le contenu HTML d'un objet */ function writeHTML (e,h) { if (document.layers) { alert(e + ' - ' + h) ; e.document.open() ; e.document.write(h) ; e.document.close() ; } if (e.innerHTML) e.innerHTML = h ; } /* ******************************************************************************** * Lit le mode d'affichage (display) d'un objet */ function getDisplay (e) { if (document.layers) return (e.display) ; else return (e.style.display) ; } /* ******************************************************************************** * Change le mode d'affichage (display) d'un objet */ function setDisplay (e,z) { if (document.layers) e.display = z ; else e.style.display = z ; } /* ================================================================================ * Traitement des onglets * * Copyright (C) 2002 Georges Planelles */ /* ******************************************************************************** * Traite le passage de la souris sur un onglet */ function SourisOver(Onglet) { if (Onglet == Courant) return ; oImage[Onglet - 1].src = xImage[(Onglet - 1) * 3 + 2].src ; } /* ******************************************************************************** * Traite la sortie de la souris d'un onglet */ function SourisOut(Onglet) { if (Onglet == Courant) return ; oImage[Onglet - 1].src = xImage[(Onglet - 1) * 3 + 1].src ; } /* ******************************************************************************** * Traite le clic souris sur un onglet */ function SourisClick(Onglet) { if ((Onglet == Courant) || (Onglet == 0)) return ; oImage[Courant - 1].src = xImage[(Courant - 1) * 3 + 1].src ; Courant = Onglet ; // Charger le texte correspondant a l'onglet choisi for (i = 0 ; i < NbOnglets ; i++) { Page = 'id_0' + (i + 1) ; Objet = getObject(Page) ; hideObject(Objet) ; Page = 'ong_0' + (i + 1) ; Objet = getObject(Page) ; setZIndex(Objet, NbOnglets - i) ; } oImage[Onglet - 1].src = xImage[(Onglet - 1) * 3].src ; Page = 'ong_0' + Onglet ; Objet = getObject(Page) ; setZIndex(Objet, 8) ; Page = 'id_0' + Onglet ; Objet = getObject(Page) ; showObject(Objet) ; changeActive(Onglet - 1) ; } /* ******************************************************************************** * Chargement des images des onglets */ function chargerImagesOnglets() { var i, j ; var fic ; xImage = new Array (NbOnglets * 3) ; for (i = 0 ; i < NbOnglets * 3 ; i++) { xImage[i] = new Image() ; fic = Onglets[Math.floor(i / 3)] ; if ((i % 3) == 0) fic = "onglet" + fic + "_normal" ; else if ((i % 3) == 1) fic = "onglet" + fic + "_inactif" ; else fic = "onglet" + fic + "_over" ; fic = "images/" + fic + ".gif" ; xImage[i].src = fic ; } oImage = new Array (NbOnglets) ; for (i = 0 ; i < NbOnglets ; i++) { if (Browser.ns4) oImage[i] = eval('document.ong_0' + (i + 1) + '.document.images[0]') ; else oImage[i] = document.images[i] ; } } /* ================================================================================ * PageScroll * Copyright (C) 2001 Thomas Brattli * This script was released at DHTMLCentral.com * Visit for more great scripts! * This may be used and changed freely as long as this msg is intact! * We will also appreciate any links you could give us. * * Made by Thomas Brattli */ // The speed of the timeout between each scroll. timSpeed = 50 ; // The height of the container (change this when it scrolls to much or to little) contHeight = 380 ; /* ******************************************************************************** * Other variables */ var scrollTim = 1 ; var active = 0 ; var oControl ; var oScroll ; /* ******************************************************************************** * This is the object constructor function, which applies * methods and properties to the Cross-browser layer object */ function makeScrollObj(obj,nest) { nest = (! nest) ? "" : 'document.' + nest + '.' ; this.el = Browser.dom ? document.getElementById(obj) : Browser.ie4 ? document.all[obj] : Browser.ns4 ? eval(nest + 'document.' + obj) : 0 ; this.css = Browser.dom ? document.getElementById(obj).style : Browser.ie4 ? document.all[obj].style : Browser.ns4 ? eval(nest + 'document.' + obj) : 0 ; this.height = Browser.ns4 ? this.css.document.height:this.el.offsetHeight ; this.top = b_gettop ; return this ; } /* ******************************************************************************** * Getting the top for the top method */ function b_gettop() { var gtop = (Browser.ns4 || Browser.ns6) ? parseInt(this.css.top) : eval(this.css.pixelTop) ; return gtop ; } /* ******************************************************************************** * The scroll function. Checks what way to scroll and checks if the * layer is not already on top or bottom. */ function scroll(speed) { clearTimeout (scrollTim) ; way = speed > 0 ? 1 : 0 ; if ((!way && oScroll[active].top() > -oScroll[active].height + contHeight) || (oScroll[active].top() < 0 && way)) { oScroll[active].css.top = (oScroll[active].top()+speed) + px ; scrollTim = setTimeout("scroll(" + speed + ")", timSpeed) ; } } /* ******************************************************************************** * Clears the timeout so the scroll stops, this is called onmouseout. */ function noScroll() { clearTimeout(scrollTim) ; } /* ******************************************************************************** * Changes the active layer. Hides the one that's visible and * shows the "new" one. Also set's the new layers top to 0 * so it starts at top. */ function changeActive(num) { oScroll[active].css.visibility = "hidden" ; active = num ; oScroll[active].css.top = 0 + px ; oScroll[active].css.visibility = "visible" ; } /* ******************************************************************************** * Initializes the page, makes a oScroll Array and calls the object constructor. * Here you can add as many scrollObjects as you want */ function scrollInit() { oScroll = new Array() // You can add and remove scrollObjects here. // throw 'entree dans le debugger' ; for (i = 0 ; i < NbOnglets ; i++) { Page = 'id_0' + (i + 1) ; oScroll[i] = new makeScrollObj(Page, 'Conteneur') ; } oControl = new makeScrollObj('Conteneur') ; oControl.css.visibility = 'visible' ; oScroll[0].css.left = 0 + px ; oScroll[0].css.top = 0 + px ; oScroll[0].css.visibility = 'visible' ; SourisClick(Section) } /* * Initialisations */ var Browser = new TestBrowser() ; var px = ((Browser.ie) || (Browser.ns6)) ? 'px' : '' ;