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 JSReplace(inStr, inReplace){
while(inStr.indexOf(inReplace) > 0){
inStr = inStr.replace(inReplace);
};
};




	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 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 
    });	
    $('.FlashSel').cycle({ 
    	fx:    'fade',
    	timeout: 3000 
    });	 
    $('.FlashSel').mouseover(function(){
		 $('.FlashSel').cycle('pause'); 
    });	 
     $('.FlashSel').mouseleave(function(){
		 $('.FlashSel').cycle('resume'); 
    });	 
    
    $('.Flash2').cycle({ 
    	fx:    'fade',
    	timeout: 3000 
    });
    
    $('.MoveLeft').cycle({ 
    	fx:    'scrollLeft',
    	timeout: 3000 
    });
    
    $('.ResultatsVille').mouseleave(function(){ 
    	$('.ResultatsVille').fadeOut(500).hide('slow');
    });    
    $(".previewCC").mouseover(function(){		
     	$("#descriptionCC").slideDown('fast').show(); 
    });	
    $(".previewCC").mouseleave(function(){		
     	$("#descriptionCC").slideDown('fast').hide(); 
    });	
    
    $("#BtnMenu").mouseover(function(){
    	$("#MenuB").css("top",$("#BtnMenu").position().top+$("#BtnMenu").height()-5);
     	$("#MenuB").slideDown('fast').show(); 
    });
    $("#BtnMenu").click(function(){
    	$("#MenuB").css("top",$("#BtnMenu").position().top+$("#BtnMenu").height()-5);
     	$("#MenuB").slideDown('fast').show(); 
    });
    $("#MenuB").mouseleave(function(){		
     	$("#MenuB").slideDown('fast').hide(); 
    });	    
    
   $("#MenuA li 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+24);
    	
    	$(this).parent().hover(function() {
		}, function(){       
		$(this).parent().find("ul.SsMenu").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});
    });	 
	$(".bienlist .more .preview").mouseover(function(){
		$(this).parent().parent().find("div.desc").slideDown('low').show();
		$(this).parent().parent().find("div.desc").css("left",$(this).parent().position().left).css("top",$(this).parent().position().top+$(this).parent().height()+10);	
		$(".bienlist .more").hover(function() {}, function(){       
			$(this).parent().parent().find("div.desc").slideUp('low').hide();
		});		
	});    
	$(".bienlist2 .more .preview").mouseover(function(){
		$(this).parent().parent().find("div.desc").slideDown('low').show();
		$(this).parent().parent().find("div.desc").css("left",$(this).parent().position().left).css("top",$(this).parent().position().top+$(this).parent().height()+10);	
		$(".bienlist2 .more").hover(function() {}, function(){       
			$(this).parent().parent().find("div.desc").slideUp('low').hide();
		});		
	}); 	    
}	

function Show(divShow,divHide)
{
	document.getElementById(divHide).style.display = 'none';
	document.getElementById(divShow).style.display = 'block';
	return false;
}


