/* ============================================== */
/* (c) Julien RICHETTI pour ANDRE BONDET, 2008    */
/* ============================================== */

function DoPop(lapage, w)
{
	window.open(lapage,'andrebondet','left=0,top=0,width='+w+',resizable=1,directory=0,scrollbars=1,menubar=0,toolbar=0,status=1,location=0;').focus();
}

function HiForm(LaForme)
{
	with (document.getElementById('f' + LaForme))
	{
		style.backgroundColor='#FFFECC';
		//style.border='1px solid gray';
	}
}
function LoForm(LaForme)
{
	with (document.getElementById('f' + LaForme))
	{
		style.backgroundColor='transparent';
		//style.border='1px solid white';
	}
}

function PopForm(LaForme, LeNom)
{
	if (LeNom) {txt = '<caption>Forme n°'+ LeNom + '</caption>' } else { txt=''; }
	txt = '<div class="cadre"><table class="legende">' + txt + '<tr><td><img src="profils/' + LaForme + '.gif" alt="" /></td></tr></table></div>';
	return overlib(txt, HAUTO, VAUTO, FOLLOWMOUSE);
}

function Hint(Symbole, Categorie, Designation, Aspect, Masse, Traction, Chaleur, Choc)
{
	txt = '<div class="cadre"><table class="legende" width="250">';
	txt = txt + '<tr><th>Désignation</th><td style="color: #069;"> ' + Designation + '</td></tr>';
	txt = txt + '<tr><th>Catégorie</th><td>' + Categorie + '</td></tr>';
	txt = txt + '<tr><th>Symbole</th><td>' + Symbole + '</td></tr>';
	if (Aspect)		txt = txt + '<tr><th>Aspect</th><td>' + Aspect + '</td></tr>';
	if (Masse)		txt = txt + '<tr><th>Masse Volumique</th><td>' + Masse + '</td></tr>';
	if (Traction)	txt = txt + '<tr><th>Resistance à la rupture en traction</th><td>' + Traction + '</td></tr>';
	if (Chaleur)	txt = txt + '<tr><th>Resistance à la chaleur continue</th><td>' + Chaleur +  '</td></tr>';
	if (Choc)		txt = txt + '<tr><th>Resistance au choc</th><td>' + Choc + '</td></tr>';
	txt = txt + '</table></div>';
	
	return overlib(txt, OFFSETX, 25, OFFSETY, -20, VAUTO, FOLLOWMOUSE);
}

function HintPS() { return Hint('PS', 'STYRENIQUES', 'Polystyrène', 'transparent/opaque', '1,04 - 1,07', '35 - 84', '77', 'Moyen');}
function HintPVCR() { return Hint('PVC R', 'Vinylique', 'Polychlorure de vinyle Rigide', 'transparent', '1,3 - 1,58', '10 - 24', '79', 'Moyen à Bon');}
function HintPVCS() { return Hint('PVC S', 'Vinylique', 'Polychlorure de vinyle Souple', 'transparent', '1,16 - 1,35', '42 - 53', '60', 'Trés bon');}
function HintABS() { return Hint('ABS', 'STYRENIQUES', 'Acrylonitrile - Butadiène - Styrène opaque', '1,01 - 1,05', '40 - 50', '93', 'Bon');}
function HintPEBD() { return Hint('PE BD', 'POLYOLEFINES', 'Polyéthylène Basse Densité (Hte pression)', 'opaque', '0,91 - 0,92', ' 4 - 16', '100', 'Très Bon');}
function HintPEHD() { return Hint('PE HD', 'POLYOLEFINES', 'Polyéthylène Basse Densité (Basse pression)', 'opaque', '0,84 - 0,97', '21 - 38', '121', 'Très Bon');}
function HintPP() { return Hint('PP', 'POLYOLEFINES', 'Polypropylène', 'opaque', '0,902 - 0,91', '30 - 39', '143', 'Très Bon');}
function HintPA6() { return Hint('PA6', 'POLYAMIDES', 'Polyamides', 'opaque', '1,12 - 1,14', '76', '121', 'Très Bon');}
function HintPA() { return HintPA6();}
function HintPVC() { return HintPVCR();}
// à détailler
function HintPVCSR() { return Hint('PVC SR', 'Vinylique', 'Polychlorure de vinyle Semi-Rigide', 'transparent', '1,16 - 1,35', '42 - 53', '60', 'Trés bon');}

function Coloris(Couleur, Libelle)
{
	txt = '<div class="cadre"><table class="legende" width="100"><caption>coloris ' + String(Couleur).toUpperCase() + '</caption><tr><td>' + Libelle + '</td><td width="32"><img src="legende/' + Couleur +'.png" style="border: 1px solid black; margin: 5px;" alt="" /></td></tr></table></div>';
	return overlib(txt, OFFSETX, 25, OFFSETY, -20, FOLLOWMOUSE);
}

function ColorisIV() { return Coloris('iv', 'Ivoire');}
function ColorisMR() { return Coloris('mr', 'Marron');}
function ColorisBL() { return Coloris('bl', 'Bleu');}
function ColorisNR() { return Coloris('nr', 'Noir');}
function ColorisBC() { return Coloris('bc', 'Blanc');}
function ColorisCR() { return Coloris('cr', 'Cristal');}
function ColorisGR() { return Coloris('gr', 'Gris');}


