/*
Copyright (C) 2004-2010  Copyright MICHAEL CULTURE AISBL
See LICENCE file.
*/
// corrections des styles pour IE6
if(navigator.userAgent.indexOf('MSIE')>=0){

/* #rech #quicksearch { width: 27em; text-align: right } #rech #quicksearch h5 { margin-top: 0 } */

	css = " span.lien { margin-left: 1.2em !important } span.fleche { left: -1.2em !important; top: 0.3em } #imageCollection h6 { margin-top: 0.5em !important }#imageCollection h6.archives { margin-top: 0.2em !important  } #rech form input.inputtext { height: 1.4em; width: 10.5em } #menu ul.annexes a { margin-top: -0.3em;  } #menu ul.annexes #basket a { margin-top: 0.6em;  } #menu ul.annexes a span { cursor: hand; }  #menu ul.annexes a span.icone { height: 1.8em } #menu #menuList #inputFilter { width: 11em; }#menu #menuList select#filterType {width: 11.3em } #menu #menuList select#translate { width: 11.3em } #menu #menuList select.sortBy { width: 15em } #liste #contenu h3#resTitle { margin-top: 0.5em } #contenu #resTools { margin-top: 0.8em;  } #contenu #top { margin-top: 1em  }#liste #contenu #checkboxTool #addChecked a { margin-right: 1.3em } #article .block .ul.linksList.downl li { display: inline } #article .block.visual2 .legende { right: 2px;  } #article #contenu #top { margin-bottom: -0.2em; } #searchBody form .wordsList { top: 2em } #searchBody form .wordsList a {  width: 100% } #liste2Body .ul li a.close, #liste2Body .ul li a.open { left: -13px; top: 1px } #liste2Body .ul li .ul li a.open, #liste2Body .ul li .ul li a.close { background-position: 0 2px !important;  }";

	document.write('<style type="text/css">'+css+'</style>');

	window.onresize = aff_minWidth;

}

if(navigator.userAgent.indexOf('Gecko')>=0 && navigator.userAgent.indexOf('Win')>=0){

	css = "span.fleche { margin-top: 0.1em !important } #menu #menuList #inputFilter { width: 11em;  } #footer { float: left; width: 100% } #liste2Body .ul li .ul li a.open, #liste2Body .ul li .ul li a.close { background-position: 0 4px !important;  }";

	document.write('<style type="text/css">'+css+'</style>');

	window.onresize = aff_minWidth;

}


if(navigator.userAgent.indexOf('Gecko')>=0 && navigator.userAgent.indexOf('Mac')>=0 && navigator.userAgent.indexOf('Safari')<0){

	css = "#menu #menuList select.sortBy { width: 15em;  }  #footer { float: left; width: 100%;  }";

	document.write('<style type="text/css">'+css+'</style>');

	window.onresize = aff_minWidth;

}

if(navigator.userAgent.indexOf('Safari')>=0){

	css = "#rech form div { display: inline; width: 100% } #menu #menuList select.sortBy { font-weight: normal; font-size: 1.2em; width: 12.5em }  #liste #contenu #top { margin-top: -1em  } #rech form input.inputtext { width: 13em }  #footer { float: left; width: 100% }";

	document.write('<style type="text/css">'+css+'</style>');

	window.onresize = aff_minWidth;

}

	css = "#footer { visibility: hidden }";

	document.write('<style type="text/css">'+css+'</style>');


// mouseover/mouseout sur le bouton Submit

function aff_bouton(t,n){

	// chemin absolu
	//adr = window.location.pathname.substring(0,window.location.pathname.lastIndexOf('/')+1)+t.getAttribute('src').substring(0,t.getAttribute('src').lastIndexOf('/')+1)

	// chemin relatif

	adr = t.getAttribute('src').substring(0,t.getAttribute('src').lastIndexOf('/')+1)

	if(n == 0){t.setAttribute('src',adr+'go_off.gif')
	}

	else if(n == 1){t.setAttribute('src',adr+'go_roll.gif')
	}

}

// redimensionnement de la largeur minimum de la zone de contenu pour IE

