
// (C) 2007 - 2008 Serge Lamarche
// http://sergewebservice.ca/
// All codes copyrights Serge Lamarche, any reproduction and 
// use strictly forbidden without written consent.
// Contact sergewebservice@yahoo.ca or serge_lamarche@hotmail.com 
// for help with your website. Reliable, inexpensive website service.


var identifiant = 0; 
function metmultimedia(typemultimedia, relurl, legend) { identifiant++; 
if (!document.getElementById) return; 
var elemtmultimedia = document.getElementById("multimedia"); 
var elemtlegende = document.getElementById("legende"); 
elemtlegende.innerHTML = ''; 
var leP = document.createElement("p"); 
if (typemultimedia!=".photos") { if (leP.setAttribute) leP.setAttribute("class","video"); } else { if (leP.setAttribute) leP.setAttribute("class","photo"); }; // permet ajuster avec css. 

//  ****var letexte = document.createTextNode(legend); 
//  ****leP.appendChild(letexte); 
leP.innerHTML = legend; 
elemtlegende.appendChild(leP); 
//elemtlegende.innerHTML = legend; 


elemtmultimedia.innerHTML = ''; 

if (typemultimedia==".mov") { relurl += ".mov?" + identifiant; 
if (fureteur()=="safari") { if (document.filmmov) document.filmmov.Stop(); };
elemtmultimedia.innerHTML = methtmlmov(relurl); return; };

if (typemultimedia==".swf") { 
elemtmultimedia.innerHTML = methtmlflash(relurl); return; }; 

if (typemultimedia==".photos") elemtmultimedia.innerHTML = methtmlphoto(relurl); }


function methtmlmov(relurl) { 
var codehtml = '<object width="480" height="288" id="filmmov" codebase="http://www.apple.com/qtactivex/qtplugin.cab" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B">\n'; 
codehtml += '<param name="src" value="'+relurl+'">\n'; 
codehtml += '<param name="controller" value="true">\n'; 
codehtml += '<param name="scale" value="aspect">\n'; 
codehtml += '<param name="autoplay" value="true">\n'; 
codehtml += '<param name="bgcolor" value="black">\n'; 
codehtml += '<embed autoplay="true" src="'+relurl+'" scale="aspect" enablejavascript="true" name="filmmov" width="480" height="288" controller="true" pluginspage="http://www.apple.com/quicktime/download/"></embed>\n'; 
codehtml += '</object>\n'; 
if (seqfilms) { codehtml += '<p class="boutons"><a href="javascript: rollvideo(false)" id="arriere">&lt;</a> - <a href="javascript: rollvideo(true)" id="avant">&gt;</a></p>\n'; }; 
return codehtml; }

function methtmlflash(relurl) {
var codehtml = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="280" id="film2004" align="middle">\n'; 
codehtml += '<param name="allowScriptAccess" value="sameDomain" />\n'; 
codehtml += '<param name="movie" value="'+relurl+'.swf" />\n'; 
codehtml += '<param name="quality" value="high" />\n'; 
codehtml += '<param name="scale" value="noscale" />\n'; 
codehtml += '<param name="bgcolor" value="#000000" />\n'; 
codehtml += '<embed src="'+relurl+'.swf" quality="high" scale="noscale" bgcolor="#000000" width="320" height="280" name="film2004" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n'; 
codehtml += '</object> \n'; 
if (seqfilms) { codehtml += '<p class="boutons"><a href="javascript: rollvideo(false)" id="arriere">&lt;</a> - <a href="javascript: rollvideo(true)" id="avant">&gt;</a></p>\n'; }; 
return codehtml; }


var seqfilms = false; var nbivideo = 0; 
function rollvideo(direction) { if (!seqfilms) return; 
(direction) ? nbivideo++ : nbivideo--; if (nbivideo==seqfilms.length) nbivideo=0 
else if (nbivideo<0) nbivideo=seqfilms.length-1; 
changemultimedia(seqfilms[nbivideo][0], seqfilms[nbivideo][1], seqfilms[nbivideo][2]); }


