
         if (GBrowserIsCompatible()) {

           // ====== Create the Euclidean Projection for the flat map ======
           // == Constructor ==
           function EuclideanProjection(a){
             this.pixelsPerLonDegree=[];
             this.pixelsPerLonRadian=[];
             this.pixelOrigo=[];
             this.tileBounds=[];
             var b=256;
             var c=1;
             for(var d=0;d<a;d++){
               var e=b/2;
               this.pixelsPerLonDegree.push(b/360);
               this.pixelsPerLonRadian.push(b/(2*Math.PI));
               this.pixelOrigo.push(new GPoint(e,e));
               this.tileBounds.push(c);
               b*=2;
               c*=2
             }
           }

           // == Attach it to the GProjection() class ==
           EuclideanProjection.prototype=new GProjection();


           // == A method for converting latitudes and longitudes to pixel coordinates == 
           EuclideanProjection.prototype.fromLatLngToPixel=function(a,b){
             var c=Math.round(this.pixelOrigo[b].x+a.lng()*this.pixelsPerLonDegree[b]);
             var d=Math.round(this.pixelOrigo[b].y+(-2*a.lat())*this.pixelsPerLonDegree[b]);
             return new GPoint(c,d)
           };

           // == a method for converting pixel coordinates to latitudes and longitudes ==
           EuclideanProjection.prototype.fromPixelToLatLng=function(a,b,c){
             var d=(a.x-this.pixelOrigo[b].x)/this.pixelsPerLonDegree[b];
             var e=-0.5*(a.y-this.pixelOrigo[b].y)/this.pixelsPerLonDegree[b];
             return new GLatLng(e,d,c)
           };

           // == a method that checks if the y value is in range, and wraps the x value ==
           EuclideanProjection.prototype.tileCheckRange=function(a,b,c){
             var d=this.tileBounds[b];
             if (a.y<0||a.y>=d) {
               return false;
             }
             if(a.x<0||a.x>=d){
               a.x=a.x%d;
               if(a.x<0){
                 a.x+=d;
               }
             }
             return true
           }

           // == a method that returns the width of the tilespace ==      
           EuclideanProjection.prototype.getWrapWidth=function(zoom) {
             return this.tileBounds[zoom]*256;
           }


         
           // ===== Create a Map Type that uses the Euclidean projection =====

           var tilelayers2 = [new GTileLayer(new GCopyrightCollection("Antistatique.net"),2,4)];
           tilelayers2[0].getCopyright = function(a,b) {return {prefix:"&copy;", copyrightTexts:["Antistatique.net"]}; }

           tilelayers2[0].getTileUrl = function (a,b) {
             return "gis/bat_b1/"+b+"_"+(a.x)+"_"+(a.y)+".gif";

           } ;

           var custommap2 = new GMapType(tilelayers2, new EuclideanProjection(18), "Batiment B1", {errorMessage:"No Data Available",alt:"Batiment B1"});


           // ===== Create a Map Type that uses the Euclidean projection =====

           var tilelayers1 = [new GTileLayer(new GCopyrightCollection("Antistatique.net"),2,4)];
           tilelayers1[0].getCopyright = function(a,b) {return {prefix:"&copy;", copyrightTexts:["Antistatique.net"]}; }

           tilelayers1[0].getTileUrl = function (a,b) {
             return "gis/bat_a1/"+b+"_"+(a.x)+"_"+(a.y)+".gif";

           } ;

           var custommap1 = new GMapType(tilelayers1, new EuclideanProjection(18), "Batiment A1", {errorMessage:"No Data Available",alt:"Batiment A1"});



           // == Open a map with these two custom map types ==

           var map = new GMap2(document.getElementById("map"), {mapTypes:[custommap1, custommap2]});
           var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10));     
           map.addControl(new GLargeMapControl(), topRight);         
           // map.addControl(new GMapTypeControl());

           var defaultcustomMap = custommap1;

           map.setCenter(new GLatLng(0,0), 2, defaultcustomMap);


             // var point = new GLatLng(0,45);
             // map.addOverlay(new GMarker(point));             



           $('.bat_a1').click(function(){
              $('#map_coupe_content li').removeClass('current');
              $(this).addClass('current');  
              map.setCenter(new GLatLng(0,0), 2, map.getMapTypes()[0]);              
           });
           $('.bat_b1').click(function(){  
              $('#map_coupe_content li').removeClass('current');
              $(this).addClass('current');       
              map.setCenter(new GLatLng(0,0), 2, map.getMapTypes()[1]);              
           });
           $('.bt_rose').click(function(){  
              $('#map_coupe_content li').removeClass('current');
              $(this).addClass('current');       
              map.setCenter(new GLatLng(0,-100), 3, map.getMapTypes()[0]);              
           });           

           $('.bt_jaune').click(function(){  
              $('#map_coupe_content li').removeClass('current');
              $(this).addClass('current');       
              map.setCenter(new GLatLng(0,-25), 3, map.getMapTypes()[0]);              
           }); 
           $('.bt_bleu').click(function(){  
              $('#map_coupe_content li').removeClass('current');
              $(this).addClass('current');       
              map.setCenter(new GLatLng(0,55), 3, map.getMapTypes()[0]);              
           });     
           
           
           $('.bt_vert').click(function(){  
              $('#map_coupe_content li').removeClass('current');
              $(this).addClass('current');       
              map.setCenter(new GLatLng(0,0), 2, map.getMapTypes()[1]);              
           }); 

         }      


      // display a warning if the browser was not compatible
         else {
           alert("Sorry, the Google Maps API is not compatible with this browser");
         }

         // This Javascript is based on code provided by the
         // Community Church Javascript Team
         // http://www.bisphamchurch.org.uk/   
         // http://econym.org.uk/gmap/

         //]]>
         
         
         // $(document).ready(function() {
         //         $("#block_fade").fadeIn('slow');
         //         $("#map").fadeIn('slow');
         //         $('#menu, .to_fade').fadeTo("slow", 0.10);
         //         $("#menu, .to_fade").hover(function(){
         //            $(this).fadeTo("slow", 1);
         //         }, function () {
         //            $(this).fadeTo("slow", 0.10);
         //         });
         //      });         

