/* Effacement automatique des champs de saisie */
function auto_fill(o, i){
 if(i){
  if(o.refv==null)
   o.refv = o.value;
  if(o.value==o.refv)
   o.value='';
   o.select();
 }
 else{
  if(o.value=='')
   o.value=o.refv;
 }
}

/* RECL - Choix des regions */
function show_region(o){
 switch(o.selectedIndex){
  case 1:
   document.getElementById("regionlbl").className = 'enabled';
   document.getElementById("region").disabled = false;
   break;
  default:
   document.getElementById("regionlbl").className = 'disabled';
   document.getElementById("region").disabled = true;
   break;
 }
}

/* PAYS - Choix des continents */
function show_countries(o, id){
 o.blur();
 if(window.currentcount!=undefined){
  window.currentcount.className = 'off';
  document.getElementById("c"+window.currentcount.cid).style.display = 'none';
 }
 if(window.currentcont==undefined){
	window.currentcont = o;
	window.currentcont.cid = id;
 }
 else{
	window.currentcont.className = 'off';
	document.getElementById("countries"+window.currentcont.cid).style.display = 'none';
 }
 window.currentcont = o;
 window.currentcont.cid = id;
 window.currentcont.className = 'on';
 document.getElementById("countries"+window.currentcont.cid).style.display = 'block';
 document.getElementById("cbase").style.display = 'block';
 return false;
}

/* PAYS - Choix des pays/continents */
function show_country(o, id, p){
 o.blur();
 if(id<0)
  id = 1+Math.floor(3*Math.random());
 if(window.currentcount==undefined){
  window.currentcount = o;
  window.currentcount.cid = id;
 }
 else{
  window.currentcount.className = 'off';
  document.getElementById("c"+window.currentcount.cid).style.display = 'none';
 }
 window.currentcount = o;
 window.currentcount.cid = id;
 window.currentcount.className = 'on';
 document.getElementById("cbase").style.display = 'none';
 document.getElementById("c"+window.currentcount.cid).style.display = 'block';
 if(p==1){
  var _pop = window.open('pop.html', 'rmpop', 'width=797, height=618, top=150, left=150, location=no, menubar=no, resizable=0, scrollbars=yes, status=no, toolbar=no, fullscreen=no');
  _pop.focus();
 }
 return false;
}

var oldprod = null;
var plast = null;

/* HOME - Rollover produits */
function gfocus(){
 window.clearTimeout(plast);
 if(oldprod!=null){
  if(this==oldprod)
   return;
  else
   oldprod.gblur();
 }
 if(this.s)
  this.style.paddingLeft = '20px';
 else
  this.style.paddingRight = '20px';
 this.inf.style.visibility = 'visible';
 //RAJOUT SHT --> rendre INVISIBLE l'image et le descriptif par défaut lors du survol d'un modèle
 document.getElementById("gi").style.visibility = 'hidden';
 //FIN RAJOUT SHT
 oldprod = this;
}

function gblur(){
 if(this.s)
  this.style.paddingLeft = '0px';
 else
  this.style.paddingRight = '0px';
 this.inf.style.visibility = 'hidden';
 //RAJOUT SHT --> rendre VISIBLE l'image et le descriptif par défaut lors du survol d'un modèle
 document.getElementById("gi").style.visibility = 'visible';
 //FIN RAJOUT SHT
 window.clearTimeout(plast);
 oldprod = null;
}

function tm_gblur(){
 plast = window.setTimeout("oldprod.gblur()", 50);
}

function init_gfocus(){
 col = document.getElementById('gamm_list').getElementsByTagName('LI');
 for(i=0;i<col.length;i++){
  if(col[i].className=='')
   col[i].s = 1;
  else
   col[i].s = 0;
  // AJOUT SHT --> les événements onmouseover et onmouseout ne sont pas appliqués aux 'trous' de la gamme...
  if (document.getElementById('gi'+i) != null)	{
  // AJOUT SHT
	col[i].inf = document.getElementById('gi'+i);
	col[i].gfocus = gfocus;
	col[i].gblur = gblur;
	col[i].onmouseover = gfocus;
	col[i].onmouseout = tm_gblur;
// AJOUT SHT
  }
// FIN AJOUT SHT
 }
}

/* HOME texte defilant */
function writemrq(texte){
 speed = 4;
 document.write('<div id="news"><marquee scrollamount="'+speed+'"><span>'+texte+'</span></marquee></div>');
}

var theedge = null;

