var lm100PhotoGallery = {
    panel: null,
    propertyHighlightImagePlayer:null,
      slideShowImages:[],
    initialize: function (slideShowImages) {
                          lm100PhotoGallery.slideShowImages =  slideShowImages;

        if(lm100PhotoGallery.slideShowImages.length>0) {
          lm100PhotoGallery.propertyHighlightImagePlayer = new ImagePlayer(lm100PhotoGallery.slideShowImages, 'galleryImage',{nextButton: yuiDom.get("nextButton"), previousButton: yuiDom.get("previousButton")});
          document.getElementById("photoGallery").style.display = "block";
          //{nextButton: yuiDom.get("nextButton"), previousButton: yuiDom.get("previousButton")}
          yuiEvent.removeListener(yuiDom.get("nextButton"),"click");
          yuiEvent.removeListener(yuiDom.get("previousButton"),"click");
          yuiEvent.addListener(yuiDom.get("nextButton"),"click",lm100PhotoGallery.nextBridge);
          yuiEvent.addListener(yuiDom.get("previousButton"),"click",lm100PhotoGallery.previousBridge);

          yuiEvent.addListener(yuiDom.get("photoGalleryTrigger"),"click",lm100PhotoGallery.showGallery);
          yuiEvent.addListener(yuiDom.get("photoGalleryCloser"),"click",lm100PhotoGallery.hideGallery);
          lm100PhotoGallery.panel = new YAHOO.widget.Panel("photoGallery",
            {
              draggable:false,
              close:false,
              visible:false,
              modal:true,
              constraintoviewport:true,
              fixedcenter: true,
              effect: {effect:YAHOO.widget.ContainerEffect.FADE, duration: 1}
            }
          );
          lm100PhotoGallery.panel.render(document.body);
      }
    },
    showGallery: function() {
      lm100PhotoGallery.panel.show();
    },
    hideGallery: function() {
        lm100PhotoGallery.panel.hide();
    },
    nextBridge: function(e) {
      var imageIndex = lm100PhotoGallery.propertyHighlightImagePlayer.next();
        // do your stuff after that call
//      alert(lm100PhotoGallery.propertyHighlightImagePlayer.currentIndex);
      yuiDom.get("currentIndex").innerHTML = (imageIndex+1);
    },
    previousBridge: function(e){
      var imageIndex = lm100PhotoGallery.propertyHighlightImagePlayer.previous();
         yuiDom.get("currentIndex").innerHTML = (imageIndex+1);

    }
}
yuiEvent.onDOMReady(function(){lm100PhotoGallery.initialize(lm100PhotoGallery.slideShowImages)});


