
/*                         ~\\|//
                            (0 0)
        •————————————oOOOo———(_)———oOOOo————————————•
        | Mail : marcel.Bultez@Tiscali.fr           |
        | Site : http://marcel-Bultez.chez-Alice.fr |
        |               .oooO   Oooo.               |
        •———————————————(   )———(   )———————————————•
                         \ (     ) /
                          \_)   (_/    */

var Champ,Fen,hor,ver;	// Variables globales


//÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
function gid(repere)	//÷÷ getElementById ÷÷
//÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
{	return document.getElementById(repere);	}
//÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
function rgb (r, g, b)	//÷÷ rgb(r,g,b) ==> RRGGBB héxa ÷÷
//÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
{	var n = (r<<16) + (g<<8) + b;
	return  (r<16? '0':'') + n.toString(16);
}
//÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
function choix(cellule)	//÷÷ choix d'une couleur ÷÷
//÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
{	gid('chx').style.backgroundColor=cellule.style.backgroundColor;
	var tmp;
	if ( cellule.style.backgroundColor.toLowerCase().substr(0,3)=='rgb' )
			tmp=eval(cellule.style.backgroundColor);
	else	tmp=cellule.style.backgroundColor.substr(1);
	var t1=eval('0x'+tmp.substr(0,2));
	gid('rr').value=t1;
	gid('rr').style.backgroundColor='rgb('+t1+',0,0)';
	gid('rrchgt').scrollLeft=t1;
	var t1=eval('0x'+tmp.substr(2,2));
	gid('gg').value=t1;
	gid('gg').style.backgroundColor='rgb(0,'+t1+',0)';
	gid('ggchgt').scrollLeft=t1;
	var t1=eval('0x'+tmp.substr(4,2));
	gid('bb').value=t1;
	gid('bb').style.backgroundColor='rgb(0,0,'+t1+')';
	gid('bbchgt').scrollLeft=t1;
}
//÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
function modCoul()	//÷÷ incrémenter/décrémenter les couleurs ÷÷
//÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
{	var t1=gid('rrchgt').scrollLeft;
	gid('rr').value=t1;
	gid('rr').style.backgroundColor='rgb('+t1+',0,0)';
	var t1=gid('ggchgt').scrollLeft;
	gid('gg').value=t1;
	gid('gg').style.backgroundColor='rgb(0,'+t1+',0)';
	var t1=gid('bbchgt').scrollLeft;
	gid('bb').value=t1;
	gid('bb').style.backgroundColor='rgb(0,0,'+t1+')';
	gid('chx').style.backgroundColor="rgb("+
				gid('rrchgt').scrollLeft+","+
				gid('ggchgt').scrollLeft+","+
				gid('bbchgt').scrollLeft+")";
}
//÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
function survol(cellule)	//÷÷ survol d'une couleur ÷÷
//÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷
{	gid('sur').style.backgroundColor=cellule.style.backgroundColor;	}