/* MPBREF rollovers */
function init_mp_frames(){
 theedge = document.getElementById("edge");
 edgerd = findxy(theedge);
 // MODIF ACS
 //for(i=0;i<5;i++){
 for(i=0;i<8;i++){
 // FIN MODIF ACS
  theevt = document.getElementById("rollevt"+i);
  // AJOUT ACS
  if (theevt != null)
  {
  // FIN AJOUT ACS
  theevt.obj = theobj = document.getElementById("roll"+i);
  theevt.frm = theobj.frm = theobj.getElementsByTagName("DIV").item(0);
  theevt.rectg = {l:0, r:0, t:0, b:0};
  theimg = theobj.getElementsByTagName("DIV").item(1);
//  theobj.style.width = theevt.offsetWidth + 4 + 'px';
  theevt.dx = -11;
  theevt.dy = -4;

  evtrd = findxy(theevt);
  theevt.refx = evtrd.x - edgerd.x;
  theevt.refy = evtrd.y - edgerd.y;
  theobj.style.left = edgerd.x + theevt.refx - theevt.dx + 'px';
  updxy(theevt);
  theevt.onmouseover = theevt.hi_show = hi_show_mp;
 }
 
 document.onmousemove = function(e){
  if(curroll==null)
   return;
  if(e){
   x = e.pageX;
   y = e.pageY;
  }
  else if(e=window.event){
   bdx = parseInt((document.body.offsetWidth - document.getElementById("main").offsetWidth))/2;
   x = e.clientX - bdx;
   y = e.clientY;
  }
  thefrmc = curroll.rectg;
  if((x<thefrmc.l)||(x>thefrmc.r)||(y>thefrmc.b)||(y<thefrmc.t))
   hi_hide();
  // AJOUT ACS
  }
  // FIN AJOUT ACS
 }
}

/* CATA_PV rollovers */
function init_cata_frames(){
 theedge = document.getElementById("edge");
 edgerd = findxy(theedge);
 for(i=0;i<8;i++){
  theevt = document.getElementById("rollevt"+i);
  if (theevt != null)	{
	theevt.obj = theobj = document.getElementById("roll"+i);
	theevt.frm = theobj.frm = theobj.getElementsByTagName("DIV").item(0);
	theevt.frm.rectg = {l:0, r:0, t:0, b:0};
	theimg = theobj.getElementsByTagName("IMG").item(0);
	theobj.style.width = theevt.offsetWidth + 4 + 'px';
	theevt.inv = 0;
	theevt.dx = 3;
	theevt.dy = 3;

	if(theobj.className.indexOf("inv")>=0)
	theevt.inv = 1;

	evtrd = findxy(theevt);
	theevt.refx = evtrd.x - edgerd.x;
	theevt.refy = evtrd.y - edgerd.y;
	theobj.style.left = edgerd.x + theevt.refx - theevt.dx + 'px';
	updxy(theevt);
	theevt.ind = i;
	theevt.onmouseover = theevt.hi_show = hi_show;
  }
 }
 
 document.onmousemove = function(e){
  if(curroll==null)
   return;
  if(e){
   x = e.pageX;
   y = e.pageY;
  }
  else if(e=window.event){
   bdx = parseInt((document.body.offsetWidth - document.getElementById("main").offsetWidth))/2;
   x = e.clientX - bdx;
   y = e.clientY + document.body.scrollTop;
  }
  thefrmc = curroll.frm.rectg;
  if((x<thefrmc.l)||(x>thefrmc.r)||(y>thefrmc.b)||(y<thefrmc.t))
   hi_hide();
 }
}

/* HIMP rollovers */
function init_frames(){
 theedge = document.getElementById("edge");
 edgerd = findxy(theedge);
 for(i=0;i<6;i++){
  theevt = document.getElementById("rollevt"+i);
  if (theevt != null)
  {
	theevt.obj = theobj = document.getElementById("roll"+i);
	theevt.frm = theobj.frm = theobj.getElementsByTagName("DIV").item(0);
	theevt.frm.rectg = {l:0, r:0, t:0, b:0};
	theimg = theobj.getElementsByTagName("IMG").item(0);
	theobj.style.width = theevt.offsetWidth + 4 + 'px';
	theevt.inv = 0;
	theevt.dx = 3;
	theevt.dy = 3;

	if(theobj.className.indexOf("inv")>=0)
	theevt.inv = 1;

	evtrd = findxy(theevt);
	theevt.refx = evtrd.x - edgerd.x;
	theevt.refy = evtrd.y - edgerd.y;
	theobj.style.left = edgerd.x + theevt.refx - theevt.dx + 'px';
	updxy(theevt);
	theevt.ind = i;
	theevt.onmouseover = theevt.hi_show = hi_show;
  }
 }
 
 document.onmousemove = function(e){
  if(curroll==null)
   return;
  if(e){
   x = e.pageX;
   y = e.pageY;
  }
  else if(e=window.event){
   bdx = parseInt((document.body.offsetWidth - document.getElementById("main").offsetWidth))/2;
   x = e.clientX - bdx;
   y = e.clientY;
  }
  thefrmc = curroll.frm.rectg;
  if((x<thefrmc.l)||(x>thefrmc.r)||(y>thefrmc.b)||(y<thefrmc.t))
   hi_hide();
 }
}

