var dsVilles=new Spry.Data.XMLDataSet("api/villes.php","root/row",{sortOnLoad:"ville",sortOrderOnLoad:"ascending",distinctOnLoad:true});dsVilles.setColumnType("ville","html");var dsMembres=new Spry.Data.XMLDataSet("api/membres.xml.php?membre=1","membres/membre",{sortOnLoad:"nom",sortOrderOnLoad:"ascending",useCache:false});dsMembres.setColumnType("numero","number");dsMembres.setColumnType("adressecourte","html");dsMembres.setColumnType("adresse","html");dsMembres.setColumnType("nom","html");dsMembres.setColumnType("contenu","html");var dsMembre=new Spry.Data.XMLDataSet("api/membres.xml.php?membre=1","membres/membre");dsMembre.setColumnType("numero","number");dsMembre.setColumnType("nom","html");dsMembre.setColumnType("adresse","html");dsMembre.setColumnType("content","html");dsMembre.setColumnType("tableauhebergement","html");dsMembre.setColumnType("categorie","html");var dsArticle=new Spry.Data.XMLDataSet("api/articles.xml.php?article=187","articles/article");dsArticle.setColumnType("numero","number");dsArticle.setColumnType("titre","html");dsArticle.setColumnType("integrale","html");dsArticle.setColumnType("image","html");Spry.Data.initRegionsOnLoad=false;VillesLoad={onPostUpdate:function(a,b){setLoc();loading.halt()}};Spry.Data.Region.addObserver("villeSelection",VillesLoad);Spry.Utils.addLoadListener(function(){loaded()});function loaded(){dsVilles.loadData();Spry.Data.initRegions()}var InterfaceMobile={paneau:1,mode:"All",numero:0,p2observer:null,p3observer:null,p4observer:null,ChargeData:function(){window.scrollTo(0,1);InterfaceMobile.showPanel(1);InterfaceMobile.paneau=1;InterfaceMobile.numero=null;var a=document.getElementById("villeSelect").value;setCookie("ville",a,true,"/","gaspesiejetaime.com",false);if(InterfaceMobile.p2observer){Spry.Data.Region.removeObserver("p2",InterfaceMobile.p2observer)}if(InterfaceMobile.p3observer){Spry.Data.Region.removeObserver("p3",InterfaceMobile.p3observer)}if(InterfaceMobile.p4observer){Spry.Data.Region.removeObserver("p4",InterfaceMobile.p4observer)}dsMembres.setURL("../api/membres.xml.php?ville="+a+"&mode="+this.mode);dsMembres.loadData()},AfficheMembre:function(a){_gaq.push(["_trackEvent","membre_"+a,"clicked"]);InterfaceMobile.numero=a;loading.start();dsMembre.setURL("../api/membres.xml.php?membre="+a);dsMembre.loadData();InterfaceMobile.p3observer={onPostUpdate:function(b,c){InterfaceMobile.showPanel(3);iniImages();iniTooltip()}};Spry.Data.Region.addObserver("p3",this.p3observer)},AfficheInfo:function(a){loading.start();InterfaceMobile.mode=a;dsMembres.setURL("../api/membres.xml.php?mode=6");dsMembres.loadData();InterfaceMobile.p4observer={onPostUpdate:function(b,c){InterfaceMobile.showPanel(4)}};Spry.Data.Region.addObserver("p4",InterfaceMobile.p4observer)},AfficheMembres:function(a){loading.start();InterfaceMobile.mode=a;var b=document.getElementById("villeSelect").value;dsMembres.setURL("../api/membres.xml.php?ville="+b+"&mode="+a);dsMembres.loadData();InterfaceMobile.p2observer={onPostUpdate:function(c,d){InterfaceMobile.showPanel(2)}};Spry.Data.Region.addObserver("p2",InterfaceMobile.p2observer)},showPreviousPanel:function(){InterfaceMobile.iniRegion();n=InterfaceMobile.paneau-1;if(n<=0){n=1}if(n>=3){n=1}var a=Ext.get("page");var b=Ext.get("p"+n);a.slideOut("r",{stopFx:false,duration:0.5}).update(Ext.getDom("p"+n).innerHTML).slideIn("l",{stopFx:true,duration:0.3});InterfaceMobile.paneau=n;setTimeout("InterfaceMobile.scrollMembre()",250)},showPanel:function(c){loading.halt();if(c!=InterfaceMobile.paneau){InterfaceMobile.iniRegion();InterfaceMobile.paneau=c;var a=Ext.get("page");var b=Ext.get("p"+c);a.slideOut("l",{stopFx:false,duration:0.5}).update(Ext.getDom("p"+c).innerHTML).slideIn("r",{stopFx:true,duration:0.5});window.scrollTo(0,1)}},iniRegion:function(a){Spry.Data.Region.removeObserver("p2",InterfaceMobile.p2observer);Spry.Data.Region.removeObserver("p3",InterfaceMobile.p3observer);Spry.Data.Region.removeObserver("p4",InterfaceMobile.p4observer)},scrollMembre:function(){if(InterfaceMobile.numero>0){var a=(Ext.getDom(InterfaceMobile.numero).offsetTop)?Ext.getDom(InterfaceMobile.numero).offsetTop:0;window.scrollTo(0,a);InterfaceMobile.numero=0}},changeTitre:function(){switch(InterfaceMobile.mode){case 1:return"Hébergement";break;case 2:return"Restauration";break;case 3:return"Activité culturelles";break;case 4:return"Activités de nature et plein air";break;case 5:return"Services";break;case 6:return"Informations touristiques";break}}};function touchHandler(c){var d=c.changedTouches,e=d[0],a="";switch(c.type){case"touchstart":a="mousedown";break;case"touchmove":a="mousemove";break;case"touchend":a="mouseup";break;default:return}var b=document.createEvent("MouseEvent");b.initMouseEvent(a,true,true,window,1,e.screenX,e.screenY,e.clientX,e.clientY,false,false,false,false,0,null);e.target.dispatchEvent(b);c.preventDefault()}function initTouch(){}var loading={etat:true,start:function(){if(loading.etat==false){var a=(Ext.lib.Dom.getViewportHeight()/2);if(InterfaceMobile.numero){var a=(Ext.getDom(InterfaceMobile.numero).offsetTop)?Ext.getDom(InterfaceMobile.numero).offsetTop:(Ext.lib.Dom.getViewportHeight()/2)}Anim=Ext.get("loading");Anim.setOpacity(1);Anim.setStyle({top:a+"px"}).show();loading.etat=true}},halt:function(){if(loading.etat==true){Anim=Ext.get("loading");if(Ext.get("loading-mask")){mask=Ext.get("loading-mask");mask.setOpacity(0.8);mask.shift({xy:Anim.getXY(),width:Anim.getWidth(),height:Anim.getHeight(),remove:true,duration:2,opacity:0,easing:"bounceOut",callback:function(){loading.etat=false;Anim.fadeOut({duration:0.2,remove:false})}})}else{Anim=Ext.get("loading");Anim.fadeOut({duration:0.2,remove:false});loading.etat=false}}}};var carousselImage;function iniImages(){if(carousselImage!=null){carousselImage.clear()}var a=Ext.get("contentMembre").query("img");if(a.length>1){carousselImage=new Ext.ux.Carousel("contentMembre",{itemSelector:"img",interval:5,autoPlay:true,showPlayButton:true,pauseOnNavigate:false,freezeOnHover:false,transitionType:"fade",navigationOnHover:true,hideNavigation:false,width:200,height:150})}}function replaceCharacters(d,c,a){var b=d.split(c);b=b.join(a);return b}function numerolocal(b,e){var d=e("{ville}");var c=readCookie("local");if(d==c){var a=e("{telephone}")}else{var a="+1"+e("{telephone}")}a=replaceCharacters(a,"-","");a=replaceCharacters(a," ","");return a}function iniTooltip(){var a=Ext.get("page").query("img.picto");if(a.length>1){for(var b=0;b<a.length;b++){var c=a[b].getAttribute("alt");if(c!=""){}}}}function setCookie(c,e,a,h,d,g){var b=new Date();b.setTime(b.getTime());if(a){a=a*1000*60*60*24}var f=new Date(b.getTime()+(a));document.cookie=c+"="+escape(e)+((a)?";expires="+f.toGMTString():"")+((h)?";path="+h:"")+((d)?";domain="+d:"")+((g)?";secure":"")}function readCookie(a){var c="";var b=a+"=";if(document.cookie.length>0){offset=document.cookie.indexOf(b);if(offset!=-1){offset+=b.length;end=document.cookie.indexOf(";",offset);if(end==-1){end=document.cookie.length}c=unescape(document.cookie.substring(offset,end))}}return c}var map;var geocoder;var address;var city;var region;var country;var latitude;var longitude;function getAddress(a,b){if(b!=null){address=b;geocoder.getLocations(b,showAddress)}}function showAddress(a){if(!a||a.Status.code!=200){}else{place=a.Placemark[0];country=place.AddressDetails.Country.CountryNameCode;console.dir(place.AddressDetails.Country.AdministrativeArea);if(place.AddressDetails.Country.AdministrativeArea.Locality.LocalityName){city=place.AddressDetails.Country.AdministrativeArea.Locality.LocalityName}else{city=place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName}setCookie("local",city,true,"/","gaspesiejetaime.com",false);setVille()}}function setVille(){citytmp=readCookie("ville");if(citytmp!=""){city=citytmp}chgVille()}function chgVille(){var c=false;var b=document.getElementById("villeSelect");for(var a=0;a<b.options.length;a++){if(b.options[a].value==city){b.options[a].selected=true;c=true;setCookie("ville",city,true,"/","gaspesiejetaime.com",false);break}}if(c==false){document.recherche.where.value=latitude+", "+longitude}InterfaceMobile.ChargeData()}function successCallback(a){latitude=a.latitude;longitude=a.longitude;city=a.gearsAddress.city;setCookie("local",city,true,"/","gaspesiejetaime.com",false);region=a.gearsAddress.region;country=a.gearsAddress.country;setVille()}function errorCallback(a){var b="Error retrieving your location: "+a.message}function setLoc(){if(google.gears){try{var a=google.gears.factory.create("beta.geolocation");a.getCurrentPosition(successCallback,errorCallback,{enableHighAccuracy:true,gearsRequestAddress:true})}catch(b){return}}else{if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(c){latitude=c.coords.latitude;longitude=c.coords.longitude;geocoder=new GClientGeocoder();geocoder.getLocations(latitude+","+longitude,showAddress)},function(c){},{timeout:10000})}}}
/*!
 * Ext Core Library 3.0
 * http://extjs.com/
 * Copyright(c) 2006-2009, Ext JS, LLC.
 *
 * MIT Licensed - http://extjs.com/license/mit.txt
 */
