function $(a){return (typeof(a)=='string')?document.getElementById(a):a;}
/*
var rolloverTab0=0, rolloverTab1=0, rolloverTab2=0, rolloverTab3=0, rolloverTab4=0;
function getInfo(id){
	id=(id)?id:'';
	$('info').innerHTML=id+'<br>tab0: '+rolloverTab0+'<br>tab1: '+rolloverTab1+' - ' +getML('tab1')+'<br>tab2: '+rolloverTab2+' - ' +getML('tab2')+'<br>tab3: '+rolloverTab3+' - ' +getML('tab3')+'<br>tab4: '+rolloverTab4+' - ' +getML('tab4');
}
*/
function getML(id){
	var from=($(id).style.marginLeft.indexOf('px')!=-1)?$(id).style.marginLeft.substring(0, $(id).style.marginLeft.indexOf('px')):$(id).style.marginLeft;
	if(from.indexOf('pt')!=-1){from=from.substring(0, $(id).style.marginLeft.indexOf('pt'));}
	return parseInt(from);
}
function move(id, to){
	var pas=95;
	var from=getML(id);
	$(id).to=($(id).to==null || $(id).to=='undefined')?null:$(id).to;
	$(id).timer=($(id).timer==null || $(id).timer=='undefined')?null:$(id).timer;
	if($(id).timer!=null && $(id).to!=to){
		clearTimeout($(id).timer);
	}
	$(id).to=to;
	if(from!=to){
		if(from<to){
			from=((from+pas)<to)?(from+pas):to;
		}else if(from>to){
			from=((from-pas)>to)?(from-pas):to;
		}
		$(id).style.marginLeft=from;
		if(from==to){
			/*$('tab0a').onmouseover=function(){xpand('tab0');}
			$('tab1a').onmouseover=function(){xpand('tab1');}
			$('tab2a').onmouseover=function(){xpand('tab2');}
			$('tab3a').onmouseover=function(){xpand('tab3');}
			$('tab4a').onmouseover=function(){xpand('tab4');}*/
			$(id).timer=null;
		}else{
			$(id).timer=setTimeout(function(){move(id, to);}, 15);
		}
	}
}
var tab={0:{'xpand':0, 'collapse':0}, 1:{'xpand':0, 'collapse':450}, 2:{'xpand':95, 'collapse':545}, 3:{'xpand':190, 'collapse':640}, 4:{'xpand':285, 'collapse':735}};
function xpand(id){
	//$(id+'a').onmouseover=function(){return false;}
	/*$('tab0a').onmouseover=function(){return false;}
	$('tab1a').onmouseover=function(){return false;}
	$('tab2a').onmouseover=function(){return false;}
	$('tab3a').onmouseover=function(){return false;}
	$('tab4a').onmouseover=function(){return false;}*/
	var toreturn=true;
	if(id=='tab0'){
		//rolloverTab0=1;
		if(getML('tab1')==tab[1]['xpand']){
			if(getML('tab4')==tab[4]['xpand']){
				move('tab4', tab[4]['collapse']);
				move('tab3', tab[3]['collapse']);
				move('tab2', tab[2]['collapse']);
				move('tab1', tab[1]['collapse']);  // tt 16/05/2010
			}else if(getML('tab3')==tab[3]['xpand']){
				move('tab3', tab[3]['collapse']);
				move('tab2', tab[2]['collapse']);
				move('tab1', tab[1]['collapse']);  // tt 16/05/2010
			}else if(getML('tab2')==tab[2]['xpand']){
				move('tab2', tab[2]['collapse']);
				move('tab1', tab[1]['collapse']);  // tt 16/05/2010
			}else if(getML('tab1')==tab[1]['xpand']){
				move('tab1', tab[1]['collapse']);
			}else{
				alert('error 1e');
			}
		}else{
			move('tab4', tab[4]['collapse']);
			move('tab3', tab[3]['collapse']);
			move('tab2', tab[2]['collapse']);
			move('tab1', tab[1]['collapse']);
			//toreturn=false;
		}
	}else if(id=='tab1'){
		//rolloverTab1=1;
		if(getML('tab1')==tab[1]['collapse']){
			move('tab1', tab[1]['xpand']);
		}else{
			if(getML('tab4')==tab[4]['xpand']){
				move('tab4', tab[4]['collapse']);
				move('tab3', tab[3]['collapse']);
				move('tab2', tab[2]['collapse']);
			}else if(getML('tab3')==tab[3]['xpand']){
				move('tab3', tab[3]['collapse']);
				move('tab2', tab[2]['collapse']);
			}else if(getML('tab2')==tab[2]['xpand']){
				move('tab2', tab[2]['collapse']);
			}else if(getML('tab1')==tab[1]['xpand'] && getML('tab2')==tab[2]['collapse']){
				toreturn=false;
				//move('tab1', tab[1]['collapse']);
			}else if(getML('tab1')==tab[1]['xpand'] && getML('tab2')==tab[2]['xpand']){
				move('tab1', tab[1]['xpand']);
			}else{
				move('tab1', tab[1]['collapse']);
			}
		}
	}else if(id=='tab2'){
		//rolloverTab2=1;
		if(getML('tab1')==tab[1]['collapse']){
			move('tab2', tab[2]['xpand']);
			move('tab1', tab[1]['xpand']);
		}else if(getML('tab1')==tab[1]['xpand'] && getML('tab2')==tab[2]['collapse']){
			move('tab2', tab[2]['xpand']);
		}else{
			if(getML('tab4')==tab[4]['xpand']){
				move('tab4', tab[4]['collapse']);
				move('tab3', tab[3]['collapse']);
			}else if(getML('tab3')==tab[3]['xpand']){
				move('tab3', tab[3]['collapse']);
			}else if(getML('tab2')==tab[2]['xpand'] && getML('tab3')==tab[3]['collapse']){
				//move('tab2', tab[2]['collapse']);
				toreturn=false;
			}else if(getML('tab2')==tab[2]['xpand'] && getML('tab3')==tab[3]['xpand']){
				move('tab2', tab[2]['xpand']);
			}else{
				move('tab2', tab[2]['collapse']);
			}
		}
	}else if(id=='tab3'){
		//rolloverTab3=1;
		if(getML('tab1')==tab[1]['collapse']){
			move('tab3', tab[3]['xpand']);
			move('tab2', tab[2]['xpand']);
			move('tab1', tab[1]['xpand']);
		}else if(getML('tab2')==tab[2]['collapse']){
			move('tab3', tab[3]['xpand']);
			move('tab2', tab[2]['xpand']);
		}else if(getML('tab3')==tab[3]['collapse']){
			move('tab3', tab[3]['xpand']);
		}else{
			if(getML('tab4')==tab[4]['xpand']){
				move('tab4', tab[4]['collapse']);
			}else if(getML('tab3')==tab[3]['xpand'] && getML('tab4')==tab[4]['collapse']){
				//move('tab3', tab[3]['collapse']);
				toreturn=false;
			}else{
				move('tab3', tab[3]['collapse']);
			}
		}
	}else if(id=='tab4'){
		//rolloverTab4=1;
		if(getML('tab1')==tab[1]['collapse']){
			move('tab4', tab[4]['xpand']);
			move('tab3', tab[3]['xpand']);
			move('tab2', tab[2]['xpand']);
			move('tab1', tab[1]['xpand']);
		}else if(getML('tab2')==tab[2]['collapse']){
			move('tab4', tab[4]['xpand']);
			move('tab3', tab[3]['xpand']);
			move('tab2', tab[2]['xpand']);
		}else if(getML('tab3')==tab[3]['collapse']){
			move('tab4', tab[4]['xpand']);
			move('tab3', tab[3]['xpand']);
		}else if(getML('tab4')==tab[4]['collapse']){
			move('tab4', tab[4]['xpand']);
		}else if(getML('tab4')==tab[4]['xpand']){
			//move('tab4', tab[4]['collapse']);
			toreturn=false;
		}else{
			move('tab4', tab[4]['collapse']);
		}
	}else{
		alert('erreur: '+id);
	}
	if(toreturn==false){
		//$(id+'a').onmouseover=function(){xpand(id);}
		/*$('tab0a').onmouseover=function(){xpand('tab0');}
		$('tab1a').onmouseover=function(){xpand('tab1');}
		$('tab2a').onmouseover=function(){xpand('tab2');}
		$('tab3a').onmouseover=function(){xpand('tab3');}
		$('tab4a').onmouseover=function(){xpand('tab4');}*/
		return false;
	}else{
		return true;
	}
}
function Hide(){
	$('corpoButton3P').className='bouton';
	$('corpo3P').style.display='none';
	$('corpoButtonHisto').className='bouton';
	$('corpoHisto').style.display='none';
	$('corpoButtonRejoindre').className='bouton';
	$('corpoRejoindre').style.display='none';
	$('corpoButtonContact').className='bouton';
	$('corpoContact').style.display='none';
}
function Show(e){
	Hide();
	$('corpoButton'+e).className='bouton_focus';
	$('corpo'+e).style.display='block';
}

