
function openWindow(file,tx,ty) {
		 myWindow= open(file, "newWindow", "width="+tx+",height="+ty+",left=0, top=0, menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
}




//-----------------------------------------------------------------
// systeme de changement de fond sur le click des sous menu

// Atteint une Url après une confirmation par boîte de dialogue...
// <a href="javascript:conf('message','url');>
// préférer la syntaxe suivante
// <a href="url" onclick="return confirm('message');>
// => l'url n'est atteinte que si message validé
// => si pas javascript, url atteinte sans confirmation
function conf(m,u)
 {
	if( confirm(m) )	window.location.href=u; //'http://www.google.fr'; //u;
 }
 
 
/* Permet d'ajuster  la taille de la fenêtre en fct de la taille d'une image 
@param str, id de l'élément img
@param int marge horizontale à rajouter
@param int marge verticale à rajouter
@param int largeur minimale
@param int hauteur minimale
*/
function fitPic( idImage , margeW , margeH ,  minW, minH ) {
	if (margeW == null){ margeW = 0;}
	if (margeH == null){ margeH = 0;}
	if (idImage == null){ idImage = "image";}
	if (minW == null){ minW = 100;}
	if (minH == null){ minH = 100;}
//	window.alert('resize, margeW '+margeW+' - margeH '+margeH);
	var aWidth = 0;
	var aHeight = 0;
	var cWidth = 0;
	var cHeight = 0;
	if (window.innerWidth){
		if (window.innerWidth > window.outerWidth) { // bug sous firefox ???
		    aWidth = window.outerWidth;
		} else {
		    aWidth = window.innerWidth;
		}
	    aHeight = window.innerHeight;
	}else{
	    aWidth = document.body.clientWidth;
	    aHeight =document.body.clientHeight;
	}
//	window.alert('actuel, W '+aWidth+' - H '+aHeight);
	cWidth = document.getElementById(idImage).width + margeW;
	cHeight = document.getElementById(idImage).height + margeH;
//	window.alert('resizeby, W '+cWidth - aWidth+' - H '+cHeight - aHeight);
	if (cWidth < minW) { cWidth = minW;}
	if (cHeight < minH) { cHeight = minH;}
	window.resizeBy(cWidth - aWidth, cHeight - aHeight);
	window.focus();
};


function zoomimage(src,largeur,hauteur) 
{
	popUp = window.open(src,'zoomimage','width=' + largeur + ',' + 'height=' + hauteur  + ' ,left=20,top=20,resizable=yes,scrollbars=no,toolbars=no,menubars=no,location=no');
	popUp.focus();
}
function zoomimage2(src,largeur,hauteur,x,y) 
{
	popUp = window.open('/zoom.php?img='+src,'zoomimage','width=' + largeur + ',' + 'height=' + hauteur  + ' ,left=' + x + ',top=' + y + ',resizable=yes,scrollbars=no,toolbars=no,menubars=no,location=no');
	popUp.focus();
}

/* Change la visibilité d'un élément 
  style display none ou paramètre 2
  si param2=undefined, on prend block
 @param string id de l'élément
 */
function showhide(idelement,display)
{
	if (typeof(display)=="undefined" || display=="") display="block";
	var el = document.getElementById(idelement);
	if (el)
	{
		if (el.style.display == "none") {
			el.style.display = display;
		} else {
			el.style.display = "none";
		}
	}
}



// Cherche remlace en RegExp
function chercheRemplace( texte, stringToFind, stringRemplacement )
{
var text = texte.toString() ;
var maReg = new RegExp( stringToFind, "gi") ;
var resultat = text.replace( maReg, stringRemplacement ) ;
if ( text.search( maReg ) == -1 )
return text
else
return resultat ;
}