online_tijd = 900;//tijd dat gebruiker online is
var aMaandKort = new Array('Jan','Feb','Mrt','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Dec');
var site_url = 'http://nieuw.clubje.nl';

function storeCaret(text) 
{ 
	if (text.createTextRange) 
	{
		text.caretPos = document.selection.createRange().duplicate();
	}
}
function loadTip() 
{
  tip = new uberToolTip( null , 10 );
  tip.init();
}

function kiesStijl(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}

//return aan de hand van engelse notatie: 13 okt
function dat_1(datum)
{
  maand = datum.substr (5,2);
  dag = datum.substr(8, 2); 
  if(maand == 0 || dag == 0)
  {
    return "";
  }
  else
  {
    maand = aMaandKort[maand-1];
    datum = dag+' '+maand;
    return datum;
  }
}

//geef gebruiker naam weer (met link naar profiel)
// userid,username,userage,usersex,lastonline,target,namelength,photo
function n(id,naam,leeftijd,geslacht,online,foto)
{
  if(geslacht == 'M')
  { 
    document.write('<img src="/images/'+stijl+'/m.gif">');
  }
  else
  {
	document.write('<img src="/images/'+stijl+'/f.gif">');
  } 
  if(naam.length > 20)
  {
    kortNaam = naam.substr(0,20)+'...';
  }
  else
  {
    kortNaam = naam;
  }
  
  if(online == 1)
  {
    online = 'on';
  }
  else
  {
    online = 'off';
  }
  document.write('<a href="/main.php?page=profiel&id='+id+'" class="'+online+'" alt="'+naam+'">'+kortNaam+'</a>');
  if(leeftijd != -1)
  {
    document.write('('+leeftijd+')');
  }
  if(foto == 1)
  {
    document.write('<a href="/main.php?page=foto&id='+id+'"><img src="images/'+stijl+'/foto.gif" border="0"></a>');
  }
}

function up(id,naam,leeftijd,geslacht,online,mood,foto,br,venster)
{
  document.write('<nobr>');
  if(geslacht == 'M')
  { 
    document.write('<img src="/images/'+stijl+'/m.gif">');
  }
  else
  {
	document.write('<img src="/images/'+stijl+'/f.gif">');
  } 
  if(mood != 0)
  {
	document.write('<img src="/images/moodie/'+mood+'.gif">');  
  }
if(naam.length > 20)
  {
    kortNaam = naam.substr(0,20)+'...';
  }
  else
  {
    kortNaam = naam;
  }
  
  if(online == 1)
  {
    online = 'on';
  }
  else
  {
    online = 'off';
  }
  if(venster == 1)
  {
    target = ' target="_blank"';  
  }
  else
  {
	  target = '';  
  }
  document.write('<a href="/main.php?page=profiel&id='+id+'" class="'+online+'" alt="'+naam+'"'+target+'>'+kortNaam+'</a>');
  if(leeftijd != -1)
  {
    document.write('('+leeftijd+')');
  }
  if(foto == 1)
  {
    document.write('<a href="/main.php?page=foto&id='+id+'"><img src="images/'+stijl+'/foto.gif" border="0"></a>');
  }
  document.write('</nobr>');

if(br == 1)
  {
	  document.write('<br>');  
  }
}
//n met br op het einde
function nl(id,naam,leeftijd,geslacht,online,foto)
{
  n(id,naam,leeftijd,geslacht,online,foto);
  document.write('<br>');

}

//zelfde als n alleen openen in nieuwe page
function np(id,naam,leeftijd,geslacht,online)
{
  if(geslacht == 'M')
  { 
    document.write('<img src="/images/'+stijl+'/m.gif">');
  }
  else
  {
	document.write('<img src="/images/'+stijl+'/f.gif">');
  } 
  if(naam.length > 20)
  {
    kortNaam = naam.substr(0,20)+'...';
  }
  else
  {
    kortNaam = naam;
  }
  
  if(online== 1)
  {
    online = 'on';
  }
  else
  {
    online = 'off';
  }
  document.write('<a href="/main.php?page=profiel&id='+id+'" class="'+online+'" alt="'+naam+'" target="_blank">'+kortNaam+'</a>');
  if(leeftijd != -1)
  {
    document.write('('+leeftijd+')');
  }
}


function addBlock(user)
{
   window.open('/popup/block.php?action=add&user='+user,'Negeerlijst','width=320,height=275');

}

function delBlock(user)
{
   window.open('/popup/block.php?action=del&user='+user,'Negeerlijst','width=320,height=275');
}
function addFriend(user)
{
   window.open('/popup/vriend.php?action=add&user='+user,'Vriendenlijst','width=320,height=275');
}

function changeMood()
{
   window.open('/popup/mood.php','mood','width=340,height=200');
}

function delFriend(user)
{
   window.open('/popup/vriend.php?action=del&user='+user,'Vriendenlijst','width=320,height=275');
}

function viewBericht()
{
   window.open('/popup/direct.php','Directbercht','width=250,height=275');
}

function writeBericht(id)
{
   window.open('/popup/direct.php?action=write&to='+id,'Directbercht'+id,'width=250,height=275');
}

function klacht(id)
{
   window.open('/popup/klacht.php?id='+id,'klacht'+id,'width=250,height=275');
}

function sendSms(id)
{
   window.open('/popup/sms.php?id='+id,'sms'+id,'width=250,height=275');
}

function voiceMail(id)
{
   window.open('/popup/voicemail.php?id='+id,'voice'+id,'width=250,height=275');
}
function openHelp(page)
{
  window.open('/popup/help.php?page='+page,'help','scrollbars,width=450,height=500');
}
