// $Id: listePaysPagesInternes.js,v 1.5 2006/08/30 19:08:05 christian Exp $ 
// code pour liste des pays


window.isOldGecko = (
		!document.readyState &&
		!window.opera &&
		!window.find &&
		window.home &&
		document.getElementsByTagName &&
		navigator.product &&
		(navigator.product == 'Gecko')
);
window.isIE5Mac = (!window.showModelessDialog && window.ActiveXObject && document.getElementById);
window.isNotFXable = (
			document.all || 
			window.isOldGecko ||
			navigator.userAgent.toLowerCase().indexOf('safari') != -1
);

function injectFX()
{
	if (window.isNotFXable) return;
	document.writeln('<script src="'+FXsrc1+'" type="text/javascript"><\/script>');
	document.writeln('<script src="'+FXsrc2+'" type="text/javascript"><\/script>');
}

var outFX = [
//	'Fade'
//	'Puff',
	'BlindUp'
//	'SwitchOff',
//	'SlideUp',
//	'DropOut',
//	'Squish',
//	'Fold',
//	'Shrink'
];
var inFX = [
//	'Grow',
//	'Appear'
	'BlindDown'
//	'SlideDown'
];

function writeBIQStyle()
{
	if (!document.getElementById) return;
	document.writeln('');
	document.writeln('<style type="text/css">');
//	document.writeln('body div#piedpage {');
//	document.writeln('	position: static !important;');
//	document.writeln('	background-color: transparent !important;');
//	document.writeln('}');
	document.writeln('div.rel-container {');
	document.writeln('	position: relative;');
	document.writeln('}');
	document.writeln('#tous-les-pays a:active span {');
	document.writeln('	color: black;');
	document.writeln('}');
	document.writeln('#tous-les-biqs {');
	document.writeln('	width: 500px;');
	document.writeln('	height: 180px;');
	document.writeln('	overflow: auto;');
	document.writeln('	position: absolute;');
	document.writeln('	z-index: 100;');
	document.writeln('	border: 2px solid #c8e0ff;');
	document.writeln('	background-color: #fff;');
//	document.writeln('	background-color: #c8e0ff');
//	document.writeln('	background: white url("cercle00.gif") no-repeat scroll left -7px;');
//	document.writeln('	background: white url("cercle0c.gif") no-repeat scroll left top;');
//	document.writeln('	_background: white url("cercle00.gif") no-repeat fixed left -7px;');
	document.writeln('}');
	document.writeln('#tous-les-biqs li {');
	document.writeln('	list-style: none outside url("' + rel_to_page + '/images/iu/utilitaires/points/vert1.gif");');
	document.writeln('}');
	document.writeln('#fermer-biqs {');
	document.writeln('	display: none;');
	document.writeln('	width: 100px;');
	document.writeln('	height: 15px;');
	document.writeln('	position: absolute;');
	document.writeln('	z-index: 1000;');
	document.writeln('	left: 370px; ');
	document.writeln('}');
	document.writeln('#fermer-biqs a:active {');
	document.writeln('	color: black;');
	document.writeln('}');
	document.writeln('/* \\*/');
	document.writeln('#tous-les-biqs {');
	document.writeln('	top: 50px;');
	document.writeln('	left: -20px;');
	document.writeln('}');
	document.writeln('* html #tous-les-biqs {');
	document.writeln('	top: 50px;');
	document.writeln('	left: -10px;');
	document.writeln('}');
	document.writeln('#fermer-biqs {');
	document.writeln('	top: 60px;');
	document.writeln('}');
	document.writeln('* html #fermer-biqs {');
	document.writeln('	top: 60px;');
	document.writeln('}');
	document.writeln('#tous-les-biqs ul {');
	document.writeln('	padding-top: 7px;');
	document.writeln('}');
	document.writeln('* html #tous-les-biqs ul {');
	document.writeln('	padding: 7px 0 0px 0;');
	document.writeln('	margin-left: 25px;');
	document.writeln('}');
	document.writeln('* html #tous-les-biqs li a {');
	document.writeln('	vertical-align: 20%;');
	document.writeln('}');
	document.writeln('/* */');
	document.writeln('</style>');
}
function writeCloseBIQs()
{
	if (!document.getElementById) return;
	document.write('<div id="fermer-biqs"><img id="X-img" src="'+coloredDotImg+'" alt="-" width="13" ');
	document.write('height="10" border="0" /><a id="X" href="javascript:;" ');
	document.write('onclick="hideBIQs(); return false">'+closeBIQs+'</a></div>');
}
function hideBIQs()
{
	if (typeof Effect == 'object')
	{
		eval('Effect.'+outFX[Math.floor(Math.random()*outFX.length)]+"('tous-les-biqs', {duration:1})")
	}
	else
	{
		document.getElementById('tous-les-biqs').style.display = 'none';
	}
	document.getElementById('fermer-biqs').style.display = 'none';
	if (!window.isNotFXable)
	{
		setTimeout(hideBIQsWait,1500);
	}
	else
	{
		hideBIQsWait();
	}
}
function hideBIQsWait()
{
	var tlp = document.getElementById('tous-les-pays').getElementsByTagName('A')[0];
	tlp.onclick = tlp.oldOnClick;
	tlp.disabled = false;
	tlp.oldOnClick = null;
	tlp.focus();
	if (!window.isIE5Mac) tlp.style.cursor = (document.all ? 'hand' : 'pointer');
}
function getContainerByTagName(containerTagName, containee)
{
        var tg = containerTagName.toLowerCase();
        var con = containee;
        while (1) {
                if (con && con.nodeName && (con.nodeName.toLowerCase() == tg)) { break; }
                else if (con == document.body) { alert('boucle infinie'); return false; }
                else { con = con.parentNode; }
        }
        return con;
}
function showBIQs()
{
	var biq = document.getElementById('tous-les-biqs');
	var x = document.getElementById('fermer-biqs');
	var tlp = document.getElementById('tous-les-pays').getElementsByTagName('A')[0];
	if (!tlp.oldOnClick)
	{
		if (!window.isIE5Mac) tlp.style.cursor = 'default';
		tlp.oldOnClick = tlp.onclick;
		tlp.disabled = true;
		tlp.onclick = function(){return false}
	}
	else
	{
		tlp.onclick = tlp.oldOnClick;
		tlp.disabled = false;
		tlp.oldOnClick = null;
		if (!window.isIE5Mac) tlp.style.cursor = (document.all ? 'hand' : 'pointer');
		return false;
	}
	if (typeof Effect == 'object')
	{
		eval('Effect.'+inFX[Math.floor(Math.random()*inFX.length)]+"('tous-les-biqs', {duration:1})")
		setTimeout(showX,1000);
	}
	else
	{
		biq.style.display = 'block';
		showX();
	}
	return false;
}
function showX()
{
	document.getElementById('fermer-biqs').style.display = 'block';
	document.getElementById('X').focus();
}
function openWithJS(url)
{
/*
This function fixes a weird bug with IE5Mac where
all the text in the opener's page gets selected
after a normal (non-JS) click on a country link,
and it's impossible to deselect it without reloading
the page. This function works in all browser but it
is called only for IE5Mac at the moment.
*/	
	if (!window.isIE5Mac) return true;
	window.open(url,'_blank');
	return false;
}
function writeTousLesPays(p)
{
	document.writeln('<div id="tous-les-biqs"><ul>');
	for (var i=0; i<p.length; i++)
	{
		document.writeln(
			'<li><a target="_blank" href="' +
			rel_to_page.replace(/\/$/,'') + p[i].url +
			'" onclick="return openWithJS(this.href)">' +
			p[i].txt + '</a>' +
			(
				typeof p[i].warn == 'string' ?
				'<span style="color:red;font-size:11px"> - ' + p[i].warn + '</span>' :
				''
			) + '</li>'
		);
	}
	document.writeln('</ul></div>');
	if (typeof Effect == 'object')
	{
		Effect.Fade('tous-les-biqs', {duration:0});
	}
	else if (document.getElementById)
	{
		document.getElementById('tous-les-biqs').style.display = 'none';
	}
}
