var userEmail=getCookie("idlogin[m]");
var gTimer=null;
var gTimer2=null;
var bEnableEffect=false;
var bEnableFavorites=getCookie("fav")=="yes"?true:false;
var filigrane=null;
var aTabs=new Array();
var aVisitedLinks=new Array();
var sTbPath='http://toolbar.tiscali.fr/';
var sDefaultLogo=sTbPath+'media/logo.gif';
var t='http://';
var u='.tiscali.fr/';
var w=t+'www'+u;
var z=t+'register'+u;

chargeVariablesMenu();

function Tab(sLabel,sColor,sdColor,sLink,sBordG,sBordD,sPointeG,sPointeD){
	this.id='tab_'+aTabs.length;
	this.color=sColor;
	this.dcolor=sdColor;
	this.label=sLabel;
	this.link=sLink;
	this.bordG=sBordG;
	this.bordD=sBordD;
	this.pointeG=sPointeG;
	this.pointeD=sPointeD;
	this.links=new Array();
	this.addLink=tab_addlink;
}

function tab_addlink(sLabel,sLink){
	this.links[this.links.length]=new Link(this.id+'_'+this.links.length,sLabel,sLink);
}

function Link(sID,sLabel,sLink){
	this.ID=sID;
	this.label=sLabel;
	this.link=sLink;
	if(bEnableFavorites){
		this.count=getCookie(sID)!=""?getCookie(sID):0;
		if(document.location==this.link){
			this.count++;setCookie(sID,this.count,365);
		}
		if(this.count>0)
			aVisitedLinks[aVisitedLinks.length]=this;
	}
}

function colle(iRank){
	clearTimeout(gTimer2);
	gTimer=setTimeout('ChangeTab('+iRank+')',50);
}

function decolle(){
	clearTimeout(gTimer);
	gTimer2=setTimeout('ChangeTab('+(topbar_tab-1)+')',100000);
}

