var ma_query = location.search;

var ind_debut_site=4;
var ind_fin_site = ma_query.indexOf('&TITRE=');

var ind_debut_titre = ind_fin_site + 7;
var ind_fin_titre = ma_query.indexOf('&URL=');

var ind_debut_url = ind_fin_titre + 5;
var ind_fin_url = ma_query.length;

var site=0;
var titre='weborama';
var urlphysique='http://www.rue-du.net';

var webobarre_l=780;
var webobarre_h=540;

if (parseInt(navigator.appVersion.charAt(0))>=4)
{
	webobarre_l = screen.width - 10;
	webobarre_h = screen.height - 180;
	
}

if(ma_query.length>0)
{
	site = ma_query.substring(ind_debut_site,ind_fin_site);
	titre = ma_query.substring(ind_debut_titre,ind_fin_titre);
	urlphysique = ma_query.substring(ind_debut_url,ind_fin_url);
}

function aimfar()
{
	//Copyright Weborama
        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_ta='0x0';
        var wbs_co=0;
        var wbs_ua=navigator.userAgent;
        var wbs_ver = parseInt(navigator.appVersion);
        if (wbs_ver>=4)
        {
                wbs_ta=screen.width+"x"+screen.height;
                wbs_co=(wbs_ua.indexOf('MSIE')!=-1)?screen.colorDepth:screen.pixelDepth;
        }
        var wbs_param = ' border=0 height=18 width=88>';

	document.cookie='wbopre=1; path=/';
	if(document.cookie.indexOf('wbopre=1')>=0){
	if(document.cookie.indexOf('wbopost=1')==-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){
	   document.body.addBehavior("#default#clientCaps");
	   wbs_conn=document.body.connectionType;
	  }
	 }
	}

	var wbs_url ='http://gold.weborama.fr/fcgi-bin/aimfar.fcgi?ID='+site+"&rd="+wbs_rand+"&ta="+wbs_ta+"&da2="+wbs_das+"&conn="+wbs_conn+"&from=webobarre";
	var wbs_fpar = '" frameborder=0 marginHeight=0 marginWidth=0 scrolling=no width=1 height=1'+ifstyle;
	var wbs_if = '<IFRAME SRC="'+ wbs_url+wbs_fpar +"></IFRAME>";
	document.write(wbs_if);
	document.cookie='wbopost=1';
	}}
}

//fonction d'ouverture d'une url
function webogo(url)
{
	var param = 'width='+webobarre_l+',height=' + webobarre_h + ',scrollbars=1,resizable=1,menubar=1,toolbar=1,location=1';

	fenetre_nav = window.open('','',param);
	fenetre_nav.moveTo(0,0);
	fenetre_nav.location=url;
	fenetre_nav.focus();
}

//killframeset
function bzutt()
{
	top.location=urlphysique;
}

//inscription
function webo_insc()
{
	url_insc = 'http://www.weborama.fr/inscription/outils-gratuits.php';
	webogo(url_insc);
}


//vote
function webo_vote()
{
	//url_vote = 'http://vote.weborama.fr/fcgi-bin/vote.fcgi?'+site;
	url_vote = 'http://www.weborama.fr/?id_vote='+site;
	webogo(url_vote);
}

//stats
function webo_stats()
{
	url_stats = 'http://www.weboscope.com/choix.php?ID='+site;
	webogo(url_stats);
}

//classements
function webo_class()
{
	url_class = 'http://www.weborama.fr/fcgi-bin/va_a.fcgi?OBJ=CLASS&ID=' + site;
	webogo(url_class);
}

//news
function webo_news()
{
	url_news = 'http://www.weborama.fr/fcgi-bin/va_a.fcgi?OBJ=NEWS&ID=' + site;
	webogo(url_news);
}

function webo_www()
{
	url_www = 'http://www.weborama.fr/';
	webogo(url_www);
}


//dns
function webo_dns()
{
	url_dns = 'http://www.rue-du.net';
	webogo(url_dns);
}


//recherche
function warm()
{
	url = 'http://www.weborama.fr/fcgi-bin/recherche.fcgi?QUERY=' + escape(document.webobarre.warm.value);
	webogo(url);
	return false;
}


//Gestion du chat
liste_car = '0123456789abcdefghijklmnopqrstuvwxyz_-ABCDEFGHIJKLMNOPQRSTUVWXYZ';
function dropChars (s)
{
	var i;
    var returnString = "";
    for (i = 0; i < s.length; i++)
    {
        var c = s.charAt(i);
		if (c.indexOf(' ')==0) c='_';
        if (liste_car.indexOf(c) != -1) returnString += c;
    }
    return returnString;
}

function webo_chat()
{
		mon_nom = prompt("Choisissez votre nom pour rejoindre le chat et discuter en ligne.\nAttention : les accents et caractères spéciaux ne sont pas pris en compte.",'Votre_nom');
		mon_nom=dropChars(mon_nom);
		if (mon_nom.length>0)
		{
			var chaine = 'http://www.weborama.fr/chat/chat.html?room=' + dropChars(titre) + '&name='+mon_nom;
			mon_chat = window.open(chaine,'webochat','WIDTH='+webobarre_l+',HEIGHT='+webobarre_h+',resize=no');
		}
		else
		{
			alert('Vous devez choisir un nom');
		}
}

