var msg="Function Disabled!";
var pfix=''; /* la bonne valeur est positionnée dans la page */
var pfix2='bw'; /* la bonne valeur est positionnée dans la page */
function ckIE(){if (event.button==2){alert(msg);return false;}return true;}
function ckNS(e){
  if (document.layers||document.getElementById&&!document.all){
    if(e.which==2||e.which==3){alert(msg);return false;}}return true;
}
if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=ckNS;
} else if (document.all&&!document.getElementById) {
	document.onmousedown=ckIE;
}
document.oncontextmenu=new Function("alert(msg);return false")

var nbprof=0;

if(top.laps) top.laps=1;


if (document.all) var hh = (top.document.body.clientHeight+30);
else var hh = (window.outerHeight-30);

function GetCookie(name) {
 if ( document.cookie) { // Le cookie est-il valide ?
  var index = document.cookie.indexOf( name);
  if ( index != -1) {
   var nDeb = (document.cookie.indexOf( "=", index) + 1);
   var nFin = document.cookie.indexOf( ";", index);
   if (nFin == -1) {nFin = document.cookie.length;}
   return unescape(document.cookie.substring(nDeb, nFin));
  }
 }
 return null;
}

function oneprofile(ID,Id,nick,birthdate,pays,country,state,ville,icochat,nbpics,room,event,param){
  nbprof++;

  var now=new Date();
  var ladate=new Date();
  ladate.setTime(now.getTime());
  ladate.setMonth(birthdate.substr(5,2)-1);
  ladate.setDate(birthdate.substr(8,2));


  var showinfo="";
  var icoroom="";
  if(room=="") room="no"; //pour faire une requete en moins dans ownpage2.php
  else icoroom="<img src='../images/icoroom"+room+".gif'>";
  
  var nocache="";
  if(nick==GetCookie("nickmem")) nocache="?"+now.getTime();

  if(dispmod) showinfo="&dispmod="+dispmod;
  var etat;
  if(icochat=="icobulle.gif"){var icotext="Chat";etat="on";}else{var icotext="Msg";etat="off";}
  if(now.getTime()==ladate.getTime() && birthdate.substr(8,2)!="00") etat+=" anniv";
  //le ---&& birthdate.substr(8,2)!="00"--- est pour corriger le bug qui faisait que quand le jour était 00 ça donnait le dernier jour du mois d'avant.

  var image=nick.toLowerCase();

  var nb = image.length;
  var somme = 0;
  for (var i=0; i<nb; i++)
    somme += image.charCodeAt(i);
  var rep1 = somme % 53;
  var rep2 = somme % 59;
  var reppic ="../pic/"+rep1+"/s_"+rep2+"/";

  if(state) state = ", "+state.toUpperCase();
  
  if(nbprof>1 && nbprof%linesize==1) document.write("</tr><tr>");
  document.write("<td valign='center' align ='center'><TABLE class='pave"+etat+"' BORDER='0' CELLPADDING='0' CELLSPACING='0' Width='120'><TR><TD ALIGN='CENTER' CLASS='art1'><B>"+nick+"</B></TD></TR><TR><TD align='center' height='115'><a href = 'ownpage2.php?id="+Id+"&nick="+nick+"&room="+room+showinfo+"' onClick=\"var wp=window.open('ownpage2.php?id="+Id+"&nick="+nick+"&room="+room+showinfo+"','"+pfix+"w"+Id+"','resizable=yes,location=no,scrollbars=yes,toolbar=no,width=560,height="+hh+",left=48,top=24');wp.focus();return false\"><img class='pic' src='"+reppic+"s_"+image+"0.jpg"+nocache+"' naturalsizeflag='0' border ='0'></a></TD></TR><TR><TD ALIGN='CENTER' Class='mini'><a href='find.php?country="+country+param+"' class='lmini'>"+pays+"</a></TD></TR><TR><TD ALIGN='CENTER' Class='mini'>"+ville+state+"</TD></TR><TR><TD ALIGN='CENTER'><A target='msgnopop' HREF='messages_s.php?id="+Id+"&nick="+nick+"&fromgallery=y' onClick=\"");
  if(ID){
    document.write("var wm=window.open('messages_s.php?id="+Id+"&nick="+nick+"&fromgallery=y','"+pfix2+"messages_s','resizable=no,location=no,scrollbars=no,toolbar=no,width=240,height=230,left=500,top=20');wm.focus()");
  }else{
    document.write("document.location.href='connection.php'");
  }

  document.write("; return false\"><IMG SRC='../images/"+icochat+"' border='0' title='"+icotext+"'></A>");
  document.write(icoroom);
  
  if(now.getTime()==ladate.getTime() && birthdate.substr(8,2)!="00") document.write(" &nbsp; <img src='../images/icobougie.gif' title='Birthday'>");
  
  if(nbpics>0) document.write(" &nbsp; <a href = 'ownpage2.php?id="+Id+"&nick="+nick+"&room="+room+"' onClick=\"var wp=window.open('ownpage2.php?id="+Id+"&nick="+nick+"&room="+room+showinfo+"','"+pfix+"w"+Id+"','resizable=yes,location=no,scrollbars=yes,toolbar=no,width=560,height="+hh+",left=48,top=24');wp.focus();return false\"><IMG SRC='../images/icophoto.gif' border='0' title='"+nbpics+" pics'></a>");

  if(event>0) document.write(" &nbsp; <a href = '../guide/guidepage.php?id="+event+"&login=event','guidepage' onClick=\"var we=window.open('../guide/guidepage.php?id="+event+"&login=event','"+pfix+"guidepage','resizable=yes,location=no,scrollbars=yes,toolbar=no,width=560,height="+hh+",left=12,top=100');we.focus();return false\"><IMG SRC='../images/icoevent.gif' border='0' title='woofer'></a>");

  document.write("</TD></TR></TABLE></td>");
}

function lpages(current, last, param) {
   var madate=new Date();
   for(var i=1; i<=last; i++) {
      if(i==current) document.write("<b>"+i+"</b>");
      else document.write("<a href='gallery.php?page="+i+param+"' class='normal'>"+i+"</a>");
      if(i<last) document.write(" - ");
   }
}


