addListenner(window,"load",installGalleryLightbox,true);function installGalleryLightbox()
{var linklist=document.getElementsByTagName('a');for(var i=0;i<linklist.length;i++){if(/gallery-lightbox/.test(linklist[i].className)){linklist[i].onclick=openGalleryLightbox;}}}
function openGalleryLightbox()
{var oData={};oData['xhrAction']='lireFichiers';oData['type']='image';oData['st']=0;if(this.className.indexOf('gallery-all')>=0){oData['globale']=1;}
XHR_post(document.location.href,oData,showGalleryLighBox);return false;}
function buildGalleryHeader(oData)
{var headerBox=document.createElement('div');headerBox.className='galerieHotelHeader';var logoSrc='img/slideflow/transparent.gif';if(oData['hotel']&&oData['hotel']['logo']){logoSrc=oData['upload-dir']+oData['hotel']['logo'][0]['zoom_src'];}else if(oData['fichiers']&&oData['fichiers'][0]){var hotelId=oData['fichiers'][0]['hotel_id'];if(oData['hotel'][hotelId]&&oData['hotel'][hotelId]['logo'][0]){logoSrc=oData['upload-dir']+oData['hotel'][hotelId]['logo'][0]['zoom_src'];}}
var codeHtml='';codeHtml+='<div class="galerieHotelMenu">';codeHtml+='    <a href="#" id="galerieHotelLienFermer">';var langueCourante=document.getElementById('langueCourante');if(langueCourante&&langueCourante.innerHTML&&langueCourante.innerHTML!='FR'){codeHtml+='         Close';}else{codeHtml+='         Fermer';}
codeHtml+='    </a>';codeHtml+='</div>';codeHtml+='<div class="galerieHotelLogo';if(logoSrc===false){codeHtml+=' cacher';}
codeHtml+='">';codeHtml+='    <img src="'+logoSrc+'" alt="" id="galerieHotelLogo" />';codeHtml+='</div>';headerBox.innerHTML=codeHtml;return headerBox;}
function buildGalleryFooter(oData)
{var langueCourante=document.getElementById('langueCourante');var codeHtml='';codeHtml+='    <a href="#" class="actif" id="galerieHotelLienPhotos">';if(langueCourante&&langueCourante.innerHTML&&langueCourante.innerHTML!='FR'){codeHtml+='photo gallery';}else{codeHtml+='Galerie photo';}
codeHtml+='</a>';if(oData['totalVideos']>0){codeHtml+='    <a href="#" id="galerieHotelLienVideos">';if(langueCourante&&langueCourante.innerHTML&&langueCourante.innerHTML!='FR'){codeHtml+='video gallery';}else{codeHtml+='Galerie vidéo';}
codeHtml+='</a>';}
return codeHtml;}
function addGalleryThumb(oData,miniList)
{var count=0;for(var i in oData['fichiers']){link=document.createElement('a');link.id='fichier-'+oData['fichiers'][i]['SPTE_id'];link.title=oData['fichiers'][i]['SPTT_legende'];link.legende='';var hotelId=0;var logoSrc='img/slideflow/transparent.gif';var legende=oData['fichiers'][i]['SPTT_legende'];if(oData['fichiers'][i]['hotel_id']){hotelId=oData['fichiers'][i]['hotel_id'];if(oData['hotel'][hotelId]){legende+='<br /><a href="hotel-accueil.php?hotel='+hotelId+'">';legende+=oData['hotel'][hotelId]['HO_nom'];legende+='</a>';if(oData['hotel'][hotelId]['logo']&&oData['hotel'][hotelId]['logo'][0]['zoom_src']){logoSrc=oData['upload-dir']+oData['hotel'][hotelId]['logo'][0]['zoom_src'];}}}
link.legende=legende;link.logoSrc=logoSrc;link.description='';if(oData['fichiers'][i]['label']&&oData['fichiers'][i]['label'].length>2){link.description=oData['fichiers'][i]['label'];}
link.legendeFichier='';if(oData['fichiers'][i]['SPTT_legende']&&oData['fichiers'][i]['SPTT_legende'].length>2){link.legendeFichier=oData['fichiers'][i]['SPTT_legende'];}
img=document.createElement('img');if(oData['fichiers'][i]['SPTE_extension']=='swf'||oData['fichiers'][i]['SPTE_extension']=='flv'){link.href=oData['upload-dir']+oData['fichiers'][i]['SPTE_nom_fichier'];if(oData['fichiers'][i]['SPTE_apercu_video']){img.src=oData['upload-dir']+oData['fichiers'][i]['SPTE_apercu_video'];link.onmouseover=ocea_afficherGalleryVideo;link.onclick=function(){return false;};}else{img.src=oData['images-dir']+'photoBonPlan.jpg';link.onmouseover=ocea_afficherGalleryVideo;link.onclick=function(){return false;};}}else if(oData['fichiers'][i]['mini_src']){link.href=oData['upload-dir']+oData['fichiers'][i]['zoom_src'];img.src=oData['upload-dir']+oData['fichiers'][i]['mini_src'];link.onclick=function(){return false;};link.onmouseover=ocea_afficherGalleryLBImg;}
img.width='87';img.height='46';link.appendChild(img);miniList.appendChild(link);count++;if(count==4){count=0;link=document.createElement('div');link.className='lineBreaker';miniList.appendChild(link);}}
var link=document.getElementById('galerieHotelPagePrecedente');var link2=document.getElementById('galerieHotelPageSuivante');if(oData['total']>20){removeClass(link,'cacher');removeClass(link2,'cacher');}else{addClass(link,'cacher');addClass(link2,'cacher');}}
function buildGalleryZoomPlace(zoomBox,oData,fileSrc)
{zoomBox.innerHTML='';img=document.createElement('img');if(oData){img.src=oData['upload-dir']+oData['fichiers'][0]['zoom_src'];}else if(fileSrc){img.src=fileSrc;}
img.id='galerieHotelZoomLB';zoomBox.appendChild(img);img=document.createElement('img');if(oData){img.src=oData['upload-dir']+oData['fichiers'][0]['zoom_src'];}else if(fileSrc){img.src=fileSrc;}
img.id='galerieHotelZoomLB2';zoomBox.appendChild(img);var legende='';var logoSrc='img/slideflow/transparent.gif';if(oData){if(oData['fichiers'][0]['SPTT_legende']){legende=oData['fichiers'][0]['SPTT_legende'];}
if(oData['fichiers'][0]['hotel_id']){hotelId=oData['fichiers'][0]['hotel_id'];if(oData['hotel'][hotelId]){legende+='<br /><a href="hotel-accueil.php?hotel='+hotelId+'">';legende+=oData['hotel'][hotelId]['HO_nom'];legende+='</a>';if(oData['hotel'][hotelId]['logo']&&oData['hotel'][hotelId]['logo'][0]['zoom_src']){logoSrc=oData['upload-dir']+oData['hotel'][hotelId]['logo'][0]['zoom_src'];}}}}
var legendeBox=document.createElement('div');legendeBox.className='galerieLegendeBox';legendeBox.id='galerieLegendeBox';if(oData&&legende&&legende.length>2){legendeBox.innerHTML=legende;}else{legendeBox.className+=' cacher';}
zoomBox.appendChild(legendeBox);var blocLogo=document.getElementById('galerieHotelLogo');if(blocLogo){if(logoSrc){blocLogo.src=logoSrc;addClass(blocLogo.parentNode,'cacher');}else{blocLogo.src='img/slideflow/transparent.gif';addClass(blocLogo.parentNode,'cacher');}}}
function buildGalleryMedias(oData)
{var medias=document.createElement('div');medias.className='container galerieHotelMedias';link=document.createElement('a');link.href='#';link.id='galerieHotelPagePrecedente';link.title='page précédente';link.onclick=goPrevGalleryPage;if(oData['total']<=20){link.className='cacher';}
medias.appendChild(link);var miniList=document.createElement('div');miniList.className='container galerieHotelVignettes';miniList.id='galerieHotelVignettes';addGalleryThumb(oData,miniList);miniList.firstChild.className+=' actif';medias.appendChild(miniList);var zoomBox=document.createElement('div');zoomBox.className='galerieHotelZoom';zoomBox.id='galerieHotelZoomPlace';buildGalleryZoomPlace(zoomBox,oData);medias.appendChild(zoomBox);link=document.createElement('a');link.href='#';link.id='galerieHotelPageSuivante';link.title='page suivante';link.onclick=goNextGalleryPage;if(oData['total']<=20){link.className='cacher';}
medias.appendChild(link);return medias;}
function buildGalleryLighBox(oData)
{if(!oData||!oData['data']){return false;}
oData=oData['data'];var img,link;var mainBox=document.createElement('div');mainBox.className='container galerieHotelLightBox';mainBox.id='galerieHotelLightBox';mainBox.start=0;mainBox.totalPerPage=20;mainBox.total=oData['total'];mainBox.pageNb=Math.ceil(mainBox.total/mainBox.totalPerPage);mainBox.actif=false;mainBox.mode='photos';mainBox.global=1;if(oData['hotel']&&oData['hotel']['logo']){mainBox.global=0;}
mainBox.appendChild(buildGalleryHeader(oData));mainBox.appendChild(buildGalleryMedias(oData));infoType=document.createElement('div');infoType.id='galerieHotelDescription';infoType.className='galerieHotelDescription';if(oData['fichiers'][0]['label']&&oData['fichiers'][0]['label'].length>2){infoType.innerHTML=oData['fichiers'][0]['label'];}
mainBox.appendChild(infoType);var infoType=document.createElement('div');infoType.className='galerieHotelFooter';infoType.innerHTML=buildGalleryFooter(oData);mainBox.appendChild(infoType);return mainBox;}
function showGalleryLighBox(oData)
{var mainBox=buildGalleryLighBox(oData);var options={content:mainBox,width:'945px',closeId:'galerieHotelLienFermer'};var lightBox=createLightBoxHtml('spg_lightBoxBackground','spg_lightBox',options);var link=document.getElementById('galerieHotelLienPhotos');if(link){link.onclick=switchToPhotos;}
var link=document.getElementById('galerieHotelLienVideos');if(link){link.onclick=switchToVideos;}
adaptLightboxPosAndSize(lightBox);}
function switchToPhotos()
{var mainBox=document.getElementById('galerieHotelLightBox');mainBox.start=0;mainBox.mode='photos';var link=document.getElementById('galerieHotelLienVideos');addClass(this,'actif');if(link){removeClass(link,'actif');}
var oData={};oData['xhrAction']='lireFichiers';oData['type']='image';oData['st']=mainBox.start;if(mainBox.global){oData['globale']=1;}
XHR_post(document.location.href,oData,refreshGalleryLighBox);return false;}
function switchToVideos()
{var mainBox=document.getElementById('galerieHotelLightBox');mainBox.start=0;mainBox.mode='videos';var link=document.getElementById('galerieHotelLienPhotos');addClass(this,'actif');if(link){removeClass(link,'actif');}
var oData={};oData['xhrAction']='lireFichiers';oData['type']='video';oData['st']=mainBox.start;if(mainBox.global){oData['globale']=1;}
XHR_post(document.location.href,oData,refreshGalleryLighBox);return false;}
function refreshGalleryLighBox(oData)
{if(!oData||!oData['data']){return false;}
oData=oData['data'];var miniList=document.getElementById('galerieHotelVignettes');while(miniList.firstChild){miniList.removeChild(miniList.firstChild);}
addGalleryThumb(oData,miniList);if(miniList.firstChild){if(miniList.firstChild.onclick){miniList.firstChild.onclick();}else if(miniList.firstChild.onmouseover){miniList.firstChild.onmouseover();}}
var lightBox=document.getElementById('spg_lightBox');adaptLightboxPosAndSize(lightBox);return false;}
function goPrevGalleryPage()
{var mainBox=document.getElementById('galerieHotelLightBox');if(mainBox.start<=0){mainBox.start=(mainBox.pageNb-1)*mainBox.totalPerPage;}else{mainBox.start-=mainBox.totalPerPage;}
var oData={};oData['xhrAction']='lireFichiers';oData['type']='image';if(mainBox.mode=='videos'){oData['type']='video';}
if(mainBox.global){oData['globale']=1;}
oData['st']=mainBox.start;XHR_post(document.location.href,oData,refreshGalleryLighBox);return false;}
function goNextGalleryPage()
{var mainBox=document.getElementById('galerieHotelLightBox');if((mainBox.start+mainBox.totalPerPage)>mainBox.total){mainBox.start=0;}else{mainBox.start+=mainBox.totalPerPage;}
var oData={};oData['xhrAction']='lireFichiers';oData['type']='image';if(mainBox.mode=='videos'){oData['type']='video';}
if(mainBox.global){oData['globale']=1;}
oData['st']=mainBox.start;XHR_post(document.location.href,oData,refreshGalleryLighBox);return false;}
function ocea_afficherGalleryVideo()
{var blocNouv=document.getElementById('galerieHotelLightBox');var extension=this.href.split('.').pop();var image=this.getElementsByTagName('img');var zoomPlace=document.getElementById('galerieHotelZoomPlace');if(!zoomPlace){return false;}
var codeVideo='';var flashVar='file='+this.href;if(image[0]&&image[0].src){flashVar+='&image='+image[0].src;}
var width=559;var height=300;var playerSrc='flash/mediaplayer.swf';codeVideo+='<div class="objetVideo">';codeVideo+='<object id="player-5646498djdfdsf654" classid="clsid:D27CDB6E-AE6D-11cf-96B8-5646498djdfdsf654"';codeVideo+='        name="player" width="'+width+'" height="'+height+'">';codeVideo+='    <param name="movie" value="'+playerSrc+'" />';codeVideo+='    <param name="allowfullscreen" value="true" />';codeVideo+='    <param name="allowscriptaccess" value="always" />';codeVideo+='    <param name="flashvars" value="'+flashVar+'" />';codeVideo+='    <param name="WMODE" value="Transparent" />';codeVideo+='    <embed';codeVideo+='        type="application/x-shockwave-flash"';codeVideo+='        id="player-5646498djdfdsf654"';codeVideo+='        name="player2-5646498djdfdsf654"';codeVideo+='        src="'+playerSrc+'"';codeVideo+='        quality="high"';codeVideo+='        bgcolor="#ffffff"';codeVideo+='        width="'+width+'"';codeVideo+='        height="'+height+'"';codeVideo+='        allowscriptaccess="always"';codeVideo+='        allowfullscreen="true"';codeVideo+='        WMODE="Transparent"';codeVideo+='        flashvars="'+flashVar+'" />';codeVideo+='</object>';codeVideo+='</div>';blocNouv.legende=false;if(this.legendeFichier&&this.legendeFichier.length>4){codeVideo+='<div class="galerieHotelDescription descriptionVideo" id="galerieHotelDescription">';codeVideo+=this.legendeFichier;codeVideo+='</div>';}
blocNouv.logoSrc='img/slideflow/transparent.gif';if(this.logoSrc&&this.logoSrc.length>2){blocNouv.logoSrc=this.logoSrc;}
blocNouv.description=false;ocea_refreshTexts();if(!blocNouv.indexActif){var miniList=document.getElementById('galerieHotelVignettes');blocNouv.indexActif=miniList.firstChild.id;}
if(blocNouv.indexActif){var actif=document.getElementById(blocNouv.indexActif);removeClass(actif,'actif');}
addClass(this,'actif');blocNouv.indexActif=this.id;zoomPlace.innerHTML=codeVideo;return false;}
function ocea_afficherGalleryLBImg()
{var blocNouv=document.getElementById('galerieHotelLightBox');if(blocNouv.showTimer){clearTimeout(blocNouv.showTimer);}
var that=this;blocNouv.showTimer=setTimeout(ocea_attendreGalleryLBImg,400);function ocea_attendreGalleryLBImg()
{var blocNouv=document.getElementById('galerieHotelLightBox');blocNouv.legende=false;if(that.legende&&that.legende.length>4){blocNouv.legende=that.legende;}
blocNouv.logoSrc='img/slideflow/transparent.gif';if(that.logoSrc&&that.logoSrc.length>2){blocNouv.logoSrc=that.logoSrc;}
blocNouv.description=false;if(that.description&&that.description.length>2){blocNouv.description=that.description;}
if(!blocNouv.indexActif){var miniList=document.getElementById('galerieHotelVignettes');blocNouv.indexActif=miniList.firstChild.id;}
if(blocNouv.indexActif){var actif=document.getElementById(blocNouv.indexActif);removeClass(actif,'actif');}
addClass(that,'actif');blocNouv.indexActif=that.id;if(that.href){blocNouv.preloadImg=new Image();blocNouv.preloadImg.onload=ocea_changerGalleryLBImg;blocNouv.preloadImg.src=that.href;}
return false;}}
function ocea_changerGalleryLBImg()
{var blocNouv=document.getElementById('galerieHotelLightBox');if(blocNouv.preloadImg&&!blocNouv.preloadImg.complete){setTimeout('ocea_changerGalleryLBImg()',50);return false;}
var img=document.getElementById('galerieHotelZoomLB');var img2=document.getElementById('galerieHotelZoomLB2');if(!img&&!img2){var zoomPlace=document.getElementById('galerieHotelZoomPlace');buildGalleryZoomPlace(zoomPlace,false,blocNouv.preloadImg.src);img=document.getElementById('galerieHotelZoomLB');img2=document.getElementById('galerieHotelZoomLB2');}
if(!img2){return false;}
img2.src=img.src;img2.style.visibility='visible';if(blocNouv.preloadImg.src&&img&&img.src){img.src=blocNouv.preloadImg.src;}
ocea_refreshTexts();img2.style.opacity=1;img2.style.filter='alpha(opacity=100)';blocNouv.fadeInterval=setInterval('ocea_disapearGalleryLBImg()',70);img.onmouseover=function(){var blocNouv=document.getElementById('galerieHotelLightBox');if(blocNouv.showTimer){clearTimeout(blocNouv.showTimer);}
return false;};img2.onmouseover=img.onmouseover;}
function ocea_refreshTexts()
{var blocNouv=document.getElementById('galerieHotelLightBox');var blocLegende=document.getElementById('galerieLegendeBox');if(blocLegende){if(blocNouv.legende){blocLegende.innerHTML=blocNouv.legende;removeClass(blocLegende,'cacher');}else{blocLegende.innerHTML='';addClass(blocLegende,'cacher');}}
var blocLogo=document.getElementById('galerieHotelLogo');if(blocLogo&&blocNouv.logoSrc&&blocNouv.logoSrc.length>2){blocLogo.src=blocNouv.logoSrc;removeClass(blocLogo.parentNode,'cacher');}else{blocLogo.src='img/slideflow/transparent.gif';addClass(blocLogo.parentNode,'cacher');}
var infoType=document.getElementById('galerieHotelDescription');if(infoType){if(blocNouv.description!==false){infoType.innerHTML=blocNouv.description;removeClass(infoType,'cacher');}else{infoType.innerHTML='';addClass(infoType,'cacher');}}}
function ocea_disapearGalleryLBImg()
{var blocNouv=document.getElementById('galerieHotelLightBox');var img2=document.getElementById('galerieHotelZoomLB2');if(!img2){return false;}
img2.style.opacity-=.2;img2.style.filter='alpha(opacity='+(img2.style.opacity*100)+')';if(img2.style.opacity<=0){img2.style.opacity=1;img2.style.filter='alpha(opacity=100)';clearInterval(blocNouv.fadeInterval);img2.style.visibility='hidden';}}
