	function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
	}


function fixPNG() {
	if(navigator.appName == 'Microsoft Internet Explorer') {
		var png = /\.png$/;
		var imgs = document.getElementsByTagName("img");
		for(var i = 0 ; i < imgs.length; i++) {
			if(imgs.item(i).src.indexOf(".png")>0) {
				imgs.item(i).style.width = imgs.item(i).offsetWidth;
				imgs.item(i).style.height = imgs.item(i).offsetHeight;
				imgs.item(i).style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + imgs.item(i).src + '\',sizingMethod=\'image\')';
				imgs.item(i).src = '/img/pix.gif';
			}
		}
	}
}

function favoris(url,titre) {
if ( navigator.appName != 'Microsoft Internet Explorer' )
{ window.sidebar.addPanel(titre,url,""); }
else { window.external.AddFavorite(url,titre); } }


function CalculDiv()
   {
	EcranLarg = document.body.clientWidth;
	
	tmp = parseInt((document.body.clientWidth - 1000 ) / 2);
	
	if( tmp == 0 )
	{
		document.getElementById("BasG").style.display ='none';
		document.getElementById("BasD").style.display ='none';
		document.getElementById("BandeG").style.display ='none'; 
	}
	
	
   }


function JSReplace(inStr, inReplace){
while(inStr.indexOf(inReplace) > 0){
inStr = inStr.replace(inReplace);
};
};

var old = -1;
function AfficheSsM(id)
{
	if ( old != "-1"){
		document.getElementById("SsM"+old).style.display = 'none';	
	}
	document.getElementById("SsM"+id).style.display = 'block';	
	old = id;
}



	var map = null;
	var geocoder = null;
	var zoom = 10;
	
	var tableauIcones = [];
    function load() {
        if (GBrowserIsCompatible()) {
	
		
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(48.1117611,-1.6802654), zoom );
    
		map.addControl(new GMapTypeControl());
			
		geocoder = new GClientGeocoder();   
			
		GDownloadUrl("/donnees.asp", function(data) {
        var xml = GXml.parse(data);
        var markers = xml.documentElement.getElementsByTagName("marker");
        for (var i = 0; i < markers.length; i++) {
			var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng")), 9);
			var marker = creerMarker(point,markers[i].getAttribute("titre"), markers[i].getAttribute("info"),markers[i].getAttribute("categorie"),markers[i].getAttribute("lien"),markers[i].getAttribute("photo") );
            map.addOverlay(marker);
           }
         });     
        }
    }
    
    function creerMarker(point, nom, html,categorie,lien,photo ) {
	   var marker = new GMarker(point,tableauIcones[categorie]);
       var infoTabs = [new GInfoWindowTab("Infos",nom+html+photo)];
      
		GEvent.addListener(marker, "click", function() 
		{
			window.location.href=lien;
		});

         
       return marker;
       }    
       