function findxy(o) {
 var rd = {x:0, y:0};
 tmp = o;
 rd.x += o.offsetLeft;
 rd.y += o.offsetTop;
 while ((o = o.offsetParent)&&(o.id!="main")){
  rd.x += o.offsetLeft;
  rd.y += o.offsetTop;
 }
 return rd;
}

var curroll = null;

function updxy(o){
 edgerd = findxy(theedge);
 if(o.inv)
  o.dy = o.obj.offsetHeight - o.offsetHeight - 3;
 o.obj.style.top = edgerd.y + o.refy - o.dy + 'px';
}

function updxy_mp(o){
 tmpc = findxy(o);
 o.obj.style.top = tmpc.y - o.dy + 'px';
}

function hi_show(){
 if(curroll!=null){
  if(curroll==this)
   return;
  else
   hi_hide();
 }
 updxy(this);
 this.frm.style.height = this.obj.offsetHeight - 2 +'px';
 this.frm.style.width = this.obj.offsetWidth - 2 +'px';
 this.obj.style.visibility = "visible";
 this.frm.rectg.l = parseInt(this.obj.style.left);
 this.frm.rectg.r = parseInt(this.frm.rectg.l + this.obj.offsetWidth);
 this.frm.rectg.t = parseInt(this.obj.style.top);
 this.frm.rectg.b = parseInt(this.frm.rectg.t + this.obj.offsetHeight);
 curroll = this;
}

function hi_show_mp(){
 if(curroll!=null){
  if(curroll==this)
   return;
  else
   hi_hide();
 }
 updxy_mp(this);
 this.frm.style.height = this.obj.offsetHeight - 2 +'px';
 this.frm.style.width = this.obj.offsetWidth - 2 +'px';
 this.obj.style.visibility = "visible";
 tmpc = findxy(this);
 this.rectg.l = parseInt(tmpc.x);
 this.rectg.r = parseInt(this.rectg.l + this.offsetWidth);
 this.rectg.t = parseInt(tmpc.y);
 this.rectg.b = parseInt(this.rectg.t + this.offsetHeight);
 curroll = this;
}

function hi_hide(){
 curroll.obj.style.visibility = "hidden";
 curroll = null;
}

/* SOND ouverture popup */
function popen(u, w, h, l, t){
 var _popsond = window.open(u, 'popsond', 'width='+w+', height='+h+', top='+t+', left='+l+', location=no, menubar=no, resizable=0, scrollbars=no, status=no, toolbar=no, fullscreen=no');
 _popsond.focus();
 return false;
}

var _popcard = null;

/* SOND ouverture popup */
function popencard(u, w, h, l, t){
 if(_popcard!=null)
  _popcard.close();
 _popcard = window.open(u, 'popcard', 'width='+w+', height='+h+', top='+t+', left='+l+', location=no, menubar=no, resizable=0, scrollbars=1, status=no, toolbar=no, fullscreen=no');
 _popcard.focus();
 return false;
}

/* SOND fermeture popup */
function pclose(){
 self.close();
 return false;
}

/* SOND - CARD resize hauteur popup */
function match_height(){
 h = (document.all)?document.body.clientHeight:window.innerHeight;
 while(document.getElementById("popmain").offsetHeight!=h){
  h = (document.all)?document.body.clientHeight:window.innerHeight;
  window.resizeBy(0, document.getElementById("popmain").offsetHeight-h);
 }
}

/* SOND - CARD resize hauteur popup */
function match_card(){
 if(arguments.length==0)
  window.setTimeout("match_card(0)", 100);
 else{
  h = (document.all)?document.body.clientHeight:window.innerHeight;
  if(document.getElementById("popmain").offsetHeight<h)
   window.resizeBy(0, document.getElementById("popmain").offsetHeight-h);
 }
}

