var paddingCurseur=53; var numPhotoAffiche; /************************************************************************************************** * * FONCTIONS DIVERSES * **************************************************************************************************/ function noclic() { alert('Il est interdit de vouloir copier des images'); return false; } /************************************************************************************************** * * ELEMENTS PAR ID (show/hide) * **************************************************************************************************/ function getByID(id) { if (document.all) { return document.all(id) ; } if(document.getElementById) { return document.getElementById(id) ; } } function hide(id) { var o = getByID(id) ; if (o) { if (document.all) { o.display = "none" ; } if(document.getElementById) { o.style.display = "none" ; } } } function show(id) { var o = getByID(id) ; if (o) { if (document.all) { o.display = "visible" ; } if(document.getElementById) { o.style.display = "block" ; } } } /************************************************************************************************** * * DIAPORAMAS / MEDIACENTER * **************************************************************************************************/ function posfleche(d) { if(document.getElementById('Curseur')!=null) {d=d*79 + paddingCurseur ; OBigSrc = getByID('Curseur'); OBigSrc.style.paddingLeft=d; } } function FigDiapo(bigdst,bigmax,mindst,minnbr,notdiv) { var distance = 0; /* La distance de la fleche à afficher */ this.Idx = 1; /* Element en cours */ numPhotoAffiche = 1; this.Prems = 1; /* Premier de la liste des vignettes */ this.Max = bigmax; /* Nombre total d'Affiches */ if (minnbr>bigmax){minnbr=bigmax-1; } /* on n'affiche pas plus de vignettes que de photos */ this.MinNbr = minnbr; /* Nombre de "Miniatures" par Objet */ this.BigDst = bigdst; /* Préfix des Affiches */ this.MinDst = mindst; /* Préfix des Miniatures */ this.NotDiv = notdiv; /* Prefix des notations */ this.OBigDst = getByID(bigdst); /* Objet "Affiche" à remplir */ this.OMinDst = getByID(mindst); /* Objet "Miniature" à remplir */ this.ONotDiv = getByID(notdiv); /* Objet "Notation" à remplir */ for(i=1;i<=this.Max;i++) { hide(this.BigDst + '_' + i); hide(this.MinDst + '_' + i); } this.next = function() { var action=1; this.Idx++; if(this.Idx > this.Max) this.Idx = 1; numPhotoAffiche = this.Idx; /*On regarde s'il faut déplacer ou pas les vignettes */ distance=this.Idx-this.Prems; if (distance<0){distance=distance+this.Max} if (distance<9) {action=0} else {action=this.Prems+1; if (action>this.Max) action=1;} this.affiche(action); /*On positionne la fleche */ if (distance<9) posfleche(distance); } this.prev = function() { var action=1; this.Idx--; if(this.Idx < 1) this.Idx = this.Max numPhotoAffiche = this.Idx; /*On regarde s'il faut déplacer ou pas les vignettes */ distance=this.Idx-this.Prems; if (distance<0){distance=distance+this.Max} if (distance<9) {action=0;} else {action=this.Idx;} /* On effectue l'affichage */ this.affiche(action); /*On positionne la fleche */ distance=this.Idx-this.Prems; if (distance<0){distance=distance+this.Max} posfleche(distance); } this.iset = function(i) { this.Idx = i; numPhotoAffiche = this.Idx; this.affiche(0); /* On positionne la flêche */ distance=i-this.Prems; if (distance<0){distance=distance+this.Max} posfleche(distance); } this.affiche = function(dern) { /* On Remplace le contenu de l'Affiche */ if(this.OBigDst) { OBigSrc = getByID(this.BigDst + '_' + this.Idx); this.OBigDst.innerHTML = OBigSrc.innerHTML; OBigSrc = getByID(this.NotDiv + '_' + this.Idx); this.ONotDiv.innerHTML = OBigSrc.innerHTML; } /* On Remplace le contenu de la liste des Miniatures */ if(this.OMinDst && dern!=0) { nb=0; this.OMinDst.innerHTML = ""; this.Prems=dern; for(i=dern;nb<=this.MinNbr;i++) { if(i<=this.Max) { nb++; OMinScr = getByID(this.MinDst + '_' + i); this.OMinDst.innerHTML += OMinScr.innerHTML; } else { i=0; } } } } this.affiche(1); } /************************************************************************************************** * * NOTATION DES PHOTOS * **************************************************************************************************/ function notation(note,action) { var idGalerie=$('num_'+numPhotoAffiche).innerHTML; var url = '/Galerieperso/Notationajax.asp'; var param= '?note=' +note+'&idgalerie='+idGalerie+'&numPhotoAffiche='+numPhotoAffiche+'&action='+action; new Ajax.Request(url, { method: 'get', parameters: param, onSuccess: function(transport) { var retour = transport.responseText; retour=retour.unescapeHTML(); retour=retour.split (""").join ('"'); retour.evalScripts(); }}); } function annulation() { var idGalerie=$('num_'+numPhotoAffiche).innerHTML; var url = '/Galerieperso/Notationajax.asp'; var param= '?idgalerie='+idGalerie+'&numPhotoAffiche='+numPhotoAffiche+'&action=annuler'; new Ajax.Request(url, { method: 'get', parameters: param, onSuccess: function(transport) { var retour = transport.responseText; retour=retour.unescapeHTML(); retour=retour.split (""").join ('"'); retour.evalScripts(); }}); }