var popupje;

function popup(idbericht,idafzender,idontvanger) {
if(popupje) {popupje.close();}
popupje = window.open('priveberichten.php?ber='+idbericht+'&afz='+idafzender+'&ontv='+idontvanger+'&schrijf=1', 'afzender'+idafzender, 'toolbar=no,scrollbars=yes,resizable=yes,status=no,width=530,height=500,top=5,left=45,menubar=no,directories=no');
}

function poppingup(url) {
if(popupje) {popupje.close();}
popupje = window.open(url, 'popup', 'toolbar=no,scrollbars=yes,resizable=yes,status=no,width=530,height=500,top=0,left=45,menubar=no,directories=no');
}

function poppingup_spec(url, width, height) {
if(popupje) {popupje.close();}
popupje = window.open(url, 'popup', 'toolbar=no,scrollbars=yes,resizable=yes,status=no,width='+width+',height='+height+',top=0,left=45,menubar=no,directories=no');
}

function trim(value) {
  value = value.replace(/^\s+/,''); 
  value = value.replace(/\s+$/,'');
  return value;
}

function emailvalidation(entered) {
with (entered) {
	apos=value.indexOf("@"); 
	dotpos=value.lastIndexOf(".");
	lastpos=value.length-1;
	if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)  {
		return false;
	} else {
		return true;
	}
}
}

function maxlength_textarea(elem,maxlength) {
if(elem.value.length>maxlength) {
	elem.value = elem.value.substr(0,maxlength);
}
}


function verwijdergeselecteerdeberichten() {
var del = "";
var formulier = parent.frames['priveberichtenlijstframe'].document.forms['priveberichtenformulier'];
if(formulier.delbericht.length) {
	for(i=0;i<formulier.delbericht.length;i++) {
		if(formulier.delbericht[i].checked==true) {
			del+=formulier.delbericht[i].value + "-";
		}
	}
} else {
	del = formulier.delbericht.value;
}
if(del!="") {
	parent.frames['priveberichtenlijstframe'].location.href = "priveberichtenlijst.php?del="+del;
}
}


function isArray(obj) {
    return obj.constructor == Array;
}

var chatbox;

function popup_chatbox() {
chatbox= window.open ("http://www.gayfriends.nl/chat/nu/chatbox1.php", "Chatbox", "location=1,status=1,scrollbars=1,resizable=1,width=675,height=705");
//chatbox= window.open ("http://www.gayfriends.nl/chatclosed.htm", "Chatbox", "location=1,status=1,scrollbars=1,resizable=1,width=675,height=705");
chatbox.moveTo(screen.width-675,0);
}

function popup_chatbox_extern(url) {
chatbox= window.open (url, "Chatbox", "location=1,status=1,scrollbars=1,resizable=1,width=675,height=705");
chatbox.moveTo(0,0);//ie accepteert geen moves van andere domeinen
}

function popup_chatbox2() {
chatbox= window.open ("http://www.gayfriends.nl/chat/nu/chatbox1.php", "Chatbox", "location=1,status=1,scrollbars=1,resizable=1,width=675,height=705");
chatbox.moveTo(screen.width-675,0);
}


function check_chatbox() {
try {
	if(chatbox.location.href) {
		//chatbox open
		alert("Om uit te loggen dien je eerst de chatbox te sluiten.");
		return false;
	}
}
catch(err) {}
}

function dolocation(userid) {
self.location.href = "index.php?tmpl=home&pid="+userid;
}
