function Decrit_point( img, contenu, vis ) {
	
    var bulle;
	//var img;
	var zone_aff;
	var infoss;
	
	//img = this;//document.getElementById( "img" + c );
	bulle = document.getElementById( "bulle" + this.id );
	infoss = document.getElementById( "infoss" );
	if( bulle == undefined )  {
		bulle = document.createElement( "div" );
		bulle.id = "bulle" + this.id;
		bulle.style.backgroundColor = "#ffff44";
		bulle.style.position = "absolute";
		bulle.style.width = "auto";
		bulle.style.zIndex = "100";
		//bulle.style.maxWidth = "150px";
		//bulle.style.width = "100px;"
		//bulle.style.whiteSpace = "nowrap";
		//bulle.style.overflow = "hidden";
		bulle.style.border = "1px solid black";
		infoss.appendChild( bulle );
    	
	}
	if( vis ) {
    	
    	bulle.innerHTML = img.title;
    	//bulle.style.visibility = "hidden";
    	//bulle.style.display = "none";
    	//larg = document.defaultView.getComputedStyle(bulle, null).getPropertyValue("width");
    	//bulle.style.display = "block";
    	//alert(larg);
    	bulle.style.top = parseInt( img.style.top ) - 4 + 'px';
    	bulle.style.left = parseInt( img.style.left ) + parseInt( img.style.width ) + 2 + 'px';
    	
    	//if( parseInt( img.style.left ) + parseInt( img.style.width ) + 2 + parseInt( larg ) > parseInt( zone_aff.style.width ) ) {
        //	bulle.style.left = parseInt( zone_aff.style.width ) - parseInt( larg ) + 'px';
    	//}
    	
    	img.sauv_title = img.title;
    	img.title = "";
		//bulle.style.top = ( evnt.pageY - 15 ) + "px";
		//bulle.style.left = ( evnt.pageX + 15 ) + "px";
			
		//bulle.innerHTML = this.nom;
		bulle.style.visibility = "visible";
		
	}
	else {
    	img.title = img.sauv_title;
		bulle.innerHTML = "";
		bulle.style.visibility = "hidden";
	}
}

function affIcone( id, vis ) {
    var el = document.getElementById( id );
    el.style.visibility = ( vis ? 'visible' : 'hidden' );
}
    
    

function afficheInfos( visible ) {
    var n;
    if( visible ) n = 0;
    else n = 9;
    bulle = document.getElementById( "gs_info" );
    if( ( bulle.style.opacity != '0.9' && visible ) ||
    ( bulle.style.opacity != '0' && !visible ) ) {
        affProg( 'gs_info', visible, n );
    }
    else {
        clearTimeout( tm );
    }
}
function afficheBulle( evnt, cible, visible ) {
    var bulle;
    var pere,pereBulle;
    bulle = document.getElementById( "gs_info" );
//     if( ( cont = document.getElementById( "contBulle" ) ) == undefined ) {
//         cont = document.createElement("div");
//         cont.style.position = "relative";
//         cont.id = "contBulle";
//         cont.appendChild( bulle );
//     }
    //pereBulle = bulle.parentNode;
    //pereBulle.removeChild( bulle );
//     if( visible ) {
//         pere = cible.parentNode;
//         pere.insertBefore( cont, cible );
//     }
    //if( evnt.target.id != 'gs_info' ) {
        
//     bulle.style.bottom = '-5px';
//     bulle.style.left = '0';
    if( evnt.pageX != undefined ) { // mozilla
        bulle.style.left = evnt.pageX + 10 + 'px';
        bulle.style.top = evnt.pageY + 10 + 'px';
    }
    else { // IE
        //bulle.style.left = evnt.x + 'px';
        //bulle.style.top = evnt.y + 'px';
        bulle.style.left = evnt.clientX + 10 + 'px';
        bulle.style.top = evnt.clientY + document.body.scrollTop + 10 + 'px';
    }
    //imgs = cible.getElementsByTagName('img');
    var elem;
    if( evnt.srcElement != undefined ) { // IE
        elem = evnt.srcElement;
    }
    else { // mozilla
        elem = evnt.target;
    }
    //titre = document.body.scrollTop;//evnt.y;
    //alert( evnt.srcElement.tagName );
    if( elem.alt != undefined ) {
        t_titre = elem.alt.split( ':' );
        if( t_titre.length == 3 ) {
            bulle.innerHTML = t_titre[0] + '<br /><span style="font-size:0.7em">&#187;&nbsp;'+ t_titre[1]+ ' ('+ t_titre[2]+ ')</span>';//imgs[0].title;
        }
        else {
            bulle.innerHTML = t_titre[0];
        }
        elem.title = '';  //evite l'affichage de la bulle du navigateur supplémentaire
    }
    if( !visible ) {
        bulle.style.visibility = 'hidden';
        /*tm = setTimeout( "afficheInfos( visible )", 100 );*/
    }
    else {
        bulle.style.visibility = 'visible';
        /*afficheInfos( visible );*/
    }
    //}
}