//MAJ zopen, match_size, tm_resize, tm_resize_inv en fonction de la maquette 1.1
var _popzoom = null;
var IW = 0, IH = 0, HD = 0;

/* Zoom ouverture popup */
function zopen(u, l, t){
 _popzoom = window.open(u, 'popzoom', 'width=1, height=1, top='+t+', left='+l+', location=no, menubar=no, resizable=0, scrollbars=auto, status=no, toolbar=no, fullscreen=no');
 window.focus();
 _popzoom.blur();
//_popzoom.document.write("<img src='"+u+"' onclick='window.close()'>");
 window.setTimeout("match_size()", 10);
 return false;
}

/* Zoom resize popup */
function match_size(){
 if(!_popzoom){
  window.setTimeout("match_size()", 10);
  return false;
 }
 if(_popzoom.document.images==null){
  window.setTimeout("match_size()", 10);
  return false;
 }
 if(_popzoom.document.images.length==0){
  window.setTimeout("match_size()", 10);
  return false;
 }
 if(_popzoom.document.images[0].complete!=1)
  window.setTimeout("match_size()", 10);
 else{
  _popzoom.document.body.style.margin = 0;
  IW = _popzoom.document.getElementsByTagName('IMG').item(0).offsetWidth;
  IH = _popzoom.document.getElementsByTagName('IMG').item(0).offsetHeight;
  if((IW<_popzoom.document.body.clientWidth)||(IH<_popzoom.document.body.clientHeight)){
   _popzoom.resizeTo(2000, 2000);
   IW = _popzoom.document.getElementsByTagName('IMG').item(0).offsetWidth;
   IH = _popzoom.document.getElementsByTagName('IMG').item(0).offsetHeight;
   tm_resize_inv();
  }
  else
   tm_resize();
 }
 _popzoom.document.title = "CITROËN";
  return false;
}

function tm_resize(){
 if(document.all){
  _popzoom.resizeBy(IW-_popzoom.document.body.clientWidth, IH-_popzoom.document.body.clientHeight);
  if((IH>_popzoom.document.body.clientHeight)||(IW>_popzoom.document.body.clientWidth))
   window.setTimeout("tm_resize()", 1000);
  else
  _popzoom.focus();
 }
 else{
  _popzoom.resizeBy(IW-_popzoom.innerWidth, IH-_popzoom.innerHeight);
  if((IH>_popzoom.innerHeight)||(IW>_popzoom.innerWidth))
   window.setTimeout("tm_resize()", 1000);
  else
   _popzoom.focus();
 }
}

function tm_resize_inv(){
 _popzoom.resizeTo(IW, IH);
 _popzoom.document.getElementsByTagName('IMG').item(0).style.width = "100%";
 _popzoom.document.getElementsByTagName('IMG').item(0).style.height = "100%";
 _popzoom.focus();
}
//FIN MAJ

/* Fonction d'impression */
function _print(){
 if(window.print)
  window.print();
 return false;
}

/*
function addBookmark(title,url) {
if (window.sidebar) 
{window.sidebar.addPanel(title, url,"");} 
else 
if( document.all ) 
{window.external.AddFavorite( url, title);} 
else 
if (window.opera && window.print ){ 
return true;} 
}*/

/* SOND ouverture popup */
function popen(u, w, h, l, t){
 var _popsond = window.open(u, 'popsond', 'width='+w+', height='+h+', top='+t+', left='+l+', location=no, menubar=no, resizable=0, scrollbars=no, status=no, toolbar=no, fullscreen=no');
 _popsond.focus();
 return false;
}

