/*
 *
 */
 //
function affichepopupfilter() {
	
	var opopup = document.getElementById('ban-temp-popup');
	var opopupfilter = document.getElementById('ban-temp-popup-filter');
	if ((typeof(opopupfilter) == 'undefined') || (opopupfilter == null)) {
		// Ajout de la popup filter
		opopupfilter = document.createElement('div');
		opopupfilter.setAttribute('id', 'ban-temp-popup-filter');
		document.body.appendChild(opopupfilter);
	}
	if (opopup.style.display == 'inline') {
		// Masque la popup
		opopup.style.display = 'none';
		// Suppression de la popup filter
		opopupfilter.parentNode.removeChild(opopupfilter);
		// On affiche tous les champs select
		var selectTags = document.getElementsByTagName('select');
		for (var index=0; index<selectTags.length; index++) {
			selectTags[index].style.display = 'inline';
		}
		// On reaffiche le flash recrutement
		var flashtRecrutement = document.getElementById('flash-hp-recrObj');				
                            if(flashtRecrutement){
                                flashtRecrutement.style.display='inline';
                            }
	} else {
		// Affiche la popup
		opopup.style.display = 'inline';
		// On masque tous les champs select
		var selecttags = document.getElementsByTagName('select');
		for (var index=0; index<selecttags.length; index++) {
			selecttags[index].style.display = 'none';
		}
		
		// On masque le flash recrutement
		var flashtRecrutement = document.getElementById('flash-hp-recrObj');		
                            if(flashtRecrutement){
                                flashtRecrutement.style.display='none'; 
                            }
		
		
		// Repositionne la fenetre
		window.scrollTo(0,0);
		// Affiche la popup filter
		opopupfilter.style.display = 'inline';
		// Resize la popup filter la popup
		resizepopupfilter();
	}
}
//
function affichepopupfiltertexte(oover, itext, sbackground) {
	// Affichage des infos
	for (var i=1; i<6; i++) {
		var sdisplay = 'none';
		var oinfos = document.getElementById('btp-h-b-infos-'+i);
		if (i == itext) {
			sdisplay = 'inline';
			var oparentinfos = (document.parentNode) ? oinfos.parentElement : oinfos.parentNode;
			oparentinfos.style.backgroundImage = 'url(' + sbackground + ')';
		}
		oinfos.style.display = sdisplay;
	}
	// Changement de style pour les onglets
	if (oover != null) {
		var oparentover = (document.parentNode) ? oover.parentElement : oover.parentNode;
	if(oparentover){
	for(var i=0; i<oparentover.childNodes.length; i++) {
			if (oparentover.childNodes[i].tagName == 'LI') {
				if (oparentover.childNodes[i] != oover) {
					oparentover.childNodes[i].className = '';
				}
			}
		}
		}
		oover.className = 'overbtp-h-b-menu';
	}
	// Changement du background
	if (oover != null) {
		var oparentover = (document.parentNode) ? oover.parentElement : oover.parentNode;
		
	}
}
//
function resizepopupfilter() {
	var opopupfilter = document.getElementById('ban-temp-popup-filter');
	
	if (opopupfilter != null) {		
		// Calcul de la largeur
		var divwidth = 0;
		opopupfilter.style.width = divwidth;
		if (typeof(opopupfilter.style.width) == 'string') {
			divwidth = opopupfilter.style.width.substring(0, (opopupfilter.style.width.length - 2));
		}
		if( typeof(window.innerWidth) == 'number' ) {
			//Non-IE
			if( typeof(window.scrollMaxX) == 'number' ) {
				//FF
				if (divwidth < window.innerWidth + window.scrollMaxX) {
					divwidth = window.innerWidth - 18 + window.scrollMaxX + 'px';
				}
			} else {
				//Safari
				if (divwidth < document.body.scrollWidth) {
					divwidth = document.body.scrollWidth + 'px';
				}
			}
		} else if (document.documentElement.scrollWidth) {
			//IE 7+ in 'standards compliant mode'
			if (divwidth < document.documentElement.scrollWidth) {
				divwidth = document.documentElement.scrollWidth - 18;
			}
		} else if (document.body.scrollWidth) {
			//IE 6
			if (divwidth < document.body.scrollWidth) {
				divwidth = document.body.scrollWidth - 18;
			}
		}
		opopupfilter.style.width = divwidth;
		
		// Calcul de la hauteur
		var divheight = 0;
		opopupfilter.style.height = divheight;
		if (typeof(opopupfilter.style.height) == 'string') {
			divheight = opopupfilter.style.height.substring(0, (opopupfilter.style.height.length - 2));
		}
		if( typeof(window.innerHeight) == 'number' ) {
			//Non-IE
			if( typeof(window.scrollMaxY) == 'number' ) {
				//FF
				if (divheight < window.innerHeight + window.scrollMaxY) {
					divheight = window.innerHeight + window.scrollMaxY + 'px';
				}
			} else {
				//Safari
				if (divheight < document.body.scrollHeight) {
					divheight = document.body.scrollHeight + 'px';
				}
			}
		} else {
			//IE 6+
			if (document.documentElement.offsetHeight > document.documentElement.scrollHeight) {
				divheight = document.documentElement.offsetHeight;
			} else {
				divheight = document.documentElement.scrollHeight;
			}
			if (divheight < document.body.scrollHeight) {
				divheight = document.body.scrollHeight;
			}
		}
		opopupfilter.style.height = divheight;
	}
	
	var opopup = document.getElementById('ban-temp-popup');
	if (opopup != null) {
		if( typeof(window.innerHeight) == 'number' ) {
			//Non-IE
			if( typeof(window.scrollMaxY) == 'number' ) {
				//FF
				opopup.style.top = (window.innerHeight / 2) - 277;
				if (opopup.style.top < 0) {
					opopup.style.top = 0;
				}
			} else {
				//Safari
				opopup.style.posTop = (window.innerHeight / 2) - 277;
				if (opopup.style.posTop < 0) {
					opopup.style.posTop = 0;
				}
			}
		} else {
			//IE 6+
			opopup.style.posTop = (document.documentElement.offsetHeight / 2) - 277;
			if (opopup.style.posTop < 0) {
				opopup.style.posTop = 0;
			}
		}
	}
}
//
function scrollpopupfilter() {
}
//

function initpopupfilter() {
// Affichage du premier onglet
//affichepopupfiltertexte(this,1,'/FR/images/static/0808-stra-fr-ban-temp-pop-filt-panneau.jpg');
}
window.onload = initpopupfilter;
window.onresize = resizepopupfilter;
window.onscroll = scrollpopupfilter;