function Decrit_tout( ){
    
    var img;
    for( c = 0; ( img = document.getElementById( "img" + c ) ) != undefined ; c++ ){
        //img = document.getElementById( "img" + c );
        
        Decrit_point( c, 'contenu', true );
        
    }
    
}

function visible( elem, visible ) {
    
    if( visible ) {
        elem.style.visibility = 'visible';
    }
    else {
        elem.style.visibility = 'hidden';
    }
}

/* n de 0 à 10 */
var tm;
function affProg( elemid, visible, n ) {
    
    elem = document.getElementById( elemid );
    clearTimeout( tm );
    if( visible ) {
        elem.style.visibility = 'visible';
        elem.style.opacity = "" + (n/10);
		if( document.all ) { // specifique à IE
    		elem.style.filter = 'alpha( opacity = ' + ( n * 10 ) + ' )';
		}
		
		if( n + 1 <= 9 ) {
    		//setTimeout( affProg, 100, elem, visible, n+1 ); // fonction sous mozilla mais pas ie
    		var ch = "affProg( '" + elem.id + "'," + visible + "," + (n+1) + " )";
    		tm = setTimeout( ch, 10 );
	    }
    }
    else {
        //elem.style.visibility = 'visible';
        elem.style.opacity = "" + (n/10);
		if( document.all ) { // specifique à IE
    		elem.style.filter = 'alpha( opacity = ' + ( n * 10 ) + ' )';
		}
		if( n - 1 >= 0 ) {
    		//setTimeout( affProg, 100, elem, visible, n-1 );
    	    tm = setTimeout( "affProg( '" + elem.id + "'," + visible + "," + (n-1) + " )", 10 );
	    
	    }
	    else {
    	    elem.style.visibility = 'hidden';
	    }
        
    }
}

// arrete la propagation de l'evement
function stopEvent( e ) {
	if( window.event == undefined ) {
		e.stopPropagation(); // Mozilla
	} 
	else { 
		window.event.cancelBubble = true; // IE
	} 
}

// renvoie les coordonnées de la souris relatives par rapport à l'element html pointé
function decalageSourisRelatif( e ) {
	
	var xx,yy;
	// calcul de la position de la souris
    if( window.event != undefined ) {   // pour IE
        e = window.event;
        if( e.offsetX != undefined && e.offsetY != undefined ){ 
		    xx = e.offsetX; yy = e.offsetY; // pour IE
	        //xx = e.x; yy = e.y; // pour IE
	    }
    }
	
	if( e.layerX != undefined && e.layerY != undefined ){
		 xx = e.layerX; yy = e.layerY; // pour Mozilla
		 
	}
	
    return new Array( xx, yy );
}

