function ouvrirFenetre(url, nompage, largeur, hauteur, extra, withsession)
{
  window.open(url, nompage,
              extra + ' status=no, width=' + largeur + ', height=' + hauteur);
  return false;
}

//******************************************************************************
function info()
{
  window.open("infoentr.html", "infos", "height=300, width=300, location=no");
}

//******************************************************************************
function changeAnnee(anneeActuelle, liste)
{
  var annee = liste.options[liste.options.selectedIndex].value;
  var s = document.location.href;

  var reg=new RegExp("(" + anneeActuelle + "-)", "");
  s = s.replace(reg,annee+'-');
  document.location.href = s;
}
//******************************************************************************
function verifMail(email)
{
  var usr    = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
  var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";
  var regex  = "^" + usr + "\@" + domain + "$";

  var rgx    = new RegExp(regex);
  return rgx.exec(email) ? true : false;
}

//******************************************************************************
var scrOfX = 0, scrOfY = 0;
function getScrollXY()
{
  if( typeof( window.pageYOffset ) == 'number' )
  {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
  {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
  {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
}

//******************************************************************************
var mouse_x=0; var mouse_y=0;
function mouseMove (evt)
{
  getScrollXY();

	if (document.all)
  {
    mouse_x=event.clientX + scrOfX;
    mouse_y=event.clientY + scrOfY;
	}
  else if (document.getElementById)
  {
		mouse_x=evt.clientX + scrOfX;
    mouse_y=evt.clientY + scrOfY;
	}
}
if (document.layers || document.all)
  document.onmousemove = mouseMove;
if (document.addEventListener)
  document.addEventListener('mousemove', mouseMove, true);

var agt = navigator.userAgent.toLowerCase();
var isMac = (agt.indexOf('mac') != -1);
var isOpera = (agt.indexOf("opera") != -1);
var isIE = ((agt.indexOf('msie')!=-1 && !isOpera && (agt.indexOf('webtv')==-1)) && !isMac);

//******************************************************************************
function showAide(nom, show)
{
  aide = document.getElementById(nom);
  if (mouse_x>450)
    aide.style.left = (mouse_x-405) + 'px';
  else
    aide.style.left = (mouse_x+5) + 'px';
  aide.style.top = (mouse_y+10) + 'px';
  aide.style.visibility = show?"visible":"hidden";
  SelectVisible(show?"hidden":"visible",document.getElementsByTagName('select'));
}

//******************************************************************************
function SelectVisible(v,elem)
{
	if (isIE)
		for (var i=0;i<elem.length;i++)
      elem[i].style.visibility=v;
}

//******************************************************************************
function limiteTaille(s, taillemax)
{
  if (s.length > taillemax)
    return s.substring(0, taillemax) + '.';
  else
    return s;
}

//******************************************************************************
var xhr_object = null;
var lastobj = null;

function AfficheTableauResultats(chaine)
{
  matchs = chaine.split('##');

  var s = '';
  var nb = 1;
  for (i=0; i < matchs.length; i++)
  {
    element = matchs[i].split('#');
    if (element.length >= 6)
    {
      nb = 3 - nb;
      s += '<tr class="matchs_l' + nb +'"><td nowrap="nowrap">' + element[4] + ' à ' + element[5] + '</td>' +
           '<td align="right">' + limiteTaille(element[0], 14) + '</td>' +
           '<td align="center" nowrap="nowrap"><strong><a href="' + element[6] + '-' + element[7] + '-detailmatch.php?&match=' + element[8] + '">' + element[2] + ' - ' + element[3] + '</a></strong></td>' +
           '<td>' + limiteTaille(element[1], 14) + '</td></tr>';
    }
  }
  s = '<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">' + s + '</table>';
  document.getElementById('tableau_resultats').innerHTML = s;
}

var callbackMatch = function getNextCallbackMatch()
{
  if ((xhr_object.readyState == 4))
  {
    //alert(xhr_object.responseText);
    document.body.style.cursor = 'default';
    AfficheTableauResultats(xhr_object.responseText);
  }
}

//******************************************************************************
function AfficheTableauProchain(chaine)
{
  matchs = chaine.split('##');

  var s = '';
  var nb = 1;
  for (i=0; i < matchs.length; i++)
  {
    element = matchs[i].split('#');
    if (element.length >= 4)
    {
      nb = 3 - nb;
      s += '<tr class="matchs_l' + nb +'"><td nowrap="nowrap">' + element[2] + ' à ' + element[3] + '</td>' +
           '<td align="right">' + element[0] + '</td>' +
           '<td style="padding-left: 5px;"> - </td>' +
           '<td>' + element[1] + '</td></tr>';
    }
  }
  s = '<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">' + s + '</table>';
  document.getElementById('tableau_prochain').innerHTML = s;
}

var callbackProchain = function getNextCallbackProchain()
{
  if ((xhr_object.readyState == 4))
  {
    //alert(xhr_object.responseText);
    document.body.style.cursor = 'default';
    AfficheTableauProchain(xhr_object.responseText);
  }
}

//******************************************************************************
function appelAjax(obj, url, retour, fn)
{
  return appelAjaxEx(obj, url, retour, fn, true);
}

function appelAjaxEx(obj, url, retour, fn, asynchrone)
{
  if (xhr_object == null)
    if(window.XMLHttpRequest)
      xhr_object = new XMLHttpRequest();
    else if(window.ActiveXObject)
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
    else
      return true;

  if (retour)
  {
    document.body.style.cursor = 'wait';
    if (obj != null)
      obj.style.cursor = 'wait';
    lastobj=obj;
  }

  xhr_object.open("GET", url, asynchrone);
  if (retour)
    xhr_object.onreadystatechange = fn;
  xhr_object.send(null);

  return false;
}

//******************************************************************************