	var agent       = navigator.userAgent.toLowerCase();
	
	//var allowAdvanced = ((agent.indexOf("msie")      != -1) && (agent.indexOf("opera")     == -1));
	var allowAdvanced = false;
	function insertCode(tagcode)
	{
		var update_button = eval('document.forms[0].button_'+ tagcode );
		var add_slash = (update_button.value.substring(1,2) == '/') ? '' : '/';
		
		if (allowAdvanced)
		{
			var text_selection = document.selection.createRange().text;
			
			if (text_selection != '' && add_slash != '') document.selection.createRange().text = '['+tagcode+']' + text_selection + '[/'+tagcode+']'; 
			else if (text_selection == '')
			{
				insertAtCaret(update_button.value);
				update_button.value = ('['+add_slash+tagcode+']');
			}
		}
		else
		{
			document.forms[0].comment.value += update_button.value;
			update_button.value = ('['+add_slash+tagcode+']');
		}
		
		document.forms[0].comment.focus();
	}
	

	function insertColor()
	{
		col = document.forms[0].selectcolor.options[document.forms[0].selectcolor.selectedIndex].value;

		if (allowAdvanced)
		{
			var text_selection = document.selection.createRange().text;
			if (col != 'none') 
			{
				if (text_selection != '') document.selection.createRange().text = '[color:'+col+']' + text_selection + '[/color]'; 
				else insertAtCaret('[color:'+col+'][/color]');
			}
		}
		else if (col != 'none') document.forms[0].comment.value += '[color:'+col+'][/color]';
	}
	
	function insertSmiley(smileyCode)
	{
		if (allowAdvanced)
		{
			insertAtCaret(smileyCode)
		}
		else 
		{
			var prevTxt = document.forms[0].comment.value;
			document.forms[0].comment.value = prevTxt + smileyCode;
		}
	}
	
	
	// -----------------------------------------------------------------------------------------------------------------------------
	// external functions from Stefan Vogel, Martin Honnen, many thanks!!!!
	// slightly modified for own use
	function storeCaret()
	{
		if (allowAdvanced)
		{
			if (document.forms[0].comment.createTextRange) document.forms[0].comment.caretPos = document.selection.createRange().duplicate();
		}
	}
	
     function insertAtCaret(text) 
	 {
     	if (document.forms[0].comment.createTextRange && document.forms[0].comment.caretPos) 
		{
        	var caretPos = document.forms[0].comment.caretPos;
         	caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?  text + ' ' : text;
		}
		else document.forms[0].comment.value  = text;
     }
	// end external functions
	// -----------------------------------------------------------------------------------------------------------------------------
	

	// -----------------------------------------------------------------------------------------------------------------------------
	// ripped from phpBB ;-)
	// leuke functie waarvan ik te lui was om zelf de code te schrijven :-D
	// lichtjes gewijzigd om de image in een nieuw venster te openen.
	
	
	var maxWidth = 500;
	
	function scaleImage(im) {
	
	  if (typeof im.naturalWidth == 'undefined') im.naturalWidth = im.width;
	
	  if (im.naturalWidth > maxWidth) {
	
	    im.width = maxWidth;
	    im.style.maxWidth = im.naturalWidth + 'px';
//	    im.className = 'resized';
	    im.title = 'click for original size';
	    im.onclick = unscaleImage;
	
	  }	
	}
	
	function unscaleImage() {
		// unscale becomes open in new window
		window.open(this.src,bcnUnscaled)
	
	/*
	  if (this.width == maxWidth) {
	
	    this.width = this.naturalWidth;
	    this.style.borderWidth = '0px';
	    this.title = 'Klik om te verkleinen';
	
	  } else {
	
	    this.width = maxWidth;
	    this.style.borderWidth = '2px';
	    this.title = 'Klik voor originele grootte';
	
	  }
	 */
	}
	// -----------------------------------------------------------------------------------------------------------------------------