// renvoie les positions top et left de l'element pointé par la souris
function positionElementCible( e ) {
	var xx,yy;
	xx = yy = 0;
	if( window.event != undefined ) {   // pour IE
        e = window.event;
       if( e.srcElement != undefined ) {
	       	yy = parseInt( e.srcElement.style.top );   // impossible d'obtenir le target.style.top !!?
	        xx = parseInt( e.srcElement.style.left );
	        if( isNaN( yy ) || isNaN( xx ) ) { xx = yy = 0; }
	    }
	}
	
    else {          // pour mozilla
        
        if( !isNaN( parseInt( e.target.style.top ) ) ) {
            yy = parseInt( e.target.style.top );
        }
        if( !isNaN( parseInt( e.target.style.left ) ) ) {
            xx = parseInt( e.target.style.left );
        }
    }
	return new Array( xx, yy );
}

function cibleEvent( e ) {
    if( window.event != undefined ) {   // pour IE
        e = window.event;
        return e.srcElement;
	}
    else {          // pour mozilla
        return e.target;
    }
}

function decalageCibleElement( cible, elem ) {
    if( cible == elem ) {
        return new Array( 0, 0 );
    }
    else {
        var tDec = decalageCibleElement( cible.parentNode, elem );
        var top = ( cible.style != undefined ? parseInt( cible.style.top ) : 0 );
        top = ( isNaN( top ) ? 0 : top );
        var left = ( cible.style != undefined ? parseInt( cible.style.left ) : 0 );
        left = ( isNaN( left ) ? 0 : left );
        
        tDec[0] += left;
        tDec[1] += top;
        return tDec;
    }
}

//renvoie la position de la souris par rapport à l'element parent de position relative
function position( evnt ) {
    var $t_dec = decalageSourisRelatif( evnt );
	var $t_pos = positionElementCible( evnt );
	var x = $t_pos[0] + $t_dec[0];
	var y = $t_pos[1] + $t_dec[1];
    return new Array( x, y );
}

function objetMagique( $htmlTag, idCadreParent ) {
	this.$moving = false;
	this.$htmlTag = $htmlTag;
	this.$htmlObj = document.getElementById( $htmlTag );
	this.$htmlObj.objMag = this;
	this.$cadreParent = document.getElementById( idCadreParent );
}

objetMagique.prototype.actionMove = function ( fct ) {
	this.$fctMove = fct;
}
objetMagique.prototype.allowMove = function () {
	
    this.$htmlObj.onmousedown = function( evnt ) {
        if( this.objMag.fctStartMove != undefined ) {
			this.objMag.fctStartMove( this );
		} 
		var $t_dec = decalageSourisRelatif( evnt );
		this.objMag.$cadreParent.elementActif = this.objMag;
		this.objMag.decX = $t_dec[0];
		this.objMag.decY = $t_dec[1];
		this.objMag.$moving = true;
		this.objMag.$htmlObj.evntonclick = true; // permet de savoir s'il s'agit d'un clic ou d'un déplacement dans l'evenement onclick
		return false; // return false sur evnt onmousedown sur mozilla pour eviter le glisser-deplacer des images
		
	};
	
	if( this.$cadreParent.onmousemove == undefined ) {
		this.$cadreParent.onmousemove = function( evnt ) { 
			if( this.elementActif ) {
				var $t_dec = decalageSourisRelatif( evnt );
				//var $t_pos = positionElementCible( evnt );
				var $t_pos = decalageCibleElement( cibleEvent( evnt ), this.$cadreParent );
// 				var calGeo = document.getElementById( 'calGeo' );
// 				window.status = window.status + '|'+ calGeo.style.top;
//                 var elem = evnt.target.parentNode.parentNode.parentNode;
//                 window.status = elem.id+ ':' + elem.style.top;
				this.elementActif.$htmlObj.style.left = $t_pos[0] + $t_dec[0] - this.elementActif.decX + 'px';
				this.elementActif.$htmlObj.style.top = $t_pos[1] + $t_dec[1] - this.elementActif.decY + 'px';
				this.elementActif.$htmlObj.evntonclick = false;
				return false; // return false sur evnt onmousemove sur IE pour eviter le glisser deplacer des images
			}
		};
	}
	
	this.$htmlObj.onmouseup = function( evnt ) {
		if( ! this.evntonclick ) { //objMag.$moving
			if( this.objMag.$fctMove != undefined ) {
				this.objMag.$fctMove( this );
			}
			this.objMag.$moving = false;
			this.objMag.$cadreParent.elementActif = null;
			
			//evnt.stopPropagation();
			//return false;
		}
	};
	
	this.$htmlObj.onclick = function( ) {
		return this.objMag.$htmlObj.evntonclick;
	}
}
	