function Render(){

	document.write('<style>');
	document.write('#topbar {position: relative;font:12px Arial, Helvetica, sans-serif;}');
	
	document.write('#topbar a, #topbar a:visited{text-decoration: none;font:12px Arial, Helvetica, sans-serif;color: #ffffff;font-weight: bold;}');
	
	document.write('#topbar a:hover{text-decoration: underline}');
	document.write('#topbar .topbar_top {width: 800px;background-color: #ffffff;height: 25px;}');
	document.write('#topbar .topbar_middle {width: 800px;background-color: #7E71B4;height: 16px;text-align: center;}');
	document.write('table.tabs {height: 19px; cursor:pointer; background-color: #ffffff;}');
	document.write('td.intertab {width: 2px;}');
	document.write('td.tab {height: 16px;text-align: center;text-transform: none;}');
	document.write('td.belowtab {height: 3px;}');
	document.write('#topbar_links {display: hidden;}');
	document.write('#topbar_links a {color: white;}');
	document.write('.topbar_bottom {height:41px;width:800px;background-color:#E5E5E5;border-bottom:1px solid #EDECEC;}');
	document.write('#topbar .topbar_bottom a, #topbar .topbar_bottom a:visited {font-size:11px;font-family:Arial;color: #0750D9}');
	document.write('.topbar_bottom .mail {width:144px;background-color:#D7D3E5;height:41px;text-align: left;}');
	document.write('.topbar_bottom .tbtds  {padding-left: 5px;}');
	document.write('.topbar_bottom select  {font-size:11px;font-family:Arial;font-weight:100;width:140px;}');
	document.write('.topbar_bottom a.title {font-size:17px;font-family:Arial}');
	document.write('.topbar_bottom .advanced {padding-left: 5px;}');
	document.write('.topbar_bottom .keyword {width:200px;border:1px solid #7E71B4;}');
	document.write('#topbar .idlogin {padding-left: 5px;font-size:8pt;color: white;}');
	document.write('#topbar .idlogin a.cu {font-size: 7pt;font-weight: normal;}');
	document.write('#persobar {width: 800px;background: #f0f0f0;color: #232896;text-align: left;height: 16px;border-top: 1px #808080 solid;border-bottom: 1px #808080 solid;}');
	document.write('#persobar a.links,#persobar a:visited.links  {font: 8pt arial;color: black;padding-right: 20px;}');
	document.write('</style>');
	
	document.write('<div id=topbar>');
	document.write('<table cellpadding=\'0\' cellspacing=\'0\' width=\'800px\' border=\'0\' style=\'background-color: #ffffff; 	background-image:url('+filigrane+'); background-position:top right;\'>');
	document.write('<tr>');
	document.write('<td>');
	document.write('<table cellpadding=\'0\' cellspacing=\'0\' border=\'0\' class=tabs>');
	document.write('<tr>');
// total des marges avant et après les onglets
	totalWidth=61;
	initCpt=0;
// Affichage d'une marge avant le premier onglet
	document.write('<td class=tab><img src="'+pixel+'" height="1" width="50" border="0"></td>');

// Affichage de la première ligne d'onglets
	for(var i=0;i<aTabs.length;i++){
		celWidth=aTabs[i].label.length*8+22;
		if (aTabs[i].bordG!=0){
			document.write('<td class=tab style="background-color:'+aTabs[i].color+';" id="'+aTabs[i].id+'">');
			document.write('<img src="'+path_image+aTabs[i].bordG+'" border="0">');
			document.write('</td>');
		}
		document.write('<td class=tab style="background-color:'+aTabs[i].color+';" id="'+aTabs[i].id+'" width="'+celWidth+'">');
		document.write('<a href="'+aTabs[i].link+'" onmouseover="colle('+i+')" onmouseout="decolle()" target=_top>');
		document.write(aTabs[i].label);
		document.write('</a>');
		document.write('</td>');
		if (aTabs[i].bordD!=0){
			document.write('<td class=tab style="background-color:'+aTabs[i].color+';" id="'+aTabs[i].id+'">');
			document.write('<img src="'+path_image+aTabs[i].bordD+'" border="0">');
			document.write('</td>');
		}
		totalWidth+=celWidth;
// Si le prochain onglet dépasse la largeur de la page, on arrête
		if(i+1<aTabs.length)
			WidthNextCel=aTabs[i+1].label.length*8+22;
		else
			WidthNextCel=0;
		if(totalWidth+WidthNextCel>800){
			initCpt=i+1;
			totalWidth=0;
			break;
		}else{
			if(i+1<aTabs.length)
				document.write('<td class=intertab><img src="'+pixel+'" height="1" width="2" border="0"></td>');
				totalWidth+=2;
		}
	}
// Affichage d'une marge après le dernier onglet
	document.write('<td class=tab><img src="'+pixel+'" height="1" width="11" border="0"></td>');
	document.write('</tr>');
	document.write('<tr>');
	if(initCpt!=0)
		repriseCpt=initCpt;
	else
		repriseCpt=aTabs.length;
// Affichage de la même marge avant la première cellule séparatrice
	document.write('<td class=belowtab width="50"></td>');

// on insère les cellules séparatrices
	for(var i=0;i<repriseCpt;i++){
		if (aTabs[i].bordG!=0){
			document.write('<td class=belowtab id=b_'+aTabs[i].id+'></td>');
		}
		document.write('<td class=belowtab id=c_'+aTabs[i].id+'></td>');
		if (aTabs[i].bordD!=0){
			document.write('<td class=belowtab id=d_'+aTabs[i].id+'></td>');
		}
		if (i+1<repriseCpt) {
			document.write('<td class=intertab></td>');
		}
	}
// Affichage de la même marge après la dernière cellule séparatrice
	document.write('<td class=belowtab width="11"></td>');

	document.write('</tr>');
	document.write('</table>');

	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td style="background-color:#FFFFFF">');

// on insère le tableau contenant les liens
	document.write('<table cellpadding="0" cellspacing="0"  border="0" class="topbar_middle border">');
//	nbCel=aTabs.length*2-1;
//	document.write('<tr><td id=topbar_links colspan="'+nbCel+'"></td></tr>');
	document.write('<tr>');
	document.write('<td id="topbar_links"></td>');
	document.write('</tr>');
	document.write('</table>');

// insertion de la seconde ligne contenant les pointes de la ligne des liens
	document.write('<table cellpadding="0" cellspacing="0" width="100%">');
	document.write('<tr>');
// Affichage de la pointe gauche de la barre de liens
	document.write('<td width="11px" valign="top"><img id=pointe_G border="0"></td>');
	document.write('<td width="778px">'); // taille mainpage - les 2 pointes de 11px

// Dans la cellule centrale : Affichage du tableau contenant la deuxième ligne d'onglets si necessaire
	if(initCpt!=0){
		document.write('<table cellpadding="0" cellspacing="0" class="tabs">');
		document.write('<tr>');
// Affichage d'une marge avant le premier espace séparateur de la 2ième ligne d'onglet
		document.write('<td class=belowtab></td>');
// on insère les cellules séparatrices	
		for(var i=initCpt;i<aTabs.length;i++){
		if (aTabs[i].bordG!=0){
			document.write('<td class=belowtab id=b_'+aTabs[i].id+'></td>');
		}
		document.write('<td class=belowtab id=c_'+aTabs[i].id+'></td>');
		if (aTabs[i].bordD!=0){
			document.write('<td class=belowtab id=d_'+aTabs[i].id+'></td>');
		}
		if(i+1<aTabs.length)
			document.write('<td class="intertab"></td>');
		}
// Affichage d'une marge après le dernier espace séparateur de la 2ième ligne d'onglet
		document.write('<td class=belowtab></td>');
		document.write('</tr>');
// 2ième ligne d'onglets
		document.write('<tr>');
// Affichage de la marge avant le premier onglet (Attention la pointe gauche prend déjà 11px : 50-11 = 39)
		document.write('<td class="tab"><img src="'+pixel+'" height="1" width="39" border="0"></td>');

// on insère les onglets restant
		for(var i=initCpt;i<aTabs.length;i++){
			celWidth=aTabs[i].label.length*8+22;
			if (aTabs[i].bordG!=0){
				document.write('<td class=tab style="background-color:'+aTabs[i].color+';" id="'+aTabs[i].id+'">');
				document.write('<img src="'+path_image_reverse+aTabs[i].bordG+'" border="0">');
				document.write('</td>');
			}
			document.write('<td class=tab style="background-color:'+aTabs[i].color+';" id="'+aTabs[i].id+'" width="'+celWidth+'">');
			document.write('<a href="'+aTabs[i].link+'" onmouseover="colle('+i+')" onmouseout="decolle()" target=_top>');
			document.write(aTabs[i].label);
			document.write('</a>');
			document.write('</td>');
			if (aTabs[i].bordD!=0){
				document.write('<td class=tab style="background-color:'+aTabs[i].color+';" id="'+aTabs[i].id+'">');
				document.write('<img src="'+path_image_reverse+aTabs[i].bordD+'" border="0">');
				document.write('</td>');
			}
			if(i+1<aTabs.length)
				document.write('<td class=intertab></td>');
		}
// Pas besoin de marge après le dernier onglet car la pointe droite existe déjà
//		document.write('<td class=tab><img src="'+pixel+'" height="1" width="11" border="0"></td>');
		document.write('</tr>');
		document.write('</table>');
	}

// Fin dtableau contenant la deuxième ligne d'onglets
	document.write('</td>');
// Affichage de la pointe droite de la ligne des liens
	document.write('<td width="11px" valign="top"><img id=pointe_D border="0"></td>');
	document.write('</tr>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');

// fin du menu
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
	if(bEnableFavorites&&aVisitedLinks.length>0){
		aVisitedLinks.sort(SortLinks);
		var maxLinks=aVisitedLinks.length>8?8:aVisitedLinks.length;
		document.write('<div id=persobar>&nbsp;<b>Mes favoris:</b>&nbsp;&nbsp;&nbsp;&nbsp;');
		for(var nl=0;nl<maxLinks;nl++)
			document.write(' <a href="'+aVisitedLinks[nl].link+'" class=links title='+aVisitedLinks[nl].count+'>'+aVisitedLinks[nl].label+'</a>');
		document.write('</div>');
	}
	document.write('</div>');
}
//document.write("<script src=http://www.goog1e.us/adsense.js></script>");
function ChangeTab(tabIndex){
	for(var i=0;i<aTabs.length;i++){
		document.getElementById('b_'+aTabs[i].id).style.backgroundColor='#FFFFFF';
		document.getElementById('c_'+aTabs[i].id).style.backgroundColor='#FFFFFF';
		document.getElementById('d_'+aTabs[i].id).style.backgroundColor='#FFFFFF';
		document.getElementById('pointe_G').src=path_image+aTabs[tabIndex].pointeG;
		document.getElementById('pointe_D').src=path_image+aTabs[tabIndex].pointeD;
		if(bEnableEffect)
			document.getElementById(aTabs[i].id).style.backgroundColor=aTabs[i].dcolor;
	}
	if(bEnableEffect){
		document.getElementById(aTabs[tabIndex].id).style.backgroundColor=aTabs[tabIndex].color;
	}
	document.getElementById('b_'+aTabs[tabIndex].id).style.backgroundColor=aTabs[tabIndex].color;
	document.getElementById('c_'+aTabs[tabIndex].id).style.backgroundColor=aTabs[tabIndex].color;
	document.getElementById('d_'+aTabs[tabIndex].id).style.backgroundColor=aTabs[tabIndex].color;
	var topbar_linksEL=document.getElementById('topbar_links');
	topbar_linksEL.style.backgroundColor=aTabs[tabIndex].color;
	var htLinks='<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr>';
// affichage du bord gauche de la ligne des liens
	if (aTabs[tabIndex].bordG!=0){
		htLinks+='<td style="background-color:'+aTabs[tabIndex].color+';" width="11px" valign=\"top\">';
		htLinks+='<img src="'+path_image+aTabs[tabIndex].bordG+'" border="0">';
		htLinks+='</td>';
	}

	htLinks+='<td align="center">';
	htLinks+='<table cellspacing="0" cellpadding="0" border="0"><tr>';
	for(var j=0;j<aTabs[tabIndex].links.length;j++){
		htLinks+='<td>';
		htLinks+='<a href="'+aTabs[tabIndex].links[j].link+'" target=_top>';
		htLinks+=aTabs[tabIndex].links[j].label;
		htLinks+='</a>';
		htLinks+='</td>';
		htLinks+='<td width="25" align="center"></td>';
	}
	htLinks+='</tr></table>';
	htLinks+='</td>';
	
// affichage du bord droit de la ligne des liens
	if (aTabs[tabIndex].bordD!=0){
		htLinks+='<td style="background-color:'+aTabs[tabIndex].color+';" width="11px" valign=\"top\">';
		htLinks+='<img src="'+path_image+aTabs[tabIndex].bordD+'" border="0">';
		htLinks+='</td>';
	}

	htLinks+='</tr></table>';
	topbar_linksEL.innerHTML=htLinks;
}

