// JavaScript Document
function goResa( page ) {
n = window.open( page, 'reserver', 'width=800, height=600, top=0, left=0, scrollbars=1, resizable=1' ) ;
n.focus() ;
}
function getOffsetPosition( elt, attr )
{
var i = 0;
var obj = document.getElementById( elt );
var s = 'obj.offset' + attr ;
while (obj && obj.tagName != 'BODY') {
i += eval(s);
obj = obj.offsetParent ;
}
return i;
}
function $( id )
{
return document.getElementById( id ) ;
}
eltAffiche = "" ;
//////////////////////////////////////
objMessage = function ( libele, idLibele, idParent, idPhoto, idSaison, nbPhoto, textTitle )
{
this.libele = libele ;
this.idLibele = idLibele ;
this.idParent = idParent ;
this.nbPhoto = nbPhoto ;
this.idPhoto = idPhoto ;
this.idSaison = idSaison ;
this.textTitle = textTitle ;
}
objMessage.prototype.creer = function()
{
var divTitre = document.getElementById(this.idParent) ;
this.div = document.createElement ("div") ;
this.div.innerHTML = this.libele ;
this.div.className = "titrePhoto" ; ;
this.div.setAttribute("id",this.idLibele) ;
divTitre.appendChild(this.div) ;
this.div.nbLien = eval ( this.nbPhoto + 1 ) ;
this.div.prefixe = this.idPhoto ;
this.div.saison = this.idSaison ;
this.div.textCloseTitle = this.textTitle ;
this.div.onmousedown = function()
{
var c = $('calque') ;
if ( c.style.display != "block" || eltAffiche != this.id ) {
c.style.display = "block" ;
c.innerHTML = '' ;
eltAffiche = this.id ;
var d = $( this.getAttribute("id") ) ;
c.style.left = eval( getOffsetPosition( d.id, 'Left') + 120 ) + 'px' ;
c.style.top = eval( getOffsetPosition( d.id, 'Top') - 180 ) + 'px' ;
for ( var p = 1; p < this.nbLien ; p++ )
{
if ( p == 1 )
{
this.photo = document.createElement('img') ;
this.photo.setAttribute( "src", urlSite + "/photos/"+this.prefixe + "-" + this.saison + "-0" + p + "-290x218.jpg" ) ;
this.photo.setAttribute( "id", "photo" ) ;
c.appendChild( this.photo ) ;
this.sep = document.createElement('br') ;
c.appendChild( this.sep ) ;
}
this.lien = document.createElement('a') ;
this.lien.setAttribute("href","javascript:changeImage("+this.prefixe+","+this.saison+","+p+");") ;
this.textLien = document.createTextNode( "[" + p + "]" ) ;
this.lien.appendChild( this.textLien ) ;
c.appendChild( this.lien ) ;
}
this.lienClose = document.createElement('a') ;
this.lienClose.setAttribute("href","javascript:closePhoto();") ;
this.lienClose.setAttribute("title", this.textCloseTitle ) ;
this.lienClose.className = "fermer" ;
this.textLienClose = document.createTextNode( wordingFermer ) ;
this.lienClose.appendChild ( this.textLienClose ) ;
c.appendChild ( this.lienClose ) ;
} else {
c.style.display = "none" ;
eltAffiche = '' ;
c.innerHTML = '' ;
}
}
}
function changeImage( idPhoto, idSaison, nmPhoto )
{
image = $( "photo" ) ;
if ( nmPhoto < 10 ) nmPhoto = '0' + nmPhoto ;
image.src = urlSite + "/photos/" + idPhoto + "-" + idSaison + "-" + nmPhoto + "-290x218.jpg" ;
}
function closePhoto() {
$ ("calque").style.display = "none" ;
}
function masquerTout(d) {
var div = document.getElementsByTagName('div') ;
var lengthDiv = div.length ;
for ( var i= 0; i < lengthDiv; i++ ) {
if (div[i].className == 'visible' && div[i]!=document.getElementById(d) ) {
div[i].className = 'invisible' ;
if ( document.getElementById('titre'+div[i].id) ) document.getElementById('titre'+div[i].id).className='off pointer';
}
}
}
function afficherDiv (d) {
var exp_reg = new RegExp( "(fr|en|es|it|es|ma|tu)" , "i" ) ;
if ( d.match(exp_reg) ) masquerTout(d) ;
if ( document.getElementById(d).className == 'visible' ) {
document.getElementById(d).className = 'invisible' ;
if ( document.getElementById('titre'+d) ) document.getElementById('titre'+d).className = 'off pointer' ;
} else {
if ( document.getElementById('titre'+d) ) document.getElementById('titre'+d).className = 'on pointer' ;
document.getElementById(d).className = 'visible';
}
}
function changeCarte( swf, aflash )
{
var monswf = $(swf);
if ( monswf ) {
if ( monswf.PercentLoaded() == 100 )
{
monswf.GotoFrame(0);
for ( var i = 0 ; i < aflash.length ; i+= 2 )
{
monswf.SetVariable(aflash[i], aflash[i+1]);
}
}
}
}
function setCarte( elt, div )
{
var nbrLien = document.getElementById( elt ).getElementsByTagName('a') ;
for ( var i = 0 ; i < nbrLien.length ; i++)
{
nbrLien[i].onmouseover = function()
{
changeCarte( 'carto', new Array('carteDefaut',''+ div +'','idRegionDefaut',''+this.id+'') ) ;
}
nbrLien[i].onmouseout = function()
{
changeCarte( 'carto', new Array('carteDefaut',''+ div +'','idRegionDefaut','') ) ;
}
}
}
// RECHERCHE
var data = saisonEte.destinations ;
oldValue = '' ;
function initSearch(m) {
$('choixDest').innerHTML = '' ;
$('choixDest').style.display = 'none' ;
tab = 0 ;
optionSelectionne = -1 ;
oldMot = m ;
document.forms['fNat'].elements['vSearch'].value = oldValue ;
}
function searchMot ( m ) {
initSearch( m ) ;
var accent = new RegExp( "[îéèêàöôâû]" , "i" ) ;
if ( m.match(accent) ) sansAccent() ;
if ( m.length > 1 )
{
var exp_reg = new RegExp( "^((.{0,32}('|\\s|-)+)?"+m+")" , "i" ) ;
for ( i=0; i < data.length; i++ )
{
var dataVille = data[i].v.replace("'","\\'") ;
var dataResidence = data[i].r.replace("'","\\'") ;
var dataValue = data[i].o ;
if ( m.toUpperCase() == dataVille.toUpperCase() ) {
setCombo(m,dataValue) ;
oldValue = dataValue ;
}
if ( data[i].v.match(exp_reg) ) {
if ( dataResidence.length > 3 )
{
if ( dataResidence.length > 40 ) {
var texteRetour = dataVille + ' - ' + dataResidence.substring(0,40) + '...' ;
} else {
var texteRetour = dataVille + ' - ' + dataResidence ;
}
} else {
var texteRetour = dataVille ;
}
$('choixDest').innerHTML += ''+texteRetour.replace("\\","")+'' ;
setCombo(m,dataValue) ;
oldValue = dataValue ;
tab++ ;
}
}
}
if ( m.length > 3 && tab == 0 ) nonTrouve() ;
if ( $('choixDest').innerHTML != '' ) $('choixDest').style.display = 'block' ;
}
var lastTouche = null ;
var toucheAppuye = function( event ) {
if ( !event && window.event ) event = window.event ;
if ( event ) lastTouche = event.keyCode ;
if ( ( lastTouche == 40 || lastTouche == 38 || lastTouche == 13 || lastTouche == 3 ) && tab > 0 ) { surLigne() ; return false ; }
}
function nonTrouve() {
$('choixDest').innerHTML = ''+wordingSearch+'' ;
document.forms['fNat'].elements['vSearch'].value = oldValue = '' ;
}
function sansAccent() {
$('choixDest').innerHTML = ''+wordingAccent+'' ;
oldValue = '' ;
}
function surLigne() {
document.fNat.comboSearch.blur() ;
if ( lastTouche == 40 && optionSelectionne < tab -1 ) {
optionSelectionne ++ ;
$('choixDest').childNodes[optionSelectionne].style.backgroundColor = '#036' ;
$('choixDest').childNodes[optionSelectionne].style.color = '#FFF' ;
if ( optionSelectionne > 0 ) {
$('choixDest').childNodes[optionSelectionne - 1].style.backgroundColor = '#FFC' ;
$('choixDest').childNodes[optionSelectionne - 1].style.color = '#06C' ;
}
}
if ( lastTouche == 38 && optionSelectionne > 0 ) {
optionSelectionne -- ;
$('choixDest').childNodes[optionSelectionne].style.backgroundColor = '#036' ;
$('choixDest').childNodes[optionSelectionne].style.color = '#FFF' ;
if ( optionSelectionne < tab ) {
$('choixDest').childNodes[optionSelectionne + 1].style.backgroundColor = '#FFC' ;
$('choixDest').childNodes[optionSelectionne + 1].style.color = '#06C' ;
}
}
if ( optionSelectionne > -1 ) {
var valeurSearch = $('choixDest').childNodes[optionSelectionne].name.toString() ;
var contenu = $('choixDest').childNodes[optionSelectionne].id.toString() ;
} else {
var valeurSearch = document.forms['fNat'].elements['vSearch'].value ;
var contenu = oldMot ;
}
if ( optionSelectionne > -1 ) setCombo( unescape(contenu),valeurSearch ) ;
if ( lastTouche == 13 || lastTouche == 3 ) { setCombo( unescape(contenu),valeurSearch ) ; goPage() ; return false ; }
if ( lastTouche == 38 && optionSelectionne == 0 ) { setCombo( oldMot,valeurSearch ) ; eraseSearch() ; }
document.fNat.sendMot.focus() ;
}
function setCombo(i,v) {
document.forms['fNat'].elements['comboSearch'].value = i.replace("\\","") ;
document.forms['fNat'].elements['vSearch'].value = v.replace("\\","") ;
}
function eraseSearch() {
$('choixDest').style.display = "none" ;
initSearch() ;
}
document.onkeydown = toucheAppuye ;
function goPage() {
var m = document.forms['fNat'].elements['comboSearch'].value ;
var motTracke = m.replace("'","\\'")
var comboData = document.forms['fNat'].elements['vSearch'].value ;
if ( comboData == '' || comboData.length < 1 ) {
urchinTracker( 'search/notFound/' + motTracke ) ;
alert( wordingSearch ) ;
return false ;
}
if ( comboData.length > 0 && comboData.length < 4 ) {
urchinTracker( 'search/' + motTracke ) ;
window.parent.location.href = 'scripts/fiche_produit.php?id_ofr=' + comboData ;
} else {
urchinTracker( 'search/' + motTracke ) ;
window.parent.location.href = comboData ;
}
}
document.body.onclick = eraseSearch ;
// SKY
skyscraper = function ( divParent , titre, remise, typo, dateSejour, page )
{
this.container = $( divParent ) ;
this.div = document.createElement ("div") ;
this.div.page = page
this.container.appendChild( this.div ) ;
this.titre = titre ;
this.remise = remise ;
this.typo = typo ;
this.dateSejour = dateSejour ;
this.div.innerHTML += ''+this.titre+'
' ;
this.div.innerHTML += ''+this.remise+'
' ;
this.div.innerHTML += ''+this.typo+'
' ;
this.div.innerHTML += ''+this.dateSejour+'
' ;
this.div.onmouseover = function()
{
this.style.backgroundColor = '#FFC' ;
}
this.div.onmouseout = function()
{
this.style.backgroundColor = '#FFF' ;
}
this.div.onclick = function()
{
window.location.href = site + this.page ;
}
}
// PAGE COMPARER
function checkCompar()
{
var offres = 0 ;
for ( var i = 0 ; i < nbrOffres ; i++ )
{
if ( document.forms['fCompar'].elements[i].checked == true ) offres++ ;
}
if ( offres > 5 ) {
alert ( wordingCompar ) ;
return false ;
} else {
document.forms['fCompar'].submit() ;
}
}
// GOOGLE MAP
function posMap( idLienMap ) {
var divMap = $("cadreMap") ;
divMap.style.display = 'block' ;
divMap.style.left = eval( getOffsetPosition( idLienMap, 'Left') + 80 ) + 'px' ;
divMap.style.top = eval( getOffsetPosition( idLienMap, 'Top') - 280 ) + 'px' ;
}
function eraseMap() {
var divMap = $("cadreMap") ;
divMap.style.display = 'none' ;
}
function load(la,lo,marque) {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
/*FONCTION ZOOM ET DEPLACEMENT*/
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GOverviewMapControl());
/*INITIALISATION CARTE*/
map.setCenter(new GLatLng(la,lo), 12);
/*ICONE*/
var tinyIcon = new GIcon();
tinyIcon.image = "ski/img/commun/marker_"+marque+".png";
tinyIcon.iconSize = new GSize(34, 34);
tinyIcon.iconAnchor = new GPoint(10, 34);
markerOptions = { icon:tinyIcon };
/*CREATION MARKER*/
function createMarker(ville) {
var marker = new GMarker(ville,markerOptions);
return marker;
}
// points
var destination = new GLatLng(la,lo);
map.addOverlay( createMarker(destination) );
}
}