// Flou
// Version : 6.03.11
//
// http://so.fun.free.fr

	if (monRolloverFlou == null)
	{
		var monRolloverFlou = new Array();
	}

	function RolloverFlou(id_rollover, frequence, vitesse,	delai, largeurMax, hauteurMax)
	{
		this.id_rollover = id_rollover;

		// this.rollover = new Array();

		// this.calque1 = "";
		// this.calque2 = "";

		this.frequence = frequence;
		this.vitesse = vitesse;
		this.delai = delai; // délai entre chaque rotations

		this.largeurMax = largeurMax;
		this.hauteurMax = hauteurMax;

		// this.indexDiapo = 2;
		this.isMouseOver = false;
		this.enCours = false;
		this.epaisseurCadre = 0;
		this.couleurCadre = "#000000";

		this.stats = new Image();
		this.stats.src = "http://so.fun.free.fr/modules/stats/image_bidon.php?script=rollover&version=6.03.11";
	}

	function progression()
	{
		if ((this.isMouseOver==false) && document.getElementById('div_rollover_flou1_' + this.id_rollover).style.opacity > 0)
		{// disparition de l'image du dessus
			// pour Firefox (le paramètre existe sous IE mais n'a pas d'influence)
			// ce paramètre sert de base commune pour les deux navigateurs pour tester l'état du calque
			opacite = parseFloat(document.getElementById('div_rollover_flou1_' + this.id_rollover).style.opacity) - parseFloat(this.vitesse / 100);
			if (opacite < 0)
			{
				opacite=0;
			}
			document.getElementById('div_rollover_flou1_' + this.id_rollover).style.opacity = opacite

			// pour IE
			if (document.getElementById('div_rollover_flou1_' + this.id_rollover).style.filter)
			{
				texte = document.getElementById('div_rollover_flou1_' + this.id_rollover).style.filter;
				opacite = texte.replace(/alpha\(opacity=([0-9]*)\)/, '$1');
				opacite = parseFloat(opacite) - this.vitesse;
				if (opacite < 0)
				{
					opacite=0;
				}
				//nouveau_texte = texte.replace(/alpha\(opacity=([0-9]*)\)/, 'alpha(opacity=' + opacite + ')');
				nouveau_texte = 'alpha(opacity=' + opacite + ')';
				document.getElementById('div_rollover_flou1_' + this.id_rollover).style.filter = nouveau_texte;
			}

			setTimeout("monRolloverFlou[" + this.id_rollover + "].progression()", this.frequence);
		}
		else if ((this.isMouseOver==true) && document.getElementById('div_rollover_flou1_' + this.id_rollover).style.opacity < 0.99)
		{// apparition de l'image du dessus

			// pour Firefox (le paramètre existe sous IE mais n'a pas d'influence)
			// ce paramètre sert de base commune pour les deux navigateurs pour tester l'état du calque
			opacite = parseFloat(document.getElementById('div_rollover_flou1_' + this.id_rollover).style.opacity) + parseFloat(this.vitesse / 100);
			if (opacite >= 1)
			{
				opacite=0.99;
			}
			document.getElementById('div_rollover_flou1_' + this.id_rollover).style.opacity = opacite;

			// pour IE
			if (document.getElementById('div_rollover_flou1_' + this.id_rollover).style.filter)
			{
				texte = document.getElementById('div_rollover_flou1_' + this.id_rollover).style.filter;
				opacite = texte.replace(/alpha\(opacity=([0-9]*)\)/, '$1');
				opacite = parseFloat(opacite) + this.vitesse;
				if (opacite > 100)
				{
					opacite=100;
				}
				//nouveau_texte = texte.replace(/alpha\(opacity=([0-9]*)\)/, 'alpha(opacity=' + opacite + ')');
				nouveau_texte = 'alpha(opacity=' + opacite + ')';
				document.getElementById('div_rollover_flou1_' + this.id_rollover).style.filter = nouveau_texte;
			}

			if (opacite == 0.99)
			{
				this.enCours = false;
				return;
			}
			setTimeout("monRolloverFlou[" + this.id_rollover + "].progression()", this.frequence);
		}
		else
		{
			this.enCours = false;
/*		if (document.getElementById('div_rollover_flou1_' + this.id_rollover).style.opacity < 0) document.getElementById('div_rollover_flou1_' + this.id_rollover).style.opacity = 0;
			if (document.getElementById('div_rollover_flou1_' + this.id_rollover).style.opacity > 1) document.getElementById('div_rollover_flou1_' + this.id_rollover).style.opacity = 1;

			if (document.getElementById('div_rollover_flou1_' + this.id_rollover).style.filter)
			{
				if (document.getElementById('div_rollover_flou1_' + this.id_rollover).style.opacity < 0) document.getElementById('div_rollover_flou1_' + this.id_rollover).style.filter = "alpha(0)";
				if (document.getElementById('div_rollover_flou1_' + this.id_rollover).style.opacity > 1) document.getElementById('div_rollover_flou1_' + this.id_rollover).style.filter = "alpha(100)";
			}
*/		}
	}

	function changePhoto(souris)
	{
		if(souris && souris=="over")
		{
			this.isMouseOver=true;
		}
		else if(souris && souris=="out")
		{
			this.isMouseOver=false
		}
/*		else if (this.isMouseOver==false) this.isMouseOver=true;
		else this.isMouseOver=false;
*/
		if (this.enCours == false)
		{
			this.enCours = true;
			monRolloverFlou[this.id_rollover].progression();
		}
	}

	function place(photo1, photo2)
	{
		document.write('<table align="center" border="' + this.epaisseurCadre + '" bordercolor="' + this.couleurCadre + '" cellpadding="0" cellspacing="0" style="border-style:solid; border-width:' + this.epaisseurCadre + '"><tr><td valign="top">'); // début du tableau pour le cadre
		document.write('<table align="center" border="0" cellpadding="0" cellspacing="0">');
		document.write('<tr height="' + this.hauteurMax + '" align="left">');
		document.write('<td width="' + this.largeurMax + '" valign="top">');
		document.write('<img src="' + photo1 + '" width="' + this.largeurMax + '" height="0" border="0" style="visibility:hidden; border:0; width:' + this.largeurMax + '; height:0"><div></div>'); // je réutilise une des images à la place d'un pixel transparent
		document.write('<div id="div_rollover_flou2_' + this.id_rollover + '" style="position:absolute; display:block; width:' + this.largeurMax + '; height:' + this.hauteurMax + '; overflow:hidden; background-image:url(\'' + photo1 + '\')"><table align="left" border="0" cellpadding="0" cellspacing="0"><tr height="' + this.hauteurMax + '"><td width="' + this.largeurMax + '"></td></tr></table></div>');
		document.write('<div id="div_rollover_flou1_' + this.id_rollover + '" style="position:absolute; display:block; width:' + this.largeurMax + '; height:' + this.hauteurMax + '; overflow:hidden; background-image:url(\'' + photo2 + '\'); opacity:0; filter: alpha(opacity=0)" tmponClick="monRolloverFlou[' + this.id_rollover + '].changePhoto()" onMouseOver="monRolloverFlou[' + this.id_rollover + '].changePhoto(\'over\')" onMouseOut="monRolloverFlou[' + this.id_rollover + '].changePhoto(\'out\')"><table align="left" border="0" cellpadding="0" cellspacing="0"><tr height="' + this.hauteurMax + '"><td width="' + this.largeurMax + '"></td></tr></table></div>');
		document.write('</td>');
		document.write('</tr>');
		document.write('</table>');
		document.write('</td></tr></table>'); // fin du tableau pour le cadre
	}

	function ajouteCadre(epaisseur, couleur)
	{
		this.epaisseurCadre = epaisseur;
		this.couleurCadre = couleur;
	}

	// liaison des fonctions à l'objet
	RolloverFlou.prototype.place = place;
	RolloverFlou.prototype.changePhoto = changePhoto;
	RolloverFlou.prototype.progression = progression;
	RolloverFlou.prototype.ajouteCadre = ajouteCadre;