/*
function fill_vid(u, type, thumb, altimg){
 var HTMLvid = '';
 switch(type){
  case "w":
    HTMLvid += '<object id="videowindow" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject">'
  + '<param name="autostart" value="true">'
  + '<param name="filename" value="'+u+'">'
  + '<param name="showcontrols" value="true">'
  + '<param name="showstatusbar" value="false">'
  + '<param name="autosize" value="false">'
  + '<param name="sendplaystatechangeevents" value="true">'
  + '<embed id="videowindow" type="application/x-mplayer2" src="'+u+'" name="videowindow" showcontrols=1></embed>'
    + '</object> ';
  break;
  case "r":
  if(detectReal()==false){
   HTMLvid += '<p class="center">Pour voir cette vidéo, vous devez<br /><a href="http://www.real.com/freeplayer/?rppr=rnwk" target="_new">télécharger le plugin Real Player</a>.</p><img width="320" height="240" src="img/video_pict.gif" alt="Fenêtre Vidéo"/>';
   break;
  }
  HTMLvid += '<object id="videowindow" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">'
  + '<param name="src" value="'+u+'">'
  + '<param name="controls" value="ImageWindow">'
  + '<param name="console" value="one">'
  + '<param name="autostart" value="true">'
  + '<embed src="'+u+'" nojava=true controls=ImageWindow console=one autostart=false>'
  + '<noembed><p class="center">Pour voir cette vidéo, vous devez<br /><a href="http://www.real.com/freeplayer/?rppr=rnwk" target="_new">télécharger le plugin Real Player</a>.</p><img width="320" height="240" src="img/video_pict.gif" alt="Fenêtre Vidéo"/></noembed>'
  + '</object>';
  HTMLvid += '<br/><object id="videowindow" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">'
  + '<param name="controls" value="ControlPanel">'
  + '<param name="console" value="one">'
  + '<param name="autostart" value="true">'
  + '<embed src="'+u+'" nojava=true controls=ControlPanel console=one>'
  + '<noembed><p class="center">Pour voir cette vidéo, vous devez<br /><a href="http://www.real.com/freeplayer/?rppr=rnwk" target="_new">télécharger le plugin Real Player</a>.</p><img width="320" height="240" src="img/video_pict.gif" alt="Fenêtre Vidéo"/></noembed>'
  + '</object>';
  break;
 }
 document.getElementById("videobox").innerHTML = HTMLvid;
 if(thumb!='')
  document.getElementById(thumb).innerHTML = '<img src="'+altimg+'" alt="" />';
 return false;
}
*/

function fill_vid(u, type, thumb, altimg){
 var HTMLvid = '';
 switch(type){
  case "w":
  //HTMLvid += '<object id="videowindow" width="320" height="285" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject">'
  /* Modif ACS ANO 441 */
  //HTMLvid += '<object id="videowindow" width="100%" height="100%" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject">'
  HTMLvid += '<object id="videowindow" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject">'
  /* Fin Modif ACS ANO 441 */
  + '<param name="autostart" value="true">'
  + '<param name="filename" value="'+u+'">'
  + '<param name="showcontrols" value="true">'
  + '<param name="showstatusbar" value="false">'
  //
  //+ '<param name="TransparentAtStart" VALUE="true">'
  //
  + '<param name="autosize" value="false">'
  + '<param name="sendplaystatechangeevents" value="true">'
  /* Modif ACS ANO 441 */
  + '<embed id="videowindow" type="application/x-mplayer2" src="'+u+'" name="videowindow" showcontrols=1></embed>'
  //+ '<embed id="videowindow" type="application/x-mplayer2" src="'+u+'" name="videowindow" width="100%" height="100%" showcontrols=1></embed>'
  /* Fin Modif ACS ANO 441 */
  //+ '<embed id="videowindow" type="application/x-mplayer2" src="'+u+'" name="videowindow" width="320" height="285" showcontrols=1></embed>'
  + '</object> ';
  break;
  case "r":
  if(detectReal()==false){
   HTMLvid += '<p class="center">Pour voir cette vidéo, vous devez<br /><a href="http://www.real.com/freeplayer/?rppr=rnwk" target="_new">télécharger le plugin Real Player</a>.</p><img width="320" height="240" src="img/video_pict.gif" alt="Fenêtre Vidéo"/>';
   break;
  }
  //HTMLvid += '<object id="videowindow" width="320" height="240" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">'
  HTMLvid += '<object id="videowindow" width="100%" height="85%" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">'
  + '<param name="src" value="'+u+'">'
  + '<param name="controls" value="ImageWindow">'
  + '<param name="console" value="one">'
  + '<param name="autostart" value="true">'
  //+ '<embed src="'+u+'" width=320 height=240 nojava=true controls=ImageWindow console=one autostart=false>'
  //+ '<embed src="'+u+'" nojava=true controls=ImageWindow console=one autostart=false>'
  + '<embed src="'+u+'" nojava=true controls=ImageWindow console=one autostart=false>'
  //+ '<noembed><p class="center">Pour voir cette vidéo, vous devez<br /><a href="http://www.real.com/freeplayer/?rppr=rnwk" target="_new">télécharger le plugin Real Player</a>.</p><img width="320" height="240" src="img/video_pict.gif" alt="Fenêtre Vidéo"/></noembed>'
  + '</object>';
  //HTMLvid += '<object id="videowindow" width="320" height="45" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">'
  //HTMLvid += '<br/><object id="videowindow" width="100%" height="100%" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">'
  HTMLvid += '<br/><object id="videowindow" width="100%" height="45" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">'
  + '<param name="controls" value="ControlPanel">'
  + '<param name="console" value="one">'
  + '<param name="autostart" value="true">'
  + '<embed src="'+u+'" width="100%" height="45" nojava=true controls=ControlPanel console=one>'
  + '<embed src="'+u+'" nojava=true controls=ControlPanel console=one>'
  //+ '<noembed><p class="center">Pour voir cette vidéo, vous devez<br /><a href="http://www.real.com/freeplayer/?rppr=rnwk" target="_new">télécharger le plugin Real Player</a>.</p><img width="320" height="240" src="img/video_pict.gif" alt="Fenêtre Vidéo"/></noembed>'
  + '</object>';
  break;
 }
 document.getElementById("videobox").innerHTML = HTMLvid;
 if(thumb!='')
 /* Ajout ACS Ano 432 */
 {
	var thumbList = thumb.split(',');
	var altimgList = altimg.split(',');
	for (i=0;i<thumbList.length;i++) {
		var curThumb = thumbList[i]
		var curAltImg = altimgList[i]
		if (document.getElementById(curThumb) && (curAltImg) && (curAltImg != ""))
			document.getElementById(curThumb).innerHTML = '<img src="'+curAltImg+'" alt="" />';
	}
 }
 /* Fin Ajout ACS */
 //document.getElementById(thumb).innerHTML = '<img src="'+altimg+'" alt="" />';
 return false;
}

