var NS4 = (document.layers);
var IE4 = (document.all);
var D="rbp.be";

function Dest (x)
//-----------
{
window.open ("mailto:" + x + "@" + D);
}

function LogIn ()
//------------
{
var MyWindow;
var MyUrl;
if (!document.forms[0].cname.value) {alert('Vous devez introduire un nom ou pseudo'); return;}
MyUrl = '/cgi-bin/bluechat/bluechat.pl' + '?site=RBP&cname=' + escape(document.forms[0].cname.value);
MyWindow = window.open(MyUrl, "BlueChatRBP", "STATUS=NO,TOOLBAR=NO,LOCATION=NO,DIRECTORIES=NO,COPYHISTORY=NO,MENU=NO,RESISABLE=NO,SCROLLBARS=NO,TOP=50,LEFT=20,WIDTH=600,HEIGHT=400");
//window.history.back();
}

function logger ()
//-------------
{
if (   ( document.location.hostname != "localhost" ) 
    && ( document.location.hostname != "" ) )
 {
  <!-- start log code -->
  document.write("<img src='/cgi-bin/logrbp.pl?");
  document.write(escape(document.location));
  document.write("\;");
  document.write(escape(document.referrer));
  document.write("\;");
  document.write(escape(navigator.appName));
  document.write("\;");
  document.write(escape(navigator.appVersion));
  document.write("' width='1' height='1' align='right' alt=''>");
  <!-- end log code -->
 }
}

function cleanadd (elm)
//---------------
{
  if (elm.value == "mon adresse email") { elm.value = "";}
  if (elm.value == "un mot") { elm.value = "";}
}

function restadd (elm,z)
//--------------
{
  if (z=="email" && elm.value == "")  { elm.value = "mon adresse email";}
  if (z=="qwery" && elm.value == "")  { elm.value = "un mot";}
}

function checkadd (frm)
//---------------
{
  if (frm.email.value == "mon adresse email") 
  { alert ("Votre adresse email n'est pas valide"); 
    return false;
  }
  if (frm.email.value == "")
  { alert ("Votre adresse email n'est pas valide"); 
    return false;
  }
}

function getCookieVal (offset)
//-------------------
{
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    { endstr = document.cookie.length; }
  return unescape(document.cookie.substring(offset, endstr));
}

function FixCookieDate (date)
//--------------------
{
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    { date.setTime (date.getTime() - skew); }
}

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() : "") +
      ((expires) ? "; expires=" + expires : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
}

function SetMyCookies (Val1,Val2)
//-------------------
{
  var expdate = new Date ();
  //FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
  expdate = "Wednesday, 09-Nov-05 00:00:00 GMT";
  //.setTime (expdate.getTime() + (24 * 60 * 60 * 1000)); // 24 hrs from now
  SetCookie (Val1, Val2, expdate);
}

function goTop ()
//------------
{
  window.open('http://www.top50natation.net/entree.php?id=1YVCLq',null,'menubar=yes, toolbar=yes, resizable=yes, scrollbars=yes, location=yes');
}

function setPseudo ()
//----------------
{
  pseudo=window.prompt ("Bienvenue "+pseudo+"... Personnalisez cette page d'accueil en introduisant un pseudo (Ne fonctionne qu'avec les cookies activés).",pseuda);
  if (pseudo)
  { 
    SetMyCookies("pseudo0",pseudo); 
    location.reload();
  }
  else { pseudo=pseuda; }
}

function findInPage (str)
//-----------------
{
 var win = this;
 var n   = 0;
 var txt, i, found;
 if (str == "") { return false; }
 if (NS4) 
 {
  if (!win.find(str))
   while(win.find(str, false, true))
    n++;
  else
   n++;
  if (n == 0) alert(str + " introuvable sur cette page.");
 }
 if (IE4) 
 {
  txt = win.document.body.createTextRange();
  for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) 
  {
   txt.moveStart("character", 1);
   txt.moveEnd("textedit");
  }
  if (found) 
  {
   txt.moveStart("character", -1);
   txt.findText(str);
   txt.select();
   txt.scrollIntoView();
   n++;
  }
  else 
  {
   if (n > 0) 
   {
    n = 0;
    findInPage(str);
   }
   else
    alert(str + " introuvable sur cette page.");
  }
 }
 return false;
}

function getStyleClass (className) 
//--------------------
{
 if (document.all) 
 {
  for (var s = 0; s < document.styleSheets.length; s++)
   for (var r = 0; r < document.styleSheets[s].rules.length; r++)
    if (document.styleSheets[s].rules[r].selectorText == '.' + className)
     return document.styleSheets[s].rules[r];
 }
 else if (document.getElementById) 
 {
  for (var s = 0; s < document.styleSheets.length; s++)
   for (var r = 0; r < document.styleSheets[s].cssRules.length; r++)
    if (document.styleSheets[s].cssRules[r].selectorText == '.' + className)
     return document.styleSheets[s].cssRules[r];
 }
 return null;
}

function dispdate ()
//------------------
{
 var curdate = new Date();
 var thedate = new Date();
 var month = thedate.getMonth() + 1;
 if (thedate.getMonth() == 0) (month = " janvier ");
 if (thedate.getMonth() == 1) (month = " février ");
 if (thedate.getMonth() == 2) (month = " mars ");
 if (thedate.getMonth() == 3) (month = " avril ");
 if (thedate.getMonth() == 4) (month = " mai ");
 if (thedate.getMonth() == 5) (month = " juin ");
 if (thedate.getMonth() == 6) (month = " juillet ");
 if (thedate.getMonth() == 7) (month = " août ");
 if (thedate.getMonth() == 8) (month = " septembre ");
 if (thedate.getMonth() == 9) (month = " octobre ");
 if (thedate.getMonth() == 10) (month = " novembre ");
 if (thedate.getMonth() == 11) (month = " décembre ");
 document.write ('<b>'+curdate.getDate()+month+curdate.getFullYear()+'</b>');
}

//--------------------
function openDetails(arg) 
{
 var hauteur=450;
 var largeur=520;
 var options = "";
 options = options + "resizable=no";
 options = options + ",scrollbars=yes";
 options = options + ",menubar=no";
 options = options + ",toolbar=no";
 options = options + ",directories=no";
 options = options + ",location=no";
 options = options + ",status=no";
 var top=(screen.height-hauteur)/2;
 var left=(screen.width-largeur)/2;
 f = window.open("http://cinetelerevue.tvbase.net/Broadcast.aspx?id="+arg,"Programmes","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
 f.focus();
}

//--------------------
function DisplayTime(displayTime)
{
 if (img <= last)
 {
  if (displayTime<1)
  { document.location.href = "diaporama.htm?" + param;
    return;
  }
  displayTime--;
  setTimeout("DisplayTime(" + displayTime + ")", 2500);
 }
}

//--------------------
function DisplayTime2(displayTime)
{
 if (imn <= last)
 {
  if (displayTime<1)
  { document.location.href = 'diapoframe.htm?'+'bas='+base+'&end='+last+'&lbl='+label+'&inx='+imn+'|';
    return;
  }
  displayTime--;
  setTimeout("DisplayTime2(" + displayTime + ")", 2500);
 }
}