//—————————————————————————————————————————————————
function CoulFer()	//—— fermer le menu couleur ——
//—————————————————————————————————————————————————
{	document.getElementById('CoulMnu').style.display="none";	
	Fen.focus();	
}
//——————————————————————————————————————————
function CoulVal()	//—— couleur validée ——
//——————————————————————————————————————————
{ 	Champ.execCommand(document.getElementById("CoulQui").innerHTML,
			false,
			document.getElementById("chx").style.backgroundColor);
	CoulFer();	
}
//——————————————————————————————————————————————————
function PosSouris(ev)	//—— note position souris ——
//——————————————————————————————————————————————————
{	switch (navigator.appName)	
	{	//	 	===============================
		case 	"Microsoft Internet Explorer":
		//	 	===============================
			hor=event.x;
			ver=event.y;
			break;
		//				=========
		default:	//	sinon
		//	   		=========
			hor=ev.pageX;
			ver=ev.pageY;
			break;	
	}	
}
//———————————————————————————————————————————————————————
function CoulAff(bou,rgb)	//—— affichage menu couleur ——
//———————————————————————————————————————————————————————
{	//if (document.getElementById("CoulMnu").style.display=="none")
	{ 	document.getElementById("CoulQui").innerHTML=
		bou.src.substring(	bou.src.lastIndexOf("/")+1,
							bou.src.lastIndexOf("."))
//		tmp=rgb.substring(rgb.indexOf("(")+1,rgb.indexOf(")"));
//		tmp=tmp.split(",");
		document.getElementById("CoulMnu").style.top=ver;
		document.getElementById("CoulMnu").style.left=hor;
		document.getElementById("CoulMnu").style.display="block";
//		for ( var n=0;n<3;n++ )
//		{	document.getElementById("CoulRep"+n).style.left=Number(tmp[n])+10;
//			document.getElementById("CoulNbr"+n).innerHTML=tmp[n];	
//		}	
	}	
}
//—————————————————————————————————————————
function FontChx(sel)	//—— police, nom ——
//—————————————————————————————————————————
{	Champ.execCommand("FontName", false, sel[sel.selectedIndex].text);	
	Fen.focus();	
}
//————————————————————————————————————————————
function TailChx(sel)	//—— police, taille ——
//————————————————————————————————————————————
{	Champ.execCommand("FontSize", false, sel[sel.selectedIndex].text);
	Fen.focus();
}
//———————————————————————————————————————
function btn1(bou,p2,p3)	//—— bouton ——
//———————————————————————————————————————
{	p2 = p2 ? p2 : false;	// valeurs par défaut
	p3 = p3 ? p3 : null;
	Champ.execCommand(bou.src.substring(bou.src.lastIndexOf("/")+1,
				bou.src.lastIndexOf(".")),p2,p3);   
	Fen.focus();	
}
//———————————————————————————————————————————————
function Voir(btn)	//—— bascule html/Editeur ——
//———————————————————————————————————————————————
{ 	var tmp=document.getElementById("txt");
	if (tmp.style.display=="none")
			{ 	tmp.style.display="inline";
				btn.title="Revoir la page";
				tmp.value=Champ.body.innerHTML; 
			}
	else	{ 	tmp.style.display="none";
				btn.title="Voir le Code HTML";
				Champ.body.innerHTML=tmp.value;
			}  
}
//———————————————————————————————————————————————————————————————
function maj()	//—— maj iframe ou textarea et envoi formulaire ——
//———————————————————————————————————————————————————————————————
{ 	var tmp=document.getElementById("txt");
	if (tmp.style.display=="none")
			{ 	tmp.value=Champ.body.innerHTML; 	}
	else 	{ 	Champ.body.innerHTML=tmp.value;  }
  	frm.submit();	
}
//—————————————————————————————————————————
function initial()	//—— Initialisation ——
//—————————————————————————————————————————
{	self.moveTo(Math.floor((window.screen.width-document.body.clientWidth)/2),
                Math.floor((window.screen.height-document.body.clientHeight)/2));
	document.getElementById("MoiGif").alt=document.title;
	document.getElementById("MoiRef").href+=document.title;
	switch (navigator.appName)	
	{	//	 	===============================
		case 	"Microsoft Internet Explorer":
		//	 	===============================
			Fen=window.frames['Saisie'];
			Champ=Fen.document;
			document.getElementById('SiIe').style.display="inline";
			break;
		//	   		=========
		default:	// 	sinon
		//	   		=========
			Champ=document.getElementById('Saisie').contentDocument;
			Fen=document.getElementById('Saisie').contentWindow;
			break;	
	}
	var t1=document.getElementById("selfnt");
	for ( var n=0;n<t1.length;n++ )	// pointer la police utilisée
	{	if ( t1[n].text=="Verdana" )
		{	t1.selectedIndex=n;
			n=t1.length;	
		}	
	}
	t1=document.getElementById("seltai");
	t1.selectedIndex=2;
	Champ.designMode='On';	// iframe modifiable
	Fen.focus();
	document.onmousemove = function(event)	{	PosSouris(event);	}
}

