// Title: Fonctions SDS-Manager
// Version: 0.1
// Date: 07/17/2007 (mm/dd/yyyy)
function findobj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&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<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findobj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapimgrestore() { 
  var i,x,a=document.src; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
//  alert ( i + '-' + x + '-' + a ) ;
}

function swapimage() { 
  var i,j=0,x,a=swapimage.arguments; document.src=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findobj(a[i]))!=null){document.src[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function EcrireCookie(nom, valeur)
{
var argv=EcrireCookie.arguments;
var argc=EcrireCookie.arguments.length;
var expires=(argc > 2) ? argv[2] : null;
var path=(argc > 3) ? argv[3] : null;
var domain=(argc > 4) ? argv[4] : null;
var secure=(argc > 5) ? argv[5] : false;
document.cookie=nom+"="+escape(valeur)+
((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
((path==null) ? "" : ("; path="+path))+
((domain==null) ? "" : ("; domain="+domain))+
((secure==true) ? "; secure" : "");
}

function upanddown ( div , img , cache , serie ) {
        chemin = $(img).src.split('/');
        chemin.reverse();
		if ( chemin[5] != '' && chemin[5] != 'http:' && chemin[5] != undefined ) {
	        rep = chemin[5] + '/' + chemin[4] + '/' + chemin[3] + '/' + chemin[2] + '/' + chemin[1] ;
		} else {
			rep = chemin[4] + '/' + chemin[3] + '/' + chemin[2] + '/' + chemin[1] ;
		}
		if ( serie != undefined ) {
			for ( i=1 ; $( serie + i ) != undefined ; i ++ ) { 
				if ( $('img_' + serie + i ).src == rep + '/deplier.png' && $( serie + i ).id != div ) {
					new Effect.BlindUp( serie + i , 0) ;
					$('img_' + serie + i ).src = rep + '/plier.png' ;					
				}
			}
		} else {
			if ( cache != '' ) {
					cachediv = cache.split('.') ;
					for ( i=0 ; cachediv[i] != undefined ; i ++ ) {
							new Effect.BlindUp(cachediv[i], 0) ;
							$('img_' + cachediv[i] ).src = rep + '/plier.png' ;
					}
			}
		}
        if ( chemin [0] == 'plier.png' ) {
                new Effect.BlindDown(div, 0) ;
                $(img).src = rep + '/deplier.png';
        } else {
                new Effect.BlindUp(div, 0) ;
                $(img).src = rep + '/plier.png';
        }
}

function parc_display ( elem ) {
	for ( compteur = 1 ; $( 'park' + compteur ) != undefined ; compteur ++ ) {
		if ( elem == 'park' + compteur ) {
			$( 'park' + compteur ).style.display = 'block' ;
		} else {
			$( 'park' + compteur ).style.display = 'none' ;
		}
	}
}

function MM_controlSound(x, _sndObj, sndFile) { //v3.0
  var i, method = "", sndObj = eval(_sndObj);
  if (sndObj != null) {
    if (navigator.appName == 'Netscape') method = "play";
    else {
      if (window.MM_WMP == null) {
        window.MM_WMP = false;
        for(i in sndObj) if (i == "ActiveMovie") {
          window.MM_WMP = true; break;
      } }
      if (window.MM_WMP) method = "play";
      else if (sndObj.FileName) method = "run";
  } }
  if (method) eval(_sndObj+"."+method+"()");
  else window.location = sndFile;
}

function displayTitleMovie(id) {
        $$('div.titre').each(function (elm) {
                if (!$(elm).hasClassName('display-none') && $(elm).id != id) {
                        $(elm).addClassName('display-none');
                }
        });
        if ($(id).hasClassName('display-none')) $(id).removeClassName('display-none');
}


