var GETDATA = new Array();
// Get the string that follows the "?" in the window's location.
var sGet = window.location.search;
if (sGet) // if has a value...
{
    // Drop the leading "?"
    sGet = sGet.substr(1);

    // Generate a string array of the name value pairs.
    // Each array element will have the form "foo=bar"
    var sNVPairs = sGet.split("&");

    // Now, for each name-value pair, we need to extract
    // the name and value.
    for (var i = 0; i < sNVPairs.length; i++)
    {
        // So, sNVPairs[i] contains the current element...
        // Split it at the equals sign.
        var sNV = sNVPairs[i].split("=");

        // Assign the pair to the GETDATA array.
        var sName = sNV[0];
        var sValue = sNV[1];
        GETDATA[sName] = sValue;
    }
}

addDOMLoadEvent = (function(){
    // create event function stack
    var load_events = [],
        load_timer,
        script,
        done,
        exec,
        old_onload,
        init = function () {
            done = true;

            // kill the timer
            clearInterval(load_timer);

            // execute each function in the stack in the order they were added
            while (exec = load_events.shift()) {
                exec();
            }

            if (script) { script.onreadystatechange = ''; }
        };

    return function (func) {
        // if the init function was already ran, just run this function now and stop
        if (done) { return func(); }

        if (!load_events[0]) {
            // for Mozilla/Opera9
            if (document.addEventListener) {
                document.addEventListener("DOMContentLoaded", init, false);
            }

            // for Internet Explorer
            /*@cc_on @*/
            /*@if (@_win32)
                document.write("<script id=__ie_onload defer src=//0><\/scr"+"ipt>");
                script = document.getElementById("__ie_onload");
                script.onreadystatechange = function() {
                    if (this.readyState == "complete") {
                        init(); // call the onload handler
                    }
                };
            /*@end @*/

            // for Safari
            if (/WebKit/i.test(navigator.userAgent)) { // sniff
                load_timer = setInterval(function() {
                    if (/loaded|complete/.test(document.readyState)) {
                        init(); // call the onload handler
                    }
                }, 10);
            }

            // for other browsers set the window.onload, but also execute the old window.onload
            old_onload = window.onload;
            window.onload = function() {
                init();
                if (old_onload) { old_onload(); }
            };
        }

        load_events.push(func);
    };
})();

setEnvironment = function(tag)
{
	if(typeof GETDATA['btag'] !== "undefined" && GETDATA['btag'] !== "") {
		document.cookie = 'banner_env='+GETDATA['btag']+'; path=/';
	}
	
	tagvalue	= null;
	var nameEQ	= 'banner_env=';
	var	ca		= document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) tagvalue = c.substring(nameEQ.length,c.length);
	}

	if(tagvalue) {
		tag	= tagvalue;
		
		addDOMLoadEvent(function() {
			notify	= document.createElement('div');
			notify.style.position	= 'fixed';
			notify.style.top		= '0px';
			notify.style.right		= '0px';
			notify.style.width		= '150px';
			notify.style.height		= '50px';
			notify.style.border		= '1px solid red';
			notify.style.backgroundColor	= '#004D72';
			notify.style.color		= 'white';
			notify.style.textAlign	= 'center';
			notify.style.zIndex		= '2147483647';
			
			notify.innerHTML		= 'Current tag:<br/><strong>'+tag+'</strong><br/><a href="javascript:unsetEnvironment();" style="color: white;">Clear</a>';
			
			document.getElementsByTagName('body')[0].appendChild(notify);
		});
	}
	
	if(typeof tag !== "undefined" && tag !== "") {
		GA_googleAddAttr("BannerTag", tag);
	}	
};

/**
 * Clear the set BannerTag attribute for the Google Ad Manager
 *
 * @return void
 */	
unsetEnvironment = function () {
	document.cookie = 'banner_env=; expires=Fri, 3 Aug 2001 20:47:11 UTC; path=/';
	url	= document.location.toString();
	if(url.indexOf('?') > 0) {
		url = url.substr(0,url.indexOf('?'));
	}
	document.location = url;
};

var mayLink	= true;
var opened	= 0;

function stopLink()
{
	mayLink	= false;
	document.getElementById('uberholder').style.cursor	= 'auto';
}

function allowLink()
{
	mayLink	= true;
	if(opened < 6)
	{
		document.getElementById('uberholder').style.cursor	= 'pointer';
	}
}

