window.onload = function(){
	HighlightMenu();
	fixPNG();
}

function HighlightMenu(){
	var SiteId = document.location.href;
	if(SiteId.indexOf('/solutions/')!= -1){document.getElementById('menu-solutions').src = '/img/_pt/_br/nav/rub-solutions-on.gif'; document.getElementById('menu-visual').src = '/img/common/menu-visu-correction.jpg';}
	else if(SiteId.indexOf('/correction/')!= -1){document.getElementById('menu-correction').src = '/img/_pt/_br/nav/rub-correction-on.gif'; document.getElementById('menu-visual').src = '/img/common/menu-visu-correction.jpg';}
	else if(SiteId.indexOf('/prolonger/')!= -1){document.getElementById('menu-prolonger').src = '/img/_pt/_br/nav/rub-prolonger-on.gif'; document.getElementById('menu-visual').src = '/img/common/menu-visu-prolonger.jpg';}
	else if(SiteId.indexOf('/expertise/')!= -1){document.getElementById('menu-expertise').src = '/img/_pt/_br/nav/rub-expertise-on.gif'; document.getElementById('menu-visual').src = '/img/common/menu-visu-expertise.jpg';}
	else if(SiteId.indexOf('/club/')!= -1){document.getElementById('menu-club').src = '/img/_pt/_br/nav/rub-club-on.gif';}
	else if(SiteId.indexOf('/tools/faq')!= -1){document.getElementById('menu-questions').src = '/img/_pt/_br/nav/rub-questions-on.gif'; document.getElementById('menu-visual').src = '/img/common/menu-visu-faq.jpg';}
	else if(SiteId.indexOf('/tools/sendtoafriend')!= -1){document.getElementById('menu-visual').src = '/img/common/menu-visu-sendtoafriend.jpg';}
	else if(SiteId.indexOf('/tools/sitemap')!= -1){document.getElementById('menu-visual').src = '/img/common/menu-visu-sitemap.jpg';}
	else if(SiteId.indexOf('/tools/newsletter')!= -1){document.getElementById('menu-visual').src = '/img/common/menu-visu-newsletter.jpg';}
	else if(SiteId.indexOf('/tools/glossary')!= -1){document.getElementById('menu-visual').src = '/img/common/menu-visu-glossary.jpg';}
	else if(SiteId.indexOf('/tools/contactus')!= -1){document.getElementById('menu-visual').src = '/img/common/menu-visu-contact.jpg';}
}

function DispatchRedirect(SelId){
	var obj = document.getElementById(SelId);
	optionValue = obj.options[obj.selectedIndex].value;
	document.location.href = optionValue;
}

//Common Functions

function openPopup(page,target,larg,haut,scrolls){
	var posXpop = (screen.availWidth-larg)/2;
	var posYpop = (screen.availHeight-haut)/2;

	param = "width="+larg+",height="+haut+",left="+posXpop+",top="+posYpop+",scrollbars="+scrolls;
	popup = window.open(page,target,param);
}

layerActive=0
function DisplayLayer(bloc,num){
	if((bloc=="bloc-temoignages-")||(bloc.indexOf('question-')!= -1)){
		if((document.getElementById(bloc+num).style.display=='none')||(document.getElementById(bloc+num).style.display=='')){
			document.getElementById(bloc+num).style.display='block';
		}
		else{
			document.getElementById(bloc+num).style.display='none';
		}
	}
	else{
		if(num!=layerActive && layerActive!=0){
			document.getElementById(bloc+layerActive).style.display='none';
		}
		if(document.getElementById(bloc+num).style.display=='block'){
			document.getElementById(bloc+num).style.display='none';
			if(bloc=="bloc-avis-"){
				document.getElementById("avis-link-"+num).className='closed';
			}
		}
		else{
			document.getElementById(bloc+num).style.display='block';
			if(bloc=="bloc-avis-"){
				document.getElementById("avis-link-"+num).className='';
			}
			layerActive=num;
		}
	}
}
   
// corrige les PNGs sur IE5.5 et IE6
function fixPNG() {
	// test IE
	if(document.all != null && window.opera == null) {
		// test IE 6
		if(window.XMLHttpRequest == null && document.implementation != null && document.compatMode != null) {
			// récupération des images
			var imgs = document.getElementsByTagName('img');
			for(var i = 0, img; img = imgs[i]; i++) {
				if(/png$/i.test(img.src)) {
					var src = img.src;
					img.src = '/img/dot.gif';
					img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='image');";
				}
			}
		}
	}
};