function show_window(titre, texte) {
	win = new Window({className: "dialog",  width:600, height:210, zIndex: 100, resizable: true, title: titre, draggable:true, wiredDrag: true, minimizable: false, maximizable: false});
	
	win.getContent().update(texte);
	win.showCenter();
}

function get_classement(max, elementid){
  new Ajax.Updater(elementid, '/ajax/classement.php?max=' + max);
  //window.setTimeout("get_classement("+max+", '"+elementid+"');",10000);	
}


function switch_div(id, mode){
  if(!mode)
  {
    if($(id).style.display == 'none') {
      $(id).style.display='block';
    } else {
      $(id).style.display='none';
    }
  }
  else
  {
    if(mode='on') $(id).style.display='block';
    if(mode='off') $(id).style.display='none';
  }
}

function pluriel(nbr) {
  if(nbr>1)
    return 's';
  else
    return '';
}

function suffixe_position(num) {
  if(num==1)
    return 'er ';
  else
    return 'eme ';
}

function change_image_ap(icone_type, mouseover) {
  var imgsrc = 'images/allopass/icone_'+icone_type+'.png';
  if(mouseover==true) {
    imgsrc = 'images/allopass/icone_cliquezici.png';
  }
  
  $('icone_'+icone_type).src = imgsrc;
}

function goto_page(page) {
  var params = document.location.search.replace(/\?/, "").split("&");
  for (i=0; i<params.length; i++) {
    params[i] = params[i].split('=');
    if (params[i][0] == 'page') {
      params[i][1] = page;
    }
    params[i] = params[i].join('=');
  }
  
  newSearch = '?'+params.join("&");
  if (document.location.search == '') document.location.search = '?page='+page;
  else if (newSearch != document.location.search) document.location.search = newSearch;
  else document.location.search += '&page='+page;
}


function show_window(titre, texte, width, height) {
	if (!width) width = 350;
	if (!height) height = 100;
	win = new Window({className: "dialog",  width: width, height: height, zIndex: 100, resizable: true, title: titre, draggable:true, wiredDrag: true, minimizable: false, maximizable: false});
	
	win.getContent().update(texte);
	win.showCenter();
	
	return win;
}