/* ------------ START NAV WITH ARROW ----------- */
function GetOpacity(el){
	if('opacity' in $(el).style){
		var value = $(el).style.opacity*100;
	}else{
		var response = $(el).style.filter;
		var value=response.substring(14,response.length-2);
		//var value=response.substring(48,response.length-2);
	}
	return value;
}

function SetOpacity(el, v){
	if($(el)){
		if('opacity' in $(el).style){
			$(el).style.opacity=v/100;
		}else{
			$(el).style.filter='Alpha(opacity='+v+');';
			//$(el).style.filter='progid:DXImageTransform.Microsoft.Alpha(Opacity='+v+');';
		}
	}
	return true;
}


function fade(from, to){
	//trace(GetOpacity(to)*1);
	//trace(GetOpacity(from)*1);
	var opacity_to=GetOpacity(to)*1;
	if(opacity_to<100){
		var opacity_from=GetOpacity(from)*1;
		if(opacity_from>0){
			SetOpacity(from, opacity_from-20);
		}else{
			$(from).style.display='none';
			$(to).style.display='block';
			SetOpacity(to, (opacity_to+20));
		}
		var timer=30;
		//timer=(navigator.appName=='Microsoft Internet Explorer')?100:30; // IE 8 does not support alpha opacity anymore nor any other kind of opacity at all \o/ : https://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=331735
		setTimeout(function(){fade(from, to);}, timer);
	}
	return true;
}