function checkOpenTarget()
{
	if(mayLink && opened < 6)
	{
		window.open('{takeovertarget}');
		opened	= opened + 1;
	}
}

	// This function is called in initialize();
	function setSID(sid){

		for(i=0 ; i < document.links.length ; i++){

			aap = new String(document.links[i].onclick);

			if(aap.toLowerCase().indexOf('function')==-1){
			    document.links[i].onclick = function () {ok=0;};
			}
			else
		    {
		    	p1 = aap.substr(0 , aap.toLowerCase().indexOf('{')+1);
		    	p2 = aap.substr(aap.toLowerCase().indexOf('{')+1);
		    	eval("document.links[i].onclick = "+p1+"ok=0; "+p2);
		    }
		}
	}

	function changed(id){
		var topicID = "changed[" + id + "]";
		document.getElementById(topicID).value = "1";
	}

	/**
	 * Change background image
	 */
	function changeForumDeleteCheck(id, field){
		var buttonID = "forumDelete_" + id;
		var postID = field + "[" + id + "]";

		if(document.getElementById(buttonID).className == "forumDelete"){
			document.getElementById(buttonID).className="forumDeleteChecked";
			document.getElementById(postID).value = "1";
		} else {
			document.getElementById(buttonID).className="forumDelete";
			document.getElementById(postID).value = "0";
		}
	}

		/**
	 * Change background image
	 */
	function changeForumCloseCheck(id, field){
		var buttonID = "forumClose_" + id;
		var postID = field + "[" + id + "]";

		changed(id);

		if(document.getElementById(buttonID).className == "forumClose"){
			document.getElementById(buttonID).className="forumCloseChecked";
			document.getElementById(postID).value = "1";
		} else {
			document.getElementById(buttonID).className="forumClose";
			document.getElementById(postID).value = "0";
		}
	}

	/**
	 * Submit forms
	 */
	function submitClose(){
		document.getElementById('close').value='1';
		document.deleteTopics.submit();
	}

	function submitDelete(){
		document.getElementById('delete').value='1';
		document.deleteTopics.submit();
	}

	// containter for divs. Has to be outside of the functions or it will be unreachable
	var divs = new Array();

	function show( classname, id ) {
		getElementByClass( classname );
		for( var i = 0; i < divs.length; i++ ) {
			divs[ i ].style.display = "none";
		}
		divs[ id ].style.display = "block";
	}

	function add( classname ) {

		getElementByClass( classname );

		var index = -1;
		for( var i = 0; i < divs.length; i++ ) {
			if( divs[ i ].style.display == "none" ) {
				index = i;
				break;
			}
		}
		if( index == -1) {
			alert( "Maximum bereikt" );
		}
		else {
			divs[ index ].style.display = "block";
			var childs = divs[ index ].childNodes;
			for( var i = 0; i < childs.length; i++ ) {
				// try to disable form elements, there could be other elements without this property
				try {
					childs[ i ].disabled = false;
				}
				catch( error ) {}
			}
		}
	}

	function substract( classname ) {
		getElementByClass( classname );
		var index = -1;
		for( var i = divs.length - 1; i >= 0; i-- ) {
			if( divs[ i ].style.display == "block" ) {
				index = i;
				break;
			}
		}
		if( index == -1) {
			alert( "Geen vragen meer over" );
		}
		else {
			divs[ index ].style.display = "none";
			var childs = divs[ index ].childNodes;
			for( var i = 0; i < childs.length; i++ ) {
				// try to disable form elements, there could be other elements without this property
				try {
					childs[ i ].disabled = true;
				}
				catch( error ) {}
			}
		}
	}

	/*
	 *  Let's a few div's scroll
	 */
	 var numItems;

	function scroll( classname, numberItems, interval ){

		getElementByClass( classname );
		numItems = numberItems;

		//only rotate if there are to many items
		if( numberItems < divs.length ) {
			//first time call to prevend a sleep effect.
			rotate();
			setInterval( "rotate()", interval );
		} else {
			//make announcements visible
			for( var i = 0 ; i < divs.length; i++ ) {
				divs[ i ].style.display = "block";
			}
		}
	}

	function getElementByClass( classname ){
		 var inc = 0;
		 var alltags = document.all ? document.all : document.getElementsByTagName( "*" );

		 for ( i=0; i< alltags.length; i++ ){
		   if (alltags[ i ].className == classname)
			 divs[ inc++ ]=alltags[ i ];
		 }
	}

	function rotate() {
		var buffer = new Array();

		for( var i = 0; i < divs.length; i++) {
			buffer[ i ] = divs[ i ].innerHTML;
		}

		for( var i = 0; i < divs.length; i++ ) {
				var index = ( i + 1 ) % divs.length
				divs[ i ].innerHTML = buffer[  index  ];

				if( i < numItems ) {
					divs[ i ].style.display = "block";
				}
		}
	}

	function textCounter(field, cntfield ,maxlimit) {
		if (field.value.length > maxlimit) { // if too long...trim it!
			field.value = field.value.substring(0, maxlimit);
		} // otherwise, update 'characters left' counter
		else {
			cntfield.value = maxlimit - field.value.length;
		}
	}

	function checkAll(field)
	{
		alert('erin');
		for (i = 0; i < field.length; i++){
			field[i].checked = true ;
		}
	}

 	function openCalendar(path) {
   		window.open(path, 'Calender', 'height=500,width=620,scrollbars=no,resizable=yes,status=no', false);
 	}

	function setTime(datum, field){
       opener.document.forms['actie'].elements[field].value = datum;
	   opener.document.forms['actie'].elements[field].focus();
       window.close();
    }

	function emptyField(form, field){
		document.forms[form].elements[field].value = '';
	}

	function setFocus(form, field){
		document.forms[form].elements[field].focus();
	}

	function checkField(form,field, index){
		document.forms[form].elements[field][index].checked = true;
	}

	function insertSmilie(tag, form, field) {
        document.forms[form].elements[field].value += tag;
        document.forms[form].elements[field].focus();
	}

	function popup(file, width, height){
	   	mywindow = window.open (file, "mywindow", "location=0,status=0,scrollbars=0,resizable=1,width=" + width + ",height=" + height);
	   	mywindow.moveTo((window.screen.availWidth - width) / 2, (window.screen.availHeight - height) / 2);//;
	}

	/*
	 * set the hidden value for this picture to 1, change class of td.
	 */
	function setPictureAllowed(rowID, form){
		if(document.forms[form].elements['checkbox_' + rowID].value == 1){
			document.getElementById('td_' + rowID).className = 'deselectedtd';
			document.forms[form].elements['checkbox_' + rowID].value = 0;
		} else {
			document.getElementById('td_' + rowID).className = 'selectedtd';
			document.forms[form].elements['checkbox_' + rowID].value = 1;
		}
	}


	// bbCode control by
	// subBlue design
	// www.subBlue.com

	// Startup variables
	var imageTag = false;
	var theSelection = false;

	// Check for Browser & Platform for PC & IE specific bits
	// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
	var clientPC = navigator.userAgent.toLowerCase(); // Get client info
	var clientVer = parseInt(navigator.appVersion); // Get browser version

	var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
	var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
	                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
	                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
	var is_moz = 0;

	var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
	var is_mac = (clientPC.indexOf("mac")!=-1);

	// Helpline messages
	b_help = "Vette tekst: [b]tekst[/b]  (alt+b)";
	i_help = "Italic tekst: [i]tekst[/i]  (alt+i)";
	u_help = "Underline tekst: [u]tekst[/u]  (alt+u)";
	q_help = "Quote text: [quote]tekst[/quote]  (alt+q)";
	c_help = "Code display: [code]code[/code]  (alt+c)";
	l_help = "Lijst: [list]tekst[/list] (alt+l)";
	o_help = "Geordende lijst: [list=]tekst[/list]  (alt+o)";
	p_help = "Afbeelding: [img]http://www.jouwwebsite.nl/fotos/foto.jpg[/img]  (alt+p)";
	w_help = "Link: [url]http://www.website.nl/[/url] of [url=http://www.website.nl/]Dit is een link[/url]  (alt+w)";
	a_help = "Alle open BBcode tags sluiten";
	s_help = "Letterkleur: [color=red]tekst[/color]  Tip: Je kan ook dit gebruiken: =#FF0000";
	f_help = "Lettergrootte: [size=small]Kleine tekst[/size]";

	// Define the bbCode tags
	bbcode = new Array();
	bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]');
	imageTag = false;

	// Shows the help messages in the helpline window
	function helpline(help) {
		document.postForm.helpbox.value = eval(help + "_help");
	}


	// Replacement for arrayname.length property
	function getarraysize(thearray) {
		for (i = 0; i < thearray.length; i++) {
			if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
				return i;
			}
		return thearray.length;
	}

	// Replacement for arrayname.push(value) not implemented in IE until version 5.5
	// Appends element to the array
	function arraypush(thearray,value) {
		thearray[ getarraysize(thearray) ] = value;
	}

	// Replacement for arrayname.pop() not implemented in IE until version 5.5
	// Removes and returns the last element of an array
	function arraypop(thearray) {
		thearraysize = getarraysize(thearray);
		retval = thearray[thearraysize - 1];
		delete thearray[thearraysize - 1];
		return retval;
	}

	function bbfontstyle(bbopen, bbclose) {
		var txtarea = document.postForm.post;

		if ((clientVer >= 4) && is_ie && is_win) {
			theSelection = document.selection.createRange().text;
			if (!theSelection) {
				txtarea.value += bbopen + bbclose;
				txtarea.focus();
				return;
			}
			document.selection.createRange().text = bbopen + theSelection + bbclose;
			txtarea.focus();
			return;
		}
		else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
		{
			mozWrap(txtarea, bbopen, bbclose);
			return;
		}
		else
		{
			txtarea.value += bbopen + bbclose;
			txtarea.focus();
		}
		storeCaret(txtarea);
	}


	function bbstyle(bbnumber) {
		var txtarea = document.postForm.post;

		txtarea.focus();
		donotinsert = false;
		theSelection = false;
		bblast = 0;

		if (bbnumber == -1) { // Close all open tags & default button names
			while (bbcode[0]) {
				butnumber = arraypop(bbcode) - 1;
				txtarea.value += bbtags[butnumber + 1];
				buttext = eval('document.postForm.addbbcode' + butnumber + '.value');
				eval('document.postForm.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
			}
			imageTag = false; // All tags are closed including image tags :D
			txtarea.focus();
			return;
		}

		if ((clientVer >= 4) && is_ie && is_win)
		{
			theSelection = document.selection.createRange().text; // Get text selection
			if (theSelection) {
				// Add tags around selection
				document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
				txtarea.focus();
				theSelection = '';
				return;
			}
		}
		else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
		{
			mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
			return;
		}

		// Find last occurance of an open tag the same as the one just clicked
		for (i = 0; i < bbcode.length; i++) {
			if (bbcode[i] == bbnumber+1) {
				bblast = i;
				donotinsert = true;
			}
		}

		if (donotinsert) {		// Close all open tags up to the one just clicked & default button names
			while (bbcode[bblast]) {
					butnumber = arraypop(bbcode) - 1;
					txtarea.value += bbtags[butnumber + 1];
					buttext = eval('document.postForm.addbbcode' + butnumber + '.value');
					eval('document.postForm.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
					imageTag = false;
				}
				txtarea.focus();
				return;
		} else { // Open tags

			if (imageTag && (bbnumber != 14)) {		// Close image tag before adding another
				txtarea.value += bbtags[15];
				lastValue = arraypop(bbcode) - 1;	// Remove the close image tag from the list
				document.postForm.addbbcode14.value = "Img";	// Return button back to normal state
				imageTag = false;
			}

			// Open tag
			txtarea.value += bbtags[bbnumber];
			if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
			arraypush(bbcode,bbnumber+1);
			eval('document.postForm.addbbcode'+bbnumber+'.value += "*"');
			txtarea.focus();
			return;
		}
		storeCaret(txtarea);
	}

	// From http://www.massless.org/mozedit/
	function mozWrap(txtarea, open, close)
	{
		var selLength = txtarea.textLength;
		var selStart = txtarea.selectionStart;
		var selEnd = txtarea.selectionEnd;
		if (selEnd == 1 || selEnd == 2)
			selEnd = selLength;

		var s1 = (txtarea.value).substring(0,selStart);
		var s2 = (txtarea.value).substring(selStart, selEnd)
		var s3 = (txtarea.value).substring(selEnd, selLength);
		txtarea.value = s1 + open + s2 + close + s3;
		return;
	}

	// Insert at Claret position. Code from
	// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
	function storeCaret(textEl) {
		if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
	}

    // Check image size
	function CheckImageSize(img, maxwidth, maxheight)
	{
		if (!maxwidth || maxwidth > 400 ) maxwidth = 400;
		if (!maxheight || maxheight > 400 ) maxheight = 400;

		if (img.height <= img.width && img.width > maxwidth)
			img.width = maxwidth;
		else if (img.height > img.width && img.height > maxheight)
			img.height = maxheight;
	}

    // Check size of images with specified class
	function CheckImagePosts(classname)
	{
		var inc = 0;
		var alltags = document.all ? document.all : document.getElementsByTagName( "*" );

		for ( i=0; i< alltags.length; i++ ){
		  if (alltags[i].className == classname)
    		  CheckImageSize(alltags[i]);
		}
	}

	// Clear items from select list
	function clearforumlist(list)
	{
		for(var i = 0;i < list.length; i++){
			list.options[i].selected = false;
		}
	}
	// return dutch month string for month number
	function fetchMonth(month)
	{
		months = Array('Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December');

		return months[month];
	}
	// format a input field to add in a table
	function makeLine(titel, inputveld)
	{
		return '<tr><td align="left" width="100">'+titel+'</td><td align="left">'+inputveld+'</td></tr>';
	}
	// Add items to the mailling list
	function addNewItem(itemtype)
	{
		next_id++;

		addTo = 'extra' + itemtype;

		obj = document.getElementById(addTo);

		if(obj)
		{
			var today = new Date();

			if(itemtype == 'News')
			{
				newHTML =           '<div id="news_extra_'+next_id+'"><div class="delete_news_button" onClick="document.getElementById(\'news_extra_'+next_id+'\').innerHTML = \'\';" title="Verwijder dit item uit de maillijst">X</div>';
				newHTML = newHTML + '<hr><table width="100%">';
				newHTML = newHTML + makeLine('Titel',		'<input type="text" name="news['+next_id+'][titel]"	style="width: 400px;">');
				newHTML = newHTML + makeLine('Datum',		'<input type="text" name="news['+next_id+'][date]"	style="width: 400px;" value="'+today.getDate()+' '+fetchMonth(today.getMonth())+' '+today.getFullYear()+' '+today.getHours()+':'+today.getMinutes()+'">');
				newHTML = newHTML + makeLine('Inhoud',		'<textarea name="news['+next_id+'][content]" style="width: 400px; height: 70px;"></textarea>');
				newHTML = newHTML + makeLine('Afbeelding',	'<input type="text" name="news['+next_id+'][image]"	style="width: 400px;" value="http://www.kindertent.nl/layout/images/...">');
				newHTML = newHTML + makeLine('Lees verder',	'<input type="text" name="news['+next_id+'][verder]" style="width: 400px;" value="http://www.kindertent.nl/...">');
				newHTML = newHTML + '</table></div>';
			}
			if(itemtype == 'Tips')
			{
				newHTML =           '<div id="news_extra_'+next_id+'"><div class="delete_news_button" onClick="document.getElementById(\'news_extra_'+next_id+'\').innerHTML = \'\';" title="Verwijder dit item uit de maillijst">X</div>';
				newHTML = newHTML + '<hr><table width="100%">';
				newHTML = newHTML + makeLine('Titel',		'<input type="text" name="tips['+next_id+'][titel]"	style="width: 400px;">');
				newHTML = newHTML + makeLine('Inhoud',		'<textarea name="tips['+next_id+'][content]" style="width: 400px; height: 70px;"></textarea>');
				newHTML = newHTML + makeLine('Lees verder',	'<input type="text" name="tips['+next_id+'][verder]" style="width: 400px;" value="http://www.kindertent.nl/...">');
				newHTML = newHTML + '</table></div>';
			}
			if(itemtype == 'Action')
			{
				newHTML =           '<div id="news_extra_'+next_id+'"><div class="delete_news_button" onClick="document.getElementById(\'news_extra_'+next_id+'\').innerHTML = \'\';" title="Verwijder dit item uit de maillijst">X</div>';
				newHTML = newHTML + '<hr><table width="100%">';
				newHTML = newHTML + makeLine('Inhoud',		'<textarea name="actions['+next_id+'][content]" style="width: 400px; height: 70px;"></textarea>');
				newHTML = newHTML + makeLine('Afbeelding',	'<input type="text" name="actions['+next_id+'][image]"	style="width: 400px;" value="http://www.kindertent.nl/layout/images/...">');
				newHTML = newHTML + makeLine('Lees verder',	'<input type="text" name="actions['+next_id+'][verder]" style="width: 400px;" value="http://www.kindertent.nl/...">');
				newHTML = newHTML + '</table></div>';
			}
			if(itemtype == 'Didyouknow')
			{
				newHTML =           '<div id="news_extra_'+next_id+'"><div class="delete_news_button" onClick="document.getElementById(\'news_extra_'+next_id+'\').innerHTML = \'\';" title="Verwijder dit item uit de maillijst">X</div>';
				newHTML = newHTML + '<hr><table width="100%">';
				newHTML = newHTML + makeLine('Afbeelding',	'<input type="text" name="didyouknow['+next_id+'][image]"	style="width: 400px;" value="http://www.kindertent.nl/layout/images/...">');
				newHTML = newHTML + makeLine('Inhoud',		'<textarea name="didyouknow['+next_id+'][content]" style="width: 400px; height: 70px;"></textarea>');
				newHTML = newHTML + '</table></div>';
			}
			if(itemtype == 'Blocks')
			{
				type = document.getElementById('typeSelect').value;

				switch(type) {
					case 'breed':
						typeText = 'Breed';
						backgroundImage = '/layout/images/mail/cadreMailTop_1.gif';
						backgroundPos = 'left';
						break;
					case 'gebruiker':
						typeText = 'Gebruiker';
						backgroundImage = '/layout/images/mail/cadreMailTop_user_1.gif';
						backgroundPos = 'left';
						break;
					case 'links':
						typeText = 'Links';
						backgroundImage = '/layout/images/mail/cadreMailTop_left_1.gif';
						backgroundPos = 'left';
						break;
					case 'rechts':
						typeText = 'Rechts';
						backgroundImage = '/layout/images/mail/cadreMailTop_right_1.gif';
						backgroundPos = 'right';
						break;
					default:
						typeText = '';
				}
				newHTML =           '<div id="blok_'+next_id+'"><table width="700px"><tr><td style="text-align: left; width: 100px;">Bloktitel</td><td style="text-align: left;">';
				newHTML = newHTML + '<input type="hidden" name="blok_type['+next_id+']"	value="'+type+'">';
				newHTML = newHTML + '<div style="float: left; width: 410px;"><input type="text" name="blok_titel['+next_id+']"	value=""	style="width: 400px;" onKeyUp="document.getElementById(\'titleDiv_'+next_id+'\').innerHTML = this.value.toUpperCase();"></div>';
				newHTML = newHTML + '<div style="float: left; width: 20px;"><input type="image" name="moveUp['+next_id+']"		onClick="document.getElementById(\'inputForm\').target=\'_self\'; document.getElementById(\'setAction\').value = \'moveUp('+next_id+')\';"		style="width: 15px; height: 15px;"	value="" src="/layout/images/button_block_l_up.gif"		title="Verplaats dit blok omhoog"></div>';
				newHTML = newHTML + '<div style="float: left; width: 20px;"><input type="image" name="moveDown['+next_id+']"	onClick="document.getElementById(\'inputForm\').target=\'_self\'; document.getElementById(\'setAction\').value = \'moveDown('+next_id+')\';"	style="width: 15px; height: 15px;"	value="" src="/layout/images/button_block_l_down.gif"		title="Verplaats dit blok omlaag"></div>';
				newHTML = newHTML + '<div style="float: left; width: 20px;"><input type="image" name="Remove['+next_id+']"		onClick="document.getElementById(\'inputForm\').target=\'_self\'; document.getElementById(\'setAction\').value = \'Remove('+next_id+')\';"		style="width: 15px; height: 15px;"	value="" src="/layout/images/button_block_l_delete.gif"	title="Verwijder dit blok"></div>';
				newHTML = newHTML + '<div style="float: right; width: 75px;">'+typeText+'</div>';
				newHTML = newHTML + '</td></tr><tr><td style="text-align: left; width: 100px;">Inhoud</td>';
				newHTML = newHTML + '<td style="text-align: left;"><div style="background-image: url('+backgroundImage+'); background-repeat: no-repeat; background-position: bottom '+backgroundPos+'; width: 580px; height: 25px;"><div style="font-size: 11px; font-weight: bold; color: #fff; padding: 4px 0px 0px 15px; width: 270px; float: '+backgroundPos+';" id="titleDiv_'+next_id+'"></div></div>';
				newHTML = newHTML + '<textarea id="blok_content['+next_id+']" name="blok_content['+next_id+']" style="width: 550px; height: 300px;"></textarea></td></tr>';
				newHTML = newHTML + '</table><hr></div><div id="extraBlocks"></div>';
			}
			obj.innerHTML = newHTML;
			obj.id = 'extra' + itemtype + '_' + next_id;
		}
	}

	// Get the version of MS Internet Explorer
	function msieversion()
	{
		var ua = window.navigator.userAgent
		var msie = ua.indexOf ( "MSIE " )

		if ( msie > 0 )      // If Internet Explorer, return version number
			return parseInt (ua.substring (msie+5, ua.indexOf (".", msie )))
		else                 // If another browser, return 0
			return 0
	}

	// setPosition of the 'kies' window
	function setPosition(obj_id)
	{
		obj = document.getElementById(obj_id);

		obj.style.position = 'relative';

		if(msieversion() > 0) {
			obj.style.top = '-365';
			obj.style.left = '200';
		} else {
			obj.style.top = '-405px;';
			obj.style.left = '400px;';
		}

		obj.style.display='block';
	}

	function divClose(divname)
	{
		obj = document.getElementById(divname);
		if(obj)
		{
			obj.style.display = 'none';
		}
	}

	function divOpen(divname)
	{
		obj = document.getElementById(divname);
		if(obj)
		{
			obj.style.display = 'block';
		}
	}

	function divToggle(divname)
	{
		obj = document.getElementById(divname);
		if(obj)
		{
			if(obj.style.display == 'block')
			{
				obj.style.display = 'none';
			}
			else
			{
				obj.style.display = 'block';
			}
		}
	}

	function checkForumRectangle(){
		if(document.getElementById('indexRectangle').offsetHeight < 250){
			document.getElementById('indexRectangle').style.display = 'none';
		}
	}

	function checkIndexRectangle(){
		if(document.getElementById('indexRectangle').offsetHeight < 250){
			document.getElementById('indexRectangle').style.display = 'none';
		}else{
			document.getElementById('cadreAdvert').style.display = 'none';
			document.getElementById('newsLinks').style.display = 'none';
		}
	}

	function loadFlash(page, target, width, height, bgcolor) {
	    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + width + '" height="' + height + '" bgcolor="' + bgcolor + '">'
	        + '<param name="quality" value="high" />'
	        + '<param name="wmode" value="transparent" />'
	        + '<param name="movie" value="' + page + '?clickTAG=' + target + '" />'
	        + '<embed src="' + page + '?clickTAG=' + target + '" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" clickTAG="' + target + '" width="' + width + '" height="' + height + '" bgcolor="' + bgcolor + '"></embed>'
	        + '</object>'
	    );
	}
	
	if(typeof load_message == 'undefined' || load_message !== false) {
		if(typeof MooTools == "object")
		{
			//If Mootools is loaded, use the Mootools version of the message.js!
			document.write('<script type="text/javascript" src="/profiles/javascript/message.js"><\/script>');
		}
		else
		{
			// 'include' prototype.js voor Ajax functionaliteit
			document.write('<script type="text/javascript" src="/shared/javascript/prototype.js"><\/script>');
			document.write('<script type="text/javascript" src="/shared/javascript/message.js"><\/script>');
		}
	}
	
	var is_warned = 0;
	function c() {
		if(top.location != 'http://modlogin.kindertent.nl/' || document.location != 'http://modlogin.kindertent.nl/') {
			obj	= document.getElementById('warning');
			if(obj) {
				obj.innerHTML	= '<strong>INCORRECTE URL GEVONDEN!<br/><br/> De pagina is niet aangeroepen via de juiste manier! Open de pagina opnieuw via de volgende URL: <a href="http://modlogin.kindertent.nl/">http://modlogin.kindertent.nl/</a>.</strong>';
			} else {
				alert('INCORRECTE URL GEVONDEN!\n\nDe pagina is niet aangeroepen via de juiste manier! Open de pagina opnieuw via de volgende URL:\n\nhttp://modlogin.kindertent.nl/');
			}
			is_warned = 1;
		}
	}