
	/*						┌───────────┬──────────────────────────┬──────────────┐
							│identifiant│	explications				│ par défaut	│
		┌──────────────┼───────────┼──────────────────────────┼──────────────┤
		│ new zi (	{ 	'image' 		: image à gérer 				│					│
		│					'zoom'  		: valeur du zoom initial 	│ 3				│
		│					'loupe' 		: taille de la loupe			│ 80				│
		│					'iddiv' 		: id du div interne			│ 					│
		│					'idimage' 	: id image pour le zoom		│ 					│
		│			) 	); ├───────────┴──────────────────────────┴──────────────┘
		└──────────────┘
							~\\|//
							 (@ ~)
		┌────────oOOO────(_)────OOOo────────┐
		│ M'écrire : http://bul.o-n.fr/?bul │  /¯/ / / / 
		│ Mon Site : http://bul.fr.nf       │ /¯/ / / / 
		│       .oooO           Oooo.       │ ¯¯  ¯¯  ¯¯
		└───────(   )───────────(   )───────┘
					\ (             ) /
					 \_)           (_/		  */

//──────────────────────────────────────────
function zi( prm )	//── Zoom sur Images ──
//──────────────────────────────────────────
{	this.init=prm['image'];
	this.zoom=prm['zoom']||3;
	this.carre=prm['loupe']||80;
	this.div=document.createElement("div");
		if ( prm['iddiv'] ) this.div.id=prm['iddiv'];
		this.div.style.position="absolute";
		this.div.style.overflow="hidden";
		this.div.style.top=this.init.offsetTop+"px";
		this.div.style.left=this.init.offsetLeft+"px";
		this.div.style.display="none";
		this.div.style.height=(this.carre*2)+"px";
		this.div.style.width=(this.carre*2)+"px";
		//─────────────────────────────────────────────────────────
		this.div.oncontextmenu=function(event)	//── menu contextuel ──
		//─────────────────────────────────────────────────────────
		{	var menu=document.createElement("div");
				var b1=document.createElement("button");
					b1.innerHTML="&nbsp;+&nbsp;";
					//────────────────────────────────────────────────────────────────
					b1.onclick=function(event)	//── augmenter la taille de la loupe ──
					//────────────────────────────────────────────────────────────────
					{	if ( 	( fnct.carre*2 )<fnct.init.offsetHeight &&
								( fnct.carre*2 )<fnct.init.offsetWidth )
						{	fnct.carre+=5;
							fnct.div.style.height=(fnct.carre*2)+"px";
							fnct.div.style.width=(fnct.carre*2)+"px";
						}
					}
					menu.appendChild(b1);
				b1=document.createElement("button");
					b1.innerHTML="&nbsp;-&nbsp;";
					//──────────────────────────────────────────────────────────────
					b1.onclick=function(event)	//── réduire la taille de la loupe ──
					//──────────────────────────────────────────────────────────────
					{	if ( 	((fnct.carre*2)-5)>this.parentNode.offsetWidth &&
								((fnct.carre*2)-5)>this.parentNode.offsetHeight )
						{	fnct.carre-=5;
							fnct.div.style.height=(fnct.carre*2)+"px";
							fnct.div.style.width=(fnct.carre*2)+"px";
						}
					}
					menu.appendChild(b1);
				l1=document.createElement("pre");
					l1.style.display="inline";
					l1.innerHTML="&#9;";
					menu.appendChild(l1);
				var l1=document.createElement("span");
					l1.innerHTML="Loupe&nbsp;";
					menu.appendChild(l1);
				l1=document.createElement("br");
					menu.appendChild(l1);
				b1=document.createElement("button");
					b1.innerHTML="&nbsp;+&nbsp;";
					//──────────────────────────────────────────────────
					b1.onclick=function(event)	//── augmenter le zoom ──
					//──────────────────────────────────────────────────
					{	//	if mais quoi ?
						{	fnct.zoom+=1;
							fnct.image.height=(fnct.zoom*fnct.init.offsetHeight);
							fnct.image.width=(fnct.zoom*fnct.init.offsetWidth);
						}
					}
					menu.appendChild(b1);
				b1=document.createElement("button");
					b1.innerHTML="&nbsp;-&nbsp;";
					//──────────────────────────────────────────────
					b1.onclick=function()	//── diminuer le zoom ──
					//──────────────────────────────────────────────
					{	if ( fnct.zoom>1 )
						{	fnct.zoom-=1;
							fnct.image.height=(fnct.zoom*fnct.init.offsetHeight);
							fnct.image.width=(fnct.zoom*fnct.init.offsetWidth);
						}
					}
					menu.appendChild(b1);
				l1=document.createElement("pre");
					l1.style.display="inline";
					l1.innerHTML="&#9;";
					menu.appendChild(l1);
				l1=document.createElement("span");
					l1.innerHTML="Zoom&nbsp;";
					menu.appendChild(l1);
				l1=document.createElement("br");
					menu.appendChild(l1);
				l1=document.createElement("pre");
					l1.style.display="inline";
					l1.innerHTML="&#9;";
					menu.appendChild(l1);
				b1=document.createElement("button");
					b1.innerHTML="Quitter";
					//───────────────────────────────────────────────────────
					b1.onclick=function()	//── fermer le menu contextuel ──
					//───────────────────────────────────────────────────────
					{	this.parentNode.parentNode.removeChild(this.parentNode);	}
					menu.appendChild(b1);
			menu.style.position="absolute";
			menu.style.top=this.offsetTop+"px";
			menu.style.left=this.offsetLeft+"px";
			menu.style.backgroundColor="#FFFFFF"
			menu.style.border="1px solid #FF0000";
			document.body.appendChild(menu);
			return false;
		}
		//──────────────────────────────────────────────────────────────
		this.div.onmousemove=function(event)	//── déplacement de la loupe ──
		//──────────────────────────────────────────────────────────────
		{	fnct.deplace(event)	};
		this.image=document.createElement("img");
			if ( prm['idimage'] )this.image.id=prm['idimage'];
			this.image.style.position="absolute";
			/*@cc_on	this.image.style.cursor="url(img/loupe.ico)";	@*/
			this.image.src=this.init.src;
			this.image.height=(this.zoom*this.init.offsetHeight);
			this.image.width=(this.zoom*this.init.offsetWidth);
			this.div.appendChild(this.image);
	document.body.appendChild(this.div);
	var fnct=this;
	//───────────────────────────────────────────────────────────────
	this.init.onmouseover=function(event)	//── survol d'une image ──
	//───────────────────────────────────────────────────────────────
	{	fnct.div.style.display="inline";
		fnct.deplace(event);
	};
	//───────────────────────────────────────────────
	this.deplace=function(event)	//── déplacement ──
	//───────────────────────────────────────────────
	{	var x,y;
		if ( window.event )
				{	x=window.event.x+document.body.scrollLeft;
					y=window.event.y+document.body.scrollTop;
				}
		else	{	x=event.pageX;
					y=event.pageY
				}
		if (	(x+fnct.carre)<fnct.init.offsetLeft ||
				(x-fnct.carre)>(fnct.init.offsetLeft+fnct.init.offsetWidth) ||
				(y+fnct.carre)<fnct.init.offsetTop ||
				(y-fnct.carre)>(fnct.init.offsetTop+fnct.init.offsetHeight)	 )
				{	fnct.div.style.display="none";	}
		else	{	fnct.image.style.top=((-y+fnct.init.offsetTop)*fnct.zoom)+"px";
					fnct.image.style.left=((-x+fnct.init.offsetLeft)*fnct.zoom)+"px";
					fnct.div.style.top=(y-fnct.carre)+"px";
					fnct.div.style.left=(x-fnct.carre)+"px";
				}
	};
}

