// Stel Vraag: Yes or Cancel
function doConfirm(vMsg, vUrl) {
	if (confirm(vMsg))  window.location=vUrl;
}

function checkChatNick() {
	var nField = document.getElementById("webchatnickname");
	var n = nField.value;
	if (n == "Webchatter") {
		alert("Kies een eigen naam in plaats van 'Webchatter'!\n\nVul deze in het veld in boven de 'Chat!' knop.");
		return false;
	}
	if (n.substring(0, 10) == "Webchatter")	{
		alert("Nah, beetje flauw he, gewoon '"+n.substring(10)+"' erachter zetten ;) Je kunt toch wel wat anders verzinnen?");
		return false;
	}
	if ((n.indexOf("Web")>=0) && (n.indexOf("chatter")>=0)) {
		alert("*zucht* Nee, ook niet zo... kom op joh, verzin ff wat origineels!");
		return false;
	}

	return true;
}

// Popup Window
function popWindow(URL,w,h,Name) {
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	features = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+w+',height='+h+',top='+wint+',left='+winl;
	window.open(URL,Name,features);
}

function openWebchatPopup(w,h,server) {
	if (!checkChatNick()) return false;
	if (server == 'irc.chatcity.nl') {
		var nick = document.webchat.username.value;
	} else {
		var nick = document.webchatalternate.username.value;
	}
	popChatWindow("http://www.bdsm-jongeren.net/webchat/chat.php?pw="+w+"&ph="+h+"&username="+nick+"&server="+server,w,h,"bdsm_jongeren_nederland_belgie_chat");
	return true;
}

function popChatWindow(URL,w,h,Name) {
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	features = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+w+',height='+h+',top='+wint+',left='+winl;
	window.open(URL,Name,features);
}