var lesclientsphotos = false; 
var clientcourant = false; var nbi = -2; var nbiclient = 0; 
function chgclientcourant(qui) { clientcourant = qui; }


function methtmlphoto(relurl) { if (!clientcourant) return; nbi = 0; 
var codehtml = '<img name="ecran" id="ecran" src="'+clientcourant+'/'+relurl+'.jpg" vspace="0" hspace="0" border="0" alt="">\n<p class="boutons"><a href="javascript: rollimg(false)" id="arriere">&lt;</a> - <a href="javascript: rollimg(true)" id="avant">&gt;</a></p>'; 
return codehtml; }


function rollimg(direction) {   if (!clientcourant) return; 
(direction) ? nbi+=2 : nbi-=2; 
if (nbi==multidata[clientcourant]['photos'].length) { nbi=0; 
  if (lesclientsphotos) { 
    if (nbiclient!=lesclientsphotos.length-1) { nbiclient++; chgclientcourant(lesclientsphotos[(nbiclient)]); }
    else { chgclientcourant(lesclientsphotos[0]); nbiclient = 0; }; }; } 
else if (nbi<0) { 
  if (lesclientsphotos) { 
    if (nbiclient==0) { chgclientcourant(lesclientsphotos[lesclientsphotos.length-1]); nbiclient = lesclientsphotos.length-1; } else { nbiclient--; chgclientcourant(lesclientsphotos[nbiclient]); }; }; 
nbi = multidata[clientcourant]['photos'].length-2 }
var nomphoto = clientcourant+"/"+multidata[clientcourant]['photos'][nbi]+".jpg"; 
var legendechg = multidata[clientcourant]['photos'][nbi+1]; 
changephoto(nomphoto,legendechg); }


function changephoto(nomphoto,legendechg) { 
if (!document.ecran) return; document.ecran.src=nomphoto; 
if (!document.getElementById) return; 
if (!document.getElementById("legende")) return; //ce qui suit change la légende.
if (!typeof(document.getElementById("legende").innerHTML)) return; 
var lalegende=document.getElementById("legende"); lalegende.innerHTML=''; 
lalegende.innerHTML="<p>"+legendechg+"</p>"; }


//fonction pour scrollbarre intérieure:
var hauteurecran = document.documentElement || false; 
hauteurecran = hauteurecran.clientHeight || window.innerHeight || false; //raccourci!!
function ajustedefileur(hauteurmin, hauteurreste) { return; if (!document.getElementById) return; 
var divdefileur = document.getElementById("defileur");
if (hauteurecran) { var hauteurdisponible=hauteurecran-hauteurreste; 
if (hauteurdisponible>hauteurmin) divdefileur.style.height = hauteurdisponible+'px'; }; }

// fonctions de base:

function ouvrepop(quoi) { 
var newwindow=window.open(quoi, 'lanouvellefenetre', 'width=400, height=260, screenX=200, screenY=300'); if (window.focus) {newwindow.focus(); }; }


function fureteur() { var navteur = navigator.userAgent.toLowerCase(); 
var fureteurs = ["konqueror", "safari", "omniweb", "opera", "webtv", "icab", "msie", "firefox", "gecko", "compatible", "mozilla"]; 
for (var i=0;i<fureteurs.length;i++) { var furteur = new RegExp(fureteurs[i], "i"); 
if (-1!=navteur.search(furteur)) return fureteurs[i]; }; return "inconnu"; }
//Thanks to PPK www.quirksmode.com. His infos helped me quickly create this function.



// (C) 2007 - 2008 Serge Lamarche
// http://sergewebservice.ca/
// All codes copyrights Serge Lamarche, any reproduction and 
// use strictly forbidden without written consent.
// Contact sergewebservice@yahoo.ca or serge_lamarche@hotmail.com 
// for help with your website. Reliable, inexpensive website service.