function selectGeo( id, actif ) {
    var img,type;
    type = ( id.substr( 0,2 ) == 'pr' ? 'R' : 'C' );
    id = id.substr( 2 );
    if( img = document.getElementById( 'img'+type+id ) ) {
        if( actif ) {
            img.style.top = parseInt( img.style.top ) - 2 + 'px';
            img.style.left = parseInt( img.style.left ) - 2 + 'px';
            img.style.height = parseInt( img.style.height ) + 4 + 'px';
            img.style.width = parseInt( img.style.width ) + 4 + 'px';
            img.oldZIndex = img.style.zIndex;
            img.style.zIndex = "5";
        }
        else {
            if( img.style.zIndex == '5' ) {
                img.style.top = parseInt( img.style.top ) + 2 + 'px';
                img.style.left = parseInt( img.style.left ) + 2 + 'px';
                img.style.height = parseInt( img.style.height ) - 4 + 'px';
                img.style.width = parseInt( img.style.width ) - 4 + 'px';
                img.style.zIndex = img.oldZIndex;
            }
        }            
    }
}



function curs( e ){
    var nv_pt;
    var zone_aff;
    var cal_sel;
    var top;
    var left;
    var xx;
    var yy;
    var carte;
    
    // calcul de la position de la souris
    //alert( window.event.target );
    if( window.event != undefined ) {   // pour IE
        e = window.event;
        if( e.offsetX != undefined && e.offsetY != undefined ){ 
		    xx = e.offsetX; yy = e.offsetY; // pour IE
	        xx = e.x; yy = e.y; // pour IE
	    }
    }
	
	if( e.layerX != undefined && e.layerY != undefined ){
		 xx = e.layerX; yy = e.layerY; // pour Mozilla
	}
	if( e.srcElement != undefined ) {   // pour IE
        top = yy;   // impossible d'obtenir le target.style.top !!?
        left = xx;
    }
    else {          // pour mozilla
        
        if( !isNaN( parseInt( e.target.style.top ) ) ) {
            top = yy + parseInt( e.target.style.top );
        }
        else {
            top = yy;
        }
        if( !isNaN( parseInt( e.target.style.left ) ) ) {
            left = xx + parseInt( e.target.style.left );
        }else {
            left = xx;
        }
        //window.status = yy;
    }
    
    if( souris_etat == 'deplace_nv_pt' ) {
        nv_pt = document.getElementById( nom_point );
        zone_aff = document.getElementById( "zone_aff" );
        //window.status = left + '-' + top;
	
        visible( nv_pt, true );
        //alert( nv_pt.style.height );
        //e.target.style.cursor = "auto";
        
        // calcul positions min et max du nouveau point
        if( top > parseInt( zone_aff.style.height ) ) top = parseInt( zone_aff.style.height );
        if( left > parseInt( zone_aff.style.width ) ) left = parseInt( zone_aff.style.width );
        if( top < 0 ) top = 0;
        if( left < 0 ) left = 0;
        
        // calcul de la position du nouveau point en tenant compte
        // du centre de l'image cible
        top -= 4 ;
        left -= 4 ;
        
        nv_pt.style.top = top + 'px';
    	nv_pt.style.left = left + 'px';
    	//window.status = 'deplace_nv_pt';
	}
	if( souris_etat == 'depart_selection' ) {
    	// on défini les coordonnées haut gauche du rectangle
		hg['y'] = top;
		hg['x'] = left;
	    souris_etat = 'en_selection';
	    
	}
	if( souris_etat == 'depart_deplace' ) {
    	if( e.srcElement != undefined ) {   // pour IE
            hg['x'] = left - parseInt( e.srcElement.style.left );
            hg['y'] = top - parseInt( e.srcElement.style.top );
    	}
    	else {      // pour mozilla
    	    hg['x'] = left - parseInt( e.target.style.left );
        	hg['y'] = top - parseInt( e.target.style.top );
    	}
    	souris_etat = 'deplace_sel';
    	
    }
	if( souris_etat == 'en_selection' ) {
    	
    	cal_sel = document.getElementById( "rect_sel" );
	    visible( cal_sel, true );
        window.status = left;
    	if( left >= hg['x'] ) {
			cal_sel.style.left = hg['x'] + "px";
			cal_sel.style.width = ( left - hg['x'] ) + "px";
		
		}
		else {
			
			cal_sel.style.left = left + "px";
			cal_sel.style.width = ( hg['x'] - left ) + "px";
			
		}
			
		if( top >= hg['y'] ) {
			cal_sel.style.top = hg['y'] + "px";
			cal_sel.style.height = ( top - hg['y'] ) + "px";
		}
		else {
			cal_sel.style.top = top + "px";
			cal_sel.style.height = ( hg['y'] - top ) + "px";
			
		}
		
	}
	if( souris_etat == 'deplace_sel' ) {
    	cal_sel = document.getElementById( "rect_sel" );
    	carte = document.getElementById( "carte" );
    	cal_sel.style.left = left - hg['x'] + "px";
    	cal_sel.style.top = top - hg['y'] + "px";
    	/*window.status = 
    	( parseInt( cal_sel.style.left ) - parseInt( carte.style.left ) ) + ':' + 
    	( parseInt( cal_sel.style.top ) - parseInt( carte.style.top ) ) + ':' + 
    	( parseInt( cal_sel.style.top ) + 
    	  parseInt( cal_sel.style.height ) ) + ':' + 
    	( parseInt( cal_sel.style.left ) + 
    	  parseInt( cal_sel.style.width ) ) ;*/
    	/*timer_id = setTimeout(fct(),1000);
    	clearTimeout( timer_id );*/
	}
	if( souris_etat == 'zoom' ) {
    	cal_sel = document.getElementById( "rect_sel" );
    	carte = document.getElementById( "carte" );
    	var p,car,url,cx,cy;
    	url = window.location;
    	url = "" + url;
    	if( url.indexOf( "?" ) >= 0 ) {
        	car = '&';
    	}
    	else {
        	car = '?';
    	}
    	cx = parseInt( cal_sel.style.left ) - parseInt( carte.style.left );
    	cy = parseInt( cal_sel.style.top ) - parseInt( carte.style.top );
    	p = 'zr=' + 
    	cx + ':' + 
    	cy + ':' + 
    	( cx + parseInt( cal_sel.style.width ) ) + ':' + 
    	( cy + parseInt( cal_sel.style.height ) );
    	window.location += car + p;
	}
    	
	
	
}

