// ########## HIGHSLIDE addSlideshow ##########

hs.addSlideshow({
  slideshowGroup: 'group1',
  interval: 5000,
  repeat: false,
  useControls: true,
  fixedControls: true,
  overlayOptions: {
    opacity: .6,
    position: 'top center',
    hideOnMouseOut: true
  }
});

// ########## HIGHSLIDE onSetClickEvent ##########

hs.onSetClickEvent = function ( sender, e ) {
  switch(e.type){
    case undefined :
      // Case thumbnail
      var slideshow = e.element.className.match(/slideshow/);
      var inlineContent = e.element.className.match(/inlineContent/);
      if (slideshow) {
        // Case slideshow
        e.element.onclick = function () {
          return hs.expand(this, { outlineType: 'rounded-white', slideshowGroup: 'group1', align: 'center', dimmingOpacity: '0.75', transitions: ['expand', 'crossfade'] });
        }
      }
      else if (inlineContent) {
        // Case slideshow
        e.element.onclick = function () {
          return hs.htmlExpand(this, { outlineType: 'rounded-white', contentId: 'highslide_html', width: '650' });
        }
      }
      else{
        // Case greybox like
        e.element.onclick = function () {
          return hs.expand(this, { outlineType: 'rounded-white' });
        }
      }
    break;
    case 'iframe' :
      // Case iframe
      var match = e.element.className.match(/hs_big/);
      var map = e.element.className.match(/a_location/);
      var a_video = e.element.className.match(/a_video/);
      var a_cgv = e.element.className.match(/cgv/);
      if (match) {
        e.element.onclick = function () {
          return hs.htmlExpand(this, { objectType: 'iframe', outlineType: 'glossy-dark', height: '470' });
        }
      }
      else if (map) {
        e.element.onclick = function () {
          return hs.htmlExpand(this, { objectType: 'iframe', outlineType: 'rounded-white', dimmingOpacity: '0.75', height: '450',  width: '600', align: 'center' });
        }
      }
      else if (a_video) {
        e.element.onclick = function () {
          return hs.htmlExpand(this, { objectType: 'iframe', outlineType: 'rounded-white', dimmingOpacity: '0.75', height: '450',  width: '600', align: 'center' });
        }
      }
      else if (a_cgv) {
        e.element.onclick = function () {
          return hs.htmlExpand(this, { objectType: 'iframe', outlineType: 'rounded-white', dimmingOpacity: '0.75', height: '650',  width: '700', align: 'center' });
        }
      }
      else{
        e.element.onclick = function () {
          return hs.htmlExpand(this, { objectType: 'iframe', outlineType: 'glossy-dark', height: '75', anchor: 'top left' });
        }
      }
    break;
  }
  // return false to prevent the onclick being set once again
  return false;
}
function openHs(){
  hs.htmlExpand(document.getElementById('highslide_html'), { outlineType: 'rounded-white', contentId: 'highslide_html', width: '650', align: 'center'});
}