function displayContent(group, from, to){
	SetOpacity(group+''+to, 0);
	SetOpacity(group+''+from, 100);
	fade(group+''+from, group+''+to);
	return true;
}

function trace(a){
	$('corpo3P2').innerHTML=$('corpo3P2').innerHTML+'<br>'+a;
}
/* ------------ END NAV WITH ARROW ----------- */

window.onresize=function(){
	if(document.body){var largeur=document.body.clientWidth;}else{var largeur=window.innerWidth;}
	if(document.body){var hauteur=document.body.clientHeight;}else{var hauteur=window.innerHeight;}
	if(largeur>=830){
		$('tab0').style.width=Math.floor((largeur-830)/2)+'px';
		$('tab0').style.height=hauteur+'px';
		$('cadre').style.height=hauteur+'px';
		//$('corpo3P').style.height=(hauteur-130)+'px';
		//$('corpoHisto').style.height=(hauteur-130)+'px';
	}
}
//window.oncontextmenu=function(){getInfo(); return false};

// ****************************************

function resizepopup(monImage, monTitre){
  	w = window.open('','chargement','width=10,height=10');
  	w.document.write( "<html><head><title>"+monTitre+"</title>\n"); 
  	w.document.write( "<link rel=stylesheet type=text/css href=../css/style.css>\n")
  	w.document.write( "<script language='JavaScript'>\n"); 
  	w.document.write( "IE5=NN4=NN6=false;\n"); 
  	w.document.write( "if(document.all)IE5=true;\n"); 
  	w.document.write( "else if(document.getElementById)NN6=true;\n"); 
  	w.document.write( "else if(document.layers)NN4=true;\n"); 
  	w.document.write( "function autoSize() {\n"); 
  	w.document.write( "if(IE5) self.resizeTo(document.images[0].width+70,document.images[0].height+120)\n"); 
  	w.document.write( "else if(NN6) self.sizeToContent();\n");
  	w.document.write( "else window.resizeTo(document.images[0].width+70,document.images[0].height+120)\n"); 
  	w.document.write( "self.focus();\n"); 
  	w.document.write( "}\n</scri");
  	w.document.write( "pt>\n"); 
  	w.document.write( "</head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad='javascript:autoSize();'>" );
  	w.document.write( "<a href='javascript:window.close();' class=lien4><br><center><b>Fermer cette fenêtre</b><br><br><center><img src='"+monImage+"' border=0 alt='"+monTitre+"'></a>" ); 
  	w.document.write( "</body></html>" );
  	w.document.close(); 
}