Ext.ns("Ext.ux");Ext.ux.Carousel=Ext.extend(Ext.util.Observable,{interval:3,transitionDuration:1,transitionType:"carousel",transitionEasing:"easeOut",itemSelector:"img",activeSlide:0,autoPlay:false,showPlayButton:false,pauseOnNavigate:false,wrap:false,freezeOnHover:false,navigationOnHover:false,hideNavigation:false,width:null,height:null,constructor:function(b,a){a=a||{};Ext.apply(this,a);Ext.ux.Carousel.superclass.constructor.call(this,a);this.addEvents("beforeprev","prev","beforenext","next","change","play","pause","freeze","unfreeze");this.el=Ext.get(b);this.slides=this.els=[];if(this.autoPlay||this.showPlayButton){this.wrap=true}if(this.autoPlay&&typeof a.showPlayButton==="undefined"){this.showPlayButton=true}this.initMarkup();this.initEvents();if(this.carouselSize>0){this.refresh()}},initMarkup:function(){var b=Ext.DomHelper;this.carouselSize=0;var a=this.el.select(this.itemSelector);this.els.container=b.append(this.el,{cls:"ux-carousel-container",id:"carousel"},true);this.els.slidesWrap=b.append(this.els.container,{cls:"ux-carousel-slides-wrap"},true);this.els.navigation=b.append(this.els.container,{cls:"ux-carousel-nav"},true).hide();this.els.caption=b.append(this.els.navigation,{tag:"h2",cls:"ux-carousel-caption"},true);this.els.navNext=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-next"},true);if(this.showPlayButton){this.els.navPlay=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-play"},true)}this.els.navPrev=b.append(this.els.navigation,{tag:"a",href:"#",cls:"ux-carousel-nav-prev"},true);this.slideWidth=this.width||this.el.getWidth(true);this.slideHeight=this.height||this.el.getHeight(true);this.els.container.setStyle({width:this.slideWidth+"px",height:this.slideHeight+"px"});this.els.caption.setWidth((this.slideWidth-(this.els.navNext.getWidth()*2)-(this.showPlayButton?this.els.navPlay.getWidth():0)-20)+"px");a.appendTo(this.els.slidesWrap).each(function(c){c=c.wrap({cls:"ux-carousel-slide"});this.slides.push(c);c.setWidth(this.slideWidth+"px").setHeight(this.slideHeight+"px")},this);this.carouselSize=this.slides.length;if(this.navigationOnHover){this.els.navigation.setStyle("top",(-1*this.els.navigation.getHeight())+"px")}this.el.clip()},initEvents:function(){this.els.navPrev.on("click",function(a){a.preventDefault();var b=a.getTarget();b.blur();if(Ext.fly(b).hasClass("ux-carousel-nav-disabled")){return}this.prev()},this);this.els.navNext.on("click",function(a){a.preventDefault();var b=a.getTarget();b.blur();if(Ext.fly(b).hasClass("ux-carousel-nav-disabled")){return}this.next()},this);if(this.showPlayButton){this.els.navPlay.on("click",function(a){a.preventDefault();a.getTarget().blur();if(this.playing){this.pause()}else{this.play()}},this)}if(this.freezeOnHover){this.els.container.on("mouseenter",function(){if(this.playing){this.fireEvent("freeze",this.slides[this.activeSlide]);Ext.TaskMgr.stop(this.playTask)}},this);this.els.container.on("mouseleave",function(){if(this.playing){this.fireEvent("unfreeze",this.slides[this.activeSlide]);Ext.TaskMgr.start(this.playTask)}},this,{buffer:(this.interval/2)*1000})}if(this.navigationOnHover){this.els.container.on("mouseenter",function(){if(!this.navigationShown){this.navigationShown=true;this.els.navigation.stopFx(false).shift({y:this.els.container.getY(),duration:this.transitionDuration})}},this);this.els.container.on("mouseleave",function(){if(this.navigationShown){this.navigationShown=false;this.els.navigation.stopFx(false).shift({y:this.els.navigation.getHeight()-this.els.container.getY(),duration:this.transitionDuration})}},this)}if(this.interval&&this.autoPlay){this.play()}},prev:function(){if(this.fireEvent("beforeprev")===false){return}if(this.pauseOnNavigate){this.pause()}this.setSlide(this.activeSlide-1);this.fireEvent("prev",this.activeSlide);return this},next:function(){if(this.fireEvent("beforenext")===false){return}if(this.pauseOnNavigate){this.pause()}this.setSlide(this.activeSlide+1);this.fireEvent("next",this.activeSlide);return this},play:function(){if(!this.playing){this.playTask=this.playTask||{run:function(){this.playing=true;this.setSlide(this.activeSlide+1)},interval:this.interval*1000,scope:this};this.playTaskBuffer=this.playTaskBuffer||new Ext.util.DelayedTask(function(){Ext.TaskMgr.start(this.playTask)},this);this.playTaskBuffer.delay(this.interval*1000);this.playing=true;if(this.showPlayButton){this.els.navPlay.addClass("ux-carousel-playing")}this.fireEvent("play")}return this},pause:function(){if(this.playing){Ext.TaskMgr.stop(this.playTask);this.playTaskBuffer.cancel();this.playing=false;if(this.showPlayButton){this.els.navPlay.removeClass("ux-carousel-playing")}this.fireEvent("pause")}return this},clear:function(){this.els.slidesWrap.update("");this.slides=[];this.carouselSize=0;this.pause();return this},add:function(b,a){var c=Ext.fly(b).appendTo(this.els.slidesWrap).wrap({cls:"ux-carousel-slide"});c.setWidth(this.slideWidth+"px").setHeight(this.slideHeight+"px");this.slides.push(c);if(a){this.refresh()}return this},refresh:function(){this.carouselSize=this.slides.length;this.els.slidesWrap.setWidth((this.slideWidth*this.carouselSize)+"px");if(this.carouselSize>0){if(!this.hideNavigation){this.els.navigation.show()}this.activeSlide=0;this.setSlide(0,true)}return this},setSlide:function(b,a){if(!this.wrap&&!this.slides[b]){return}else{if(this.wrap){if(b<0){b=this.carouselSize-1}else{if(b>this.carouselSize-1){b=0}}}}if(!this.slides[b]){return}this.els.caption.update(this.slides[b].child(":first-child",true).title||"");var d=b*this.slideWidth;if(!a){switch(this.transitionType){case"fade":this.slides[b].setOpacity(0);this.slides[this.activeSlide].stopFx(false).fadeOut({duration:this.transitionDuration/2,callback:function(){if(this.slides[this.activeSlide]){this.els.slidesWrap.setStyle("left",(-1*d)+"px");this.slides[this.activeSlide].setOpacity(1);this.slides[b].fadeIn({duration:this.transitionDuration/2})}},scope:this});break;default:var c=(-1*d)+this.els.container.getX();this.els.slidesWrap.stopFx(false);this.els.slidesWrap.shift({duration:this.transitionDuration,x:c,easing:this.transitionEasing});break}}else{this.els.slidesWrap.setStyle("left","0")}this.activeSlide=b;this.updateNav();this.fireEvent("change",this.slides[b],b)},updateNav:function(){this.els.navPrev.removeClass("ux-carousel-nav-disabled");this.els.navNext.removeClass("ux-carousel-nav-disabled");if(!this.wrap){if(this.activeSlide===0){this.els.navPrev.addClass("ux-carousel-nav-disabled")}if(this.activeSlide===this.carouselSize-1){this.els.navNext.addClass("ux-carousel-nav-disabled")}}}});
