 videoListeId = "";
 window.addEvent('domready', function() {	 
 	
 	initVideoListe();
 	}) ;
 	
 	function initVideoListe(){
 		
 		if(videoListeId != ""){
 			
 var videoListePanel = null;
var tabImage = new Array();

creer_structure_videoListe(videoListeId);
 		};

 	};
 	
 	
function creer_structure_videoListe(p){
 // JSON request with data


	
	 var jsonReq = new Request.JSON({
      url: '../php/videoListe.php',
      method: 'post',
      data: {
        json: 'yes'
      },  
      onComplete: function(r){
    // alert (listeDiapos[1].objets[1].id);
    // listeDiapos = R;
      ////console.log (r[0].objets[0].id);
      
    	for(i=0;i<r.length;i++){
	var 	m = r[i].image;
		if(m != ""){
	precharger_image2(m.replace('\/','/'))	;
		};
	};  
      
  videoListePanel = $(p);
  suite2(r);
      }
    });
    
	jsonReq.send();
	
	
	//////console.log("structure..."+p);




//afficherContenuDiapos(0);*/

};

function suite2(r){
listeVid=r;
	//console.log("suite.............."+ videoListePanel);
		 nbrx = (r.length * 120)+120;
		posx =0;
	objetListe ='<div id="back" class="SlideItMoo_back" onClick="javascript:deplacerPremiere()" onMouseOver ="montre1()" onMouseOut ="cache1()" style="	cursor:pointer; position:absolute;background:url(../images/slideitmoo_forward.png) no-repeat center; top:45px;left:632px;width:25px;height:25px;opacity:0.5 "><!--slide back button--></div><div class="SlideItMoo_forward" id="btavance" onClick="javascript:deplacerDerniere()" onMouseOver ="montre2()" onMouseOut ="cache2()" style="cursor:pointer; position:absolute;background:url(../images/slideitmoo_back.png) no-repeat center; top:45px;left:8px;width:25px;height:25px;opacity:0.5  "><!--slide forward button--></div><div id="SlideItMoo_outer"><div id="SlideItMoo_inner" style="width:'+nbrx+'px"><ul id="thumbwrap" class="thumbwrap">';
		
	for(i=0;i<r.length;i++){	
			var im = r[i].image;
		im = im.replace('\/','/');
	im = im.replace('./','/');
		im = im.replace('[','');
				im = im.replace('[','');
objetListe +='<li><div><a href="javascript:playVid('+i+')"><span class="wrimg"><img class="ombrecss" alt="miao01" style="	border: 1px solid #70706F;" src="../../deploy/'+im+'"></span><span class="caption">'+r[i].titre+'</span></a></div></li>';	

//objetListe += '<div class="SlideItMoo_element"><a href="#"  target="_blank"><img src=".'+im+'" /></a>'+r[i].titre+'</div>';	
	}
				
				
objetListe +=		'</ul></div></div>';
 videoListePanel.innerHTML =	objetListe;
 

 myEffect20 = new Fx.Morph("SlideItMoo_inner", {    duration: 250 ,
    transition: Fx.Transitions.Sine.easeOut  
    }); 
//myEffect20.addEvent("complete",deplacerImage);
	  };
	  
	  function playVid(vid){
	  	//console.log("http://www.youtube.com/embed/"+listeVid[vid].src+"?rel=0");
	  	$("youtubePlayer").setProperty("src","http://www.youtube.com/embed/"+listeVid[vid].src+"?rel=0");
	  };
function montre1(){
$("back").setStyle("opacity",1);
}	  
function cache1(){
$("back").setStyle("opacity",0.5);
}		  
function montre2(){
$("btavance").setStyle("opacity",1);
}	  
function cache2(){
$("btavance").setStyle("opacity",0.5);
}
function deplacerDerniere() {
	//console.log("structure1..."+posx);
	//console.log("avance...");

    sens="avance";
    if(posx < 0){
    		posx +=120;
myEffect20.start({    'left': [posx] // Morphs the height from the current to 100px.;});

    };
	}
		
function deplacerImage() {
	if(sens =="avance"){
$$("#thumbwrap li:first-child").inject("thumbwrap","bottom");
	$("SlideItMoo_inner").setStyle("left","0px");
	}else{
			$$("#thumbwrap li:last-child").inject("thumbwrap","top");
	$("SlideItMoo_inner").setStyle("left","0px");
	};
}
		
		
		
		
	function deplacerPremiere() {

    sens="recule";
//console.log("structure2..."+posx);

    if (posx > -(nbrx-(120*6)) ){
    	
    	    posx -= 120;
myEffect20.start({    'left': [posx] // Morphs the height from the current to 100px.;});
    };
	}
function precharger_image2(url)
{

    var img = new Image();
    img.src="."+url;
};



	

