
$(document).ready(function() {  
  loadGallery('.gallerytn3'); 
});

function google_code_photos(){
  _gaq.push(['_trackEvent', 'Photos', 'Clic']);
  //alert('google done');
}

/*
 function google_code_photos(){
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-23215072-1']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  //alert('google done');
}
*/

function remp_code_photos(){
  var NETMX="http://nouvell.wemfbox.ch/cgi-bin/ivw/CP/News/Photos";
  //document.write("<img src=\""+NETMX+"?r="+escape(document.referrer)+"&d="+(Math.random()*100000)+"&x="+screen.width+"x"+screen.height+"\" width=\"1\" height=\"1\" alt=\"\" />");
  $("#remp").append("<img src=\""+NETMX+"?r="+escape(document.referrer)+"&d="+(Math.random()*100000)+"&x="+screen.width+"x"+screen.height+"\" width=\"1\" height=\"1\" alt=\"\" />");
  //alert('remp done');
}

function loadImageProcess(image){
  //alert('IMAGE LOADED : '+image);

  google_code_photos();
  remp_code_photos();
  reload_pub();

}

function loadGallery(elem){

  tn1 = $(elem).tn3({
    skinDir:"/libraries/js/tn3gallery/skins",
    /*imageClick:"fullscreen",*/
    imageClick:"next",
    width:660,
    height:614,
    skin:"tn3e", 
    autoplay:false,
    mouseWheel: false,

    //load_end:testload(),

    image: { 
      
      maxZoom:1.5,
      crop:false,
      clickEvent:"click",
      overMove: false,
      
      transition: 
        function(e) { 
          //alert(this.$active.find("img").attr("src")); 
          loadImageProcess(this.$active.find("img").attr("src"));
        }, 
  
      defaultTransition:{
        type:"slide",
        duration:500,
      }
      
    },

    /*image:{
      maxZoom:1.5,
      crop:false,
      clickEvent:"dblclick",
      transitions:[
        {
          type:"blinds"
        },
        { 
        alert(this.$active.find("img").attr("src")); 
        }, 
        {
          type:"grid"
        },
        {
          type:"grid",
          duration:460,
          gridX:1,
          gridY:8,
          sort:"random",
          method:"scale",
          partDuration:360
        }
      ],
      defaultTransition:{
        type:"slide",
        duration:500,
      }
    },*/
    thumbnailer: {
      overMove: false
    }
  });

}

