function showDialog(url, title, width, height)
{
	var objBody = document.body;
	
	var objOverlay = document.createElement("div");
	objOverlay.setAttribute("id", "overlay");
	objOverlay.onclick = function() {hideDialog(); return false; }	

	objOverlay.style.height = objBody.scrollHeight + "px";
	objOverlay.style.width = objBody.scrollWidth + "px";
	objBody.appendChild(objOverlay);
	
	var objDialog = document.createElement("div");
	objDialog.setAttribute("id", "dialog");
	objDialog.style.width = width + "px";
	objDialog.style.height = height + "px";
	objDialog.style.marginTop = ((height / 2) * -1) + "px";
	objDialog.style.marginLeft = ((width / 2) * -1) + "px";
	objBody.appendChild(objDialog);
	
	var objDialogTitle = document.createElement("div");
	objDialogTitle.setAttribute("id", "dialogTitle");
	objDialogTitle.onclick = function() {hideDialog(); return false; }
	objDialogTitle.style.width = (width - 20) + "px";
	objDialogTitle.innerHTML = title;
	objDialog.appendChild(objDialogTitle);
	
	var objDialogClose = document.createElement("div");
	objDialogClose.setAttribute("id", "dialogClose");
	objDialogClose.onclick = function() {hideDialog(); return false; }
	objDialogClose.style.position = "relative";
	objDialogClose.style.zIndex = "9999";
	objDialog.appendChild(objDialogClose);

	var objIframe = document.createElement("iframe");
	objIframe.setAttribute("id", "dialogIframe");
	objIframe.style.width = width + "px";
	objIframe.style.height = (height - 24) + "px";
	objIframe.frameBorder = "0";
	objIframe.src = url;
	objDialog.appendChild(objIframe);
}

function hideDialog()
{
	var objBody = document.body;
	var objOverlay = document.getElementById("overlay");
	var objDialog = document.getElementById("dialog");
	
	objOverlay.style.display = "none";
	objDialog.style.display = "none";
	
	objBody.removeChild(objDialog);
	objBody.removeChild(objOverlay);
}

function showReactie()
{
	document.getElementById('gbreactie').style.display = 'block';
	document.getElementById('gbberichten').style.display = 'none';
}

function hideReactie()
{
	document.getElementById('gbreactie').style.display = 'none';
	document.getElementById('gbberichten').style.display = 'block';
}

function addSmiley(SmileyCode)
{
	SmileyCode = stripslashes(SmileyCode);
	var MessageBox = document.getElementById('gbmessage');

	if (MessageBox.selectionStart || MessageBox.selectionStart == '0')
	{ 
		var Start = MessageBox.selectionStart; 
		var End = MessageBox.selectionEnd; 
		MessageBox.value = MessageBox.value.substring(0, Start) + SmileyCode + MessageBox.value.substring(End, MessageBox.value.length); 
	} 
	else
	{ 
		MessageBox.value += SmileyCode; 
	}
	
	MessageBox.focus(); 
}

function stripslashes(string)
{
	string=string.replace(/\\'/g,'\'');
	string=string.replace(/\\"/g,'"');
	string=string.replace(/\\\\/g,'\\');
	string=string.replace(/\\0/g,'\0');
	return string;
}