function changeGde(elt,Photo,id,Link)
{	
	oldPhoto = document.getElementById("PhotoGde"+id).src;
	oldTitle = document.getElementById("LinkGde"+id).title;

	document.getElementById("LinkGde"+id).title = document.getElementById(Link).title;
	oldPhoto = oldPhoto.replace("?w=393&h=294","");
	elt.src = oldPhoto +"?w=184&h=137";
	
	Photo = Photo.replace("?w=184&h=137","");
	document.getElementById("PhotoGde"+id).src = Photo+"?w=393&h=294";
	document.getElementById(Link).title = oldTitle;
	
} 


	
function loadingJS()
{
	$(".telephone").keypress(function(e){ 			
		errorField = "#Error"+$(this).attr("name");			
			if( e.which!=8  && e.which!=118 &&  e.which!=99 && e.which!=0 && (e.which<48 || e.which>57))
		{$(errorField).html("Caractères non valides").show().delay(1200).fadeOut(1000);
			return false;
		}
		value = $(this).attr("value"); 
		if( value.length<14 || e.which==8 || e.which==0 )
		{
			if( (value.length == 2 || value.length == 5 || value.length == 8 || value.length == 11 ) && e.which!=8 && e.which!=0 && e.which!=118 &&  e.which!=99  )
			{
				$(this).attr("value", value+" ");
			}
		}
		else
			return false;	
	});	
	
	
	var ctrlDown = false;
    var ctrlKey = 17, vKey = 86, cKey = 67;

    var ctrlDown = false;
    var ctrlKey = 17, vKey = 86, cKey = 67;

    $(document).keydown(function(e)
    {
        if (e.keyCode == ctrlKey) ctrlDown = true;
    }).keyup(function(e)
    {
        if (e.keyCode == ctrlKey) ctrlDown = false;
    });

    $(".no-copy-paste").keydown(function(e)
    {	
		
        if (ctrlDown && (e.keyCode == vKey || e.keyCode == cKey)){ alert("Copier-coller non autorisé pour ce champ"); ctrlDown = false;return false;}
    });	
    $('.Flash').cycle({ 
    	fx:    'fade',
    	timeout: 3000 
    });	
    $('.FlashP').cycle({ 
    	fx:    'fade',
    	timeout: 3000 
    });	 
    $('.Flash2').cycle({ 
    	fx:    'fade',
    	timeout: 3000 
    });
    
    $('.MoveLeft').cycle({ 
    	fx:    'scrollLeft',
    	timeout: 3000 
    });
    $('#coupCoeurCycle').cycle({
		fx: 'fade', 
		cleartypeNoBg : true
	});
    
    $('.ResultatsVille').mouseleave(function(){ 
    	$('.ResultatsVille').fadeOut(500).hide('slow');
    });  
      
	$(".MenuBien .parent a").mouseover(function(){
    	$(this).parent().find("ul.SsMenu").slideDown('fast').show();
    	$(this).parent().find("ul.SsMenu").css("left",$(this).parent().position().left);
    	$(this).parent().find("ul.SsMenu").css("top",$(this).parent().position().top+34);    	
    	$(this).parent().hover(function() {
		}, function(){       
		$(this).parent().find("ul.SsMenu").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});
    });
    
    $(".openRech .openRechLeft a").mouseover(function(){
		$(this).parent().parent().parent().parent().find("div.recherche").slideDown('low').show();
		$(this).parent().parent().parent().parent().find("div.recherche").css("left",$(this).parent().position().left).css("top",$(this).parent().position().top+$(this).parent().height()+10);	
	}); 
	
	$(".divPreview .preview").mouseover(function(){
		$(this).parent().parent().find("div.libelle").slideDown('low').show();
		$(this).parent().parent().find("div.libelle").css("left",$(this).parent().position().left).css("top",$(this).parent().position().top+$(this).parent().height()+10);	
		$(".divPreview").hover(function() {}, function(){       
			$(this).parent().parent().find("div.libelle").slideUp('low').hide();
		});		
	});  



	$(".bienlist .photo").cycle({ fx:  'fade', timeout: 1, speed:800}).cycle('pause');	
    $(".bienlist .photo").mouseenter(function(){
		$(this).cycle('resume');	
    });       
    $(".bienlist .photo").mouseleave(function(){ $(this).cycle('pause') });
    
    $(".bienlist2 .photo").cycle({ fx:  'fade', timeout: 1, speed:800}).cycle('pause');	
    $(".bienlist2 .photo").mouseenter(function(){
		$(this).cycle('resume');	
    });       
    $(".bienlist2 .photo").mouseleave(function(){ $(this).cycle('pause') });
	
	setLinks();
	 
	 (function($) {
		$(function() { //on DOM ready
			$(".photo ul").simplyScroll({
				autoMode: 'loop',
				speed : 3,
				frameRate : 25
			});
		});		
	})(jQuery);    
}	
function Show(divShow,divHide)
{
	document.getElementById(divHide).style.display = 'none';
	document.getElementById(divShow).style.display = 'block';
	return false;
}

function setLinks() {
  if (!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName("a");
  if (links.length == 0) return false;
  for (var i = 0; i < links.length; i++) {
    var relation = links[i].getAttribute("rel");
    if (relation == "external") {
      links[i].onclick = function() {
        return !window.open(this.href);
      }
    }     
  }
}


