//le nom document ne doit pas contenir d'espace : eg "le machin.htm" INTERDIT

//1° partie : la création du bouton (span)
//découvert dans http://www.creaweb.fr/
//modifié et annoté pour mes besoins http://www.ifrance.com/olivierweb

//les variables
if (document.images)
var logotexte="sommaire"
var logolink="javascript:AffSom()"
var imgsrc=""
var alttext=""
var fadeintoview=1
var visibleduration=0
//
var staticlogo=new Image(70,25)
staticlogo.src=imgsrc

//2 fonctions pour Netscape
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers)
setTimeout("window.onresize=regenerate",400)
}


var fadeset=''
if (fadeintoview)
fadeset="filter:alpha(opacity=0)"

//pour IE
if (document.all)
document.write('<span id="logo" style="'+fadeset+';position:absolute;top:100;width:'+staticlogo.width+';height:'+staticlogo.height+';BACKGROUND-COLOR:' + document.bgColor +  '"></span>')

//effet de fondu, pour IE uniquement
function bringintoview(){
if (logo.filters.alpha.opacity<=95)
logo.filters.alpha.opacity+=5
else{
clearInterval(viewit)
if (visibleduration!=0)
setTimeout("logo.style.visibility='hidden'",visibleduration*1000)
}
}

//pour Netscape
function createlogo(){
staticimage=new Layer(100)
staticimage.left=-300
staticimage.top=120
staticimage.document.write('<a href="'+logolink+'">'+logotexte)
if (imgsrc!=""){staticimage.document.write('<img src="'+staticlogo.src+'" border=0 alt="'+alttext+'">')}
staticimage.document.write('</a>')
staticimage.document.close()
staticimage.visibility="show"
regenerate2()
staticitns()
}

if (document.layers)
window.onload=createlogo;

//pour IE
if (document.all){
/*en bas à droite, ce qu'il y avait à l'origine
w=document.body.clientWidth-logo.style.pixelWidth-5
h=document.body.clientHeight-logo.style.pixelHeight-5
*/
//en haut à gauche, ce que je veux
w=0
h=0
logo.style.left=w
logo.style.top=h
}

function logoit(){
var w2=document.body.scrollLeft+w
var h2=document.body.scrollTop+h
logo.style.left=w2
logo.style.top=h2
}

//fonction pour Netscape
function logoit2(){
/*à l'origine
staticimage.left=pageXOffset+window.innerWidth-staticimage.document.width-15
staticimage.top=pageYOffset+window.innerHeight-staticimage.document.height
*/
//en haut à gauche, ce que je veux
staticimage.left=pageXOffset
staticimage.top=pageYOffset
}

//fonction et if pour IE
function insertimage(){
logo.innerHTML='<a href="'+logolink+'">'+logotexte
if (imgsrc!=""){logo.innerHTML+='<img src="'+staticlogo.src+'" border=0 alt="'+alttext+'">'}
logo.innerHTML+='</a>'
if (fadeintoview)
viewit=setInterval("bringintoview()",100)
else{
if (visibleduration!=0)
setTimeout("logo.style.visibility='hidden'",visibleduration*1000)
}
}

if (document.all){
window.onscroll=logoit
window.onresize=new Function("window.location.reload()")
window.onload=insertimage
}


//fonction pour Netscape
function staticitns(){
setInterval("logoit2()",90)
if (visibleduration!=0)
setTimeout("staticimage.visibility='hide'",visibleduration*1000)
}

//2°partie la création du sommaire des ancres, NE FONCTIONNE PAS AVEC NETSCAPE, "anchors n'est pas une fonction"
function AffSom(){
//issu d'une longue réflexion, contactez-moi pour avoir des détails ou pour utiliser le code
var str = new String ("toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes, resizable=yes, top=0, left=0, width=250, height=300");
var FenSom = window.open ("", "montresignets", str);
FenSom.document.writeln ("<html>");
FenSom.document.writeln ("<head>");
FenSom.document.writeln ("<title>Sommaire</title>");
FenSom.document.writeln ('<Style TYPE="text/css">');
FenSom.document.writeln ('A:active {COLOR: red}');
FenSom.document.writeln ('A:visited {COLOR: purple}');
FenSom.document.writeln ('A:hover {BACKGROUND-COLOR: #409fff; COLOR: yellow; TEXT-DECORATION: none}');
FenSom.document.writeln ('A:link { COLOR: #409fff }');
FenSom.document.writeln ('BODY {COLOR: blue; FONT-FAMILY: Verdana, Arial; Font-size: 12px; background-color:' + document.bgColor +  '}');
FenSom.document.writeln ('</style>');
FenSom.document.writeln ("</head>");
FenSom.document.write ('<bo' + 'dy topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0>');
FenSom.document.writeln ('<font style="font:	8pt Verdana, Arial, Helvetica, Sans-serif">');
FenSom.document.writeln ("<script language=javascript>function navigateClose(str){if (document.my_parent != null){document.my_parent.location.href=str;window.close();}else{alert(\"Please wait until the list has populated.\");}}<\/script>");
FenSom.document.writeln ("Sommaire de <b>" + document.title + "</b>:<ol style=\"LIST-STYLE: square outside; MARGIN-LEFT: 3px; TEXT-ALIGN: left; color: #409fff\">");
var anchors = document.anchors;
for (i = 0; i < anchors.length; i++)
{
	if (anchors(i).name != "")
	{
	FenSom.document.writeln ("<li><A HREF='" + document.location.pathname + "#" + anchors(i).name + "' Target=BAS>" + anchors(i).innerText + "</a><BR>");
	}
}
FenSom.document.writeln ("</ol><center><a href='javascript:window.close()' style=\"color:#FF0000;text-decoration:none\">fermer la fen&ecirc;tre</a></center><BR></body>");
FenSom.document.writeln ("</font></body></html>");
FenSom.document.close();
}