/* Centrage cadre en hauteur */
function win_height(){
 if(document.all)
  wh = document.body.clientHeight;
 else
  wh = window.innerHeight;	
 nh = (wh-document.getElementById("popmain").offsetHeight)/2;
 if(nh<0)
  nh = 0;
 document.getElementById("popmain").style.marginTop = parseInt(nh) + 'px';
 onresize = win_height;
}

function detectReal(){
 var pluginFound = false;
 var activeXFound = false;

 // If this Microsoft Internet Explorer 4.5 for Macintosh, plugins detection is impossible
 if (navigator.appVersion.indexOf("PPC")!=-1 && navigator.userAgent.indexOf("MSIE 4")!=-1)
  return false;

 // Check for Plug-in presence
 plugInFound = getPlugIn("RealPlayer","G2","Plug-In");

 // Check for RealPlayer ActiveX
 try {
  testObject = new ActiveXObject("rmocx.RealPlayer G2 Control.1");

  // Since G2 (Real 6), all Real player version numbers begin by 6
  embedVersion = testObject.GetVersionInfo();
		
  // First version supported : 6.0.6.131 = G2 Gold
  versionArray = embedVersion.split(".");
  conditionA = versionArray[0]>=6;
  conditionB = versionArray[1]>=0;
  conditionC = versionArray[2]>=6;
  conditionD = versionArray[3]>=131;
		
  if (conditionA && conditionB && conditionC && conditionD)
   activeXFound = true;
  else 
   activeXFound = false;
 } catch(e){
  activeXFound = false;
 }
 
 if (plugInFound || activeXFound)
  return true;
 else
  return false;
}

// Parse plugins collection with strings to find
// User has to pass strings to be found in plugin name and description
// Ex. "Shockwave","Flash","5"
function getPlugIn() {
 var allFound = false;
 var plugInsCollection = navigator.plugins;
 for (i=0;i<plugInsCollection.length;i++) {
  // Get plugin description
  plugInDescription = " " + plugInsCollection[i].description;
  plugInName = " " + plugInsCollection[i].name;
  for (j=0;j<arguments.length;j++) {
   if (plugInDescription.indexOf(" " + arguments[j])!=-1 || plugInName.indexOf(" " + arguments[j])!=-1)
    allFound = true;
   else{
    allFound = false;
    break;
   }
  }

  // Send back the search result
  if (allFound){
   return true;
  }
 }
 return false;
}

function popup(url, titre, width, height, loc, menu, resize, scroll,
status, tool){
 var left = (screen.width - width) / 2;
 var top = (screen.height - height) / 2 - 20;
 if(left < 0) left = 0;
 if(top < 0) top = 0;
 var _popup = window.open(url, ''+titre+'', 'width='+width+',height='+height+', top='+top+', left='+left+', location='+loc+',menubar='+menu+', resizable='+resize+', scrollbars='+scroll+',status='+status+', toolbar='+tool+'');
 _popup.focus();
}