/*
function defCurCarte( evnt ) {
    
    var elem = document.getElementById( 'zone_aff' );
    var zoneActive = document.getElementById( 'carte' );
    var oldCur = 'loupe.cur';
    var newCur = 'crosshair';
    var imgRep = document.getElementById( 'imgCurRep' );
    setCursor( evnt, elem, zoneActive, oldCur, newCur, imgRep );
}
    

// elem : element html sur lequel est specifier le comportement onmousemove et le curseur CSS
// zoneActive : element html sur lequel on change le curseur lorsque la souris se déplace directement
//   sur cet element.
// oldCur : nom du curseur CSS prévu au départ
// newCur : nom du curseur CSS a utiliser avec l'image
// imgRep : element html image de remplacement
// ex: setCursor( carte, 'loupe.cur', 'crosshair', img );

function setCursor( evnt, elem, zoneActive, oldCur, newCur, imgRep ) {
    var st= window.getComputedStyle( elem, '' );
    if( st.cursor.indexOf( oldCur ) < 0 ) { 
        // ne prend pas en charge
        // le curseur CSS
        elem.style.cursor = newCur;
        if( evnt.target == zoneActive ) {
            //deplace l'image du curseur
            imgRep.style.visibility = 'visible';
            imgRep.style.top = parseInt( evnt.layerY ) - 5 + 'px';
            imgRep.style.left = parseInt( evnt.layerX ) - 5 + 'px';
        }
        else {
            imgRep.style.visibility = 'hidden';
        }
    }
}
*/
function clickLoupe( evnt, nomParent ) {
    var elem = document.getElementById( nomParent );
    var cible = cibleEvent( evnt );
    var t_dec = decalageCibleElement( cible, elem );
    var t_decSouris = decalageSourisRelatif( evnt );
    t_dec[0] += t_decSouris[0];
    t_dec[1] += t_decSouris[1];
    window.location = urlClickLoupe+ '&p=' +t_dec[0]+ 'a' +t_dec[1];
}