// personnalisation de OverLib
var ol_width=100;
var ol_fgcolor='#F9F9F0';
var ol_bgcolor='#333333';

// rollover sur chaque rangée des tableaux
// (adapté de www.evolt.com, Chris Heilmann)
window.onload = function ()
{
	// au chargement de la page
	initRowBehavior();
}

// attribut les comportements aux éléments
function initRowBehavior()
{
	// est-ce un navigateur compatible ?
	if (!document.getElementsByTagName) return;
	
	// recherche les tableaux de la page
	var TBL = document.getElementsByTagName('TABLE');
	// mais seulement ceux dont le style est "ref"
	for (var i=0; i < TBL.length; i++) {
		if (TBL[i].className == "ref") {
			var TRS = TBL[i].getElementsByTagName('TR');
			for (var j=0; j < TRS.length; j++) {
				TRS[j].onmouseover = mouseGoesOver;
				TRS[j].onmouseout = mouseGoesOut;
			}
			var LNK = TBL[i].getElementsByTagName('A');
			for (var j=0; j < LNK.length; j++) {
				LNK[j].onmouseout = nd;
				LNK[j].href = 'javascript:nd();void(0);';
				LNK[j].title = '';
			}
		}
	}
	// recherche les menus spéciaux ouvrants des popups
	var MNU = document.getElementById('menu');
	var LNK = MNU.getElementsByTagName('a');
	for (var i=0; i < LNK.length; i++) {
		// s'il s'agit des menus spéciaux Légende, Conditions
		if (LNK[i].className == "pop"){
			LNK[i].onclick = function(){DoPop(this.href, 640); return false;}
			LNK[i].onkeypress = function(){DoPop(this.href, 640); return false;}
		}
		// s'il s'agit du sommaire
		if (LNK[i].className == "popsom"){
			LNK[i].onclick = function(){PopSommaire(this); return false;}
			LNK[i].onkeypress = function(){PopSommaire(this); return false;}
		}
		// s'il s'agit du menu spécial retour à la page précédente / fermer / back
		if (LNK[i].className == "unpop"){UnPop(LNK[i]);}
		if (LNK[i].className == "back"){BackLink(LNK[i]);}
	}
}

function BackLink(what)
{
	what.href = "javascript:history.back();";
	what.textContent = "Retour à la page précédente";
	// ce qui semble ne pas marcher avec IEX, donc on force avec innerText ?
	what.innerText = "Retour à la page précédente";
}

function UnPop(what)
{
	if (window.name=='andrebondet')
	{
		what.title = "Fermer cette fenêtre et revenir à la page précédente";
		what.href = "javascript:close();";
		what.textContent = "Fermer cette fenêtre";
		// ce qui semble ne pas marcher avec IEX, donc on force avec innerText ?
		what.innerText = "Fermer cette fenêtre";
	}
}

function mouseGoesOver()
{
	// passe la rangée en surbrillance
	this.style.backgroundColor='#CF0';
	// s'il y a une illustration à mettre en évidence 
	if (this.id){HiForm(this.id.substr(0,2));}
}

function mouseGoesOut()
{
	// repasse la rangée à sa couleur originale
	this.style.backgroundColor='transparent';
	if (this.id){LoForm(this.id.substr(0,2));}
}

function PopSommaire(what)
{
	return overlib(sommaire, FULLHTML, STICKY, MOUSEOFF, CENTER, FIXY, 95);
}

var sommaire = "<div id=\"popsom\">";
	sommaire += "<a href=\"index.html\">Retour au catalogue...</a><hr/>";
	sommaire += "<a href=\"plat.html\">Plat</a>";
	sommaire += "<a href=\"battement.html\">Battement</a>";
	sommaire += "<a href=\"corniere.html\">Profil en L, Cornière</a>";
	sommaire += "<a href=\"profil-en-u.html\">Profil en U</a>";
	sommaire += "<a href=\"profil-en-h.html\">Profil en H</a>";
	sommaire += "<a href=\"jonction.html\">Jonction</a>";
	sommaire += "<a href=\"couvre-joint.html\">Jonction (couvre-joint)</a>";
	sommaire += "<a href=\"bordures.html\">Bordure</a>";
	sommaire += "<a href=\"rails-double.html\">Rail de glissement (double)</a>";
	sommaire += "<a href=\"mono-rail.html\">Mono-rail de glissement</a>";
	sommaire += "<a href=\"glissiere.html\">Rail de glissement (Glissière)</a>";
	sommaire += "<a href=\"taquet.html\">Rail de glissement (Taquet)</a>";
	sommaire += "<a href=\"charniere.html\">Charnière</a>";
	sommaire += "<a href=\"rail-dossiers-suspendus.html\">Rail pour dossiers suspendus</a>";
	sommaire += "<a href=\"porte-etiquette.html\">Porte étiquette, porte affiche</a>";
	sommaire += "<a href=\"reliure.html\">Reliure</a>";
	sommaire += "<a href=\"protection.html\">Protection</a>";
	sommaire += "<a href=\"jonc.html\">Tube rond, jonc</a>";
	sommaire += "<a href=\"tube-rectangulaire.html\">Tube carré, rectangulaire</a>";
	sommaire += "<hr><a href=\"surmesure.html\">Profilés sur mesure...</a>";
	sommaire += "</div>";

