// JavaScript Document

function affichePortfolio(products_id,vignette_id, site)

{

     var photos = document.getElementById('portfolio_img_small_'+products_id);

     var liens = photos.getElementsByTagName('a');



     var big_photo = document.getElementById('premiere_image_'+products_id);

     var lien_photo = document.getElementById('zoom-pict_'+products_id) ;

     var lien2_photo = document.getElementById('zoom-pict2_'+products_id) ;

	

     for (var i=0 ; i < liens.length ; i++)
     {

          // Au clique sur ces liens

          if ( i == vignette_id )

          {

               if ( big_photo != null )

               {
					//console.log('big_photo is not null');
                    //big_photo.src = liens[i].href;

                    big_photo_src = liens[i].href;
					 lien_photo.title = liens[i].title;
					//console.log('SRC Current : '+big_photo_src);
                    big_photo_src_1_modif = big_photo_src.replace ('http://'+site+'/images/products/', "");

                         big_photo_src_2_modif = big_photo_src.replace ('http://'+site, "");

//alert(big_photo_src_1_modif);

//alert(big_photo_src_2_modif);

                         big_photo.src = 'image.php/'+big_photo_src_1_modif+'?image='+big_photo_src_2_modif;
						 
					//console.log('SRC Next : image.php/'+big_photo_src_1_modif+'?width=288&height=384&image='+big_photo_src_2_modif);
                         

                    big_photo.alt = liens[i].title;

               }



               if ( lien_photo != null )

               {

                    

                    var monhref = liens[i].href; // Je crée monhref pour retravailler la chaîne de caractères

                         //monhref = monhref.replace (/180.jpg/, "500.jpg"); // Je remplace l'extension .jpg par -b.jpg pour appeler l'image grand format

                         //lien_photo.href = liens[i].href;

                         lien_photo_href = liens[i].href;

                         //lien1_modif = monhref.replace ('http://'+site+'/images/products/', "");

                         lien_photo_2_modif = lien_photo_href.replace ('http://'+site+'/', "");

                         //lien2_photo.href = '/image.php/'+lien1_modif+'?width=180&amp;height=180&amp;image='+lien2_modif;

                         lien_photo.href = lien_photo_2_modif;



               }

               if ( lien2_photo != null )

               {



                    var monhref = liens[i].href; // Je crée monhref pour retravailler la chaîne de caractères

                         //lien2_photo.href = liens[i].href;

                         monhref = liens[i].href;

                         //lien1_modif = monhref.replace ('http://'+site+'/images/products/', "");

                         lien2_modif = monhref.replace ('http://'+site+'/', "");

                         //lien2_photo.href = '/image.php/'+lien1_modif+'?width=180&amp;height=180&amp;image='+lien2_modif;

                         //lien2_photo.href = '#'+vignette_id;
						 lien2_photo.href = lien2_modif;



               }

               var class_vignette = "current";

          }

          else

          {

               var class_vignette = "";

          }



          document.getElementById("vignette_"+products_id+"_"+i+"").className = class_vignette;

     }



     // un return false; doit être mis en place dans la page html avec le lien <a onclick

}