function aff_minWidth(){

	if(navigator.userAgent.indexOf('MSIE')>=0){

		if(document.body.clientWidth < 809){ document.getElementById('contenu').style.width = "590px";document.getElementById('rech').style.width = "590px"; document.getElementById('langues').style.width = "590px" }

		if(document.body.clientWidth > 811){ document.getElementById('contenu').style.width = "";document.getElementById('rech').style.width = ""; document.getElementById('langues').style.width = "" }

	}

}


// redimensionnement de la hauteur minimum de la zone de contenu en fontion de la hauteur du menu

function aff_minHeight(){

	cnt = "";

	if(document.getElementsByTagName('body')[0].id == "article"){

		cnt = "articleBody"

	} else {

		cnt = "contenu"

	}

	h1 = document.getElementById('menu').offsetHeight;
	h2 = document.getElementById(cnt).offsetHeight;
	h3 = document.getElementById('path').offsetHeight + document.getElementById('preferences').offsetHeight;



	if( (h2 + h3) < h1 ) {


		mrg = 6;

		if(navigator.userAgent.indexOf('MSIE')>=0){ mrg = -1 }
		if(navigator.userAgent.indexOf('Mac')>=0){ mrg = 19 }
		if(navigator.userAgent.indexOf('Gecko')>=0&&navigator.userAgent.indexOf('Win')>=0){ mrg = 19 }

		document.getElementById('contenu').style.height = (h1 - h3 - mrg) + "px";


	if(document.getElementById('top')){

		document.getElementById('top').style.bottom = "0";
		document.getElementById('top').style.position = "absolute";

	}

	}
	document.getElementById('footer').style.visibility = "visible";

	if(document.getElementById('top')){

		document.getElementById('top').style.visibility = "visible";

	}
}



function aff_affichage(){


	aff_minWidth();aff_minHeight();

	if(document.getElementsByTagName('body')[0].id == "carte"){

	document.onmousemove = getMouseXY;
	aff_mrgh = document.getElementById('imageMap').offsetTop + 77;

	if(navigator.userAgent.indexOf('MSIE')>=0){
		aff_mrgh -= 16;
		mpim = document.getElementById('contenu').getElementsByTagName('area')

		for(i=0;i<mpim.length;i++){

			mpim[i].setAttribute('title2',mpim[i].getAttribute('alt'))
			mpim[i].setAttribute('alt','')

		}

	}

	document.getElementById('imageMap').style.visibility = "visible"


	}

}

// script pour les cartes

var aff_curr = "";

var IE = document.all?true:false

if (!IE) document.captureEvents(Event.MOUSEMOVE)

var aff_tempX = 0
var aff_tempY = 0
var aff_mrgh

aff_color = new Array('stl2','stl3','stl4','stl5');
aff_col = 0;

function getMouseXY(e) {

	if(aff_curr == ""){
		document.getElementById('infoCountry').style.visibility = "hidden"
		document.getElementById('coul').style.visibility = "hidden"
	}
	else {
		document.getElementById('infoCountry').style.visibility = "visible"
		document.getElementById('coul').style.visibility = "visible"
	}


	if (IE) {
		aff_tempX = event.clientX + document.body.scrollLeft
		aff_tempY = event.clientY + document.body.scrollTop
	} else {
		aff_tempX = e.pageX
		aff_tempY = e.pageY
	}

	if (aff_tempX < 0){aff_tempX = 0}
	if (aff_tempY < 0){aff_tempY = 0}

	if(aff_tempX < 777){
	document.getElementById('infoCountry').getElementsByTagName('span')[0].className = aff_color[aff_col]

	document.getElementById('infoCountry').style.left = (aff_tempX - 191) + "px";
	document.getElementById('infoCountry').style.top = (aff_tempY - 44 - aff_mrgh) + "px";

	document.getElementById('infoCountry').getElementsByTagName('span')[0].innerHTML = aff_curr;

	document.getElementById('coul').style.left = (aff_tempX - 214) + "px";
	document.getElementById('coul').style.top = (aff_tempY - 58 - aff_mrgh) + "px";

	return true
	}
}

function showCurr(t){



aff_curr=t.getAttribute('alt')

	if(navigator.userAgent.indexOf('MSIE')>=0){

aff_curr=t.getAttribute('title2')

	}

}


function hideCurr(){

	aff_curr = "";
	aff_col++;
	if(aff_col == aff_color.length){
		aff_col = 0
	}

}



