function AddSmile(SmileCode) {
	var SmileCode;
	var newMessage;
	var oldMessage = document.reaction.bericht.value;
	
	newMessage = oldMessage+SmileCode;
	document.reaction.bericht.value=newMessage;
	document.reaction.bericht.focus();
	
	return;
}



b_help = "Vette tekst: [b]text[/b]";
i_help = "Schuine tekst: [i]text[/i]";
u_help = "Onderstreepte tekst: [u]text[/u]";
a_help = "Hyperlink: [url]http://www.url.nl[/url] of [url=http://www.url.nl]URL tekst[/url]";
p_help = "Invoegen image: [img]http://image_url[/img]";
o_help = "Off Topic: [ot]offtopic[/ot]";
q_help = "Quote text: [quote]text[/quote]";
c_help = "Codehighlight: [code]text[/code] (Vak met regelnummers en colorcoding)";

bbcode = new Array();
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[url]','[/url]','[img]','[/img]','[ot]','[/ot]','[quote]','[/quote]');
imageTag = false;

function helpline(help)	{
document.reaction.helpbox.value = eval(help + "_help");
}

function jump(s, location)	
{
parent.window.location=""+s+""+location+"";
}

function banip(ip, user, naam, url)	{
	
	if(confirm("Wil je "+naam+" met ip "+ip+" een ban geven?"))	{
		parent.window.location = url;
	}
}

function confirm_inbox_delete(){
	
	if( confirm('Weet je zeker dat je de door jou geselecteerde priveberichten wilt verwijderen?') ){
		document.delete_form.submit();
		
	}
	
}

function confirm_favo_delete(){
	
	if( confirm('Weet je zeker dat je de door jou geselecteerde topics uit je favorieten wilt verwijderen?') ){
		document.delete_form.submit();
	}
	
}

function confirm_pm_delete(start_url){
	
	if( confirm('Weet je zeker dat je dit privebericht wilt verwijderen?') ){
		parent.window.location = start_url;
	}
	
}

function confirm_report_delete(start_url){
	
	if( confirm('Weet je zeker dat je het topicreport wilt verwijderen?') ){
		parent.window.location = start_url;
		
	}
	
}

function confirm_report_topic_delete(start_url){
	
	if( confirm('Weet je zeker dat je alle topicreports uit dit topic wilt verwijderen?') ){
		parent.window.location = start_url;
	}
	
}

function resize_image(image_naam){
	
	var image = document.getElementById(image_naam).width;
	if( image > 640 ){
		image = 640;
	}
	
}

/* Thnx to Civil :) */
function inbox_select_all(checkbox){
	var el = checkbox.form.elements, i = el.length;
	while (i--){
		if (el[i].type == 'checkbox')
			el[i].checked = checkbox.checked;
	}
}

function toon_cat(cat_id){
	
	if( document.getElementByName(cat_id).style.display == '' ){
		document.getElementByName(cat_id).style.display = 'none';
	} else {
		document.getElementByName(cat_id).style.display = '';
	}
	
}

function sort_up(input_id){
	var oude_waarde = document.getElementById(input_id).value;
	document.getElementById(input_id).value++;
}

function sort_down(input_id){
	var oude_waarde = document.getElementById(input_id).value;
	document.getElementById(input_id).value--;
}

function toon_table(table_id){

	if(document.getElementById(table_id).style.display == 'none'){
		document.getElementById(table_id).style.display='block'
	} else {
		document.getElementById(table_id).style.display='none'
	}
}

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=400');");
}
/*
var maxImageWidth = 500;
function unscaleImage()
{
    if(maxImageWidth > 0)
        this.width = this.width == maxImageWidth? this.orgwidth:maxImageWidth;
}

function scaleImage(im)
{
    if (maxImageWidth > 0 && im.width > maxImageWidth)
    {
        im.orgwidth = im.width;
        im.width = maxImageWidth;
        im.onclick = unscaleImage;
    }
}
*/

var maxImageWidth = 610;
function unscaleImage()
{
    if(maxImageWidth > 0)
     this.width = this.width == maxImageWidth? this.orgwidth:maxImageWidth; 
		
		}

function scaleImage(im)
{
    if (maxImageWidth > 0 && im.width > maxImageWidth)
    {
        im.orgwidth = im.width;
        im.width = maxImageWidth;
        im.onclick = unscaleImage;
    }
	
	
}

function changeAvatar(){

	var image = document.getElementById('avatar');
	var imageurl = document.editprofiel.avatar.value;
	image.src = imageurl;
	
}