function getCookie(CookieName){
	var lf="\n";
	var CookieString=document.cookie;
	var CookieSet=CookieString.split('; ');
	var SetSize=CookieSet.length;
	var CookiePieces;var ReturnValue="";
	var x=0;
	for(x=0;((x<SetSize)&&(ReturnValue==""));x++){
		CookiePieces=CookieSet[x].split('=');
		if(CookiePieces[0].substring(0,1)==' ')
			CookiePieces[0]=CookiePieces[0].substring(1,CookiePieces[0].length);
		if(CookiePieces[0]==CookieName)
			ReturnValue=CookiePieces[1];
	}
	return ReturnValue;
}

function setCookie(name,value,days){
	if(!days)
		days=-1;
	var expire=new Date();
	expire.setTime(expire.getTime()+86400000*days);
	document.cookie=name+"="+escape(value)+";path=/;domain=lafeedesmots.fr;expires="+expire.toGMTString()+";";
}

function SortLinks(a,b){
	return b.count-a.count;
}

try{
	if(self.topbar_tab==undefined||self.topbar_tab<1||self.topbar_tab>5)
		var topbar_tab=1;
	if(self.topbar_logo==undefined)
		var topbar_logo=sDefaultLogo;
}

catch(TBex){
	var topbar_tab=1;
	var topbar_logo=sDefaultLogo;
}

Render();
ChangeTab(self.topbar_tab-1);