
function getCookieVal (offset)
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
	

function GetCookie (name)
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen)
	{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}

function SetCookie (name,value,expires,path,domain,secure) 
{
	document.cookie = name + "=" + escape (value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
}

//Ouvre la description longue dans les classements.
function ouvrir(id)
{
	var url = "/desc_long.php3?id="+id;
	fenetre_detail = window.open(url,'description_longue','toolbar=no,directories=no,location=no,status=no,menubar=no,resizable=yes,width=300,height=290');
	if ( parseInt(navigator.appVersion.charAt(0))>=3 && navigator.userAgent.indexOf("MSIE 4")!=-1 ) fenetre_detail.focus();
}

//Ouverture de l'espace webmestre
function logon()
{
        window.open('','esp_abo','toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,menuBar=0,width=800,height=600');
        document.Webo_check.submit();
        return true;
}

//Ouvre la console de démo
function demo_stats(the_id,the_type,the_version)
{
	if(the_type==1)
	{
		alert("Ce site devrait tirer partie de la nouvelle version et passer au Weboscope Gold ;-) Le webmaster peut consulter les stats par l'espace webmaster");
	}
	//Demo Weboscope GOLD
	if(the_type==2)
	{
	        var url='';
	        if (parseInt(navigator.appVersion.charAt(0))>2)
	        {
	        	if(the_version != null)
	        	{
				if(the_version == 'v5')
				{
					if(screen.width>=900)
					{
						
						url = 'http://www.weborama.fr/cgi-bin/gold/admin/debut_stat_gold2.cgi?VERSION=5&SIZE=L&LIBRE=' + the_id ;
                        			hauteur = 'width=895,height=640,status=1';
					
					}
					else
					{
						url = 'http://www.weborama.fr/cgi-bin/gold/admin/debut_stat_gold2.cgi?VERSION=5&SIZE=S&LIBRE=' + the_id ;
                        			hauteur = 'width=763,height=523,status=1';
					}
				}
	        	}
                	else if (navigator.appName.indexOf("Microsoft") != -1)
                	{

				url = 'http://www.weborama.fr/cgi-bin/gold/admin/debut_stat_gold2.cgi?LIBRE=' + the_id ;
                        	hauteur = 'width=761,height=505,status=1,resizable=0';
                	}
                	else
                	{
				url = 'http://www.weborama.fr/cgi-bin/gold/admin/debut_stat_gold2.cgi?LIBRE=' + the_id ;
                        	hauteur = 'width=763,height=523,status=1';
                	}
                	mes_stats = window.open(url,'Weboscope_gold',hauteur);
			if ( parseInt(navigator.appVersion.charAt(0))>=3 && navigator.userAgent.indexOf("MSIE 4")!=-1 ) mes_stats.focus();
        	}
	        else alert("Votre navigateur ne permet pas de visualiser ces statistiques Netscape 6,IE5.5 ou plus sont recommandés");
	}
	//Compte Pro
	if(the_type==3) top.location = "http://www.weboscope.com/V5/trafic.php";
	//Compte Wreport
	if(the_type==5) top.location = "http://weborama.com/wreport-satistique.php";
	//Démo console de vote
	if(the_type==4)
	{
		var url = 'http://www.weborama.fr/cgi-bin/gold/admin/session_visiteur_vote.cgi?LIBRE=' + the_id ;
		mes_stats = window.open(url,'console_vote','width=626,height=482,status=yes,menubar=1');
		if ( parseInt(navigator.appVersion.charAt(0))>=3 && navigator.userAgent.indexOf("MSIE 4")!=-1 ) mes_stats.focus();
	}
}


function verif_cookie_vote()
{
	
	if (GetCookie('WEBO_SITE')==null  && GetCookie('WEBO_VOTE')==null && GetCookie('WEBO_SOND')==null)
	premiere = window.open("http://vote.weborama.fr/question.html","question","toolbar=no,directories=no,menubar=no,location=no,resizable=yes,width=300,height=360,scrollbars=yes");
}


function ouvre_questionnaire(monlayer)
{
	
	if (GetCookie('WEBO_SITE')==null  && GetCookie('WEBO_VOTE')==null && GetCookie('WEBO_SOND')==null)
		document.getElementById(monlayer).style.display='';
}

	
	
function webo_pub(message,mon_url)
{
	if (GetCookie('la_pub')==null)
	{
		var expdate= new Date();
		expdate.setTime(expdate.getTime() + (24 * 3600 * 1000 * 4)); // 4 jours from now
		SetCookie ("la_pub","vu",expdate,"/");
		if(confirm(message))
		{
			ma_fen = window.open(mon_url,'new');
		}
	}
}
//////////////////////////////////////////////////////////////////////
// Debut profiling
/////////////////////////////////////////////////////////////////////
var mon_pfl_domaine = '';
var mon_pfl_id = 3214;
var WEBO_PFL1='';
var WEBO_PFL2='';
var WEBO_PFL3='';
var WEBO_PFL4='';
var WEBO_PFL5='';

var mon_pfl_cookie = 'wbo_segment_' + mon_pfl_id;

function maj_segment(numero,valeur)
{
	if(parseInt(navigator.appVersion,10)<=3) return -1;
	nb_mois = 12;

	numero = parseInt(numero,10);
	if ((numero < 1) || (numero > 5)) return -2;
	
	var verif_val_I = /^\d+$/;
	if(verif_val_I.test(valeur)) valeur = encode_en_lettre(valeur);
	
	var verif_val_A = /^\w*$/; 
	if(verif_val_A.test(valeur))
	{
	
		var mon_profil_wbo = GetCookie(mon_pfl_cookie);
		tab_segment = new Array('','','','','');

		if(mon_profil_wbo != null)
		{
			tab_segment = mon_profil_wbo.split('|');
			if(tab_segment.length != 5) tab_segment = ('','','','','');
			
			//On vérifie qu'une mise à jour est nécessaire.
			if(tab_segment[numero - 1]==valeur) return 1;
			
		}
			
		if(mon_pfl_domaine=='')
		{
			mon_pfl_domaine = this.location.host;
			tab_points = new Array();
			tab_points = this.location.host.split('.');
			if(tab_points.length>2) mon_pfl_domaine = mon_pfl_domaine.substring(mon_pfl_domaine.indexOf('.'),mon_pfl_domaine.length);
			if(tab_points.length==2) mon_pfl_domaine = '.' + mon_pfl_domaine;
		}
		

		
		var ma_chaine_profil='';
		for(var i=1; i<=5; i++)
		{
			
			if(i==numero) tab_segment[i-1]=valeur;
			if((tab_segment[i-1]=='') || (tab_segment[i-1]==null)) tab_segment[i-1] = '';
			ma_chaine_profil += tab_segment[i-1];
			
			if(i<5) ma_chaine_profil += '|';
		}
		
		
		expd = new Date();
		expd.setTime(expd.getTime() + (nb_mois * 30 * 24 * 3600 * 1000));
		SetCookie (mon_pfl_cookie,ma_chaine_profil,expd,'/',mon_pfl_domaine);
		return 2;
		
	}
	else return -3;
	
}
function raz_segment()
{
	//destruction du cookie
	expd = new Date();
	expd.setTime(expd.getTime() - (24 * 3600 * 1000));
	SetCookie (mon_pfl_cookie,'||||',expd,'/',mon_pfl_domaine);
}

function recup_param_profil()
{
	var mes_param_pfl = GetCookie(mon_pfl_cookie);
	if(mes_param_pfl == null)
	{
		mes_pfl = new Array('','','','','');
		if(WEBO_PFL1 != '') mes_pfl[0]=WEBO_PFL1;
		if(WEBO_PFL2 != '') mes_pfl[1]=WEBO_PFL2;
		if(WEBO_PFL3 != '') mes_pfl[2]=WEBO_PFL3;
		if(WEBO_PFL4 != '') mes_pfl[3]=WEBO_PFL4;
		if(WEBO_PFL5 != '') mes_pfl[4]=WEBO_PFL5;
		
		mes_param_pfl = '';
		var verif_val_I = /^\d+$/;
		for(var i=1;i<=5;i++)
		{
			if(verif_val_I.test(mes_pfl[i-1])) mes_pfl[i-1] = encode_en_lettre(mes_pfl[i-1]);
			mes_param_pfl += mes_pfl[i-1];
			if(i<5) mes_param_pfl += '|';
		}	
	}
	return mes_param_pfl;
}

function encode_en_lettre(num)
{
	num = parseInt(num,10);
	if(num > 2500) return '';
	var num1 = parseInt(num/52,10);
	var num2 = num % 52;

	num1 += 65;
	if (num1>90) num1+=6;
	
	num2 += 65;
	if (num2>90) num2+=6;
	
	var mon_code52 = String.fromCharCode(num1) + String.fromCharCode(num2);
	return mon_code52;
}
//////////////////////////////////////////////////////////
//fin profiling
//////////////////////////////////////////////////////////


//Weboscope version 2.1.2 copyright weborama
//modif le 8 nov 2002 pour la pub
function webo_zp(_WEBOZONE,_WEBOPAGE,_WEBOID,_ACC)
{
	WEBO_PFL1='A';
	if(document.cookie.indexOf('wbostat=') != -1) WEBO_PFL1='W';
	var pfl_webmaster = escape(recup_param_profil());

//	if(_WEBOID==null) _WEBOID=3214;
	if(_WEBOID==null) return 1;
        var wbs_da=new Date();
        var wbs_das=parseInt(wbs_da.getTime()/1000 - 60*wbs_da.getTimezoneOffset());
        var wbs_rand = wbs_da.getTime()%100;
	
	var wbs_ref=''+escape(document.referrer);
	var wbs_ta='0x0';
	var wbs_co=0;
	var wbs_nav=navigator.appName;
	if (parseInt(navigator.appVersion)>=4)
	{
		wbs_ta=screen.width+"x"+screen.height;
		wbs_co=(wbs_nav!="Netscape")?screen.colorDepth:screen.pixelDepth;
	}
	if((_ACC != null)&&(wbs_nav!="Netscape"))
	{
		var reftmp = 'parent.document.referrer';
		if((_ACC<5)&&(_ACC>0))
		{
			for(_k=_ACC;_k>1;_k--) reftmp = 'parent.' + reftmp;
		}
		var mon_ref = eval(reftmp);

		if(document.referrer == parent.location || document.referrer=='') wbs_ref=''+escape(mon_ref)

	}
	var wbs_arg="http://pro.weborama.fr/fcgi-bin/comptage.fcgi?ID="+_WEBOID;
	wbs_arg+="&ZONE="+_WEBOZONE+"&PAGE="+_WEBOPAGE+"&WEBOPFL="+pfl_webmaster;
	wbs_arg+="&ver=2&da2="+wbs_das+"&ta="+wbs_ta+"&co="+wbs_co+"&ref="+wbs_ref;
	var wbs_t= " border='0' height='1' width='1' alt=''>";
	document.write('<IMG SRC='+wbs_arg+wbs_t);
	/*
	if(window.location.host.indexOf('vote')==-1 && window.location.href.indexOf('inscription')==-1)
	{
		var estmac=(navigator.userAgent.indexOf('Mac')>=0)?true:false;
		var ifstyle= ' style="display:none"';
		if(navigator.appName=='Netscape') ifstyle='';
		var wbs_conn='';
		if (! estmac)
		{
		 	var msieind=navigator.userAgent.indexOf('MSIE');
	 		if (msieind > 0)
	 		{
			 	if(parseInt(navigator.userAgent.charAt(msieind+5))>=5)
			 	{
			 	//	if(document.body != null)
			 	//	{
						document.body.addBehavior("#default#clientCaps");
		  				wbs_conn=document.body.connectionType;
		  		//	}
	  			}
			}
		}
	
	
	
	
		document.cookie='wbopre=1; path=/';
		if(document.cookie.indexOf('wbopre=1')>=0){
			if(document.cookie.indexOf('wbopost=1')==-1){
				var wbs_url ='http://gold.weborama.fr/fcgi-bin/aimfar.fcgi?ID='+_WEBOID+"&rd="+wbs_rand+"&ta="+wbs_ta+"&da2="+wbs_das+"&conn="+wbs_conn;
				var wbs_fpar = '" frameborder=0 marginHeight=0 marginWidth=0 scrolling=no width=1 height=1 style="display:none "';
				var wbs_if = '<IFRAME SRC="'+ wbs_url+wbs_fpar +"></IFRAME>";
				document.write(wbs_if);
				document.cookie='wbopost=1';
			}
		}
	}
	*/
}


//Weboscope version 2.1.2 copyright weborama
//cree en juin 2003 sans pub
function webo_zp_sp(_WEBOZONE,_WEBOPAGE,_WEBOID,_ACC)
{

	WEBO_PFL1='A';
	if(document.cookie.indexOf('wbostat=') != -1) WEBO_PFL1='W';
	var pfl_webmaster = escape(recup_param_profil());

//      if(_WEBOID==null) _WEBOID=3214;
        if(_WEBOID==null) return 1;
        var wbs_da=new Date();
        var wbs_das=parseInt(wbs_da.getTime()/1000 - 60*wbs_da.getTimezoneOffset());
        var wbs_rand = wbs_da.getTime()%100;
	
	var wbs_ref=''+escape(document.referrer);
	var wbs_ta='0x0';
	var wbs_co=0;
	var wbs_nav=navigator.appName;
	if (parseInt(navigator.appVersion)>=4)
	{
		wbs_ta=screen.width+"x"+screen.height;
		wbs_co=(wbs_nav!="Netscape")?screen.colorDepth:screen.pixelDepth;
	}

	if((_ACC != null)&&(wbs_nav!="Netscape"))
	{
		var reftmp = 'parent.document.referrer';
		if((_ACC<5)&&(_ACC>0))
		{
			for(_k=_ACC;_k>1;_k--) reftmp = 'parent.' + reftmp;
		}
		var mon_ref = eval(reftmp);

		if(document.referrer == parent.location || document.referrer=='') wbs_ref=''+escape(mon_ref)

	}

	var wbs_arg="http://pro.weborama.fr/fcgi-bin/comptage.fcgi?ID="+_WEBOID;
	wbs_arg+="&ZONE="+_WEBOZONE+"&PAGE=" + _WEBOPAGE + "&WEBOPFL="+pfl_webmaster;
	wbs_arg+="&ver=2&da2="+wbs_das+"&ta="+wbs_ta+"&co="+wbs_co+"&ref="+wbs_ref;
	var wbs_t= " border='0' height='1' width='1' alt=''>";
	if (parseInt(navigator.appVersion)>=3)
	{
		webo_compteur = new Image(1,1);
		webo_compteur.src=wbs_arg;
	}
	else
	{
		document.write('<IMG SRC='+wbs_arg+wbs_t);
	}
}


function insert_bouton(URL, SRC)
{
	document.write('<A HREF="' + URL + '" target="partenaire"><IMG SRC=' + SRC + ' border=0></A>');
}


//Cette fonction ouvre et ferme l'espace d'autopromo dans les classements.
//Si etat=1 => Ouvre, si etat=0 => Ferme
//Les troisième et quatrième paramètres correspondent au nom des images à faire apparaître ou disparaitre (petit flèche)
function openClose(myname,etat,img1, img2)
{
	//Ouvre et ferme l'autopromo. 
	elem = document.getElementById(myname);
	if(etat==1)
	{
		elem.style.display='';
		document.PourOuvrir.src=img1.src;
		document.getElementById('suite').style.visibility='hidden';
	}
	else if (etat==0)
	{
		elem.style.display='none';
		document.PourOuvrir.src=img2.src;
		document.getElementById('suite').style.visibility='visible';		
	}
}


//Cette fonction change le HREF du lien qui l'appelle.
//Fonction créée pour résoudre le problème du bouton du milieu et du onClick
var href_tampon = '#';

function changeLinkHref(ida,newHref) {
  	href_tampon = ida.href;
    ida.href = newHref;
}

function resetLinkHref(ida) {
    ida.href = href_tampon;
    href_tampon = '#';
}