function afficheSuite( valeurId ) {
    var tag = document.getElementById( 'suite-'+ valeurId );
    var act = document.getElementById( 'act-suite-'+ valeurId );
    if( tag != undefined && act != undefined ) {
        tag.style.display='block';
        act.style.display='none';
        return false;
    }
    return true;
}

function popup( url ) {
    
    window.name = 'gbMain';
    window.open( url, 'gb_popup',
	'alwaysRaised=yes,dependent=yes,toolbar=no,height=420,width=450,menubar=no,resizable=yes,scrollbars=yes,status=no' );

}

function nvFen( url ) {
    window.open( url );
}


/* depuis http://homepage.ntlworld.com/bobosola/pngtestfixed.htm */
function UcorrectPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }
}

function confirmLocalisation( obj ) {
    
    var coord = Math.floor( parseInt( obj.style.left ) + parseInt( obj.style.width )/2 ) + ':' + Math.floor( parseInt( obj.style.top) + parseInt( obj.style.height )/2 );
    cInfo.innerHTML = 
'     <form action="'+ actionForm+ '" method="post" >'
+ '        Confirmer la nouvelle localisation ? <br />'
+ '        <input type="hidden" name="coord" value="' + coord + '" />'
+ '        <input name="modif" type="submit" value="OK" />'
+ '        <input type="button" value="Fermer" onclick="cInfo.style.display=\'none\';" />'
+ '    </form>';
    
	cInfo.style.visibility = 'visible';
	cInfo.style.display = 'block';
}

