var x;
var y;
var M=6;
function item(url,name,l){
	this.url=url;
	this.name=name;
	this.left=l
}
var menu1=new item('index','Accueil',30);
var menu2=new item('forfaits','Forfaits',15);
var menu3=new item('confort','Confort',5);
var menu4=new item('performance','Performance',0);
var menu5=new item('simplicite','Simplicit&eacute;',15);
var menu6=new item('contact','Contact',30);

function createMenu(f){
	var MenuEl=Elt('menu');
	var toppos=100;
	var inctop=50;
	for(i=1;i<=M;i++){
		var Menu=eval('menu'+i);
		r=document.createElement('DIV')
		r.id=Menu.url;
		r.onclick=function onclick() {BigUp(i,this.id)}
		r.style.paddingLeft=Menu.left+"%";
		r.style.top=toppos+"px";
		r.style.width="150px";
		r.style.position="relative";
		r.setAttribute("onClick","BigUp("+i+",'"+Menu.url+"')");
		r.setAttribute("style","width:150px;position:relative;padding-left:"+Menu.left+"%;top:"+toppos+"px");
		r.innerHTML='<table onmouseover="StopDyna('+i+')" id="Menu'+i+'" class="BAccueil"><tr><td align="right"><img id="ImgM'+i+'" class="ImgMn" src="Images/icone_itt.gif" style="display:none" /></td><td width="100%" align="left">'+Menu.name+'</td></tr></table>';
		MenuEl.appendChild(r)
		toppos+=inctop;
	}
	Dyna_Menu();
}

function Mask(div){
	try{
		if (Elt(div)) Elt(div).style.display = "none";
	}catch(err){
		TraiteErr("Mask",err.description);
	}
}

function Show(div){
	try{
		if (Elt(div)) Elt(div).style.display = "block";
	}catch(err){
		TraiteErr("Show",err.description);
	}
}

function Elt(id){
	if (document.getElementById){
		return document.getElementById(id);
	}else if (document.all) {
		return document.all[id];
	}else if (document.layers) {
		return document.layers[id].innerHTML = Value;
	}	
	return null;
}

function resizeIfr(){
	getWindowHW();
	Y=y-80
	Elt('ifr').style.height=Y+"px";
	Elt('MenuD').style.height=Y+"px";
	Y=y-25;
	Elt('piedPage').style.top=Y+"px";
}

var IdxImgM = 6;
var Tmr_Menu = 1200;
var Ok_Dyna_Menu = true;
var TT;
var NewIdx = 0;
function Dyna_Menu(){
	try{
		if (Ok_Dyna_Menu){
			if (NewIdx<M)NewIdx ++;	
				else NewIdx=1;
			ReDraw_Btn(NewIdx);
		}
		TT=setTimeout('Dyna_Menu()',Tmr_Menu);
	}catch(err){
		alert("Dyna_Menu : "+err.description);
	}
}

function StopDyna(Idx){
	try{		
		Ok_Dyna_Menu = false;
		ReDraw_Btn(Idx);
	}catch(err){
		//alert("StopDyna : "+err.description);
	}	
}

function ReDraw_Btn(Idx){
	try{		
		Mask("ImgM"+IdxImgM);
		Elt('Menu'+IdxImgM).style.color = '#FFFFFF';
		Elt('Menu'+IdxImgM).style.fontSize = '12px';
		Elt('Menu'+IdxImgM).style.borderBottom = '1px dotted #FF9900';
		Show("ImgM"+Idx);
		Elt('Menu'+Idx).style.color = '#FF9900';
		Elt('Menu'+Idx).style.fontSize = '16px';
		Elt('Menu'+Idx).style.borderBottom = '1px dotted #FFFFFF';
		IdxImgM = Idx;
	}catch(err){		
		//alert("ReDraw_Btn : "+err.description);
	}	
}

function BigUp(id,lien){
	try{
		Mask('news_over');
		Mask('contenuaccueil');
		Show('contenu');
		if (id<0){
			Ok_Dyna_Menu = true;
			clearTimeout(TT);
			TT=setTimeout('Dyna_Menu()',Tmr_Menu);
		}else{
			Show("ImgM"+id);
			clearTimeout(TT);
		}
		//Elt('ifr').src
		if (lien) Elt('ifr').src = "PAGES/"+lien+".html";
		else Elt('ifr').src = "PAGES/index.html";
	}catch(e){//alert("BigUp : "+err.description);
	}
}

function getWindowHW(){
	if (self.innerHeight){ // all except Explorer
		x = self.innerWidth;
		y = self.innerHeight;
	}else if (document.documentElement && document.documentElement.clientHeight){ // Explorer 6 Strict Mode
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}else if (document.body){ // other Explorers
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}	
}


function OpenURL(lien){
	window.open(lien,'_blank');
}
