/* affichage infobulle */
var infoBulleOuvert = 0;
var legende_bandeau = "Côte-d'Or Tourisme ©R. GUITON<br>Côte-d'Or Tourisme ©R. GUITON<br>©Galyna Andrushko - Fotolia.com";

function GetId(id)
{
	return document.getElementById(id);
}




function image_gestion_infobulle() 
{
		
	for(var i=0; i<document.images.length; i++) {
		var img = document.images[i];
		var imgID = img.id;

		var imgName = img.src.toUpperCase();

		if (img.title != '' && img.src.indexOf('/charte/') == -1 ){
//			if (img.title != ''  ){
			title = img.title;
			title = title.replace("'", "&rsquo;");
		
			var strNewHTML = "<span onmouseover='montre_infobulle(\""+title+"\");' onmouseout='cache_infobulle();'>";
			strNewHTML += "<img class='img_rollon' src=\""+img.src+"\"  ></span>";
//			width=\"" + img.width + "\" height=\"" + img.height + "\" alt=\""+img.alt+"\"
			img.outerHTML = strNewHTML;
			
		}
	}

}



		if(!isIE){
			if(window.HTMLElement) {
			    HTMLElement.prototype.__defineSetter__("outerHTML",function(sHTML){
				var r=this.ownerDocument.createRange();
				r.setStartBefore(this);
				var df=r.createContextualFragment(sHTML);
				this.parentNode.replaceChild(df,this);
				return sHTML;
        	});

    		HTMLElement.prototype.__defineGetter__("outerHTML",function(){
			 var attr;
				var attrs=this.attributes;
				var str="<"+this.tagName.toLowerCase();
				for(var i=0;i<attrs.length;i++){
					attr=attrs[i];
					if(attr.specified)
						str+=" "+attr.name+'="'+attr.value+'"';
					}
				if(!this.canHaveChildren)
					return str+">";
				return str+">"+this.innerHTML+"</"+this.tagName.toLowerCase()+">";
			});
       
 			HTMLElement.prototype.__defineGetter__("canHaveChildren",function(){
				  switch(this.tagName.toLowerCase()){
							case "area":
							case "base":
						 case "basefont":
							case "col":
							case "frame":
							case "hr":
							case "img":
							case "br":
							case "input":
							case "isindex":
							case "link":
							case "meta":
							case "param":
							return false;
						}
						return true;
				
					 });
		}

	}




function montre_infobulle(text) {
	
  if(infoBulleOuvert==0 && text!= '') {
		GetId("infobulle_contenu").innerHTML = text; // Cette fonction est a améliorer, il parait qu'elle n'est pas valide (mais elle marche)

		Pos_infoBulle();
		GetId("InfoBulle").style.visibility="visible"; // Si il est caché (la verif n'est qu'une securité) on le rend visible.
    	infoBulleOuvert=1;
  }

}

function cache_infobulle() {
  	if(infoBulleOuvert==1) {
		GetId("InfoBulle").style.visibility="hidden"; // Si la bulle etais visible on la cache
		infoBulleOuvert=0;
		GetId("infobulle_contenu").innerHTML = "";
	}
}


//fonctions standards
function Pos_Souris(e)
{
    mouse_x = (navigator.appName.substring(0,3) == "Net" ) ? e.pageX : event.x+document.body.scrollLeft ;
    //mouse_x = (navigator.appName.substring(0,3) == "Net" ) ? e.pageX : event.x ;
    mouse_y = (navigator.appName.substring(0,3) == "Net" ) ? e.pageY : event.y+document.body.scrollTop ;
    //mouse_y = (navigator.appName.substring(0,3) == "Net" ) ? e.pageY : event.y ;
	if(infoBulleOuvert == 1)
		Pos_infoBulle();
}


function Pos_infoBulle() {
	var posXinfo = mouse_x; // On retire la bande de gauche
        var posYinfo = mouse_y;


	if (typeof ActiveXObject != 'undefined') //IE
        {

	   posXinfo += findPosX(GetId('page'));
	    posYinfo += findPosY(GetId('page'));

	}


		posXinfo += 10;
		posYinfo += 10;
		

        posXinfo += "px";
        posYinfo += "px"

        GetId("InfoBulle").style.left = posXinfo;
        GetId("InfoBulle").style.top = posYinfo;
	
}