function departLocalisation() {
    
	var imgFctDepl = document.getElementById( 'imgFctDepl' ); 
	if( imgFctDepl != undefined ) 
	    imgFctDepl.style.visibility = 'hidden';
    
}
function initStopDepl( nomImgPuce, urlImgFct ) {
    var imgPuce = document.getElementById( nomImgPuce );
    
    var imgFctDepl = document.getElementById( 'imgFctDepl' );
    if( imgFctDepl == undefined ) {
        imgFctDepl = document.createElement( 'img' );
        imgFctDepl.src = urlImgFct;
        imgFctDepl.id = 'imgFctDepl';
        imgFctDepl.style.position = 'absolute';
        imgFctDepl.style.visibility = 'hidden';
        imgPuce.parentNode.parentNode.appendChild( imgFctDepl );
    }
    
    if( imgFctDepl != undefined ) {
        if( parseInt( imgPuce.style.top ) > 300 || 
            parseInt( imgPuce.style.top ) < 0 || 
            parseInt( imgPuce.style.left ) > 300 || 
            parseInt( imgPuce.style.left ) < 0 )
        {
            imgPuce.style.top = '150px';
            imgPuce.style.left = '150px';
            imgFctDepl.style.visibility = 'hidden';
        }
        if( imgFctDepl.style.visibility == 'visible' ) {
            imgFctDepl.style.visibility = 'hidden';
        }
        else {
            cInfo.innerHTML = '<p><strong>Déplacez le point rouge pour localiser précisement le géosite sur la carte</strong></p>';
        	cInfo.style.visibility = 'visible';
        	cInfo.style.display = 'block';
        	setTimeout( function() { cInfo.style.display = 'none'; }, 4000 );
	
            imgFctDepl.style.top = parseInt( imgPuce.style.top ) - 20 + 'px';
            imgFctDepl.style.left = parseInt( imgPuce.style.left ) - 20 + 'px';
            imgFctDepl.style.visibility = 'visible';
        }
    }
}
function init( ) {
    //correctPNG();
    /*var toto = 0.8;
    var titi = 0.1;
    alert( 0.8 - 0.05 - 0.05 );
    alert( toto - titi ); 
    javascript:alert( 0.1+0.2 )
    http://www.codingforums.com/archive/index.php?t-52075.html
    http://developer.mozilla.org/fr/docs/Une_r%C3%A9introduction_%C3%A0_JavaScript
    http://www.cafzone.net/ipb/lofiversion/index.php/t31305.html
    */
    
    
    var nv_pt = document.getElementById( nom_point );
    if( nv_pt != undefined ) {
        
        souris_etat = 'deplace_nv_pt';
        //nv_pt.onmousedown = new Function( "event", "souris_etat = 'deplace_nv_pt'; nom_point = this.id; if( window.event == undefined ) { event.stopPropagation(); } else { window.event.cancelBubble = true; }" );
        //nv_pt.onmouseup = function (){ souris_etat = ''; }
        var zone_aff = document.getElementById( "zone_aff" );
        
        var cAideZoom;
        cAideZoom = document.createElement( "div" );
		cAideZoom.style.visibility = "hidden";
        cAideZoom.style.backgroundColor = "#ffff44";
		cAideZoom.style.position = "absolute";
		cAideZoom.style.width = "170px";
		cAideZoom.id = "cAideZoom";
		//window.status = ( parseInt( cal_sel.top ) - 10 ) + 'px' + ':' + cAideZoom.style.left;
		cAideZoom.innerHTML = 'Double-clic pour zoomer';
		cAideZoom.style.border = "1px solid black";
		zone_aff.appendChild( cAideZoom );
            		
        zone_aff.onmousedown = function (){ souris_etat = 'depart_selection';return false; }    // le return false en onmousedown et onmousemouve permet d'eviter le comportement prioritaire de drag & drop des images dans le navigateur.
        zone_aff.onmousemove = new Function( "event", "curs( event );return false;" );
        zone_aff.onmouseup = function (){ souris_etat = ''; }
        var cal_sel = document.getElementById( "rect_sel" );
        cal_sel.onmousemove = function (){ 
            if( souris_etat == '' ) { 
                this.style.cursor = 'move';
                if( ! aideZoom ) {
                    cAideZoom.style.top = ( parseInt( cal_sel.style.top ) - 20 ) + 'px';
            		cAideZoom.style.left = cal_sel.style.left;
            		affProg( cAideZoom.id, true, 0 );
                    //timer_id = setTimeout( visible, 3000, cAideZoom ,false );
                    //timer_id = setTimeout( affProg, 3000, cAideZoom ,false, 9 );
                    var ch;
                    ch = "affProg( '" + cAideZoom.id + "'," + false + "," + 9 + " )";
                    timer_id = setTimeout( ch, 3000 );
	    
                    aideZoom = true;
                }
            }
            if( souris_etat == 'en_selection' ) {
                this.style.cursor = 'crosshair';
            }
        }
       cal_sel.ondblclick = new Function( "event", "souris_etat = 'zoom'; curs( event );return false;" );
       cal_sel.onmousedown = new Function( "event", "if( souris_etat == '' ) { souris_etat = 'depart_deplace'; curs( event ); if( window.event == undefined ) { event.stopPropagation(); } else { window.event.cancelBubble = true; } } " );
       cal_sel.onmouseup = function (){ souris_etat = ''; }
        
        
    }
    
	//cInfo.innerHTML = 'cocuo';
}

var cInfo;
var hg = Array();
var souris_etat;
var nom_point = "nv_pt";
var aideZoom = false;
