
function $(id){
		return document.getElementById(id);
	}
function resolution(){
	if(window.screen.availWidth == 800){
	document.body.style.width="800px";
	document.body.style.fontSize="9px";
	}
	if(window.screen.availWidth > 1400){
	document.body.style.width="1100px";
	if(navigator.appName=="Microsoft Internet Explorer"){
	$("ligne").style.width=(window.screen.availWidth-21)+"px";
	}else if(navigator.appName=="Opera"){
	$("ligne").style.width=(window.screen.availWidth-1)+"px";
	}else{
	$("ligne").style.width=window.screen.availWidth+"px";
	}
	document.body.style.margin="auto";
	}
}	
var boutton=new Boutton();

function Boutton(){
this.intitule=['accueil','just\'in','news','porte-folio','services','contact'];
this.cellules=function(){
	
		document.writeln("<ul>");
		for(var i=0; i<this.intitule.length;i++){
		
		document.writeln("<li><a class=\"menuhaut\" id=\""+i+"\" href=\""+this.intitule[i]+".php\"style=\"color:rgb(255,255,255);background-color:rgb(0,174,239);\" >"+this.intitule[i]+"</a>");
			if(i==3){
				
				if(navigator.appName=="Microsoft Internet Explorer"){
				
				document.writeln("<ul class=\"menu\" style=\"margin-left:-103px;margin-top:31px;\">");
				}else{
				document.writeln("<ul class=\"menu\">");
				}
			
			document.writeln("<li><a href=\"webfolio.php\">Web</a></li>");
			document.writeln("<li><a href=\"3dfolio.php\">3D</a></li>");
			document.writeln("<li><a href=\"printfolio.php\">print</a></li>");
			document.writeln("<li><a href=\"diversfolio.php\">Divers</a></li>");
			document.writeln("</ul>");
			} 
			
			if(i==4){
				if(navigator.appName=="Microsoft Internet Explorer"){
				
				document.writeln("<ul class=\"menu\" style=\"margin-left:-103px;margin-top:31px;\">");
				}else{
				document.writeln("<ul class=\"menu\">");
				}
			document.writeln("<li><a href=\"services.php?x=web\">Web</a></li>");
			document.writeln("<li><a href=\"services.php?x=3d\">3D</a></li>");
			document.writeln("<li><a href=\"services.php?x=print\">Print</a></li>");
			document.writeln("</ul>");
			}
		
		document.writeln("</li>");
		
		}
		document.writeln("</ul>");
	}
this.init= function(){ //fonction lancée au chargement de la page
		for(var i=0;i<this.intitule.length;i++){
			this.onglet(i); $(i).setRGB(); // crée l'onglet et lui donne sa couleur de base (pour chaque onglet)
		}
	}
this.onglet= function(d){

	$(d).rouge=0;
	$(d).rouge2=255;
	$(d).vert=174;
	$(d).vert2=255;
	$(d).bleu=239;
	$(d).bleu2=255;
	$(d).setRGB=function(){
		this.style.backgroundColor="rgb("+this.rouge+","+this.vert+","+this.bleu+")";
		this.style.color="rgb("+this.rouge2+","+this.vert2+","+this.bleu2+")";
	}
	$(d).eclaireUnPas=function(){
		this.rouge+=25;
		this.vert+=8;
		this.bleu+=8;
		this.rouge2-=25;
		this.vert2-=25;
		this.bleu2-=25;
	}
	$(d).ref=null;
	$(d).onmouseover= function(e){
		clearInterval(this.ref);
		this.ref=setInterval("document.getElementById('"+this.id+"').eclaire()",30);
	}
	$(d).eclaire= function(){
		if(this.rouge+5<=255){
			this.eclaireUnPas();
			this.setRGB();
		}else{
		clearInterval(this.ref);
		}
	}
	$(d).eteintUnPas=function(){
		this.rouge-=25;
		this.vert-=8;
		this.bleu-=8;
		this.rouge2+=25;
		this.vert2+=25;
		this.bleu2+=25;
	}
	$(d).onmouseout= function(e){
		clearInterval(this.ref);
		this.ref=setInterval("document.getElementById('"+this.id+"').eteint()",30);
	}
	$(d).eteint= function(){
		if(this.rouge-5>=0){
			this.eteintUnPas();
			this.setRGB();
		}else{
		clearInterval(this.ref);
		}
	}
}
}
